From nobody Mon Feb 9 10:39:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass(p=none dis=none) header.from=nutanix.com ARC-Seal: i=2; a=rsa-sha256; t=1767634681; cv=pass; d=zohomail.com; s=zohoarc; b=ms4+4rBLnUNzep3FrKySyCMcOg4FhQjc86lBvrCXuL+7HsiHFgluadhRaF2S6OHA8BXBwFSnKDEg9jMUV0puuWCA5UG+K+O5sRixz7zJz7LOlw7LMNkOKRRkApPR4OHzS8cSmrwfgy56F3cmga/4/IycOaKqWHfbm2/0Hh4cjt4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767634681; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fXTrvi28bKIEeu2NDZX0od1373jez3SQ6AGr+deNwFA=; b=AY6dg2eJNPbzIk0AWuBFGaYk7iKoHT68s42mkYSqvs5t5XWqCtGxvCWoJJAcyNZFzpSxZZxWmlzPQ6Z/yANIPf8ki7WZrgxzFCRPjZCxfWKO5rUJasva4mTJnDBrGPCSg2c8770RXV7kvwYgovv0L/Ot1nTkZxE09wG96eOnT1Q= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1767634681008268.2012817040693; Mon, 5 Jan 2026 09:38:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcmxK-0003Ed-Py; Mon, 05 Jan 2026 10:57:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vcmxI-0003Dw-Vb for qemu-devel@nongnu.org; Mon, 05 Jan 2026 10:57:17 -0500 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vcmxG-0000JS-0y for qemu-devel@nongnu.org; Mon, 05 Jan 2026 10:57:16 -0500 Received: from pps.filterd (m0127844.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 605EpWYf3489983; Mon, 5 Jan 2026 07:56:56 -0800 Received: from co1pr03cu002.outbound.protection.outlook.com (mail-westus2azon11020108.outbound.protection.outlook.com [52.101.46.108]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 4bf3h1kcds-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 05 Jan 2026 07:56:56 -0800 (PST) Received: from BYAPR02MB5029.namprd02.prod.outlook.com (2603:10b6:a03:61::24) by CH8PR02MB11020.namprd02.prod.outlook.com (2603:10b6:610:2bf::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9478.4; Mon, 5 Jan 2026 15:56:54 +0000 Received: from BYAPR02MB5029.namprd02.prod.outlook.com ([fe80::3eff:7198:f537:d1e8]) by BYAPR02MB5029.namprd02.prod.outlook.com ([fe80::3eff:7198:f537:d1e8%4]) with mapi id 15.20.9478.004; Mon, 5 Jan 2026 15:56:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= proofpoint20171006; bh=fXTrvi28bKIEeu2NDZX0od1373jez3SQ6AGr+deNw FA=; b=msETs3K+peVot5su0LioMgNLPeu8HqIBE3x6zOZn/fuLQ0/OtOoRNu76r u3m2PJ6GUx/1ejVLOz7WjQQ3aF6n9LWE4er2ikMyrYGIyEDm6nhXnhlzDPajIqw4 ibOt2vIw+8iU089aG0ROHWtYmaU1nNZwUqp5ExiDlJrxSwHX0TsfU8OBdpJ1W6ri D1C+vurNHGgq5Kr4hQaINm7iFQJaHxPtTdLYf3Ba04L0+HMt2jUlLCHzHdQosObS I2PZC8VSZNrLQfNm7joG9bHdRckjlSTdRHDoi1pmj1B8ucPv04ovY5MhOpQWiGx6 TuTMkiWI5fw78N7xGCzQ6fCl5QHnw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QFlWMwNaH2NZAr9nPDD6rXv26eNZTdcCawSGce9IVW3ZpXzzyYW7xyFdRa6K9OOtbje6C2DrmGDjDSRrsSwTMI88rAZnUE+Lmg6B0KQGAR/LhXIUpxvRdQp7hhWYx4Acp8AXXpVswVYWJI9tdZ4QQG+E5qpoi1vMLcW/orPWWwYMUOa2DOooG/ZJdc4YMOC3knvkGUgmJLnvMgXWW7Z9woUYRw1qX7JB2H8ZuGRq4jwvDsZxi8S+aduDW7Dq268LUCROJx6g0HA0E3O8h2EJP1KSF1TOwqMiQx7LXse3tjknJNRgaaWjW/8xeUi/K4mbBL6lFy4i7nJpm7fUuBXgpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fXTrvi28bKIEeu2NDZX0od1373jez3SQ6AGr+deNwFA=; b=ppg2sogqwYGMOrSZfmOQzRWHLmr4ECOdoIVd6iBiFDbjGHVApF4EoC/Wd0EpsdjAF6j+LjSFIQ7ksTf/HWouQVky2aM5rtLvtDNu18RKN2AcaFnHbjC0LS7a5v6ESKkqYdTyHfmd38fc1rKka3LLomCQ2OkAu3B661Mw2IHGUnFKS4pJJAniellgsa7Vbmhu5FV/tevddxWIqWRnQ2++5EpnU6954p3yVphMxFty60MXSspZFtdYd9qabRS0XhQIKpP9K0T8E+UEUFADHTCYDu+Hn8WVQ9/Evtup+eszJ7+HUv3H+QecuROe7TkUGdHNH3sKyUnWYfB5AaB5vMGcPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fXTrvi28bKIEeu2NDZX0od1373jez3SQ6AGr+deNwFA=; b=iPirHNMJVGc4g4iJgEj+69PtNS3S0pE4iCkfpYyVkI+xIZqVL9AkzD/HaIx1n+v5sa0qOk4SbUEcwizxKLgSxJ4MVj6suTBliXm27LjlQQy/D/TzJKrrvmxHVsNELS/Vx8xJoLR1IOqZdUslMK3G3oxdsR0oe59eBrIhl+NlRAmvXoALguOgF7HDy0a9QTD0Gxgnq1cg8JP5PJuI24y2a8BB+tfFvNJG1HCRJA/P1wYkYOTqU8eVORkRFt0TjH0il4/VIQJ0ZGsyvcQFC558qTKelmMFWzDBotP//qZMjBy9XrLBZ1ff4Z0/ZjvFy5vgo6CgVW4y9TJFYIA48qba9A== From: Yunpeng Yang To: "philmd@linaro.org" CC: "minyard@acm.org" , "farosas@suse.de" , "lvivier@redhat.com" , "pbonzini@redhat.com" , "qemu-devel@nongnu.org" , Mark Cave-Ayland , "corey@minyard.net" , Jonathan Davies Subject: [PATCH v2 1/2] hw/ipmi/ipmi_bmc_sim: Support getting fake LAN channel config Thread-Topic: [PATCH v2 1/2] hw/ipmi/ipmi_bmc_sim: Support getting fake LAN channel config Thread-Index: AQHcflvpeUVc3SzaHEOB7NNRGQ4OWQ== Date: Mon, 5 Jan 2026 15:56:54 +0000 Message-ID: <20260105155648.1037077-2-yunpeng.yang@nutanix.com> References: <20260105155648.1037077-1-yunpeng.yang@nutanix.com> In-Reply-To: <20260105155648.1037077-1-yunpeng.yang@nutanix.com> Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BYAPR02MB5029:EE_|CH8PR02MB11020:EE_ x-ms-office365-filtering-correlation-id: a126c815-b06f-4591-d297-08de4c730c7f x-proofpoint-crosstenant: true x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|366016|1800799024|38070700021; x-microsoft-antispam-message-info: =?iso-8859-1?Q?TRWvrH3ydW+c1A1I7y/0Y+atIGYcQQyQYTst0LBiVkuTWbIY8UdfSQ17G6?= =?iso-8859-1?Q?qmgW4tzza+2ZlIVhyMbf70FyCVbroJHMhvW/hnJY8FNKY5e9570/t2rwI6?= =?iso-8859-1?Q?M7Dc+dcIXc13jnqGGmLdFBmt6skjjH0ehjF6JXMbBnE44Vt3i7zMjD+UfL?= =?iso-8859-1?Q?4Daaoj2Zo4/Ljz+CwJzzk0lLvYUD4O23Gmf/9og+K5kyLQ6LzvUaF/ENci?= =?iso-8859-1?Q?9XnpYZJ/nCdqFTJ4et1mWYn+HxlCrXgGzjvgEULY5h1pbXO0A68et2RIKD?= =?iso-8859-1?Q?03gkDEyq10PtbBPbQQI/v1ZpAAN7UOt5zoaAUWDwqeK+NYiaxXsjMaVhC9?= =?iso-8859-1?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4W25l4KkzZ3OTzbQNo42m?= =?iso-8859-1?Q?J/bYVNyEVSHbr3XBCCo2VsOLO+zuhyVUUknHuPMHeqD58HysU/1aSuax0a?= =?iso-8859-1?Q?w76h5GSexKS7xyMCmuRjCICko0tJ7ZzRk/ek5eTZJfb996IRlb4aW/Pwxm?= =?iso-8859-1?Q?pTKvavTyFlJCy7wpUqqOT3e0Mpi2CO5Vx8PM9B1qBJxLIycZMRCCN9jLda?= =?iso-8859-1?Q?8/lEDwytjy3ZNRbBAmIhSYa3QtZN3VhV71vBoE+G+fs/2Jh0P3iTJipfez?= =?iso-8859-1?Q?Wh8dA88bBnnr8uw+2iSYwc3Fr2BFp56eL+BI1STcDbPppRPoVRjx56R6yE?= =?iso-8859-1?Q?p7yIaoWhOl3MObHa9b31EEqsYuE0?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB5029.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024)(38070700021); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?Vmr/+ncM1gzHZhPmanLULqcz7iMCv2NRpSSafL11Dwd9bZLLhKA02YJhjP?= =?iso-8859-1?Q?O/z7UZm0dC7S/MsAW3L+HCZZJXUp7Jm3RuUGNYJJqvnXvH74jn3c+pSk6r?= =?iso-8859-1?Q?z9bWEQlCXLTiHWztzG5bw58SyGCunMUVIW5rEP8crZvO+rDKfjHWZ92Man?= =?iso-8859-1?Q?V6i3ZEzfa+nGE1aH6du9OCONq2cQtHJsbRVWPg38Fx0nqbNb2YNaj/Zvpo?= =?iso-8859-1?Q?VEjbNloSY3o40ehI3IgWDcvJX4YWhWNsTuHuXHOI5N8cKxBr6D5wbEVcg9?= =?iso-8859-1?Q?rsqnwjlaW3oSjlenmhNFKm6vEOmhtvQTNZ3RGtY0mysw8k95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7dtj/Lo8o3Y0O4glAPtqG/7Vbdf/A0Tdrrr6pv8pNWrEAl?= =?iso-8859-1?Q?NUAEhqJa4Z3MaWIpyLvf7Uv01V2CCNh6qS5yp2G7tpn6/91mdBjX1QSyGf?= =?iso-8859-1?Q?aYNsrEHJf/KIQJthAfLuqOi9p9Irg3g/IYaQSbkLfb76XoKd306qvkE52c?= =?iso-8859-1?Q?tDxDH0ejzOCUjo7uq+86K6OqR4tN01mFK1K4yleUBSAZbXNQuJy+iH2Rpx?= =?iso-8859-1?Q?pLjHC/6Yjz8ry+cY8FgZYoYB6en4+tmRCtJ0S8NHO8yfr3YE9QmBrMK0w5?= =?iso-8859-1?Q?OVbOMcdJP3wnIBbj5oLCeFCSvnEo9TKjxpthDQuA7nJajGX1sWW7b7eKZ9?= =?iso-8859-1?Q?XUj43cEhUrV7ZvjQ+8lO0OuK4N+Cusq+IMmlWNXJwjRqpwLTr971g7Bgo/?= =?iso-8859-1?Q?T9XbvthBf6S8zlgxtt5GyeNrof/0Qp0yti2QVDu3nbbFSDWPZrBPmnmkLX?= =?iso-8859-1?Q?JBtirR3GM0in5QdqQaxB2Z7KBwFQ/ic6sbnytL2NwBKvvcNMFszP3hI1ff?= =?iso-8859-1?Q?/cQlq1PN8CzrkfQ23UjKaVFfLmrvUQx8AmxQnAx11Pe/uPAcYZhIux8H8J?= =?iso-8859-1?Q?E3KE0iVz0Q5B4G3T+BLpLj6kjSVxJhg=3D?= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB5029.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a126c815-b06f-4591-d297-08de4c730c7f X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2026 15:56:54.7340 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: +gTl5zlp337eDbnYg/Ytl6Dk8PsXvEw6bDg29+S1LjS5z/KrTGRB7+tK+jr7dnOZyQWRBl38YuUOaOYJdfPgnwXoLKhgqMU5OOOBsiC/j+U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH8PR02MB11020 X-Proofpoint-ORIG-GUID: kv_F7nq-1lm_GjbAJdwFgA4PUcPSw3Ef X-Authority-Analysis: v=2.4 cv=QcBrf8bv c=1 sm=1 tr=0 ts=695bdf48 cx=c_pps a=wnlGNIUL0AhmB29u2vspYA==:117 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=vUbySO9Y5rIA:10 a=0kUYKlekyDsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=64Cc0HZtAAAA:8 a=cZESGH4Fb4bm021qM-AA:9 a=wPNLvfGTeEIA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTA1MDEzOSBTYWx0ZWRfX/Y2a0d/baeld XYNP12b2QzSrd8T/Vl8vUW+77Pwuwiyi8Ee/gY2Q6HB/nT9PnnRK5ffQwCHoByh+dvmrwX3PjwC fl3BYVTYiZ2MN7tpzZTP7czWwjdyTgQZTN6Xpe4QLV7phy45QrZ9b5m09c+Fueqgs3fkYTjiodm bvdHIjgzBdC1a2dB1BD9dG2ndlJxN4SIvz/6B0CS2yuU/PeoDRbfCUmpOa3v4zdtBshoYUopYvA aLAzV+Fg1SGmkNdTrmOxxlARczdg0xGfPNKnkbBlpRKBlsJilf4a8GDHmW5tQTEqljRo5rx58Qw 7Y7XQSJsLibyJa/PH6xwm2+RTgfhwDbmM1gZfkaA4oIAstgeZ4x/erB9vJaCTNqAfnr5BfHwf+V kKyUNc3igeobvkC5uMGIOiaJbfGsM+4iuHsHvCIuatfBgkrbGiXOLcP9WBZVwW7ReWoCUbSwJbM yELUg1DNWOETJd1gmRQ== X-Proofpoint-GUID: kv_F7nq-1lm_GjbAJdwFgA4PUcPSw3Ef X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2026-01-05_01,2026-01-05_01,2025-10-01_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.155.12; envelope-from=yunpeng.yang@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @nutanix.com) X-ZM-MESSAGEID: 1767634684466158500 Content-Type: text/plain; charset="utf-8" The following IPMI commands are added or modified to support getting fake LAN channel configurations from the `ipmi_bmc_sim` device: * Get Channel Access; * Get Channel Info Command; * Get LAN Configuration Parameters. The fake LAN channel configurations can be specified from QEMU commandline options for device `ipmi_bmc_sim`. Inside the guest OS, the configurations can be retrieved from the device using some IPMI tools, e.g., `ipmitool lan print`. Note, there is not a real LAN channel. The fake LAN channel is suitable for testing purposes. Signed-off-by: Yunpeng Yang --- hw/ipmi/ipmi_bmc_sim.c | 302 ++++++++++++++++++++++++++++++++++-- include/hw/ipmi/ipmi.h | 1 + qemu-options.hx | 26 ++++ tests/qtest/ipmi-kcs-test.c | 60 +++++++ 4 files changed, 379 insertions(+), 10 deletions(-) diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c index 3d4fe1a699..d88aa22b72 100644 --- a/hw/ipmi/ipmi_bmc_sim.c +++ b/hw/ipmi/ipmi_bmc_sim.c @@ -27,11 +27,13 @@ #include "qemu/timer.h" #include "hw/ipmi/ipmi.h" #include "qemu/error-report.h" +#include "qapi/error.h" #include "qemu/module.h" #include "hw/core/loader.h" #include "hw/core/qdev-properties.h" #include "hw/core/qdev-properties-system.h" #include "migration/vmstate.h" +#include "net/net.h" =20 #define IPMI_NETFN_CHASSIS 0x00 =20 @@ -70,6 +72,7 @@ #define IPMI_CMD_GET_MSG 0x33 #define IPMI_CMD_SEND_MSG 0x34 #define IPMI_CMD_READ_EVT_MSG_BUF 0x35 +#define IPMI_CMD_GET_CHANNEL_ACCESS 0x41 #define IPMI_CMD_GET_CHANNEL_INFO 0x42 =20 #define IPMI_NETFN_STORAGE 0x0a @@ -101,6 +104,10 @@ #define IPMI_CMD_GET_SEL_TIME 0x48 #define IPMI_CMD_SET_SEL_TIME 0x49 =20 +#define IPMI_NETFN_TRANSPORT 0x0c + +#define IPMI_CMD_GET_LAN_CONFIG 0x02 + =20 /* Same as a timespec struct. */ struct ipmi_time { @@ -170,6 +177,23 @@ typedef struct IPMISensor { #define MAX_SENSORS 20 #define IPMI_WATCHDOG_SENSOR 0 =20 +#define NBYTES_IP 4 +#define NBYTES_MAC 6 + +typedef struct IPMILan { + uint8_t channel; + uint8_t ipaddr[NBYTES_IP]; + uint8_t ipsrc; + MACAddr macaddr; + uint8_t netmask[NBYTES_IP]; + uint8_t defgw_ipaddr[NBYTES_IP]; + MACAddr defgw_macaddr; + + char *arg_ipaddr; + char *arg_netmask; + char *arg_defgw_ipaddr; +} IPMILan; + #define MAX_NETFNS 64 =20 typedef struct IPMIRcvBufEntry { @@ -215,6 +239,7 @@ struct IPMIBmcSim { IPMIFru fru; IPMISensor sensors[MAX_SENSORS]; char *sdr_filename; + IPMILan lan; =20 /* Odd netfns are for responses, so we only need the even ones. */ const IPMINetfn *netfns[MAX_NETFNS / 2]; @@ -265,6 +290,36 @@ struct IPMIBmcSim { #define IPMI_BMC_WATCHDOG_ACTION_POWER_DOWN 2 #define IPMI_BMC_WATCHDOG_ACTION_POWER_CYCLE 3 =20 +#define IPMI_CHANNEL_IMPLEMENTATION_MIN 0x1 +#define IPMI_CHANNEL_IMPLEMENTATION_MAX 0xb +#define IPMI_CHANNEL_IS_IMPLEMENTATION_SPECIFIC(c) \ + (IPMI_CHANNEL_IMPLEMENTATION_MIN <=3D (c) && \ + (c) <=3D IPMI_CHANNEL_IMPLEMENTATION_MAX) + +#define IPMI_BMC_CHANNEL_IS_LAN(ibs, c) \ + ((ibs)->lan.channel !=3D 0 && (ibs)->lan.channel =3D=3D (c)) + +#define IPMI_BMC_LAN_CFG_CC_PARAM_NOT_SUPPORTED 0x80 + +#define IPMI_BMC_LAN_CFG_PARAM_SET_IN_PROGRESS 0x00 +#define IPMI_BMC_LAN_CFG_PARAM_AUTH_TYPE_SUPPORT 0x01 +#define IPMI_BMC_LAN_CFG_PARAM_AUTH_TYPE_ENABLES 0x02 +#define IPMI_BMC_LAN_CFG_PARAM_IP_ADDR 0x03 +#define IPMI_BMC_LAN_CFG_PARAM_IP_ADDR_SOURCE 0x04 +#define IPMI_BMC_LAN_CFG_PARAM_MAC_ADDR 0x05 +#define IPMI_BMC_LAN_CFG_PARAM_SUBNET_MASK 0x06 +#define IPMI_BMC_LAN_CFG_PARAM_IPV4_HDR_PARAMS 0x07 +#define IPMI_BMC_LAN_CFG_PARAM_DEFAULT_GW_IP_ADDR 0x0c +#define IPMI_BMC_LAN_CFG_PARAM_DEFAULT_GW_MAC_ADDR 0x0d +#define IPMI_BMC_LAN_CFG_PARAM_BACKUP_GW_ADDR 0x0e +#define IPMI_BMC_LAN_CFG_PARAM_BACKUP_GW_MAC_ADDR 0x0f +#define IPMI_BMC_LAN_CFG_PARAM_COMMUNITY_STRING 0x10 +#define IPMI_BMC_LAN_CFG_PARAM_NUM_DESTINATIONS 0x11 + +#define IPMI_BMC_LAN_CFG_PARAMETER_REVISION 0x11 + +#define IPMI_BMC_LAN_CFG_IS_VALID_IP_SOURCE(v) (0x0 <=3D (v) && (v) <= =3D 0x4) + #define RSP_BUFFER_INITIALIZER { } =20 static inline void rsp_buffer_pushmore(RspBuffer *rsp, uint8_t *bytes, @@ -1231,6 +1286,25 @@ static void get_watchdog_timer(IPMIBmcSim *ibs, } } =20 +static void get_channel_access(IPMIBmcSim *ibs, + uint8_t *cmd, unsigned int cmd_len, + RspBuffer *rsp) +{ + uint8_t channel =3D cmd[2] & 0xf; + + if (channel =3D=3D IPMI_CHANNEL_IPMB || channel =3D=3D IPMI_CHANNEL_SY= STEM || + IPMI_BMC_CHANNEL_IS_LAN(ibs, channel)) { + /* alerting disabled */ + /* per message authentication disabled */ + /* user level authentication disabled */ + /* channel always available */ + rsp_buffer_push(rsp, 0x20 | 0x10 | 0x08 | 0x02); + rsp_buffer_push(rsp, 0x04); /* privilege limit: ADMINISTRATOR */ + } else { + rsp_buffer_set_error(rsp, IPMI_CC_INVALID_DATA_FIELD); + } +} + static void get_channel_info(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, RspBuffer *rsp) @@ -1240,29 +1314,29 @@ static void get_channel_info(IPMIBmcSim *ibs, IPMIFwInfo info =3D {}; uint8_t ch =3D cmd[2] & 0x0f; =20 - /* Only define channel 0h (IPMB) and Fh (system interface) */ - if (ch =3D=3D 0x0e) { /* "This channel" */ ch =3D IPMI_CHANNEL_SYSTEM; } rsp_buffer_push(rsp, ch); =20 - if (ch !=3D IPMI_CHANNEL_IPMB && ch !=3D IPMI_CHANNEL_SYSTEM) { - /* Not a supported channel */ - rsp_buffer_set_error(rsp, IPMI_CC_INVALID_DATA_FIELD); - return; - } - if (k->get_fwinfo) { k->get_fwinfo(s, &info); } =20 + /* Only define channel 0h (IPMB), LAN, and Fh (system interface) */ if (ch =3D=3D IPMI_CHANNEL_IPMB) { rsp_buffer_push(rsp, IPMI_CHANNEL_MEDIUM_IPMB); rsp_buffer_push(rsp, IPMI_CHANNEL_PROTOCOL_IPMB); - } else { /* IPMI_CHANNEL_SYSTEM */ + } else if (IPMI_BMC_CHANNEL_IS_LAN(ibs, ch)) { + rsp_buffer_push(rsp, IPMI_CHANNEL_MEDIUM_802_3_LAN); + rsp_buffer_push(rsp, IPMI_CHANNEL_PROTOCOL_IPMB); + } else if (ch =3D=3D IPMI_CHANNEL_SYSTEM) { rsp_buffer_push(rsp, IPMI_CHANNEL_MEDIUM_SYSTEM); rsp_buffer_push(rsp, info.ipmi_channel_protocol); + } else { + /* Not a supported channel */ + rsp_buffer_set_error(rsp, IPMI_CC_INVALID_DATA_FIELD); + return; } =20 rsp_buffer_push(rsp, 0x00); /* Session-less */ @@ -2045,6 +2119,135 @@ static void set_sensor_reading(IPMIBmcSim *ibs, } } =20 +static inline bool is_ipv4_netmask_valid(const void *buf) +{ + uint32_t netmask =3D ldl_be_p(buf); + + return netmask !=3D 0 && clo32(netmask) + ctz32(netmask) =3D=3D 32; +} + +/* + * Request data (from cmd[2] to cmd[5] inclusive): + * bytes meaning + * 1 [bit 7] revision only flag, [bits 3:0] channel number + * 2 parameter selector + * 3 set selector + * 4 block selector + */ +static void get_lan_config(IPMIBmcSim *ibs, + uint8_t *cmd, unsigned int cmd_len, + RspBuffer *rsp) +{ + uint8_t channel; + + if (ibs->lan.channel =3D=3D 0) { + /* LAN channel disabled. Fail as if this command were not defined.= */ + rsp_buffer_set_error(rsp, IPMI_CC_INVALID_CMD); + return; + } + if (cmd_len < 6) { + rsp_buffer_set_error(rsp, IPMI_CC_REQUEST_DATA_LENGTH_INVALID); + return; + } + channel =3D cmd[2] & 0xf; + + rsp_buffer_push(rsp, IPMI_BMC_LAN_CFG_PARAMETER_REVISION); + if (cmd[2] & 0x80) { + /* The requester only requests parameter revision, not the paramet= er */ + return; + } + if (!IPMI_BMC_CHANNEL_IS_LAN(ibs, channel)) { + rsp_buffer_set_error(rsp, IPMI_CC_INVALID_DATA_FIELD); + return; + } + + switch (cmd[3]) { + case IPMI_BMC_LAN_CFG_PARAM_SET_IN_PROGRESS: + rsp_buffer_push(rsp, 0x0); /* set complete */ + break; + + case IPMI_BMC_LAN_CFG_PARAM_AUTH_TYPE_SUPPORT: + rsp_buffer_push(rsp, 0x01); /* Authentication type "none" supporte= d */ + break; + + case IPMI_BMC_LAN_CFG_PARAM_AUTH_TYPE_ENABLES: + /* Only authentication type "none" enabled */ + rsp_buffer_push(rsp, 0x01); /* for privilege level "Callback" */ + rsp_buffer_push(rsp, 0x01); /* for privilege level "User" */ + rsp_buffer_push(rsp, 0x01); /* for privilege level "Operator" */ + rsp_buffer_push(rsp, 0x01); /* for privilege level "Administrator"= */ + rsp_buffer_push(rsp, 0x01); /* for privilege level "OEM" */ + break; + + case IPMI_BMC_LAN_CFG_PARAM_IP_ADDR: + rsp_buffer_pushmore(rsp, ibs->lan.ipaddr, NBYTES_IP); + break; + + case IPMI_BMC_LAN_CFG_PARAM_IP_ADDR_SOURCE: + rsp_buffer_push(rsp, ibs->lan.ipsrc); + break; + + case IPMI_BMC_LAN_CFG_PARAM_MAC_ADDR: + rsp_buffer_pushmore(rsp, ibs->lan.macaddr.a, NBYTES_MAC); + break; + + case IPMI_BMC_LAN_CFG_PARAM_SUBNET_MASK: + rsp_buffer_pushmore(rsp, ibs->lan.netmask, NBYTES_IP); + break; + + case IPMI_BMC_LAN_CFG_PARAM_IPV4_HDR_PARAMS: + /* TTL 0x40 */ + rsp_buffer_push(rsp, 0x40); + /* don't fragment */ + rsp_buffer_push(rsp, 0x40); + /* precedence 0x0, minimize delay */ + rsp_buffer_push(rsp, 0x10); + break; + + case IPMI_BMC_LAN_CFG_PARAM_DEFAULT_GW_IP_ADDR: + rsp_buffer_pushmore(rsp, ibs->lan.defgw_ipaddr, NBYTES_IP); + break; + + case IPMI_BMC_LAN_CFG_PARAM_DEFAULT_GW_MAC_ADDR: + rsp_buffer_pushmore(rsp, ibs->lan.defgw_macaddr.a, NBYTES_MAC); + break; + + case IPMI_BMC_LAN_CFG_PARAM_BACKUP_GW_ADDR: + /* 0.0.0.0 */ + rsp_buffer_push(rsp, 0x00); + rsp_buffer_push(rsp, 0x00); + rsp_buffer_push(rsp, 0x00); + rsp_buffer_push(rsp, 0x00); + break; + + case IPMI_BMC_LAN_CFG_PARAM_BACKUP_GW_MAC_ADDR: + /* 00:00:00:00:00:00 */ + rsp_buffer_push(rsp, 0x00); + rsp_buffer_push(rsp, 0x00); + rsp_buffer_push(rsp, 0x00); + rsp_buffer_push(rsp, 0x00); + rsp_buffer_push(rsp, 0x00); + rsp_buffer_push(rsp, 0x00); + break; + + case IPMI_BMC_LAN_CFG_PARAM_COMMUNITY_STRING: + { + static uint8_t community_str[18] =3D "public"; + + rsp_buffer_pushmore(rsp, community_str, sizeof(community_str)); + } + break; + + case IPMI_BMC_LAN_CFG_PARAM_NUM_DESTINATIONS: + rsp_buffer_push(rsp, 0x00); /* LAN Alerting not supported */ + break; + + default: + rsp_buffer_set_error(rsp, IPMI_BMC_LAN_CFG_CC_PARAM_NOT_SUPPORTED); + return; + }; +} + static const IPMICmdHandler chassis_cmds[] =3D { [IPMI_CMD_GET_CHASSIS_CAPABILITIES] =3D { chassis_capabilities }, [IPMI_CMD_GET_CHASSIS_STATUS] =3D { chassis_status }, @@ -2089,6 +2292,7 @@ static const IPMICmdHandler app_cmds[] =3D { [IPMI_CMD_RESET_WATCHDOG_TIMER] =3D { reset_watchdog_timer }, [IPMI_CMD_SET_WATCHDOG_TIMER] =3D { set_watchdog_timer, 8 }, [IPMI_CMD_GET_WATCHDOG_TIMER] =3D { get_watchdog_timer }, + [IPMI_CMD_GET_CHANNEL_ACCESS] =3D { get_channel_access, 4 }, [IPMI_CMD_GET_CHANNEL_INFO] =3D { get_channel_info, 3 }, }; static const IPMINetfn app_netfn =3D { @@ -2119,12 +2323,22 @@ static const IPMINetfn storage_netfn =3D { .cmd_handlers =3D storage_cmds }; =20 +static const IPMICmdHandler transport_cmds[] =3D { + [IPMI_CMD_GET_LAN_CONFIG] =3D { get_lan_config }, +}; +static const IPMINetfn transport_netfn =3D { + .cmd_nums =3D ARRAY_SIZE(transport_cmds), + .cmd_handlers =3D transport_cmds +}; + + static void register_cmds(IPMIBmcSim *s) { ipmi_sim_register_netfn(s, IPMI_NETFN_CHASSIS, &chassis_netfn); ipmi_sim_register_netfn(s, IPMI_NETFN_SENSOR_EVENT, &sensor_event_netf= n); ipmi_sim_register_netfn(s, IPMI_NETFN_APP, &app_netfn); ipmi_sim_register_netfn(s, IPMI_NETFN_STORAGE, &storage_netfn); + ipmi_sim_register_netfn(s, IPMI_NETFN_TRANSPORT, &transport_netfn); } =20 static uint8_t init_sdrs[] =3D { @@ -2174,9 +2388,25 @@ static void ipmi_sdr_init(IPMIBmcSim *ibs) } } =20 +static const VMStateDescription vmstate_ipmi_sim_lan =3D { + .name =3D TYPE_IPMI_BMC_SIMULATOR "-lan", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT8(channel, IPMILan), + VMSTATE_UINT8_ARRAY(ipaddr, IPMILan, NBYTES_IP), + VMSTATE_UINT8(ipsrc, IPMILan), + VMSTATE_UINT8_ARRAY(macaddr.a, IPMILan, NBYTES_MAC), + VMSTATE_UINT8_ARRAY(netmask, IPMILan, NBYTES_IP), + VMSTATE_UINT8_ARRAY(defgw_ipaddr, IPMILan, NBYTES_IP), + VMSTATE_UINT8_ARRAY(defgw_macaddr.a, IPMILan, NBYTES_MAC), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_ipmi_sim =3D { .name =3D TYPE_IPMI_BMC_SIMULATOR, - .version_id =3D 1, + .version_id =3D 2, .minimum_version_id =3D 1, .fields =3D (const VMStateField[]) { VMSTATE_UINT8(bmc_global_enables, IPMIBmcSim), @@ -2198,6 +2428,7 @@ static const VMStateDescription vmstate_ipmi_sim =3D { VMSTATE_UINT16(sensors[IPMI_WATCHDOG_SENSOR].deassert_states, IPMIBmcSim), VMSTATE_UINT16(sensors[IPMI_WATCHDOG_SENSOR].assert_enable, IPMIBm= cSim), + VMSTATE_STRUCT(lan, IPMIBmcSim, 2, vmstate_ipmi_sim_lan, IPMILan), VMSTATE_END_OF_LIST() } }; @@ -2232,6 +2463,47 @@ out: fru->nentries =3D size / fru->areasize; } =20 +static void ipmi_lan_init(IPMILan *lan, Error **errp) +{ + struct in_addr ip; + + /* + * `lan->channel` can be either 0 (meaning LAN channel disabled) or + * a valid IPMI implementation-specific channel. + */ + if (lan->channel !=3D 0 && + !IPMI_CHANNEL_IS_IMPLEMENTATION_SPECIFIC(lan->channel)) { + error_setg(errp, "invalid LAN channel %d", lan->channel); + return; + } + if (lan->arg_ipaddr) { + if (inet_pton(AF_INET, lan->arg_ipaddr, &ip) !=3D 1) { + error_setg(errp, "invalid ip address '%s'", lan->arg_ipaddr); + return; + } + memcpy(lan->ipaddr, &ip.s_addr, NBYTES_IP); + } + if (!IPMI_BMC_LAN_CFG_IS_VALID_IP_SOURCE(lan->ipsrc)) { + error_setg(errp, "invalid ip source %d", lan->ipsrc); + return; + } + if (lan->arg_netmask) { + if (inet_pton(AF_INET, lan->arg_netmask, &ip) !=3D 1 || + !is_ipv4_netmask_valid(&ip.s_addr)) { + error_setg(errp, "invalid subnet mask '%s'", lan->arg_netmask); + return; + } + memcpy(lan->netmask, &ip.s_addr, NBYTES_IP); + } + if (lan->arg_defgw_ipaddr) { + if (inet_pton(AF_INET, lan->arg_defgw_ipaddr, &ip) !=3D 1) { + error_setg(errp, "invalid ip address '%s'", lan->arg_defgw_ipa= ddr); + return; + } + memcpy(lan->defgw_ipaddr, &ip.s_addr, NBYTES_IP); + } +} + static void ipmi_sim_realize(DeviceState *dev, Error **errp) { IPMIBmc *b =3D IPMI_BMC(dev); @@ -2259,6 +2531,9 @@ static void ipmi_sim_realize(DeviceState *dev, Error = **errp) ibs->acpi_power_state[1] =3D 0; =20 ipmi_init_sensors_from_sdrs(ibs); + + ipmi_lan_init(&ibs->lan, errp); + register_cmds(ibs); =20 ibs->timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, ipmi_timeout, ibs); @@ -2276,6 +2551,13 @@ static const Property ipmi_sim_properties[] =3D { DEFINE_PROP_UINT32("mfg_id", IPMIBmcSim, mfg_id, 0), DEFINE_PROP_UINT16("product_id", IPMIBmcSim, product_id, 0), DEFINE_PROP_UUID_NODEFAULT("guid", IPMIBmcSim, uuid), + DEFINE_PROP_UINT8("lan.channel", IPMIBmcSim, lan.channel, 0), + DEFINE_PROP_STRING("lan.ipaddr", IPMIBmcSim, lan.arg_ipaddr), + DEFINE_PROP_UINT8("lan.ipsrc", IPMIBmcSim, lan.ipsrc, 0), + DEFINE_PROP_MACADDR("lan.macaddr", IPMIBmcSim, lan.macaddr), + DEFINE_PROP_STRING("lan.netmask", IPMIBmcSim, lan.arg_netmask), + DEFINE_PROP_STRING("lan.defgw_ipaddr", IPMIBmcSim, lan.arg_defgw_ipadd= r), + DEFINE_PROP_MACADDR("lan.defgw_macaddr", IPMIBmcSim, lan.defgw_macaddr= ), }; =20 static void ipmi_sim_class_init(ObjectClass *oc, const void *data) diff --git a/include/hw/ipmi/ipmi.h b/include/hw/ipmi/ipmi.h index dabbb9ec5d..3134a85c58 100644 --- a/include/hw/ipmi/ipmi.h +++ b/include/hw/ipmi/ipmi.h @@ -45,6 +45,7 @@ enum ipmi_op { #define IPMI_CHANNEL_IPMB 0x00 #define IPMI_CHANNEL_SYSTEM 0x0f #define IPMI_CHANNEL_MEDIUM_IPMB 0x01 +#define IPMI_CHANNEL_MEDIUM_802_3_LAN 0x04 #define IPMI_CHANNEL_MEDIUM_SYSTEM 0x0c #define IPMI_CHANNEL_PROTOCOL_IPMB 0x01 #define IPMI_CHANNEL_PROTOCOL_KCS 0x05 diff --git a/qemu-options.hx b/qemu-options.hx index ec92723f10..01f2923cf8 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1144,6 +1144,32 @@ SRST is set, get "Get GUID" command to the BMC will return it. Otherwise "Get GUID" will return an error. =20 + ``lan.channel=3Dval`` + channel number of the fake LAN channel. It can be 0 or any + integer from 0x1 to 0xb inclusive. If set to 0, the LAN channel + is disabled, otherwise the LAN channel is enabled at the + specified channel number. The default is 0. + + ``lan.ipaddr=3Daddr`` + the ipv4 address of the BMC LAN channel. + + ``lan.ipsrc=3Dval`` + the ipv4 address source of the BMC LAN channel. It can be 0 + (unspecified source), 1 (static address), 2 (DHCP), 3 (BIOS or + system software), or 4 (other source). The default is 0. + + ``lan.macaddr=3Dmac`` + the mac address of the BMC LAN channel. + + ``lan.netmask=3Dmask`` + the ipv4 subnet mask for the BMC LAN channel. + + ``lan.defgw_ipaddr=3Daddr`` + the default gateway ipv4 address for the BMC LAN channel. + + ``lan.defgw_macaddr=3Dmac`` + the default gateway mac address for the BMC LAN channel. + ``-device ipmi-bmc-extern,id=3Did,chardev=3Did[,slave_addr=3Dval]`` Add a connection to an external IPMI BMC simulator. Instead of locally emulating the BMC like the above item, instead connect to an diff --git a/tests/qtest/ipmi-kcs-test.c b/tests/qtest/ipmi-kcs-test.c index 3186c6ad64..d0a207477e 100644 --- a/tests/qtest/ipmi-kcs-test.c +++ b/tests/qtest/ipmi-kcs-test.c @@ -262,6 +262,62 @@ static void test_enable_irq(void) kcs_ints_enabled =3D 1; } =20 + +static uint8_t get_channel_access_cmd[] =3D { 0x18, 0x41, 0x01, 0x40 }; +static uint8_t get_channel_access_rsp[] =3D { 0x1c, 0x41, 0x00, 0x3a, 0x04= }; + +/* + * Get channel access + */ +static void test_kcs_channel_access(void) +{ + uint8_t rsp[20]; + unsigned int rsplen =3D sizeof(rsp); + + kcs_cmd(get_channel_access_cmd, sizeof(get_channel_access_cmd), + rsp, &rsplen); + g_assert(rsplen =3D=3D sizeof(get_channel_access_rsp)); + g_assert(memcmp(get_channel_access_rsp, rsp, rsplen) =3D=3D 0); +} + + +static uint8_t get_channel_info_cmd[] =3D { 0x18, 0x42, 0x01 }; +static uint8_t get_channel_info_rsp[] =3D { 0x1c, 0x42, 0x00, 0x01, 0x04, = 0x01, + 0x00, 0xf2, 0x1b, 0x00, 0x00, 0x= 00 }; + +/* + * Get channel info + */ +static void test_kcs_channel_info(void) +{ + uint8_t rsp[20]; + unsigned int rsplen =3D sizeof(rsp); + + kcs_cmd(get_channel_info_cmd, sizeof(get_channel_info_cmd), rsp, &rspl= en); + g_assert(rsplen =3D=3D sizeof(get_channel_info_rsp)); + g_assert(memcmp(get_channel_info_rsp, rsp, rsplen) =3D=3D 0); +} + + +/* get ip address (specified in cmdline): 10.0.0.2 */ +static uint8_t get_ipaddr_cmd[] =3D { 0x30, 0x02, 0x01, 0x03, 0x00, 0x00 }; +static uint8_t get_ipaddr_rsp[] =3D { 0x34, 0x02, 0x00, 0x11, + 0x0a, 0x00, 0x00, 0x02 }; + +/* + * Get LAN configurations + */ +static void test_kcs_lan_get(void) +{ + uint8_t rsp[20]; + unsigned int rsplen =3D sizeof(rsp); + + kcs_cmd(get_ipaddr_cmd, sizeof(get_ipaddr_cmd), rsp, &rsplen); + g_assert(rsplen =3D=3D sizeof(get_ipaddr_rsp)); + g_assert(memcmp(get_ipaddr_rsp, rsp, rsplen) =3D=3D 0); +} + + int main(int argc, char **argv) { char *cmdline; @@ -271,6 +327,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); =20 cmdline =3D g_strdup_printf("-device ipmi-bmc-sim,id=3Dbmc0" + ",lan.channel=3D1,lan.ipaddr=3D10.0= .0.2" " -device isa-ipmi-kcs,bmc=3Dbmc0"); qtest_start(cmdline); g_free(cmdline); @@ -280,6 +337,9 @@ int main(int argc, char **argv) qtest_add_func("/ipmi/local/kcs_enable_irq", test_enable_irq); qtest_add_func("/ipmi/local/kcs_base_irq", test_kcs_base); qtest_add_func("/ipmi/local/kcs_abort_irq", test_kcs_abort); + qtest_add_func("/ipmi/local/kcs_channel_access", test_kcs_channel_acce= ss); + qtest_add_func("/ipmi/local/kcs_channel_info", test_kcs_channel_info); + qtest_add_func("/ipmi/local/kcs_lan_get", test_kcs_lan_get); ret =3D g_test_run(); qtest_quit(global_qtest); =20 --=20 2.43.7 From nobody Mon Feb 9 10:39:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass(p=none dis=none) header.from=nutanix.com ARC-Seal: i=2; a=rsa-sha256; t=1767634729; cv=pass; d=zohomail.com; s=zohoarc; b=F/L5AVY4zbkOAZYLLcjhMTq+mrJDoXEithkAOjloKHPnKxIe9wquOneG3vPuiVNituCAznQQnNlyljWNycBp5i6/PMuflZXkOx7+7NYP62q8vPgv23uZCogbYr+jmKM1bm9fCeI6OtIT8fsAKdNO97S0XxoeM67Mw3AHVq6u0Do= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767634729; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=utqGPlEuoWhHGwuxU1Np4qoYuZedznQrM9hwMY4QJNU=; b=XUFRdHA4uPjpr3sgBvpENChtjEkrhSJ8fx0ESnT7Ue9EQmYNqI+3ER8KqNZiKlR1yi/yn4AuFORyJ/02jeVorfbrhIzYpYgT+BE1lahAbionfIqwldSJPWfpdUT8+4AMT1AAgmji9+hZLzCcBOtCFhU9Xcm4kDzlNdGtoCmbFA4= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1767634729278967.1841131247772; Mon, 5 Jan 2026 09:38:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcmxK-0003EN-5I; Mon, 05 Jan 2026 10:57:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vcmxH-0003D6-Uj for qemu-devel@nongnu.org; Mon, 05 Jan 2026 10:57:15 -0500 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vcmxF-0000J8-HH for qemu-devel@nongnu.org; Mon, 05 Jan 2026 10:57:15 -0500 Received: from pps.filterd (m0127844.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 605EpWYg3489983; Mon, 5 Jan 2026 07:56:57 -0800 Received: from co1pr03cu002.outbound.protection.outlook.com (mail-westus2azon11020108.outbound.protection.outlook.com [52.101.46.108]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 4bf3h1kcds-2 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 05 Jan 2026 07:56:57 -0800 (PST) Received: from BYAPR02MB5029.namprd02.prod.outlook.com (2603:10b6:a03:61::24) by CH8PR02MB11020.namprd02.prod.outlook.com (2603:10b6:610:2bf::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9478.4; Mon, 5 Jan 2026 15:56:55 +0000 Received: from BYAPR02MB5029.namprd02.prod.outlook.com ([fe80::3eff:7198:f537:d1e8]) by BYAPR02MB5029.namprd02.prod.outlook.com ([fe80::3eff:7198:f537:d1e8%4]) with mapi id 15.20.9478.004; Mon, 5 Jan 2026 15:56:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= proofpoint20171006; bh=utqGPlEuoWhHGwuxU1Np4qoYuZedznQrM9hwMY4QJ NU=; b=pw8e7wBR/si1s6zt40tCWli35FFqe0II3nqJ9v0Oo94JpwuNt3t/u+eOT 3ZP4Z4+AxuXeK2b4qUgFIyYhSKZax+RF0eCCO8JY3ejKViw+FJop0duC37gnbGOD ZBbKbMlQJJixiyO2+0KZKSeUTe+PvFWq18aEsbfCezbHB+b/9pQroQDV1SbmWqox ndfY1otu3IvZbBMelJmyr6DIcSNwSfANKhVnZWvoYgeeit6wLKPagoJOLhAJbqAD 1c9hRmDo+/uNtHXJCpIwQrTIT8IeXYx6SqRRwRB1UeHbR9eEstDjs7DMJn/3s6QF NmzrTr6L6jgGuGw6TcDtqvLofD7Gw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Dac9c/JqugYjR8e3K6B93nX7RY8lLWlyv9+noJuH3Jz9+FkuiZrQXJ6ER5xHwp9HKvn1oWHgytjcbHrGyz/WYmX3gxs2lNCg4/2LMdOUhuh/IXbuZWAMQTUf9f+WqvDa2b8SEkftoNarDfqwocZq9hkVvPuMdnoEOzQ15t1G3Plv1Fy+srnObeSXMEwwmeFhbpOXiqAMHg3bisU1Y6onatLma0ovOoUx8Kz02zYhW2ugg2a3/HJHlbsOkUHNdH3/Q7P6Ow8PZDu09uR7n9Cu+3jPUzGvTn7zMFObGQ5m1qz5eKyhcHc4nhe051VP5IkKNNgOTO1q59UeJ+GLRFBzDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=utqGPlEuoWhHGwuxU1Np4qoYuZedznQrM9hwMY4QJNU=; b=YnG4Ga1lxpWTixwsav+CscsjBzvnp+DI1NA1B7aI1ntI/z0hVo9P8kJaOMy7Wi4V3UMFRHKSfvLi8H5miFK1MISJiY5O8XmVzv57aDNHuLMbUMZ7UxF47LvrWRkx3BX+KUn67ZSq/xq7bIHv/ouBIlLJZsyL3In13YBdb1A7SROFZhpc7uUYMLaQ2llJaN2uKIJlKgNtWIiqy+bmNVQ82JB+Sb5G02AFjLVaW2T9yI0exze+hTbaFyeGYEWdzBT0KveUa+E3rIUkQMTW9nnIHo+r80u6djXMRS3LDsr8KNll0xjJmk3yxMgW+WDSpQ+em/wdZOjvSGCsMGu8C5hivA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=utqGPlEuoWhHGwuxU1Np4qoYuZedznQrM9hwMY4QJNU=; b=LvYWT23RLcQ/s360lyGS4nD21B+VNWBUXStVsA8UP3NOXZKeFm8RI8eBJpgmq6uXBqd8E9BY932tmzfd+UpCxH4irOl0gnuCTCUK3m79njqejVpWmxZ6EDAzj5329M0o3QvLLhEScur0x/XYgCUE4GKAtK5ROTzZlsOCWcedCDVmypL9Kw9lfIMRKiDZslXuoUY6RNx6Gl3JE+8sBPu1X/uHYS4CCpu1b+y9UxbZTY9G9MXau8K7TEr9e7XXfhv18xlFf/FYip4K42FAtv3F0Y0xNwFeyY5z1JeqkiQI3T4nGtUurWm/5LzZ/wmNvCt4JiTt1SHzcrD8ZEgoO+de8A== From: Yunpeng Yang To: "philmd@linaro.org" CC: "minyard@acm.org" , "farosas@suse.de" , "lvivier@redhat.com" , "pbonzini@redhat.com" , "qemu-devel@nongnu.org" , Mark Cave-Ayland , "corey@minyard.net" , Jonathan Davies Subject: [PATCH v2 2/2] hw/ipmi/ipmi_bmc_sim: Support setting fake LAN channel config Thread-Topic: [PATCH v2 2/2] hw/ipmi/ipmi_bmc_sim: Support setting fake LAN channel config Thread-Index: AQHcflvqo3unXIH890y8e8vh4T4Oog== Date: Mon, 5 Jan 2026 15:56:55 +0000 Message-ID: <20260105155648.1037077-3-yunpeng.yang@nutanix.com> References: <20260105155648.1037077-1-yunpeng.yang@nutanix.com> In-Reply-To: <20260105155648.1037077-1-yunpeng.yang@nutanix.com> Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BYAPR02MB5029:EE_|CH8PR02MB11020:EE_ x-ms-office365-filtering-correlation-id: d5e8d8ce-c827-4ff8-4c53-08de4c730ce9 x-proofpoint-crosstenant: true x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|366016|1800799024|38070700021; x-microsoft-antispam-message-info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XW5jib2IhGwa2/H/wVYUjq4uWjrCBsHt?= =?iso-8859-1?Q?sHsAYMzPIOiQLMA6y8Dxbg2ol5zAyNre+U0S/yvKT4rxgb46CDiXYOsjh1?= =?iso-8859-1?Q?QBvTXpSGBw3kA+wrrqhG9ujVhn/v6LWfWyuHIWNclVQ60QJdxE0UwTwoHM?= =?iso-8859-1?Q?nOwbptT0cTMSSKcfSbebiWNKUuCmRMReciU4qGTnzK3C+dA6SVnG+mqyad?= =?iso-8859-1?Q?6Q/eusUIhDnmZve+HHMfEzITgPYF1lOJsV0VVwho0bS3q+xHwKHxETiWY0?= =?iso-8859-1?Q?hcq/sOfP0FoSGz6IiBkN2E0BhZz/R5Uz8tOZrlSsvW2paZJJ84+WBJN4d2?= =?iso-8859-1?Q?cRlS9wXLLXVMQCC60RtKz9NPDLgsifqSZM/W2uPjwlw+iQjivsyynnWk51?= =?iso-8859-1?Q?PZ9ExLAfxfFFlBFWd1rHrwOTIJ6pkAgVDYMISmJkV31ruoRwunUQyOu8ZL?= =?iso-8859-1?Q?5A0cwT3b6ibn2L49ygHD8QFz2NZerhLa1/6JdDPBlCN9Lit8d0RfnA0nhS?= =?iso-8859-1?Q?1WinC38xAGIh54ObL8iyKVtQqKpsL3vcE7w+lQvkzYX9NA8pXHIvZ3xhZm?= =?iso-8859-1?Q?GMIVlcFG4aF2W+OWtrnKZjeOM7jud1WgzycDy7lztYG/M0PjByhWdUiWdl?= =?iso-8859-1?Q?RCA8hm+9IgBxuMPreAHT7j/NtdTRkuy5TETE/qijA7Qpg4LiXIxxrg/627?= =?iso-8859-1?Q?HU9uodkfPnLPgLY7egRdTIp1QFck?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB5029.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024)(38070700021); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?v+Xcslm8GPkD6PCPI1HJ3ULNtry6lNFMk/n1puaoRrup0qb3JJWCWeKFB5?= =?iso-8859-1?Q?AXi4kDdu3F+xmnmhQyE8s4v/4NY1m0EK1onGpluzRO6Bgn9eu4C5vfTjTm?= =?iso-8859-1?Q?D1pxAEdATfXzj+wzqRxI0hjpmbEIT1q2Dxdkgcy/o7+RXZhNpc3J9wlA52?= =?iso-8859-1?Q?EstlyyNIbTemRm/BLP+zrwrdjs9xl34R8czd51jNbPSN3fRB5oVSbFZ2uv?= =?iso-8859-1?Q?leZwB2jPy0F/4i0uZumPsx0jfraC12BYmGXsMRoNbCqgQqPiVhqcPsOa+I?= =?iso-8859-1?Q?Pn62XRJAmpM0U8aavQRECGOkzGqv6dHt13phOe1iiB2ZmWYIM7m4IY4aj9?= =?iso-8859-1?Q?WK5mfBrBlGrZd1p+46JarhVfsJE0IIu59lxqUCR63OBMEWwehilo8QkSwo?= =?iso-8859-1?Q?/RASSZeRbeWPKM0k284gW3Q66IbZArmEvHCJlpLfrVKEW0hjW7QUDR+KoU?= =?iso-8859-1?Q?F2Ct5d8aGkRf7rtVFJouJePPYm+/ZYvFNQn1cdOs28Ek9hTffiCsXblwtD?= =?iso-8859-1?Q?kn3a0zVN60Ziz9R2/w3Nr2I+TCE6PYepQAf7LLnW4QDisx1xCHeBIzt13c?= =?iso-8859-1?Q?xLbarPStTfIG0FvuMs8gZRENvzw1nP90hvc/oBlvCpIHJN2w/w870g69PD?= =?iso-8859-1?Q?js2dXNS5ewk2BPHgRmWdKzftVyxDEyF67ctnk8Kv0G9nw3H32CkNN7zVU2?= =?iso-8859-1?Q?99vcrnOpyVzLlJcvkKc25DzWQYnHlss2YM3w82HMWJ0NI2LrQBydsfZfoL?= =?iso-8859-1?Q?KZJBUszJX5eLzQLGpx7ADpf8URhQ8Nd5KJfQgk5XEFhB670WTmvqwgzAUm?= =?iso-8859-1?Q?jfBa2B4ZwVcqiN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8dluticK3+lFj5?= =?iso-8859-1?Q?QfoqByk3eAJyFanYHirHzObIgK5ME+29BLOvbt/ViKAvydJzpbQb3n4t5p?= =?iso-8859-1?Q?KYZYgpt4SrHQIJf6nRiaxBg0+hh7nKM=3D?= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB5029.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5e8d8ce-c827-4ff8-4c53-08de4c730ce9 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2026 15:56:55.4405 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: tGGFvFDVh9gEnjOolQu+lf8WX6LFcvfh3RSKhr4US/k2fcShOHQniqI0tSS07kpSTN+YFUr2HR/23qOBc7dB/845hZkEVc6JICLXecsD8Oo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH8PR02MB11020 X-Proofpoint-ORIG-GUID: qFo9Fx9W-ARA7GaFc9BNq2BH4AVm37uO X-Authority-Analysis: v=2.4 cv=QcBrf8bv c=1 sm=1 tr=0 ts=695bdf49 cx=c_pps a=wnlGNIUL0AhmB29u2vspYA==:117 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=vUbySO9Y5rIA:10 a=0kUYKlekyDsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=64Cc0HZtAAAA:8 a=XT8gEEquJfDF-nft9kEA:9 a=wPNLvfGTeEIA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTA1MDEzOSBTYWx0ZWRfXxXlus3ondhd3 N6PNtfwsMhxtlqHw/msVhKPyQ/4wdrMLt5lqQACb96h1zYpF4XtSaSAxng9iEDjt4Gjhm8l8BvA eqU0FLmcBSA6Gxm0Q4+SgxkkBdaqjKCLWnKsfJDYfiDvHUH7Sr+5Pl3L1kiaSG2YA0bjlPueSxR 0+vREg/0arB7UTEh9JGztmYPatTHs0iX3vDAkTHGRU98ELyS1wio0lfvn7X3OBPAyWrwX/GFUsp o90rywnkD4Cxd2XONy5dETNQKHCP7T58vGNFeI+VJI6NSZlP4sPQb9DW1s2Shi9QSIaIwMoSivE aFMw7Pen76JmtNoMOjGAqRW6pQOMH52W1kSUgQkwpu+IohcYYPhNL9LWa8J9Mf1mCNQaGPgaF+P +xMEFyE/X3V8Fi7Tjl5mueYLOkHEvqFJC/oCNWU3mSQ7KEa39rQ0lAgkfIqOpt1B1cLjKEdoOI6 rOE2UNc3nthCxXtaKLw== X-Proofpoint-GUID: qFo9Fx9W-ARA7GaFc9BNq2BH4AVm37uO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2026-01-05_01,2026-01-05_01,2025-10-01_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.155.12; envelope-from=yunpeng.yang@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @nutanix.com) X-ZM-MESSAGEID: 1767634731371158500 Content-Type: text/plain; charset="utf-8" The "Set LAN Configuration Parameters" IPMI command is added to the `ipmi_bmc_sim` device to support dynamically setting fake LAN channel configurations. With the fake LAN channel enabled, inside the guest OS, tools such as `ipmitool` can be used to modify the configurations. Signed-off-by: Yunpeng Yang --- hw/ipmi/ipmi_bmc_sim.c | 110 ++++++++++++++++++++++++++++++++++++ tests/qtest/ipmi-kcs-test.c | 83 +++++++++++++++++++++++++++ 2 files changed, 193 insertions(+) diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c index d88aa22b72..012e2ee4fe 100644 --- a/hw/ipmi/ipmi_bmc_sim.c +++ b/hw/ipmi/ipmi_bmc_sim.c @@ -106,6 +106,7 @@ =20 #define IPMI_NETFN_TRANSPORT 0x0c =20 +#define IPMI_CMD_SET_LAN_CONFIG 0x01 #define IPMI_CMD_GET_LAN_CONFIG 0x02 =20 =20 @@ -300,6 +301,7 @@ struct IPMIBmcSim { ((ibs)->lan.channel !=3D 0 && (ibs)->lan.channel =3D=3D (c)) =20 #define IPMI_BMC_LAN_CFG_CC_PARAM_NOT_SUPPORTED 0x80 +#define IPMI_BMC_LAN_CFG_CC_PARAM_READONLY 0x82 =20 #define IPMI_BMC_LAN_CFG_PARAM_SET_IN_PROGRESS 0x00 #define IPMI_BMC_LAN_CFG_PARAM_AUTH_TYPE_SUPPORT 0x01 @@ -2126,6 +2128,113 @@ static inline bool is_ipv4_netmask_valid(const void= *buf) return netmask !=3D 0 && clo32(netmask) + ctz32(netmask) =3D=3D 32; } =20 +/* + * Request data (from cmd[2] on): + * bytes meaning + * 1 [bits 3:0] channel number + * 2 parameter selector + * [3:N] configuration parameter data (from cmd[4] on) + */ +static void set_lan_config(IPMIBmcSim *ibs, + uint8_t *cmd, unsigned int cmd_len, + RspBuffer *rsp) +{ + uint8_t channel; + uint8_t *param; /* pointer to configuration parameter data */ + unsigned int param_len; + + if (ibs->lan.channel =3D=3D 0) { + /* LAN channel disabled. Fail as if this command were not defined.= */ + rsp_buffer_set_error(rsp, IPMI_CC_INVALID_CMD); + return; + } + if (cmd_len < 5) { + rsp_buffer_set_error(rsp, IPMI_CC_REQUEST_DATA_LENGTH_INVALID); + return; + } + channel =3D cmd[2] & 0xf; + param =3D cmd + 4; + param_len =3D cmd_len - 4; + + if (!IPMI_BMC_CHANNEL_IS_LAN(ibs, channel)) { + rsp_buffer_set_error(rsp, IPMI_CC_INVALID_DATA_FIELD); + return; + } + + switch (cmd[3]) { + case IPMI_BMC_LAN_CFG_PARAM_IP_ADDR: + if (param_len < NBYTES_IP) { + rsp_buffer_set_error(rsp, IPMI_CC_REQUEST_DATA_LENGTH_INVALID); + return; + } + memcpy(ibs->lan.ipaddr, param, NBYTES_IP); + break; + + case IPMI_BMC_LAN_CFG_PARAM_IP_ADDR_SOURCE: + if (param_len < 1) { + rsp_buffer_set_error(rsp, IPMI_CC_REQUEST_DATA_LENGTH_INVALID); + return; + } + if (!IPMI_BMC_LAN_CFG_IS_VALID_IP_SOURCE(*param)) { + rsp_buffer_set_error(rsp, IPMI_CC_INVALID_DATA_FIELD); + return; + } + ibs->lan.ipsrc =3D *param; + break; + + case IPMI_BMC_LAN_CFG_PARAM_MAC_ADDR: + if (param_len < NBYTES_MAC) { + rsp_buffer_set_error(rsp, IPMI_CC_REQUEST_DATA_LENGTH_INVALID); + return; + } + memcpy(ibs->lan.macaddr.a, param, NBYTES_MAC); + break; + + case IPMI_BMC_LAN_CFG_PARAM_SUBNET_MASK: + if (param_len < NBYTES_IP) { + rsp_buffer_set_error(rsp, IPMI_CC_REQUEST_DATA_LENGTH_INVALID); + return; + } + if (!is_ipv4_netmask_valid(param)) { + rsp_buffer_set_error(rsp, IPMI_CC_INVALID_DATA_FIELD); + return; + } + memcpy(ibs->lan.netmask, param, NBYTES_IP); + break; + + case IPMI_BMC_LAN_CFG_PARAM_DEFAULT_GW_IP_ADDR: + if (param_len < NBYTES_IP) { + rsp_buffer_set_error(rsp, IPMI_CC_REQUEST_DATA_LENGTH_INVALID); + return; + } + memcpy(ibs->lan.defgw_ipaddr, param, NBYTES_IP); + break; + + case IPMI_BMC_LAN_CFG_PARAM_DEFAULT_GW_MAC_ADDR: + if (param_len < NBYTES_MAC) { + rsp_buffer_set_error(rsp, IPMI_CC_REQUEST_DATA_LENGTH_INVALID); + return; + } + memcpy(ibs->lan.defgw_macaddr.a, param, NBYTES_MAC); + break; + + case IPMI_BMC_LAN_CFG_PARAM_SET_IN_PROGRESS: + case IPMI_BMC_LAN_CFG_PARAM_AUTH_TYPE_SUPPORT: + case IPMI_BMC_LAN_CFG_PARAM_AUTH_TYPE_ENABLES: + case IPMI_BMC_LAN_CFG_PARAM_IPV4_HDR_PARAMS: + case IPMI_BMC_LAN_CFG_PARAM_BACKUP_GW_ADDR: + case IPMI_BMC_LAN_CFG_PARAM_BACKUP_GW_MAC_ADDR: + case IPMI_BMC_LAN_CFG_PARAM_COMMUNITY_STRING: + case IPMI_BMC_LAN_CFG_PARAM_NUM_DESTINATIONS: + rsp_buffer_set_error(rsp, IPMI_BMC_LAN_CFG_CC_PARAM_READONLY); + return; + + default: + rsp_buffer_set_error(rsp, IPMI_BMC_LAN_CFG_CC_PARAM_NOT_SUPPORTED); + return; + } +} + /* * Request data (from cmd[2] to cmd[5] inclusive): * bytes meaning @@ -2324,6 +2433,7 @@ static const IPMINetfn storage_netfn =3D { }; =20 static const IPMICmdHandler transport_cmds[] =3D { + [IPMI_CMD_SET_LAN_CONFIG] =3D { set_lan_config }, [IPMI_CMD_GET_LAN_CONFIG] =3D { get_lan_config }, }; static const IPMINetfn transport_netfn =3D { diff --git a/tests/qtest/ipmi-kcs-test.c b/tests/qtest/ipmi-kcs-test.c index d0a207477e..9bab0d84ad 100644 --- a/tests/qtest/ipmi-kcs-test.c +++ b/tests/qtest/ipmi-kcs-test.c @@ -318,6 +318,88 @@ static void test_kcs_lan_get(void) } =20 =20 +/* set/get ip address: 192.0.2.2 */ +static uint8_t lan_set_ipaddr_cmd[] =3D { 0x30, 0x01, 0x01, 0x03, + 0xc0, 0x00, 0x02, 0x02 }; +static uint8_t lan_set_ipaddr_rsp[] =3D { 0x34, 0x01, 0x00 }; +static uint8_t lan_get_ipaddr_cmd[] =3D { 0x30, 0x02, 0x01, 0x03, 0x00, 0x= 00 }; +static uint8_t lan_get_ipaddr_rsp[] =3D { 0x34, 0x02, 0x00, 0x11, + 0xc0, 0x00, 0x02, 0x02 }; +/* set ip address source: static */ +static uint8_t lan_set_ipsrc_cmd[] =3D { 0x30, 0x01, 0x01, 0x04, 0x01 }; +static uint8_t lan_set_ipsrc_rsp[] =3D { 0x34, 0x01, 0x00 }; + +/* set/get subnet mask: 255.255.255.0 */ +static uint8_t lan_set_netmask_cmd[] =3D { 0x30, 0x01, 0x01, 0x06, + 0xff, 0xff, 0xff, 0x00 }; +static uint8_t lan_set_netmask_rsp[] =3D { 0x34, 0x01, 0x00 }; +static uint8_t lan_get_netmask_cmd[] =3D { 0x30, 0x02, 0x01, 0x06, 0x00, 0= x00 }; +static uint8_t lan_get_netmask_rsp[] =3D { 0x34, 0x02, 0x00, 0x11, + 0xff, 0xff, 0xff, 0x00 }; + +/* set/get default gateway ip address: 192.0.2.1 */ +static uint8_t lan_set_defgw_ipaddr_cmd[] =3D { 0x30, 0x01, 0x01, 0x0c, + 0xc0, 0x00, 0x02, 0x01 }; +static uint8_t lan_set_defgw_ipaddr_rsp[] =3D { 0x34, 0x01, 0x00 }; +static uint8_t lan_get_defgw_ipaddr_cmd[] =3D { 0x30, 0x02, 0x01, 0x0c, + 0x00, 0x00 }; +static uint8_t lan_get_defgw_ipaddr_rsp[] =3D { 0x34, 0x02, 0x00, 0x11, + 0xc0, 0x00, 0x02, 0x01 }; + +/* + * Set and then get LAN configurations + */ +static void test_kcs_lan_set_get(void) +{ + uint8_t rsp[20]; + unsigned int rsplen =3D 0; + + /* set ip address */ + rsplen =3D sizeof(rsp); + kcs_cmd(lan_set_ipaddr_cmd, sizeof(lan_set_ipaddr_cmd), rsp, &rsplen); + g_assert(rsplen =3D=3D sizeof(lan_set_ipaddr_rsp)); + g_assert(memcmp(lan_set_ipaddr_rsp, rsp, rsplen) =3D=3D 0); + + /* get ip address */ + rsplen =3D sizeof(rsp); + kcs_cmd(lan_get_ipaddr_cmd, sizeof(lan_get_ipaddr_cmd), rsp, &rsplen); + g_assert(rsplen =3D=3D sizeof(lan_get_ipaddr_rsp)); + g_assert(memcmp(lan_get_ipaddr_rsp, rsp, rsplen) =3D=3D 0); + + /* set ip address source */ + rsplen =3D sizeof(rsp); + kcs_cmd(lan_set_ipsrc_cmd, sizeof(lan_set_ipsrc_cmd), rsp, &rsplen); + g_assert(rsplen =3D=3D sizeof(lan_set_ipsrc_rsp)); + g_assert(memcmp(lan_set_ipsrc_rsp, rsp, rsplen) =3D=3D 0); + + /* set subnet mask */ + rsplen =3D sizeof(rsp); + kcs_cmd(lan_set_netmask_cmd, sizeof(lan_set_netmask_cmd), rsp, &rsplen= ); + g_assert(rsplen =3D=3D sizeof(lan_set_netmask_rsp)); + g_assert(memcmp(lan_set_netmask_rsp, rsp, rsplen) =3D=3D 0); + + /* get subnet mask */ + rsplen =3D sizeof(rsp); + kcs_cmd(lan_get_netmask_cmd, sizeof(lan_get_netmask_cmd), rsp, &rsplen= ); + g_assert(rsplen =3D=3D sizeof(lan_get_netmask_rsp)); + g_assert(memcmp(lan_get_netmask_rsp, rsp, rsplen) =3D=3D 0); + + /* set default gateway ip address */ + rsplen =3D sizeof(rsp); + kcs_cmd(lan_set_defgw_ipaddr_cmd, sizeof(lan_set_defgw_ipaddr_cmd), + rsp, &rsplen); + g_assert(rsplen =3D=3D sizeof(lan_set_defgw_ipaddr_rsp)); + g_assert(memcmp(lan_set_defgw_ipaddr_rsp, rsp, rsplen) =3D=3D 0); + + /* get default gateway ip address */ + rsplen =3D sizeof(rsp); + kcs_cmd(lan_get_defgw_ipaddr_cmd, sizeof(lan_get_defgw_ipaddr_cmd), + rsp, &rsplen); + g_assert(rsplen =3D=3D sizeof(lan_get_defgw_ipaddr_rsp)); + g_assert(memcmp(lan_get_defgw_ipaddr_rsp, rsp, rsplen) =3D=3D 0); +} + + int main(int argc, char **argv) { char *cmdline; @@ -340,6 +422,7 @@ int main(int argc, char **argv) qtest_add_func("/ipmi/local/kcs_channel_access", test_kcs_channel_acce= ss); qtest_add_func("/ipmi/local/kcs_channel_info", test_kcs_channel_info); qtest_add_func("/ipmi/local/kcs_lan_get", test_kcs_lan_get); + qtest_add_func("/ipmi/local/kcs_lan_set_get", test_kcs_lan_set_get); ret =3D g_test_run(); qtest_quit(global_qtest); =20 --=20 2.43.7