aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Delevoryas <pdel@fb.com>2022-05-16 16:05:35 -0700
committerPeter Delevoryas <pdel@fb.com>2022-05-18 21:19:20 -0700
commit177ff459970a18fc4aa70b3c6a5add5248f5a0c1 (patch)
treefa3c3ab352735c9cb75684ce22d56e21a7a06d08
parent70f26099b1117c48a31139585ff84266e3e9c49a (diff)
downloadslirp-177ff459970a18fc4aa70b3c6a5add5248f5a0c1.zip
slirp-177ff459970a18fc4aa70b3c6a5add5248f5a0c1.tar.gz
slirp-177ff459970a18fc4aa70b3c6a5add5248f5a0c1.tar.bz2
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 <pdel@fb.com>
-rw-r--r--src/libslirp.h5
-rw-r--r--src/slirp.c2
-rw-r--r--src/slirp.h1
3 files changed, 8 insertions, 0 deletions
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;