Skip to content

Commit 193125d

Browse files
David Aherndavem330
David Ahern
authored andcommitted
net: Introduce VRF device driver
This driver borrows heavily from IPvlan and teaming drivers. Routing domains (VRF-lite) are created by instantiating a VRF master device with an associated table and enslaving all routed interfaces that participate in the domain. As part of the enslavement, all connected routes for the enslaved devices are moved to the table associated with the VRF device. Outgoing sockets must bind to the VRF device to function. Standard FIB rules bind the VRF device to tables and regular fib rule processing is followed. Routed traffic through the box, is forwarded by using the VRF device as the IIF and following the IIF rule to a table that is mated with the VRF. Example: Create vrf 1: ip link add vrf1 type vrf table 5 ip rule add iif vrf1 table 5 ip rule add oif vrf1 table 5 ip route add table 5 prohibit default ip link set vrf1 up Add interface to vrf 1: ip link set eth1 master vrf1 Signed-off-by: Shrijeet Mukherjee <[email protected]> Signed-off-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9972f13 commit 193125d

File tree

3 files changed

+693
-0
lines changed

3 files changed

+693
-0
lines changed

drivers/net/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,13 @@ config NLMON
297297
diagnostics, etc. This is mostly intended for developers or support
298298
to debug netlink issues. If unsure, say N.
299299

300+
config NET_VRF
301+
tristate "Virtual Routing and Forwarding (Lite)"
302+
depends on IP_MULTIPLE_TABLES && IPV6_MULTIPLE_TABLES
303+
---help---
304+
This option enables the support for mapping interfaces into VRF's. The
305+
support enables VRF devices.
306+
300307
endif # NET_CORE
301308

302309
config SUNGEM_PHY

drivers/net/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ obj-$(CONFIG_VIRTIO_NET) += virtio_net.o
2525
obj-$(CONFIG_VXLAN) += vxlan.o
2626
obj-$(CONFIG_GENEVE) += geneve.o
2727
obj-$(CONFIG_NLMON) += nlmon.o
28+
obj-$(CONFIG_NET_VRF) += vrf.o
2829

2930
#
3031
# Networking Drivers

0 commit comments

Comments
 (0)