aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/rtnetlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r--net/core/rtnetlink.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 34ba7a08876d..d735e854f916 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1027,6 +1027,7 @@ static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
1027{ 1027{
1028 int err; 1028 int err;
1029 struct switchdev_attr attr = { 1029 struct switchdev_attr attr = {
1030 .orig_dev = dev,
1030 .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID, 1031 .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
1031 .flags = SWITCHDEV_F_NO_RECURSE, 1032 .flags = SWITCHDEV_F_NO_RECURSE,
1032 }; 1033 };
@@ -2563,7 +2564,7 @@ static int nlmsg_populate_fdb_fill(struct sk_buff *skb,
2563 struct net_device *dev, 2564 struct net_device *dev,
2564 u8 *addr, u16 vid, u32 pid, u32 seq, 2565 u8 *addr, u16 vid, u32 pid, u32 seq,
2565 int type, unsigned int flags, 2566 int type, unsigned int flags,
2566 int nlflags) 2567 int nlflags, u16 ndm_state)
2567{ 2568{
2568 struct nlmsghdr *nlh; 2569 struct nlmsghdr *nlh;
2569 struct ndmsg *ndm; 2570 struct ndmsg *ndm;
@@ -2579,7 +2580,7 @@ static int nlmsg_populate_fdb_fill(struct sk_buff *skb,
2579 ndm->ndm_flags = flags; 2580 ndm->ndm_flags = flags;
2580 ndm->ndm_type = 0; 2581 ndm->ndm_type = 0;
2581 ndm->ndm_ifindex = dev->ifindex; 2582 ndm->ndm_ifindex = dev->ifindex;
2582 ndm->ndm_state = NUD_PERMANENT; 2583 ndm->ndm_state = ndm_state;
2583 2584
2584 if (nla_put(skb, NDA_LLADDR, ETH_ALEN, addr)) 2585 if (nla_put(skb, NDA_LLADDR, ETH_ALEN, addr))
2585 goto nla_put_failure; 2586 goto nla_put_failure;
@@ -2600,7 +2601,8 @@ static inline size_t rtnl_fdb_nlmsg_size(void)
2600 return NLMSG_ALIGN(sizeof(struct ndmsg)) + nla_total_size(ETH_ALEN); 2601 return NLMSG_ALIGN(sizeof(struct ndmsg)) + nla_total_size(ETH_ALEN);
2601} 2602}
2602 2603
2603static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, u16 vid, int type) 2604static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, u16 vid, int type,
2605 u16 ndm_state)
2604{ 2606{
2605 struct net *net = dev_net(dev); 2607 struct net *net = dev_net(dev);
2606 struct sk_buff *skb; 2608 struct sk_buff *skb;
@@ -2611,7 +2613,7 @@ static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, u16 vid, int type)
2611 goto errout; 2613 goto errout;
2612 2614
2613 err = nlmsg_populate_fdb_fill(skb, dev, addr, vid, 2615 err = nlmsg_populate_fdb_fill(skb, dev, addr, vid,
2614 0, 0, type, NTF_SELF, 0); 2616 0, 0, type, NTF_SELF, 0, ndm_state);
2615 if (err < 0) { 2617 if (err < 0) {
2616 kfree_skb(skb); 2618 kfree_skb(skb);
2617 goto errout; 2619 goto errout;
@@ -2746,7 +2748,8 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh)
2746 nlh->nlmsg_flags); 2748 nlh->nlmsg_flags);
2747 2749
2748 if (!err) { 2750 if (!err) {
2749 rtnl_fdb_notify(dev, addr, vid, RTM_NEWNEIGH); 2751 rtnl_fdb_notify(dev, addr, vid, RTM_NEWNEIGH,
2752 ndm->ndm_state);
2750 ndm->ndm_flags &= ~NTF_SELF; 2753 ndm->ndm_flags &= ~NTF_SELF;
2751 } 2754 }
2752 } 2755 }
@@ -2847,7 +2850,8 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh)
2847 err = ndo_dflt_fdb_del(ndm, tb, dev, addr, vid); 2850 err = ndo_dflt_fdb_del(ndm, tb, dev, addr, vid);
2848 2851
2849 if (!err) { 2852 if (!err) {
2850 rtnl_fdb_notify(dev, addr, vid, RTM_DELNEIGH); 2853 rtnl_fdb_notify(dev, addr, vid, RTM_DELNEIGH,
2854 ndm->ndm_state);
2851 ndm->ndm_flags &= ~NTF_SELF; 2855 ndm->ndm_flags &= ~NTF_SELF;
2852 } 2856 }
2853 } 2857 }
@@ -2875,7 +2879,7 @@ static int nlmsg_populate_fdb(struct sk_buff *skb,
2875 err = nlmsg_populate_fdb_fill(skb, dev, ha->addr, 0, 2879 err = nlmsg_populate_fdb_fill(skb, dev, ha->addr, 0,
2876 portid, seq, 2880 portid, seq,
2877 RTM_NEWNEIGH, NTF_SELF, 2881 RTM_NEWNEIGH, NTF_SELF,
2878 NLM_F_MULTI); 2882 NLM_F_MULTI, NUD_PERMANENT);
2879 if (err < 0) 2883 if (err < 0)
2880 return err; 2884 return err;
2881skip: 2885skip:
@@ -3347,7 +3351,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
3347{ 3351{
3348 struct net *net = sock_net(skb->sk); 3352 struct net *net = sock_net(skb->sk);
3349 rtnl_doit_func doit; 3353 rtnl_doit_func doit;
3350 int sz_idx, kind; 3354 int kind;
3351 int family; 3355 int family;
3352 int type; 3356 int type;
3353 int err; 3357 int err;
@@ -3363,7 +3367,6 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
3363 return 0; 3367 return 0;
3364 3368
3365 family = ((struct rtgenmsg *)nlmsg_data(nlh))->rtgen_family; 3369 family = ((struct rtgenmsg *)nlmsg_data(nlh))->rtgen_family;
3366 sz_idx = type>>2;
3367 kind = type&3; 3370 kind = type&3;
3368 3371
3369 if (kind != 2 && !netlink_net_capable(skb, CAP_NET_ADMIN)) 3372 if (kind != 2 && !netlink_net_capable(skb, CAP_NET_ADMIN))