Skip to content

Commit 0c5c2d3

Browse files
Eric Biedermandavem330
Eric Biederman
authored andcommitted
neigh: Allow for user space users of the neighbour table
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fc1f9ea commit 0c5c2d3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

include/linux/neighbour.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ enum
3131
* Neighbor Cache Entry Flags
3232
*/
3333

34+
#define NTF_USE 0x01
3435
#define NTF_PROXY 0x08 /* == ATF_PUBL */
3536
#define NTF_ROUTER 0x80
3637

net/core/neighbour.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,11 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
16541654
flags &= ~NEIGH_UPDATE_F_OVERRIDE;
16551655
}
16561656

1657-
err = neigh_update(neigh, lladdr, ndm->ndm_state, flags);
1657+
if (ndm->ndm_flags & NTF_USE) {
1658+
neigh_event_send(neigh, NULL);
1659+
err = 0;
1660+
} else
1661+
err = neigh_update(neigh, lladdr, ndm->ndm_state, flags);
16581662
neigh_release(neigh);
16591663
goto out_dev_put;
16601664
}

0 commit comments

Comments
 (0)