Skip to content

Commit cfdf0d9

Browse files
Yajun Dengdavem330
authored andcommitted
rtnetlink: use nlmsg_notify() in rtnetlink_send()
The netlink_{broadcast, unicast} don't deal with 'if (err > 0' statement but nlmsg_{multicast, unicast} do. The nlmsg_notify() contains them. so use nlmsg_notify() instead. so that the caller wouldn't deal with 'if (err > 0' statement. v2: use nlmsg_notify() will do well. Signed-off-by: Yajun Deng <yajun.deng@linux.dev> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 63a9192 commit cfdf0d9

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

net/core/rtnetlink.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -710,15 +710,8 @@ static int rtnl_link_fill(struct sk_buff *skb, const struct net_device *dev)
710710
int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group, int echo)
711711
{
712712
struct sock *rtnl = net->rtnl;
713-
int err = 0;
714713

715-
NETLINK_CB(skb).dst_group = group;
716-
if (echo)
717-
refcount_inc(&skb->users);
718-
netlink_broadcast(rtnl, skb, pid, group, GFP_KERNEL);
719-
if (echo)
720-
err = netlink_unicast(rtnl, skb, pid, MSG_DONTWAIT);
721-
return err;
714+
return nlmsg_notify(rtnl, skb, pid, group, echo, GFP_KERNEL);
722715
}
723716

724717
int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid)

0 commit comments

Comments
 (0)