Commit 01757f53 authored by Yajun Deng's avatar Yajun Deng Committed by David S. Miller

net: Use nlmsg_unicast() instead of netlink_unicast()

It has 'if (err >0 )' statement in nlmsg_unicast(), so use nlmsg_unicast()
instead of netlink_unicast(), this looks more concise.

v2: remove the change in netfilter.
Signed-off-by: default avatarYajun Deng <yajun.deng@linux.dev>
Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 71ce9d92
...@@ -1376,7 +1376,7 @@ static void nl_fib_input(struct sk_buff *skb) ...@@ -1376,7 +1376,7 @@ static void nl_fib_input(struct sk_buff *skb)
portid = NETLINK_CB(skb).portid; /* netlink portid */ portid = NETLINK_CB(skb).portid; /* netlink portid */
NETLINK_CB(skb).portid = 0; /* from kernel */ NETLINK_CB(skb).portid = 0; /* from kernel */
NETLINK_CB(skb).dst_group = 0; /* unicast */ NETLINK_CB(skb).dst_group = 0; /* unicast */
netlink_unicast(net->ipv4.fibnl, skb, portid, MSG_DONTWAIT); nlmsg_unicast(net->ipv4.fibnl, skb, portid);
} }
static int __net_init nl_fib_lookup_init(struct net *net) static int __net_init nl_fib_lookup_init(struct net *net)
......
...@@ -580,10 +580,7 @@ int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, ...@@ -580,10 +580,7 @@ int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
nlmsg_free(rep); nlmsg_free(rep);
goto out; goto out;
} }
err = netlink_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid, err = nlmsg_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid);
MSG_DONTWAIT);
if (err > 0)
err = 0;
out: out:
if (sk) if (sk)
......
...@@ -119,11 +119,8 @@ static int raw_diag_dump_one(struct netlink_callback *cb, ...@@ -119,11 +119,8 @@ static int raw_diag_dump_one(struct netlink_callback *cb,
return err; return err;
} }
err = netlink_unicast(net->diag_nlsk, rep, err = nlmsg_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid);
NETLINK_CB(in_skb).portid,
MSG_DONTWAIT);
if (err > 0)
err = 0;
return err; return err;
} }
......
...@@ -77,10 +77,8 @@ static int udp_dump_one(struct udp_table *tbl, ...@@ -77,10 +77,8 @@ static int udp_dump_one(struct udp_table *tbl,
kfree_skb(rep); kfree_skb(rep);
goto out; goto out;
} }
err = netlink_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid, err = nlmsg_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid);
MSG_DONTWAIT);
if (err > 0)
err = 0;
out: out:
if (sk) if (sk)
sock_put(sk); sock_put(sk);
......
...@@ -57,10 +57,8 @@ static int mptcp_diag_dump_one(struct netlink_callback *cb, ...@@ -57,10 +57,8 @@ static int mptcp_diag_dump_one(struct netlink_callback *cb,
kfree_skb(rep); kfree_skb(rep);
goto out; goto out;
} }
err = netlink_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid, err = nlmsg_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid);
MSG_DONTWAIT);
if (err > 0)
err = 0;
out: out:
sock_put(sk); sock_put(sk);
......
...@@ -2471,7 +2471,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err, ...@@ -2471,7 +2471,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err,
nlmsg_end(skb, rep); nlmsg_end(skb, rep);
netlink_unicast(in_skb->sk, skb, NETLINK_CB(in_skb).portid, MSG_DONTWAIT); nlmsg_unicast(in_skb->sk, skb, NETLINK_CB(in_skb).portid);
} }
EXPORT_SYMBOL(netlink_ack); EXPORT_SYMBOL(netlink_ack);
......
...@@ -284,10 +284,8 @@ static int sctp_tsp_dump_one(struct sctp_transport *tsp, void *p) ...@@ -284,10 +284,8 @@ static int sctp_tsp_dump_one(struct sctp_transport *tsp, void *p)
goto out; goto out;
} }
err = netlink_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid, err = nlmsg_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid);
MSG_DONTWAIT);
if (err > 0)
err = 0;
out: out:
return err; return err;
} }
......
...@@ -295,10 +295,8 @@ static int unix_diag_get_exact(struct sk_buff *in_skb, ...@@ -295,10 +295,8 @@ static int unix_diag_get_exact(struct sk_buff *in_skb,
goto again; goto again;
} }
err = netlink_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid, err = nlmsg_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid);
MSG_DONTWAIT);
if (err > 0)
err = 0;
out: out:
if (sk) if (sk)
sock_put(sk); sock_put(sk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment