From 177ff459970a18fc4aa70b3c6a5add5248f5a0c1 Mon Sep 17 00:00:00 2001 From: Peter Delevoryas Date: Mon, 16 May 2022 16:05:35 -0700 Subject: slirp: Add out-of-band ethernet address If a network card supports NC-SI, then it redirects all traffic with the out-of-band (OOB) management controller's (MC) ethernet address to the out-of-band management controller, usually over some sideband RMII interface, not like the PCIe connection to the main host. It's also pretty common for the network card to provision the out-of-band management controller's ethernet address. At startup, the OOB MC asks the network card what its MAC address is through OEM NC-SI commands. This protocol is so common that it's going to be standardized soon in NC-SI 1.2.0 [1] as "Get MC MAC Address". Note: At some point, the network card may provision *multiple* OOB ethernet addresses, but right now everything just uses one. [1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.2.0WIP80.pdf Signed-off-by: Peter Delevoryas --- src/libslirp.h | 5 +++++ src/slirp.c | 2 ++ src/slirp.h | 1 + 3 files changed, 8 insertions(+) diff --git a/src/libslirp.h b/src/libslirp.h index 35ddab6..3afad21 100644 --- a/src/libslirp.h +++ b/src/libslirp.h @@ -144,6 +144,11 @@ typedef struct SlirpConfig { * Fields introduced in SlirpConfig version 5 begin */ uint32_t mfr_id; /* Manufacturer ID (IANA Private Enterprise number) */ + /* + * MAC address allocated for an out-of-band management controller, to be + * retrieved through NC-SI. + */ + uint8_t oob_eth_addr[6]; } SlirpConfig; /* Create a new instance of a slirp stack */ diff --git a/src/slirp.c b/src/slirp.c index 588cada..54056c9 100644 --- a/src/slirp.c +++ b/src/slirp.c @@ -650,8 +650,10 @@ Slirp *slirp_new(const SlirpConfig *cfg, const SlirpCb *callbacks, void *opaque) if (cfg->version >= 5) { slirp->mfr_id = cfg->mfr_id; + memcpy(slirp->oob_eth_addr, cfg->oob_eth_addr, ETH_ALEN); } else { slirp->mfr_id = 0; + memset(slirp->oob_eth_addr, 0, ETH_ALEN); } ip6_post_init(slirp); diff --git a/src/slirp.h b/src/slirp.h index 4c956d9..e413867 100644 --- a/src/slirp.h +++ b/src/slirp.h @@ -152,6 +152,7 @@ struct Slirp { bool disable_host_loopback; uint32_t mfr_id; + uint8_t oob_eth_addr[ETH_ALEN]; /* mbuf states */ struct slirp_quehead m_freelist; -- cgit v1.1