-.\" $OpenBSD: ifconfig.8,v 1.301 2018/02/19 06:48:45 jmc Exp $
+.\" $OpenBSD: ifconfig.8,v 1.302 2018/02/20 03:45:06 dlg 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 $
.\"
.\"
.\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94
.\"
-.Dd $Mdocdate: February 19 2018 $
+.Dd $Mdocdate: February 20 2018 $
.Dt IFCONFIG 8
.Os
.Sh NAME
.Op Cm tunneldomain Ar tableid
.Op Oo Fl Oc Ns Cm tunneldf
.Op Cm tunnelttl Ar ttl
+.Op Oo Fl Oc Ns Cm vnetflowid
.Op Oo Fl Oc Ns Cm vnetid Ar network-id
.Ek
.nr nS 0
.Ar copy
to have the TTL copied between the encapsulated protocol headers
and the tunnel protocol headers.
+.It Cm vnetflowid
+Use a portion of the virtual network identifier space for a flow identifier.
+This allows load balancing of the encapsulated traffic over multiple
+links.
+.It Cm -vnetflowid
+Disable the use of portion of the virtual network identifier as a
+flow identifier.
.It Cm vnetid Ar network-id
Set the virtual network identifier.
This is a number which is used by tunnel protocols such as
-/* $OpenBSD: ifconfig.c,v 1.358 2018/02/19 00:23:57 dlg Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.359 2018/02/20 03:45:06 dlg Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
"\5VLAN_MTU\6VLAN_HWTAGGING\10CSUM_TCPv6" \
"\11CSUM_UDPv6\20WOL"
+struct ifencap {
+ unsigned int ife_flags;
+#define IFE_VNETID_MASK 0xf
+#define IFE_VNETID_NOPE 0x0
+#define IFE_VNETID_NONE 0x1
+#define IFE_VNETID_ANY 0x2
+#define IFE_VNETID_SET 0x3
+ int64_t ife_vnetid;
+#define IFE_VNETFLOWID 0x10
+
+#define IFE_PARENT_MASK 0xf00
+#define IFE_PARENT_NOPE 0x000
+#define IFE_PARENT_NONE 0x100
+#define IFE_PARENT_SET 0x200
+ char ife_parent[IFNAMSIZ];
+};
+
struct ifreq ifr, ridreq;
struct in_aliasreq in_addreq;
struct in6_ifreq ifr6;
void unsetpfsync_syncpeer(const char *, int);
void setpfsync_defer(const char *, int);
void pfsync_status(void);
+void setvnetflowid(const char *, int);
+void delvnetflowid(const char *, int);
+void getvnetflowid(struct ifencap *);
void settunneldf(const char *, int);
void settunnelnodf(const char *, int);
void setpppoe_dev(const char *,int);
{ "tunnelttl", NEXTARG, 0, settunnelttl },
{ "tunneldf", 0, 0, settunneldf },
{ "-tunneldf", 0, 0, settunnelnodf },
+ { "vnetflowid", 0, 0, setvnetflowid },
+ { "-vnetflowid", 0, 0, delvnetflowid },
{ "pppoedev", NEXTARG, 0, setpppoe_dev },
{ "pppoesvc", NEXTARG, 0, setpppoe_svc },
{ "-pppoesvc", 1, 0, setpppoe_svc },
warn("SIOCSLIFPHYDF");
}
+void
+setvnetflowid(const char *ignored, int alsoignored)
+{
+ if (strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)) >=
+ sizeof(ifr.ifr_name))
+ errx(1, "vnetflowid: name is too long");
+
+ ifr.ifr_vnetid = 1;
+ if (ioctl(s, SIOCSVNETFLOWID, &ifr) < 0)
+ warn("SIOCSVNETFLOWID");
+}
+
+void
+delvnetflowid(const char *ignored, int alsoignored)
+{
+ if (strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)) >=
+ sizeof(ifr.ifr_name))
+ errx(1, "vnetflowid: name is too long");
+
+ ifr.ifr_vnetid = 0;
+ if (ioctl(s, SIOCSVNETFLOWID, &ifr) < 0)
+ warn("SIOCSVNETFLOWID");
+}
+
+void
+getvnetflowid(struct ifencap *ife)
+{
+ if (strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)) >=
+ sizeof(ifr.ifr_name))
+ errx(1, "vnetflowid: name is too long");
+
+ if (ioctl(s, SIOCGVNETFLOWID, &ifr) == -1)
+ return;
+
+ if (ifr.ifr_vnetid)
+ ife->ife_flags |= IFE_VNETFLOWID;
+}
+
void
mpe_status(void)
{
}
#endif /* SMALL */
-struct ifencap {
- unsigned int ife_flags;
-#define IFE_VNETID_MASK 0xf
-#define IFE_VNETID_NOPE 0x0
-#define IFE_VNETID_NONE 0x1
-#define IFE_VNETID_ANY 0x2
-#define IFE_VNETID_SET 0x3
- int64_t ife_vnetid;
-
-#define IFE_PARENT_MASK 0xf0
-#define IFE_PARENT_NOPE 0x00
-#define IFE_PARENT_NONE 0x10
-#define IFE_PARENT_SET 0x20
- char ife_parent[IFNAMSIZ];
-};
-
void
setvnetid(const char *id, int param)
{
struct ifencap ife = { .ife_flags = 0 };
getvnetid(&ife);
+ getvnetflowid(&ife);
getifparent(&ife);
if (ife.ife_flags == 0)
break;
case IFE_VNETID_SET:
printf(" vnetid %lld", ife.ife_vnetid);
+ if (ife.ife_flags & IFE_VNETFLOWID)
+ printf("+");
break;
}