aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/rtnetlink.c
diff options
context:
space:
mode:
authorHubert Sokolowski <hubert.sokolowski@intel.com>2015-04-09 08:16:17 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-09 17:30:58 -0400
commit1e53d5bb8878dcbdbffde334ab89b1f57778b48c (patch)
treeab028253535344103115cdfa1a548c0e70e4c146 /net/core/rtnetlink.c
parentca69d7102fde3e22b09536867ba14ace84ea80e1 (diff)
net: Pass VLAN ID to rtnl_fdb_notify.
When an FDB entry is added or deleted the information about VLAN is not passed to listening applications like 'bridge monitor fdb'. With this patch VLAN ID is passed if it was set in the original netlink message. Also remove an unused bdev variable. Signed-off-by: Hubert Sokolowski <hubert.sokolowski@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r--net/core/rtnetlink.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 5e02260b087f..c3bf19000d3a 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2404,7 +2404,7 @@ EXPORT_SYMBOL(rtmsg_ifinfo);
2404 2404
2405static int nlmsg_populate_fdb_fill(struct sk_buff *skb, 2405static int nlmsg_populate_fdb_fill(struct sk_buff *skb,
2406 struct net_device *dev, 2406 struct net_device *dev,
2407 u8 *addr, u32 pid, u32 seq, 2407 u8 *addr, u16 vid, u32 pid, u32 seq,
2408 int type, unsigned int flags, 2408 int type, unsigned int flags,
2409 int nlflags) 2409 int nlflags)
2410{ 2410{
@@ -2426,6 +2426,9 @@ static int nlmsg_populate_fdb_fill(struct sk_buff *skb,
2426 2426
2427 if (nla_put(skb, NDA_LLADDR, ETH_ALEN, addr)) 2427 if (nla_put(skb, NDA_LLADDR, ETH_ALEN, addr))
2428 goto nla_put_failure; 2428 goto nla_put_failure;
2429 if (vid)
2430 if (nla_put(skb, NDA_VLAN, sizeof(u16), &vid))
2431 goto nla_put_failure;
2429 2432
2430 nlmsg_end(skb, nlh); 2433 nlmsg_end(skb, nlh);
2431 return 0; 2434 return 0;
@@ -2440,7 +2443,7 @@ static inline size_t rtnl_fdb_nlmsg_size(void)
2440 return NLMSG_ALIGN(sizeof(struct ndmsg)) + nla_total_size(ETH_ALEN); 2443 return NLMSG_ALIGN(sizeof(struct ndmsg)) + nla_total_size(ETH_ALEN);
2441} 2444}
2442 2445
2443static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, int type) 2446static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, u16 vid, int type)
2444{ 2447{
2445 struct net *net = dev_net(dev); 2448 struct net *net = dev_net(dev);
2446 struct sk_buff *skb; 2449 struct sk_buff *skb;
@@ -2450,7 +2453,8 @@ static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, int type)
2450 if (!skb) 2453 if (!skb)
2451 goto errout; 2454 goto errout;
2452 2455
2453 err = nlmsg_populate_fdb_fill(skb, dev, addr, 0, 0, type, NTF_SELF, 0); 2456 err = nlmsg_populate_fdb_fill(skb, dev, addr, vid,
2457 0, 0, type, NTF_SELF, 0);
2454 if (err < 0) { 2458 if (err < 0) {
2455 kfree_skb(skb); 2459 kfree_skb(skb);
2456 goto errout; 2460 goto errout;
@@ -2585,7 +2589,7 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh)
2585 nlh->nlmsg_flags); 2589 nlh->nlmsg_flags);
2586 2590
2587 if (!err) { 2591 if (!err) {
2588 rtnl_fdb_notify(dev, addr, RTM_NEWNEIGH); 2592 rtnl_fdb_notify(dev, addr, vid, RTM_NEWNEIGH);
2589 ndm->ndm_flags &= ~NTF_SELF; 2593 ndm->ndm_flags &= ~NTF_SELF;
2590 } 2594 }
2591 } 2595 }
@@ -2686,7 +2690,7 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh)
2686 err = ndo_dflt_fdb_del(ndm, tb, dev, addr, vid); 2690 err = ndo_dflt_fdb_del(ndm, tb, dev, addr, vid);
2687 2691
2688 if (!err) { 2692 if (!err) {
2689 rtnl_fdb_notify(dev, addr, RTM_DELNEIGH); 2693 rtnl_fdb_notify(dev, addr, vid, RTM_DELNEIGH);
2690 ndm->ndm_flags &= ~NTF_SELF; 2694 ndm->ndm_flags &= ~NTF_SELF;
2691 } 2695 }
2692 } 2696 }
@@ -2711,7 +2715,7 @@ static int nlmsg_populate_fdb(struct sk_buff *skb,
2711 if (*idx < cb->args[0]) 2715 if (*idx < cb->args[0])
2712 goto skip; 2716 goto skip;
2713 2717
2714 err = nlmsg_populate_fdb_fill(skb, dev, ha->addr, 2718 err = nlmsg_populate_fdb_fill(skb, dev, ha->addr, 0,
2715 portid, seq, 2719 portid, seq,
2716 RTM_NEWNEIGH, NTF_SELF, 2720 RTM_NEWNEIGH, NTF_SELF,
2717 NLM_F_MULTI); 2721 NLM_F_MULTI);
@@ -2754,7 +2758,6 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
2754{ 2758{
2755 struct net_device *dev; 2759 struct net_device *dev;
2756 struct nlattr *tb[IFLA_MAX+1]; 2760 struct nlattr *tb[IFLA_MAX+1];
2757 struct net_device *bdev = NULL;
2758 struct net_device *br_dev = NULL; 2761 struct net_device *br_dev = NULL;
2759 const struct net_device_ops *ops = NULL; 2762 const struct net_device_ops *ops = NULL;
2760 const struct net_device_ops *cops = NULL; 2763 const struct net_device_ops *cops = NULL;
@@ -2778,7 +2781,6 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
2778 return -ENODEV; 2781 return -ENODEV;
2779 2782
2780 ops = br_dev->netdev_ops; 2783 ops = br_dev->netdev_ops;
2781 bdev = br_dev;
2782 } 2784 }
2783 2785
2784 for_each_netdev(net, dev) { 2786 for_each_netdev(net, dev) {
@@ -2791,7 +2793,6 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
2791 cops = br_dev->netdev_ops; 2793 cops = br_dev->netdev_ops;
2792 } 2794 }
2793 2795
2794 bdev = dev;
2795 } else { 2796 } else {
2796 if (dev != br_dev && 2797 if (dev != br_dev &&
2797 !(dev->priv_flags & IFF_BRIDGE_PORT)) 2798 !(dev->priv_flags & IFF_BRIDGE_PORT))
@@ -2801,7 +2802,6 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
2801 !(dev->priv_flags & IFF_EBRIDGE)) 2802 !(dev->priv_flags & IFF_EBRIDGE))
2802 continue; 2803 continue;
2803 2804
2804 bdev = br_dev;
2805 cops = ops; 2805 cops = ops;
2806 } 2806 }
2807 2807