diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2016-09-03 13:46:58 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2016-09-03 13:46:58 +0000 |
commit | f25fb3ff1b4179dce1d40d4efd3eb083850caccf (patch) | |
tree | cef66f3c3c2d3be0f639eab68f35d4bd0998cb59 /sbin/ifconfig/ifconfig.c | |
parent | 2d375858bb375fb1b514a87b235a60a5151cac17 (diff) |
Add support for a multipoint-to-multipoint mode in vxlan(4). In this
mode, vxlan(4) must be configured to accept any virtual network
identifier with "vnetid any" and added to a bridge(4) or switch(4).
This way the driver will dynamically learn the tunnel endpoints and
their vnetids for the responses and can be used to dynamically bridge
between VXLANs. It is also being used in combination with switch(4)
and the OpenFlow tunnel classifiers.
With input from yasuoka@ goda@
OK deraadt@ dlg@
Diffstat (limited to 'sbin/ifconfig/ifconfig.c')
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 7b53792682c..f213d21d18c 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.329 2016/09/02 10:01:36 goda Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.330 2016/09/03 13:46:57 reyk Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -99,6 +99,7 @@ #include <err.h> #include <errno.h> #include <stdio.h> +#include <stdint.h> #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -3622,13 +3623,18 @@ void setvnetid(const char *id, int param) { const char *errmsg = NULL; - uint32_t vnetid; - - vnetid = strtonum(id, 0, UINT_MAX, &errmsg); - if (errmsg) - errx(1, "vnetid %s: %s", id, errmsg); + int64_t vnetid; strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + + if (strcasecmp("any", id) == 0) + vnetid = -1; + else { + vnetid = strtonum(id, 0, INT64_MAX, &errmsg); + if (errmsg) + errx(1, "vnetid %s: %s", id, errmsg); + } + ifr.ifr_vnetid = vnetid; if (ioctl(s, SIOCSVNETID, (caddr_t)&ifr) < 0) warn("SIOCSVNETID"); @@ -3658,7 +3664,12 @@ getvnetid(void) return; } - printf("\tvnetid: %u\n", ifr.ifr_vnetid); + if (ifr.ifr_vnetid < 0) { + printf("\tvnetid: any\n"); + return; + } + + printf("\tvnetid: %lld\n", ifr.ifr_vnetid); } void |