aboutsummaryrefslogtreecommitdiff
path: root/net/slirp.c
diff options
context:
space:
mode:
authorBenjamin Drung <benjamin.drung@profitbricks.com>2018-02-27 17:06:01 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-05-31 21:19:08 +0200
commitf18d137542a48150d177031fc6c54786179bf2a3 (patch)
tree5b8d86d0280a01ffc70ea84538169282c70854d7 /net/slirp.c
parentc181ddaa176856b3cd2dfd12bbcf25fa9c884a97 (diff)
slirp: Add domainname option to slirp's DHCP server
This patch will allow the user to include the domainname option in replies from the built-in DHCP server. Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'net/slirp.c')
-rw-r--r--net/slirp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/net/slirp.c b/net/slirp.c
index 692252445a..005c2675e6 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -157,7 +157,8 @@ static int net_slirp_init(NetClientState *peer, const char *model,
const char *bootfile, const char *vdhcp_start,
const char *vnameserver, const char *vnameserver6,
const char *smb_export, const char *vsmbserver,
- const char **dnssearch, Error **errp)
+ const char **dnssearch, const char *vdomainname,
+ Error **errp)
{
/* default settings according to historic slirp */
struct in_addr net = { .s_addr = htonl(0x0a000200) }; /* 10.0.2.0 */
@@ -359,6 +360,11 @@ static int net_slirp_init(NetClientState *peer, const char *model,
ip6_dns.s6_addr[15] |= 3;
}
+ if (vdomainname && !*vdomainname) {
+ error_setg(errp, "'domainname' parameter cannot be empty");
+ return -1;
+ }
+
nc = qemu_new_net_client(&net_slirp_info, peer, model, name);
@@ -371,7 +377,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
s->slirp = slirp_init(restricted, ipv4, net, mask, host,
ipv6, ip6_prefix, vprefix6_len, ip6_host,
vhostname, tftp_export, bootfile, dhcp,
- dns, ip6_dns, dnssearch, s);
+ dns, ip6_dns, dnssearch, vdomainname, s);
QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry);
for (config = slirp_configs; config; config = config->next) {
@@ -958,7 +964,7 @@ int net_init_slirp(const Netdev *netdev, const char *name,
user->ipv6_host, user->hostname, user->tftp,
user->bootfile, user->dhcpstart,
user->dns, user->ipv6_dns, user->smb,
- user->smbserver, dnssearch, errp);
+ user->smbserver, dnssearch, user->domainname, errp);
while (slirp_configs) {
config = slirp_configs;