]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
neigh: Allow for user space users of the neighbour table
authorEric Biederman <ebiederm@aristanetworks.com>
Wed, 4 Mar 2009 08:03:08 +0000 (00:03 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Mar 2009 08:03:08 +0000 (00:03 -0800)
Currently it is possible to do just about everything with the arp table
from user space except treat an entry like you are using it.  To that end
implement and a flag NTF_USE that when set in a netwlink update request
treats the neighbour table entry like the kernel does on the output path.

This allows user space applications to share the kernel's arp cache.

Signed-off-by: Eric Biederman <ebiederm@aristanetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/neighbour.h
net/core/neighbour.c

index 8730d5dae1bc2a3c5b8a33aab453cb8382a19dcf..12c9de1384517e7097a74e5df7da825472bf1f64 100644 (file)
@@ -31,6 +31,7 @@ enum
  *     Neighbor Cache Entry Flags
  */
 
+#define NTF_USE                0x01
 #define NTF_PROXY      0x08    /* == ATF_PUBL */
 #define NTF_ROUTER     0x80
 
index 417b6d739fb7b440119af9ae267f50d5a891fc78..a1cbce7fdae5851f6534f433eb0aa3be3a06e1e6 100644 (file)
@@ -1654,7 +1654,11 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
                                flags &= ~NEIGH_UPDATE_F_OVERRIDE;
                }
 
-               err = neigh_update(neigh, lladdr, ndm->ndm_state, flags);
+               if (ndm->ndm_flags & NTF_USE) {
+                       neigh_event_send(neigh, NULL);
+                       err = 0;
+               } else
+                       err = neigh_update(neigh, lladdr, ndm->ndm_state, flags);
                neigh_release(neigh);
                goto out_dev_put;
        }