summaryrefslogtreecommitdiff
path: root/sbin/ifconfig
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2016-09-03 13:46:58 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2016-09-03 13:46:58 +0000
commitf25fb3ff1b4179dce1d40d4efd3eb083850caccf (patch)
treecef66f3c3c2d3be0f639eab68f35d4bd0998cb59 /sbin/ifconfig
parent2d375858bb375fb1b514a87b235a60a5151cac17 (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')
-rw-r--r--sbin/ifconfig/ifconfig.89
-rw-r--r--sbin/ifconfig/ifconfig.c25
2 files changed, 25 insertions, 9 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index d3cff744311..9dce28326d1 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ifconfig.8,v 1.270 2016/06/15 19:39:33 gerhard Exp $
+.\" $OpenBSD: ifconfig.8,v 1.271 2016/09/03 13:46:57 reyk Exp $
.\" $NetBSD: ifconfig.8,v 1.11 1996/01/04 21:27:29 pk Exp $
.\" $FreeBSD: ifconfig.8,v 1.16 1998/02/01 07:03:29 steve Exp $
.\"
@@ -31,7 +31,7 @@
.\"
.\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94
.\"
-.Dd $Mdocdate: June 15 2016 $
+.Dd $Mdocdate: September 3 2016 $
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -1603,6 +1603,11 @@ to identify packets with a virtual network.
The accepted size of the number depends on the individual tunnel protocol;
it is a 24-bit number for
.Xr vxlan 4 .
+If supported by the tunnel protocol,
+the value can also be set to
+.Ar any
+to accept packets with arbitrary network identifiers (eg. for
+multipoint-to-multipoint modes).
.It Cm -vnetid
Clear the virtual network identifier.
.El
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