Commit fcb1fee4 authored by Alexey Kuznetsov's avatar Alexey Kuznetsov Committed by David S. Miller

Do not fail creating _new_ NOARP entry with EPERM.

parent 8a62319b
...@@ -1239,6 +1239,7 @@ int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) ...@@ -1239,6 +1239,7 @@ int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
read_lock(&neigh_tbl_lock); read_lock(&neigh_tbl_lock);
for (tbl=neigh_tables; tbl; tbl = tbl->next) { for (tbl=neigh_tables; tbl; tbl = tbl->next) {
int err = 0; int err = 0;
int override = 1;
struct neighbour *n; struct neighbour *n;
if (tbl->family != ndm->ndm_family) if (tbl->family != ndm->ndm_family)
...@@ -1266,6 +1267,7 @@ int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) ...@@ -1266,6 +1267,7 @@ int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
if (n) { if (n) {
if (nlh->nlmsg_flags&NLM_F_EXCL) if (nlh->nlmsg_flags&NLM_F_EXCL)
err = -EEXIST; err = -EEXIST;
override = nlh->nlmsg_flags&NLM_F_REPLACE;
} else if (!(nlh->nlmsg_flags&NLM_F_CREATE)) } else if (!(nlh->nlmsg_flags&NLM_F_CREATE))
err = -ENOENT; err = -ENOENT;
else { else {
...@@ -1278,7 +1280,7 @@ int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) ...@@ -1278,7 +1280,7 @@ int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
if (err == 0) { if (err == 0) {
err = neigh_update(n, nda[NDA_LLADDR-1] ? RTA_DATA(nda[NDA_LLADDR-1]) : NULL, err = neigh_update(n, nda[NDA_LLADDR-1] ? RTA_DATA(nda[NDA_LLADDR-1]) : NULL,
ndm->ndm_state, ndm->ndm_state,
nlh->nlmsg_flags&NLM_F_REPLACE, 0); override, 0);
} }
if (n) if (n)
neigh_release(n); neigh_release(n);
......
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