From: David Ahern <dsah...@gmail.com> When adding a new neighbor via rtnetlink, neigh_add does a lookup and if the result is NULL calls __neigh_lookup_errno to create a new entry if the NLM_F_CREATE flag is set. But, __neigh_lookup_errno calls neigh_lookup again before neigh_create; the neigh_lookup is redundant.
Replace the call to __neigh_lookup_errno with a call to __neigh_create to more efficiently achieve the same result and prepare for the next patch. Signed-off-by: David Ahern <dsah...@gmail.com> --- net/core/neighbour.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 53e30c15882d..e324467e9a71 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -1785,7 +1785,7 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, goto out; } - neigh = __neigh_lookup_errno(tbl, dst, dev); + neigh = __neigh_create(tbl, dst, dev, true); if (IS_ERR(neigh)) { err = PTR_ERR(neigh); goto out; -- 2.11.0