From nobody Fri Nov 14 18:21:19 2025 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=1761674617; cv=pass; d=zohomail.com; s=zohoarc; b=VuOBZaPAQDneiuG5SSRMv7SJ4G/kqYwFoofzfCpeDABhgTC0sN6k8vxpj/Tu9A6V+cSpJTxRyG/W/KOFFELrPktYvrj08I2nerp4DVQBqa9k6ti4ZwKr+FPg9F0/TO7s3jC3wxyY7yvtBHRYVOY1F31Y9MSUemlEycsRowsvgqg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761674617; 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=Ze2uqv5aQp9M54pnUAdS5ZNu1eeYzFZoY9rEmLzSd+4=; b=nTiEbgV174ABTXQlXN94o9vnU4Vn6iArWk9c359u+RVAIz/0OdywxvB7iZE4XG8+Q4pHXt3lAaGEu8f6E2sw4sLPswRkJ8j4bNX2cDZkQZVdjcQXG47Zx1SDh7YD7UYlHOfj/TfynO85mNX0lWMp7GCgnfJli+Z7Yr/y8imsan0= 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 1761674616978830.6689894597902; Tue, 28 Oct 2025 11:03:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDo1U-0003nC-RK; Tue, 28 Oct 2025 14:02:22 -0400 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 1vDo1G-0003ib-G8 for qemu-devel@nongnu.org; Tue, 28 Oct 2025 14:02:08 -0400 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 1vDo10-0000NI-Db for qemu-devel@nongnu.org; Tue, 28 Oct 2025 14:02:05 -0400 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 59SFVX053264077; Tue, 28 Oct 2025 11:01:23 -0700 Received: from bl2pr02cu003.outbound.protection.outlook.com (mail-eastusazon11021109.outbound.protection.outlook.com [52.101.52.109]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 4a30j4gcqt-2 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 28 Oct 2025 11:01:23 -0700 (PDT) Received: from BYAPR02MB5029.namprd02.prod.outlook.com (2603:10b6:a03:61::24) by MWHPR02MB10548.namprd02.prod.outlook.com (2603:10b6:303:281::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9253.18; Tue, 28 Oct 2025 18:01:20 +0000 Received: from BYAPR02MB5029.namprd02.prod.outlook.com ([fe80::3158:6137:fd0f:d590]) by BYAPR02MB5029.namprd02.prod.outlook.com ([fe80::3158:6137:fd0f:d590%3]) with mapi id 15.20.9253.018; Tue, 28 Oct 2025 18:01:20 +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=Ze2uqv5aQp9M54pnUAdS5ZNu1eeYzFZoY9rEmLzSd +4=; b=T0KXUAdfGkXKSPukX1X8v/lkq0RuLHIAG2hje83R/CJOZ5Z3+ddmOUGBU yv35fkXgkWeoHobtcBgoUFTis+9bLPGpHFTEC0TD7XU2q6FJ8q0jKShIxthlB3ZG eD1gF52drVhBjRe+3ToE03SZCEPK88QbUDRaZJ3XD4B9GpqlPNXfkXG8K9Q4r6Wo fn9m5Awu2Rat8BxYvyhUw9EmkjTBSdAYMTZ16hwN/5/f0MUyB02PCxWACIRz2hQP 6bmeX4dhibK6LFk0iWfLl4VwVm4nDGKNHPR0fRB3CNKslPD1ySmUe3FTGxsr7eLX NckcceqFQp+m3OPJA+tcJ0eIN8idA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=N/IfHf4v16sQ47uBYyZh6oPm1XRDbb6xue6Evyj4Nmcf5ImJQPeO7kbnJpdV5tmqimcrdlqYn3wybBtsPDawAxNiduppzaeRkfrQ2rD/HuV8NSl5zZ0s3PBGpdqavN5ITXtfj/XvLroU+hVCrT+XqaO8E1vh24Nt49uJ3eYhmi5gpWIWK5B5nLkpJ8GFxLQuPnwvNDkyhxfhUIhcPTCHzw4LTfqFWu4wsKZrNT9WrBNRC38NJC+5ZG6PwcTcGASrvfE6snXaQumf8Fw8Vw4uWLg1Q3yAuETuHOPk7QBKMtpyQ5ktGoPzIY699EWtvtZF/2TfsDp8OEDqQ5McSF5eow== 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=Ze2uqv5aQp9M54pnUAdS5ZNu1eeYzFZoY9rEmLzSd+4=; b=Xp0xt2YXu5FEx6EdN1hWAMJHbG13xQc50f+B+q9OjQ9k8NxvPe7N1r0meDqHh/eI3MBmgnJcsIRjKmdRGt6kgbwST4w/Ntw7K5fBRSLi3uzcCWZql57SiZKunEBPKmc+mZTpGr3R635sCL3ijP81yqXgnkYfn4YnsaV6fP6azN2ygQO919L6Mq33VH2vTfTjzjFDR3y4ETmYPPyblsuYzbNHRz0uXXW3MJzGfr8JIgG4LiOZ6A3GnXgh+b3IsGJwHof58HfuK/9gE7IRwneubhVnOfhMIhm8TsvykGwPuFXLApmkWKenjtFDjBJGr0ExqnKaWKmG/QTlCjLrg6RAlA== 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=Ze2uqv5aQp9M54pnUAdS5ZNu1eeYzFZoY9rEmLzSd+4=; b=hDPVP7iCMXeKPP1CCK7F7wM3S8VgHp7yNJ2Fto0X7HUCupzLGirA/+d27uwpSE/Q5Lc4nc8lFf94xQXMEJHD4VXU3fmCDgbx2P2huwUh1XEjPXlo1j2t4lxBNdP4L55pXEme34QJ/vv9/q1upn9copSQLIzmgd2gci489btOg4w6kOiUB0IGyj038WoE+3boNZzoC/SsocPI4LmrY3QYu8hJj0Yy5y1w97uExCc1GEZOpfdYAv5hheMZQi80Iulz8ZGXimH4GkziGHIqDFUn/FGiSUV7Wqp+WS57kluB/A95YLAKywWZpxuJ6ImDhwJ/K9bh+Nrm3Sp2s9/GwsmbKg== From: Yunpeng Yang To: "minyard@acm.org" CC: "farosas@suse.de" , "lvivier@redhat.com" , "pbonzini@redhat.com" , "qemu-devel@nongnu.org" , Mark Cave-Ayland , "corey@minyard.net" , Jonathan Davies , "cornelia.huck@de.ibm.com" Subject: [PATCH 1/2] hw/ipmi/ipmi_bmc_sim: Support getting fake LAN channel config Thread-Topic: [PATCH 1/2] hw/ipmi/ipmi_bmc_sim: Support getting fake LAN channel config Thread-Index: AQHcSDTcH1pDlX4+/0KsuzktMTd+ng== Date: Tue, 28 Oct 2025 18:01:19 +0000 Message-ID: <20251028180115.1098433-2-yunpeng.yang@nutanix.com> References: <20251028180115.1098433-1-yunpeng.yang@nutanix.com> In-Reply-To: <20251028180115.1098433-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_|MWHPR02MB10548:EE_ x-ms-office365-filtering-correlation-id: 0aff7217-2a2a-47dc-c803-08de164c001f x-proofpoint-crosstenant: true x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700021; x-microsoft-antispam-message-info: =?iso-8859-1?Q?gVY5Q5egMYTLykpoXY20nsrAMUfPrXTJF+Qp2EbTqtQI7F70HjZqvp/FLN?= =?iso-8859-1?Q?d8vaOXfOJeOJtJ0WfQy1/GCQaLPtz6hQTgH0RcmHsEC+LN8JEQ3sOlDuQ/?= =?iso-8859-1?Q?xiAj1EVJ/fkSzhZp/XH/0OijEy2mSF3plYc4hKgn4Tq1npHSK3UF8nn5p0?= =?iso-8859-1?Q?JN6EKBmgx7xM37fUNfMngN1RLmTvdUNi+0mBtDjbF3TsAY7BXDvDb2tk2j?= =?iso-8859-1?Q?DqyMMxJVKX+rKEDKjdtW7aHoE9/+9q9w0B64pcUixA4bJdoYnt4Py6rVZB?= =?iso-8859-1?Q?4lNCz1kdL0OS94crxj27r9L1l3+Ha5Cf51B2+M5ZoLdBDb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SFh/+Hjx/QpylKwzUr1DmqVh6YeFgODW3HqEoKRw64isQzau5NJU1a?= =?iso-8859-1?Q?ohm97nNYbqmjkMjp+rDvPV7Os2F5VkSPwZbKsBqpYkV9DaiE1666AdA0zE?= =?iso-8859-1?Q?HRWTJpQLcOGLa/oO4i/woeV8RQu/EM9RrtpjBlBQjbPCI9TOBIc7DlAu7I?= =?iso-8859-1?Q?jLkwfLBqh86JPlfouqBent/306A+u0d3NpvflHsOhQm9gE6NMDjMimaNeV?= =?iso-8859-1?Q?wId5/jQHvhLl1q0nlUwcC14GPkwlDvOpruG4uJIUlSjx/eTeqyyYmylhXa?= =?iso-8859-1?Q?JFch8kmE9MCRYKfq+QITI8/m/vghenjfGpBYa8q3LU9HwoazXgLu/gzOyg?= =?iso-8859-1?Q?6Na+QPpB7GNbBt2J4hqfcBlYuZjy?= 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)(1800799024)(366016)(38070700021); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?AnRFz7oJWI6smkU1nskr+LGAAucUpfkEj3R8G29mKr3oS/6fOWLdzlRdmf?= =?iso-8859-1?Q?Sw8fpqF9ifZnp/GFik8mMcv+P81Sy7lWMdwmj54EnNUbcvDs2Zmpa59J8v?= =?iso-8859-1?Q?H3CVUPwkQz7Tc3Lgsv36hddm6T6iF1mrkZ5BFjdUtfe6AgroMre6unF3On?= =?iso-8859-1?Q?WJBnlMHMvd59gW7cDBzzjw+rElJHX1lQleDJFxncaTTGEIosE3fcVZ+B05?= =?iso-8859-1?Q?YQUcanuhQAozeZNU42+0MoAOD5+I+/vSWs6MQ7xmTWW2qHt5wUt4nRMO++?= =?iso-8859-1?Q?TQaGk38e4XnY8qrtpL8FuOdHI0BN5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?Q?OcxuIyUsQSKHPbtP2ytWrC8K0Xinkc83M6q2tHu8LjNGKkl5VoiLtRrcHO?= =?iso-8859-1?Q?+m3FZmMDbCOLYfH5KFl1eH/hA7HuuTfaJZIDCJ0JB2nktjzu0sfMWVzAWM?= =?iso-8859-1?Q?nvSP9Nh2PkGjDgp5mRncDcHO8RW+10ARh5EIKfZnT52jT0xKIIi2py8tU/?= =?iso-8859-1?Q?X0AfyQbyto42cxHQ8vTjKKPuzmwpncneJ0tFTtcOz2yoJAxcRlGWbV7wLA?= =?iso-8859-1?Q?8Z4OvQa9c64hLQ/CXojeetOqQlwk5LROcUbhSZlMDVUBogYbr0gEUikv43?= =?iso-8859-1?Q?F0yq/0Pz/DHU8NafNYCBJzAJLf6m6YcOu18ckE4Zcw/zcZJLfDnp9U+QzS?= =?iso-8859-1?Q?svBvpbtF/rpBQwC5PcMuvwWYcyiXCAnDhVLIps9Q3UuA0b/2Ec6jtnzzkW?= =?iso-8859-1?Q?liyw6H1PdjdM40p+obzYeKj7oGU+NE5jrPlYiA71rz0wXzbBVBvArt9g?= =?iso-8859-1?Q?=3D=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: 0aff7217-2a2a-47dc-c803-08de164c001f X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Oct 2025 18:01:19.7464 (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: HwiXjyyf7pLl5tYK/vVz3lHbr6zf8mYdACthGyqndf/8d2NtP7HiL+ZCZIaCV60HGWciOOXtvde2Wj2vnKPYXXjRGv4UcyfmUToRbmEj1yI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB10548 X-Proofpoint-GUID: VceG0pb_Vm7kB2AinTOLR96EUlkFQosc X-Authority-Analysis: v=2.4 cv=FJYWBuos c=1 sm=1 tr=0 ts=690104f3 cx=c_pps a=eErdSk/Sa828lcK029XJ5Q==:117 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=x6icFKpwvdMA:10 a=0kUYKlekyDsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=64Cc0HZtAAAA:8 a=pTf6PJ8vMGm95pvt50EA:9 a=wPNLvfGTeEIA:10 a=cPQSjfK2_nFv0Q5t_7PE:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDI4MDE1MiBTYWx0ZWRfXxCubsFN8nbRU 1RFgehQThioBAx9LqeA6+YMVZulprCRn8IOdXRkps+BI0ERcl4ExooPeIldK8L2dr+erx87+LZ3 +5tSF9tcr8OCXechC++o1oBDR6nBR8c/s8Wkio3mZip27A92GAW7n8SsptRwYPO2HnZNDhXgt06 IFRYGL7J0VqVpWoIO4cyZBcPJqRo7MtF1duf0KSey46kTAQ5Tsyyw3MZZ+AoYbliyEcPdrWZt7/ MRTHisNC6oRBq03Oazfj+z903yb69Xyn4/I9VwB5Uy9OUYA8YBM5JgmJD9P8Fcc69rhAwlKPbk8 UWXDcFu++QuH1KN6/UzEPpCoAyXCp8bzOV8n2cmD/FKZL0BtnLKrU6CqokfKGoV3oiJBIVv+WlQ NxdOvcdCJBqcx/RDJxcDScEHiTPuDA== X-Proofpoint-ORIG-GUID: VceG0pb_Vm7kB2AinTOLR96EUlkFQosc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-28_07,2025-10-22_01,2025-03-28_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 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=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: 1761674619915154100 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 | 297 ++++++++++++++++++++++++++++++++++-- include/hw/ipmi/ipmi.h | 1 + qemu-options.hx | 26 ++++ tests/qtest/ipmi-kcs-test.c | 60 ++++++++ 4 files changed, 374 insertions(+), 10 deletions(-) diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c index 04e1dcd0e7..2ead46ee55 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/loader.h" #include "hw/qdev-properties.h" #include "hw/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,140 @@ static void set_sensor_reading(IPMIBmcSim *ibs, } } =20 +static inline bool is_valid_netmask(const uint8_t *netmask) +{ + uint32_t mask =3D netmask[3]; + uint32_t inverted; + + mask |=3D (uint32_t) netmask[2] << 8; + mask |=3D (uint32_t) netmask[1] << 16; + mask |=3D (uint32_t) netmask[0] << 24; + inverted =3D ~mask; + return mask !=3D 0 && (inverted & (inverted + 1)) =3D=3D 0; +} + +/* + * 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 +2297,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 +2328,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 { @@ -2176,7 +2395,7 @@ static void ipmi_sdr_init(IPMIBmcSim *ibs) =20 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 +2417,13 @@ 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_UINT8_V(lan.channel, IPMIBmcSim, 2), + VMSTATE_UINT8_ARRAY_V(lan.ipaddr, IPMIBmcSim, NBYTES_IP, 2), + VMSTATE_UINT8_V(lan.ipsrc, IPMIBmcSim, 2), + VMSTATE_UINT8_ARRAY_V(lan.macaddr.a, IPMIBmcSim, NBYTES_MAC, 2), + VMSTATE_UINT8_ARRAY_V(lan.netmask, IPMIBmcSim, NBYTES_IP, 2), + VMSTATE_UINT8_ARRAY_V(lan.defgw_ipaddr, IPMIBmcSim, NBYTES_IP, 2), + VMSTATE_UINT8_ARRAY_V(lan.defgw_macaddr.a, IPMIBmcSim, NBYTES_MAC,= 2), VMSTATE_END_OF_LIST() } }; @@ -2232,6 +2458,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_valid_netmask((const uint8_t *) &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 +2526,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 +2546,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 cd581aa134..3435d84178 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 0223ceffeb..100226d84b 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1142,6 +1142,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 Fri Nov 14 18:21:19 2025 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=1761674621; cv=pass; d=zohomail.com; s=zohoarc; b=lclTKF1WmmlHU/Xy+NEAU8WaYpVDho8WNvCNc0jkfKWZ+me+GPPvEWxkQEvdu6UKFLoegBBUsZmvKzG2B7f68TVvJZkMZq2lRsi5+puRRneNywA4v40TpeMPsLkHsBQZrYZAXNZxej9dkfmfKSodQU/lwo8nEYiRueFNBykjjGc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761674621; 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=DEkcMBHmZGU93qZZMuWGEJGnuMvqZ/ZvjXjt+ellG9o=; b=k1lJHWFNMskdn77LVonQiuylsaGfYnDUa7JMJH9KB/KSIpAm2gzrqRMF+rwAtjdPUaAoXoQ9CoBfKoPpcETNRdvoq92jZk34LW/5Q7/fl/iu76/ae8zqwW8lpXbjS7uQDAg2qfPzo8VJ/ZuL7pKOh3XnrWGJIYFtkodNFsQ9GCo= 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 1761674621499497.49287042127446; Tue, 28 Oct 2025 11:03:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDo1J-0003jC-Bu; Tue, 28 Oct 2025 14:02:09 -0400 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 1vDo1E-0003iF-Dy for qemu-devel@nongnu.org; Tue, 28 Oct 2025 14:02:04 -0400 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 1vDo10-0000NM-E4 for qemu-devel@nongnu.org; Tue, 28 Oct 2025 14:02:03 -0400 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 59SFVX083264077; Tue, 28 Oct 2025 11:01:25 -0700 Received: from bl2pr02cu003.outbound.protection.outlook.com (mail-eastusazon11021109.outbound.protection.outlook.com [52.101.52.109]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 4a30j4gcqt-3 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 28 Oct 2025 11:01:24 -0700 (PDT) Received: from BYAPR02MB5029.namprd02.prod.outlook.com (2603:10b6:a03:61::24) by MWHPR02MB10548.namprd02.prod.outlook.com (2603:10b6:303:281::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9253.18; Tue, 28 Oct 2025 18:01:21 +0000 Received: from BYAPR02MB5029.namprd02.prod.outlook.com ([fe80::3158:6137:fd0f:d590]) by BYAPR02MB5029.namprd02.prod.outlook.com ([fe80::3158:6137:fd0f:d590%3]) with mapi id 15.20.9253.018; Tue, 28 Oct 2025 18:01:21 +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=DEkcMBHmZGU93qZZMuWGEJGnuMvqZ/ZvjXjt+ellG 9o=; b=qnF7x9MXnd+FfEFWEdWIeqAntFQrZdM+heIvPxNUIRqJn+YhWr+GtljFA hhBiRnUD/IUoqqshj9eWzQgBBEb6SsILjU4xjlgYcOCc6rcvvXPoMBTN3ZfnOfHE wNX3+x2HN318k1/+vuKNMoUozQ9qb+5wiwGWqtqWq4hpHr7gIqm2kYb+1fC2VDtX s+19ZJ9xQXzZL+NpsSMkHrTEM0noEhakwQ0Hd1xXY9t2fKFNfMx/GeGbGnBHaBrx D7g73WJROZhY3bBPkPuf1vAJl6D1P3PKVCrE/VtoS/iP/QCRvWyKtl9rkVzvQapz Fu+gNCwAAAjgBNreAXxBAgAWhGo8w== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A+zHlVYE4tKwpLu/kH/1WjQqq8/2DTQNj5/flYc5EWpz5V0YaTNIQW1H0lUFQc06cRyMQJTkKHwQW7ic72EUtkV1Y5DaBKlzbFDnumzZHEyn/p05t2YP5ssoCkdk3HL06BjQbfJP9FYQiVyRorXDk0dA+AfAc69wpw/fA2AN/z3mo99rq0bIIMSdH5wx7Dzu/qicoQU4MnZPxB3Pp/RDfWR+VrJYBZtVoZvKCSmZWBmANMK3DnZx9fGcrCNxwzCVluSU8SGPL2FdPi/qikMFL1MZqUkEyskJ7wSvHwGsBIqIHZF0jvKsmCTk45IthWBba+stjwTApS9bsaLMMjpkRg== 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=DEkcMBHmZGU93qZZMuWGEJGnuMvqZ/ZvjXjt+ellG9o=; b=sGpkmu0Kr2aKu/Q/GKihiwQaJN4kmyVQMgoEpeuMxTtALeHpOtwNoq3Xq/rxF6vz1iDL2z2ADIPawW2FHzeJejSOzZSWh+b5MCYPV7FCyCJi5rgIPkbFiCXaeSMcDRGg6/ZwiihE6y0fPCiMq92+fhfAwkUzawT6AJsejAZGLxnLeDICk3iDPPdnoxv6cEDaC27jHwwEN3kjsh4H5JGvGOygCpUR4CaLOMpjSbYGKb0++Ye/wxoa45XNnB5MEDd9DYac8IIgGK+i1CGgD6f6DMli5/1y17egFWPXL5KSmXQToLgjKxV1oGJztb2iIT+jQWjmBKvYz9pt3s9iLERIlA== 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=DEkcMBHmZGU93qZZMuWGEJGnuMvqZ/ZvjXjt+ellG9o=; b=lVY+VBkKdJvfPOk8f7EEAyddD7pdYVnKtpqlNv8r9IwXre3yBaK+uhzY7Tsj7BE31ISj2x0sQwUjLH9/k9O7CUD8CkuFq/LNLmq5vpHpS4oVHFn/IjkyJea//Y8XjRS6dPNURwj/uVFq37OFjXFKrCV26u61cUvNNApIWfN6k2x/Qpu7Tt4f/3dfdgzCeC8R4GA+xyMWVN706ZIVvpWcaJAz2nTosR7qNSioMthRG+na23IMs6LmcUbbSqqiOpEtaLHzg95aiYdGb8r+MUiNJt45ghajQZJiR/B8M8bH4YuELcXLtx/MA38dmuv+cQwnXK+YKuHpnxhjCTCndLaUxA== From: Yunpeng Yang To: "minyard@acm.org" CC: "farosas@suse.de" , "lvivier@redhat.com" , "pbonzini@redhat.com" , "qemu-devel@nongnu.org" , Mark Cave-Ayland , "corey@minyard.net" , Jonathan Davies , "cornelia.huck@de.ibm.com" Subject: [PATCH 2/2] hw/ipmi/ipmi_bmc_sim: Support setting fake LAN channel config Thread-Topic: [PATCH 2/2] hw/ipmi/ipmi_bmc_sim: Support setting fake LAN channel config Thread-Index: AQHcSDTd7FALtb84VUatIr6Y31K5DA== Date: Tue, 28 Oct 2025 18:01:20 +0000 Message-ID: <20251028180115.1098433-3-yunpeng.yang@nutanix.com> References: <20251028180115.1098433-1-yunpeng.yang@nutanix.com> In-Reply-To: <20251028180115.1098433-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_|MWHPR02MB10548:EE_ x-ms-office365-filtering-correlation-id: 6a02a75d-4484-4eac-eda0-08de164c004e x-proofpoint-crosstenant: true x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700021; x-microsoft-antispam-message-info: =?iso-8859-1?Q?+GQfvz2V6Mz1C8lmoqqauccLb0gSVS2O9Ox9w63hQADZF98XrqFFshHsnG?= =?iso-8859-1?Q?btYUxFtfg2mJsM1c2JfDjwXhJIkjds1A57QSVicCiCSCgmvxDx2pbgZilU?= =?iso-8859-1?Q?70FyZ4v2ou8XkQS3MCS2uczXeo/cAWmCjyn/t12kNFJ6jiGpoX2ejFkH4o?= =?iso-8859-1?Q?mszuls6JNfC6zMmSsOmPX9SzGg5miZ2+dsJ6HuUX60nO/T/O+ifBpLuWUH?= =?iso-8859-1?Q?lkCCZTI3/6TPf/sTMoTlK40RaPNKPJwtlvrJfANHypIh4AB6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E4DNdoKI7wcn6mhNNZlST0tyAcMvMRJ87l5X8ng2ehKEx?= =?iso-8859-1?Q?27K4kEd8hN2AMceGfuSZDy9mdyC7h4AR3GX+EUzmxebJAs9h9dbq/io2pK?= =?iso-8859-1?Q?VEwYQPP29PDaLueDI59j6HAq1jbONydZ3qN3zmv3mkCmqWfeEEKjukWSBs?= =?iso-8859-1?Q?AsUF6xZ+U2XdiHc0OnRIjj1ZYf3HbOn/Lm8374dnSzBGv8V0evwVcZ2UJi?= =?iso-8859-1?Q?OJnRgrMgc0DCi9gPPZiyOtHunQEX0hpwKOCVLBP9lvyPFEYL80PnFxFAek?= =?iso-8859-1?Q?LGTNIqUPUarUCEiP/DGuPec8DZ8aW/iuGym00J0eIcHC7mk5OvDdfiGTY7?= =?iso-8859-1?Q?L6U0rP19ezXsl2TPrPH/TPgeRWrF9RcnFc9tsVFKjWQaL48zz5gwRLGWNv?= =?iso-8859-1?Q?L0Fk66MXFN6Ka+OFQpTwXTGLyr7C?= 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)(1800799024)(366016)(38070700021); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?Ulvr3Y+982lv03yFjfpxJiYpLcuFyn/J8rc/XeKO8fRMs75YQlZZNc2+Df?= =?iso-8859-1?Q?/cAb1DocBQ9OFMxnA7SuipI23CKOuJlXiFLaSk8NRg+cNvnGbVVinel55X?= =?iso-8859-1?Q?ekj0bm2UGNsBY3DcG9wSOT6yQu9UEMlllZ3UrAHg9UBObKQk3sr/sPyIug?= =?iso-8859-1?Q?MH1Mmr3ZvDkD1PBVNnwKJtX73Es/6Qi8zphqWyKl56Dno/SS4WYmSIS22I?= =?iso-8859-1?Q?3VsHcGWDAGPJPvCIWuGbNM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EaSrI0LPP?= =?iso-8859-1?Q?RCLEwyEchykKgT/+UpTqpG+VyNQ0rv7VdxEjOHDwB3gH57+WpxdRMrma+b?= =?iso-8859-1?Q?mYKRYHMmAEm6qfcMGGmYm6n5h4XtfSdy9tY8ml5VwXQfeARTXLEAeVe0Hd?= =?iso-8859-1?Q?97ykUPIITyVeAymPKLNoJCyP58CljymZfIK4ghICo3fLuS4NdM3CpXo4gB?= =?iso-8859-1?Q?pLFi7OuEW3helq7bMuzKREywKSmY5/kUIfmVSNsem6ugdR9irjexTRA692?= =?iso-8859-1?Q?j0eKYiIocHvUkP8B8U0kTGU3+gBdvFmAqigeIeUrtSgFMzCfzsgi6/CBda?= =?iso-8859-1?Q?55Vja8EYImiTDVaHUzV1Mc6d2Y/13XQSuNW1KTN3SqRSv0DeBL6sSIwQ3s?= =?iso-8859-1?Q?d6KBkNDwEbeklG6LB1Qx7JY82mvtun4E8yXbpqwuPKykAeFNAb7NGs9MP8?= =?iso-8859-1?Q?9C0tdYxXxCjUIehqeVG1LyGcUT4kpat23A/mbKNdwaTaqjnpzBcbuYJk7h?= =?iso-8859-1?Q?OlXdSLP9YMz2K7KvsILnBFI9pwAhHkxB5wnGIQyiXffVqmd8QRyYlxUA?= =?iso-8859-1?Q?=3D=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: 6a02a75d-4484-4eac-eda0-08de164c004e X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Oct 2025 18:01:20.9508 (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: b01B+C9W5oqcdNKLyHaxdIhfVDK0qSw9Hj0jv0hifqZHYyoVn/5ducP6th//RMp0XglL2gs5K9F2UPgM7gVwEVqfBTeh5cg83V2dUwsS4Qc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB10548 X-Proofpoint-GUID: iJXEv75E61YPFHTrc4bqqY0CwKJUAb5g X-Authority-Analysis: v=2.4 cv=FJYWBuos c=1 sm=1 tr=0 ts=690104f4 cx=c_pps a=eErdSk/Sa828lcK029XJ5Q==:117 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=x6icFKpwvdMA:10 a=0kUYKlekyDsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=64Cc0HZtAAAA:8 a=XT8gEEquJfDF-nft9kEA:9 a=wPNLvfGTeEIA:10 a=cPQSjfK2_nFv0Q5t_7PE:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDI4MDE1MiBTYWx0ZWRfXwy9F7YXrPXKl vPMyd7CCeyz1tljJiC6p1viuhmux3PO3pNy440B8GQIvbOjLUE9/Yt6pe1GY1VJ1EtZlN9UFT8K l/DJFJQbBDLKOvaCKFAKz6lKEzfrOwLCyg96gfpmlu3rwM7bteFhwY0x73fVCLhlyEH8KepK4lP wxEOsJrIQwzpSoG/FZtWw8NsDasqhA2u7U/7mtTX7SUdYG7hoTy6TPWLrDZLOIkPh8l+eD9hGee YE1GNiHvErXHYcDOytL/euc6IPpqB+KQPizV7rq/z9gp7oQaWHcbFrK7fvIMGD/4LtZV5fG4HYx +UV0mZGcZ+PNq1t3mwZ2Nn31zT8v9UVovion33952RHPB5tOgxMEg4KZEdpFyzHGYG0ARohP5S+ q4rL46gEOUIkasz+iTeXUJJfyzSFBQ== X-Proofpoint-ORIG-GUID: iJXEv75E61YPFHTrc4bqqY0CwKJUAb5g X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-28_07,2025-10-22_01,2025-03-28_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 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 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: 1761674625834158500 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 2ead46ee55..f4cea91fde 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 @@ -2131,6 +2133,113 @@ static inline bool is_valid_netmask(const uint8_t *= netmask) return mask !=3D 0 && (inverted & (inverted + 1)) =3D=3D 0; } =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_valid_netmask(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 @@ -2329,6 +2438,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