aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ipvlan/ipvlan_main.c
diff options
context:
space:
mode:
authorMahesh Bandewar <maheshb@google.com>2017-10-26 18:09:25 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-29 05:39:57 -0400
commitfe89aa6b250c1011ccf425fbb7998e96bd54263f (patch)
tree35d21de9cf2d9e240a999597379d040aa9d1397f /drivers/net/ipvlan/ipvlan_main.c
parenta190d04db93710ae166749055b6985397c6d13f5 (diff)
ipvlan: implement VEPA mode
This is very similar to the Macvlan VEPA mode, however, there is some difference. IPvlan uses the mac-address of the lower device, so the VEPA mode has implications of ICMP-redirects for packets destined for its immediate neighbors sharing same master since the packets will have same source and dest mac. The external switch/router will send redirect msg. Having said that, this will be useful tool in terms of debugging since IPvlan will not switch packets within its slaves and rely completely on the external entity as intended in 802.1Qbg. Signed-off-by: Mahesh Bandewar <maheshb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ipvlan/ipvlan_main.c')
-rw-r--r--drivers/net/ipvlan/ipvlan_main.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 4368afb1934c..a266aa435d4d 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -478,6 +478,11 @@ static int ipvlan_nl_changelink(struct net_device *dev,
478 ipvlan_mark_private(port); 478 ipvlan_mark_private(port);
479 else 479 else
480 ipvlan_clear_private(port); 480 ipvlan_clear_private(port);
481
482 if (flags & IPVLAN_F_VEPA)
483 ipvlan_mark_vepa(port);
484 else
485 ipvlan_clear_vepa(port);
481 } 486 }
482 487
483 return err; 488 return err;
@@ -506,8 +511,12 @@ static int ipvlan_nl_validate(struct nlattr *tb[], struct nlattr *data[],
506 if (data[IFLA_IPVLAN_FLAGS]) { 511 if (data[IFLA_IPVLAN_FLAGS]) {
507 u16 flags = nla_get_u16(data[IFLA_IPVLAN_FLAGS]); 512 u16 flags = nla_get_u16(data[IFLA_IPVLAN_FLAGS]);
508 513
509 /* Only one bit is used at this moment. */ 514 /* Only two bits are used at this moment. */
510 if (flags & ~IPVLAN_F_PRIVATE) 515 if (flags & ~(IPVLAN_F_PRIVATE | IPVLAN_F_VEPA))
516 return -EINVAL;
517 /* Also both flags can't be active at the same time. */
518 if ((flags & (IPVLAN_F_PRIVATE | IPVLAN_F_VEPA)) ==
519 (IPVLAN_F_PRIVATE | IPVLAN_F_VEPA))
511 return -EINVAL; 520 return -EINVAL;
512 } 521 }
513 522