From: Martin Lucina Date: Tue, 13 Jan 2015 18:05:09 +0000 (+0100) Subject: rumpconfig: Enable deconfig for network interfaces X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e858a76fe81e8fda2efcba025494b59747143a64;p=rumpuser-xen.git rumpconfig: Enable deconfig for network interfaces Enable deconfig of network interaces, including dhcp. Current tests show that issue #14 appears to be fixed, so this should be good to go. Signed-off-by: Martin Lucina --- diff --git a/rumpconfig.c b/rumpconfig.c index 6c60a71..cec6a5d 100644 --- a/rumpconfig.c +++ b/rumpconfig.c @@ -198,10 +198,6 @@ out: static void rumprun_deconfig_net(const char *if_index) { -#if 1 - /* TODO According to pwwka this is not fully implemented yet */ - printf("rumprun_deconfig: (not yet) deconfiguring xenif%s\n", if_index); -#else char *if_type = NULL; char *if_method = NULL; char *if_addr = NULL; @@ -217,10 +213,19 @@ rumprun_deconfig_net(const char *if_index) if (strcmp(if_type, "inet") == 0 && strcmp(if_method, "dhcp") == 0) { - /* TODO: need an interface into brlib dhcp to allow us to - * destroy the interface. */ - printf("rumprun_deconfig: not deconfiguring xenif%s (uses dhcp)\n", - if_index); + /* TODO: need an interface to send DHCPRELEASE here */ + snprintf(buf, sizeof buf, "xenif%s", if_index); + if ((rv = rump_pub_netconfig_ifdown(buf)) != 0) { + warnx("rumprun_deconfig: %s: ifdown failed: %s\n", buf, + strerror(rv)); + goto out; + } + if ((rv = rump_pub_netconfig_ifdestroy(buf)) != 0) { + printf("rumprun_deconfig: %s: ifdestroy failed: %s\n", + buf, strerror(rv)); + goto out; + } + } else if (strcmp(if_type, "inet") == 0 && strcmp(if_method, "static") == 0) { @@ -250,7 +255,6 @@ out: free(if_mask); if (if_gw) free(if_gw); -#endif } static int