New command-line suboption "[,dhcpvendopt=optstring]" is defined in the qapi-schema.json. If supplied, the optstring is passed to SLIRP initialization.
Signed-off-by: Fedor Lyakhov <fedor.lyak...@gmail.com> --- net/slirp.c | 9 +++++---- qapi-schema.json | 3 +++ slirp/libslirp.h | 3 ++- slirp/slirp.c | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index cce026b..6c86568 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -137,7 +137,8 @@ static int net_slirp_init(NetClientState *peer, const char *model, const char *vhostname, const char *tftp_export, const char *bootfile, const char *vdhcp_start, const char *vnameserver, const char *smb_export, - const char *vsmbserver, const char **dnssearch) + const char *vsmbserver, const char *dhcp_vendopt, + const char **dnssearch) { /* default settings according to historic slirp */ struct in_addr net = { .s_addr = htonl(0x0a000200) }; /* 10.0.2.0 */ @@ -242,8 +243,8 @@ static int net_slirp_init(NetClientState *peer, const char *model, s = DO_UPCAST(SlirpState, nc, nc); - s->slirp = slirp_init(restricted, net, mask, host, vhostname, - tftp_export, bootfile, dhcp, dns, dnssearch, s); + s->slirp = slirp_init(restricted, net, mask, host, vhostname, tftp_export, + bootfile, dhcp, dns, dnssearch, dhcp_vendopt, s); QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry); for (config = slirp_configs; config; config = config->next) { @@ -754,7 +755,7 @@ int net_init_slirp(const NetClientOptions *opts, const char *name, ret = net_slirp_init(peer, "user", name, user->q_restrict, vnet, user->host, user->hostname, user->tftp, user->bootfile, user->dhcpstart, user->dns, user->smb, - user->smbserver, dnssearch); + user->smbserver, user->dhcpvendopt, dnssearch); while (slirp_configs) { config = slirp_configs; diff --git a/qapi-schema.json b/qapi-schema.json index 391356f..d86aac5 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3056,6 +3056,8 @@ # @dhcpstart: #optional the first of the 16 IPs the built-in DHCP server can # assign # +# @dhcpvendopt: #optional vendor-specific DHCP options to pass to the guest +# # @dns: #optional guest-visible address of the virtual nameserver # # @dnssearch: #optional list of DNS suffixes to search, passed as DHCP option @@ -3082,6 +3084,7 @@ '*tftp': 'str', '*bootfile': 'str', '*dhcpstart': 'str', + '*dhcpvendopt':'str', '*dns': 'str', '*dnssearch': ['String'], '*smb': 'str', diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 5bdcbd5..2bce4de 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -13,7 +13,8 @@ Slirp *slirp_init(int restricted, struct in_addr vnetwork, const char *vhostname, const char *tftp_path, const char *bootfile, struct in_addr vdhcp_start, struct in_addr vnameserver, const char **vdnssearch, - void *opaque); + const char *dhpc_vendopt_string, void *opaque); + void slirp_cleanup(Slirp *slirp); void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout); diff --git a/slirp/slirp.c b/slirp/slirp.c index bad8dad..3dfce46 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -204,7 +204,7 @@ Slirp *slirp_init(int restricted, struct in_addr vnetwork, const char *vhostname, const char *tftp_path, const char *bootfile, struct in_addr vdhcp_start, struct in_addr vnameserver, const char **vdnssearch, - void *opaque) + const char *dhpc_vendopt_string, void *opaque) { Slirp *slirp = g_malloc0(sizeof(Slirp)); -- 1.8.4.5