Skip to content

Commit

Permalink
rtnetlink: use nlmsg_notify() in rtnetlink_send()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Yajun Deng authored and davem330 committed Jul 16, 2021
1 parent 63a9192 commit cfdf0d9
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,15 +710,8 @@ static int rtnl_link_fill(struct sk_buff *skb, const struct net_device *dev)
int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group, int echo)
{
struct sock *rtnl = net->rtnl;
int err = 0;

NETLINK_CB(skb).dst_group = group;
if (echo)
refcount_inc(&skb->users);
netlink_broadcast(rtnl, skb, pid, group, GFP_KERNEL);
if (echo)
err = netlink_unicast(rtnl, skb, pid, MSG_DONTWAIT);
return err;
return nlmsg_notify(rtnl, skb, pid, group, echo, GFP_KERNEL);
}

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

0 comments on commit cfdf0d9

Please sign in to comment.