diff mbox

[RFC] neigh: Allow for user space users of the neighbour table

Message ID m11vtshn74.fsf@fess.ebiederm.org
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric W. Biederman Feb. 20, 2009, 8:23 p.m. UTC
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>
---
 include/linux/neighbour.h |    1 +
 net/core/neighbour.c      |    6 +++++-
 2 files changed, 6 insertions(+), 1 deletions(-)

Comments

David Miller March 4, 2009, 8:03 a.m. UTC | #1
From: ebiederm@xmission.com (Eric W. Biederman)
Date: Fri, 20 Feb 2009 12:23:43 -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>

Ok, no objections from me.

I'll apply this to net-next-2.6, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric W. Biederman March 4, 2009, 9:32 p.m. UTC | #2
David Miller <davem@davemloft.net> writes:

> Ok, no objections from me.
>
> I'll apply this to net-next-2.6, thanks.

Thanks

Eric

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h
index 8730d5d..12c9de1 100644
--- a/include/linux/neighbour.h
+++ b/include/linux/neighbour.h
@@ -31,6 +31,7 @@  enum
  *	Neighbor Cache Entry Flags
  */
 
+#define NTF_USE		0x01
 #define NTF_PROXY	0x08	/* == ATF_PUBL */
 #define NTF_ROUTER	0x80
 
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 278a142..0fc92ed 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1656,7 +1656,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;
 	}