Skip to contentSkip to conversation

ip link: Add ipvlan support to the iproute2/ip util

PATCH Applied Mahesh Bandewar 2 participants 2 messages Nov 24, 2014 – Dec 3, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ip link: Add ipvlan support to the iproute2/ip util

Adding basic support to create virtual devices using 'ip' utility. Following is the syntax -

ip link add link <master> <virtual> type ipvlan mode [ l2 | l3 ] e.g. ip link add link eth0 ipvl0 type ipvlan mode l3

Cc Stephen Hemminger <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Maciej Żenczykowski <[email protected]>
Cc Laurent Chavey <[email protected]>
Cc Tim Hockin <[email protected]>
Cc Brandon Philips <[email protected]>
Cc Pavel Emelianov <[email protected]>
---
 include/linux/if_link.h | 14 +++++++
 ip/Makefile             |  2 +-
 ip/iplink.c             |  2 +-
 ip/iplink_ipvlan.c      | 98 +++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 114 insertions(+), 2 deletions(-)
 create mode 100644 ip/iplink_ipvlan.c
include/linux/if_link.h +14 -0
index 47320636361c..ef1e9f73fb15 100644
@@ -325,6 +325,20 @@ enum macvlan_macaddr_mode {
 	MACVLAN_MACADDR_SET,
 };
 
+/* IPVLAN section */
+enum {
+	IFLA_IPVLAN_UNSPEC,
+	IFLA_IPVLAN_MODE,
+	__IFLA_IPVLAN_MAX,
+};
+
+#define IFLA_IPVLAN_MAX (__IFLA_IPVLAN_MAX - 1)
+
+enum ipvlan_mode {
+	IPVLAN_MODE_L2 = 0, /* Process packets all the way upto L2 */
+	IPVLAN_MODE_L3 = 1, /* Process Packets all the way upto L3 */
+};
+
 #define MACVLAN_FLAG_NOPROMISC	1
 
 /* VXLAN section */
ip/Makefile +1 -1
index fdc82f7286a0..01901bc8571c 100644
@@ -6,7 +6,7 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
     iplink_macvlan.o iplink_macvtap.o ipl2tp.o link_vti.o link_vti6.o \
     iplink_vxlan.o tcp_metrics.o iplink_ipoib.o ipnetconf.o link_ip6tnl.o \
     link_iptnl.o link_gre6.o iplink_bond.o iplink_bond_slave.o iplink_hsr.o \
-    iplink_bridge.o iplink_bridge_slave.o ipfou.o
+    iplink_bridge.o iplink_bridge_slave.o ipfou.o iplink_ipvlan.o
 
 RTMONOBJ=rtmon.o
 
ip/iplink.c +1 -1
index 43b26f4cea08..2fc7fa2b47c8 100644
@@ -90,7 +90,7 @@ void iplink_usage(void)
 		fprintf(stderr, "TYPE := { vlan | veth | vcan | dummy | ifb | macvlan | macvtap |\n");
 		fprintf(stderr, "          bridge | bond | ipoib | ip6tnl | ipip | sit | vxlan |\n");
 		fprintf(stderr, "          gre | gretap | ip6gre | ip6gretap | vti | nlmon |\n");
-		fprintf(stderr, "          bond_slave }\n");
+		fprintf(stderr, "          bond_slave | ipvlan }\n");
 	}
 	exit(-1);
 }
ip/iplink_ipvlan.c new file +98 -0

98 lines not on this page · raw message

Signature · 1 line
2.1.0.rc2.206.gedb03e5
#1 lore raw
Quoted 6 lines · On Sun, 23 Nov 2014 18:06:11 -0800 Mahesh Bandewar <[email protected]> wrote:

Adding basic support to create virtual devices using 'ip' utility. Following is the syntax -

ip link add link <master> <virtual> type ipvlan mode [ l2 | l3 ] e.g. ip link add link eth0 ipvl0 type ipvlan mode l3

Quoted 8 lines
Cc Stephen Hemminger <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Maciej Żenczykowski <[email protected]>
Cc Laurent Chavey <[email protected]>
Cc Tim Hockin <[email protected]>
Cc Brandon Philips <[email protected]>
Cc Pavel Emelianov <[email protected]>

Applied to net-next branch.