diff options
author | Peter Delevoryas <pdel@fb.com> | 2021-12-01 23:54:04 -0800 |
---|---|---|
committer | Peter Delevoryas <pdel@fb.com> | 2022-05-11 14:12:40 -0700 |
commit | b397a330e244a94019dd88d5c98b805568cf5a8a (patch) | |
tree | 437bc85ca21631f1e40e59277d84072788c4f80c | |
parent | 11d70507f8abc88c32106d54fdc00eff1e6469a5 (diff) | |
download | slirp-b397a330e244a94019dd88d5c98b805568cf5a8a.zip slirp-b397a330e244a94019dd88d5c98b805568cf5a8a.tar.gz slirp-b397a330e244a94019dd88d5c98b805568cf5a8a.tar.bz2 |
slirp: Add manufacturer's ID
The manufacturer's ID is used in NC-SI commands such as "Get Version ID"
[1]. It is also essential to providing a path towards adding OEM
(non-standardized) NC-SI commands.
This field should be derived from the IANA Private Enterprise Numbers list,
per the NC-SI specification. It may be useful for things besides NC-SI, but
NC-SI responses for BMC's in QEMU are the main use case I have in mind.
Note: I did not add this attribute to slirp_init, since it is deprecated.
[1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.0.0.pdf
[2] https://www.iana.org/assignments/enterprise-numbers/enterprise-numbers
Signed-off-by: Peter Delevoryas <pdel@fb.com>
-rw-r--r-- | src/libslirp.h | 6 | ||||
-rw-r--r-- | src/slirp.c | 6 | ||||
-rw-r--r-- | src/slirp.h | 2 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/libslirp.h b/src/libslirp.h index 77396f0..35ddab6 100644 --- a/src/libslirp.h +++ b/src/libslirp.h @@ -90,7 +90,7 @@ typedef struct SlirpCb { } SlirpCb; #define SLIRP_CONFIG_VERSION_MIN 1 -#define SLIRP_CONFIG_VERSION_MAX 4 +#define SLIRP_CONFIG_VERSION_MAX 5 typedef struct SlirpConfig { /* Version must be provided */ @@ -140,6 +140,10 @@ typedef struct SlirpConfig { * Fields introduced in SlirpConfig version 4 begin */ bool disable_dhcp; /* slirp will not reply to any DHCP requests */ + /* + * Fields introduced in SlirpConfig version 5 begin + */ + uint32_t mfr_id; /* Manufacturer ID (IANA Private Enterprise number) */ } SlirpConfig; /* Create a new instance of a slirp stack */ diff --git a/src/slirp.c b/src/slirp.c index 04bce41..588cada 100644 --- a/src/slirp.c +++ b/src/slirp.c @@ -648,6 +648,12 @@ Slirp *slirp_new(const SlirpConfig *cfg, const SlirpCb *callbacks, void *opaque) slirp->cb->init_completed(slirp, slirp->opaque); } + if (cfg->version >= 5) { + slirp->mfr_id = cfg->mfr_id; + } else { + slirp->mfr_id = 0; + } + ip6_post_init(slirp); return slirp; } diff --git a/src/slirp.h b/src/slirp.h index 35c2be3..a61ea15 100644 --- a/src/slirp.h +++ b/src/slirp.h @@ -151,6 +151,8 @@ struct Slirp { bool disable_host_loopback; + uint32_t mfr_id; + /* mbuf states */ struct slirp_quehead m_freelist; struct slirp_quehead m_usedlist; |