ipneigh: support for NTF_EXT_LEARNED flag on neigh entries

Adds new option extern_learn to set NTF_EXT_LEARNED flag
on neigh entries.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
Roopa Prabhu 2018-10-11 13:45:10 -07:00 committed by David Ahern
parent f8805f567e
commit 4c45b684f9
2 changed files with 14 additions and 2 deletions

View File

@ -48,7 +48,7 @@ static void usage(void)
{
fprintf(stderr, "Usage: ip neigh { add | del | change | replace }\n"
" { ADDR [ lladdr LLADDR ] [ nud STATE ] | proxy ADDR } [ dev DEV ]\n");
fprintf(stderr, " [ router ]\n\n");
fprintf(stderr, " [ router ] [ extern_learn ]\n\n");
fprintf(stderr, " ip neigh { show | flush } [ proxy ] [ to PREFIX ] [ dev DEV ] [ nud STATE ]\n");
fprintf(stderr, " [ vrf NAME ]\n\n");
fprintf(stderr, "STATE := { permanent | noarp | stale | reachable | none |\n"
@ -142,6 +142,8 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv)
req.ndm.ndm_flags |= NTF_PROXY;
} else if (strcmp(*argv, "router") == 0) {
req.ndm.ndm_flags |= NTF_ROUTER;
} else if (matches(*argv, "extern_learn") == 0) {
req.ndm.ndm_flags |= NTF_EXT_LEARNED;
} else if (strcmp(*argv, "dev") == 0) {
NEXT_ARG();
dev = *argv;
@ -354,6 +356,9 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
if (r->ndm_flags & NTF_PROXY)
print_null(PRINT_ANY, "proxy", " %s", "proxy");
if (r->ndm_flags & NTF_EXT_LEARNED)
print_null(PRINT_ANY, "extern_learn", " %s ", "extern_learn");
if (show_stats) {
if (tb[NDA_CACHEINFO])
print_cacheinfo(RTA_DATA(tb[NDA_CACHEINFO]));

View File

@ -24,7 +24,8 @@ ip-neighbour \- neighbour/arp tables management.
.IR ADDR " } [ "
.B dev
.IR DEV " ] [ "
.BR router " ] "
.BR router " ] [ "
.BR extern_learn " ]"
.ti -8
.BR "ip neigh" " { " show " | " flush " } [ " proxy " ] [ " to
@ -84,6 +85,12 @@ indicates whether we are proxying for this neigbour entry
.BI router
indicates whether neigbour is a router
.TP
.BI extern_learn
this neigh entry was learned externally. This option can be used to
indicate to the kernel that this is a controller learnt dynamic entry.
Kernel will not gc such an entry.
.TP
.BI lladdr " LLADDRESS"
the link layer address of the neighbour.