static void config_ipv6(const char *ifname, const char *method, const char *addr, const char *mask, const char *gw) { int rv; if (strcmp(method, "auto") == 0) { if ((rv = rump_pub_netconfig_auto_ipv6(ifname)) != 0) { errx(1, "ipv6 autoconfig failed"); } } else { if (strcmp(method, "static") != 0) { errx(1, "method \"static\" or \"dhcp\" expected, " "got \"%s\"", method); } if (!addr || !mask) { errx(1, "static net cfg missing addr or mask"); } if ((rv = rump_pub_netconfig_ipv6_ifaddr(ifname, addr, atoi(mask))) != 0) { errx(1, "ifconfig \"%s\" for \"%s/%s\" failed", ifname, addr, mask); } if (gw && (rv = rump_pub_netconfig_ipv6_gw(gw)) != 0) { errx(1, "gw \"%s\" addition failed", gw); } } }
static void config_client6(void) { int rv; /* configure networking using the portable interfaces */ NOFAIL_RV(rump_pub_netconfig_ifcreate("shmif0")); NOFAIL_RV(rump_pub_netconfig_ifsetlinkstr("shmif0", "busmem2")); NOFAIL_RV(rump_pub_netconfig_ipv6_ifaddr("shmif0", "2002::1", 64)); NOFAIL_RV(rump_pub_netconfig_ipv6_gw("2002::2")); }