Modify neighbour proxy show
New "ip neigh show proxy" command now can show proxies which were added with "ip neigh add proxy" command. Kernel code to support this feature sent a bit earlier to netdev. Signed-off-by: Tony Zelenoff <antonz@parallels.com>
This commit is contained in:
parent
0e56c6b69b
commit
1dac7817b4
13
ip/ipneigh.c
13
ip/ipneigh.c
|
|
@ -209,6 +209,7 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
||||||
if (filter.index && filter.index != r->ndm_ifindex)
|
if (filter.index && filter.index != r->ndm_ifindex)
|
||||||
return 0;
|
return 0;
|
||||||
if (!(filter.state&r->ndm_state) &&
|
if (!(filter.state&r->ndm_state) &&
|
||||||
|
!(r->ndm_flags & NTF_PROXY) &&
|
||||||
(r->ndm_state || !(filter.state&0x100)) &&
|
(r->ndm_state || !(filter.state&0x100)) &&
|
||||||
(r->ndm_family != AF_DECnet))
|
(r->ndm_family != AF_DECnet))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -267,6 +268,9 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
||||||
if (r->ndm_flags & NTF_ROUTER) {
|
if (r->ndm_flags & NTF_ROUTER) {
|
||||||
fprintf(fp, " router");
|
fprintf(fp, " router");
|
||||||
}
|
}
|
||||||
|
if (r->ndm_flags & NTF_PROXY) {
|
||||||
|
fprintf(fp, " proxy");
|
||||||
|
}
|
||||||
if (tb[NDA_CACHEINFO] && show_stats) {
|
if (tb[NDA_CACHEINFO] && show_stats) {
|
||||||
struct nda_cacheinfo *ci = RTA_DATA(tb[NDA_CACHEINFO]);
|
struct nda_cacheinfo *ci = RTA_DATA(tb[NDA_CACHEINFO]);
|
||||||
int hz = get_user_hz();
|
int hz = get_user_hz();
|
||||||
|
|
@ -314,6 +318,7 @@ int do_show_or_flush(int argc, char **argv, int flush)
|
||||||
{
|
{
|
||||||
char *filter_dev = NULL;
|
char *filter_dev = NULL;
|
||||||
int state_given = 0;
|
int state_given = 0;
|
||||||
|
struct ndmsg ndm = { 0 };
|
||||||
|
|
||||||
ipneigh_reset_filter();
|
ipneigh_reset_filter();
|
||||||
|
|
||||||
|
|
@ -354,7 +359,9 @@ int do_show_or_flush(int argc, char **argv, int flush)
|
||||||
if (state == 0)
|
if (state == 0)
|
||||||
state = 0x100;
|
state = 0x100;
|
||||||
filter.state |= state;
|
filter.state |= state;
|
||||||
} else {
|
} else if (strcmp(*argv, "proxy") == 0)
|
||||||
|
ndm.ndm_flags = NTF_PROXY;
|
||||||
|
else {
|
||||||
if (strcmp(*argv, "to") == 0) {
|
if (strcmp(*argv, "to") == 0) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
}
|
}
|
||||||
|
|
@ -418,7 +425,9 @@ int do_show_or_flush(int argc, char **argv, int flush)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rtnl_wilddump_request(&rth, filter.family, RTM_GETNEIGH) < 0) {
|
ndm.ndm_family = filter.family;
|
||||||
|
|
||||||
|
if (rtnl_dump_request(&rth, RTM_GETNEIGH, &ndm, sizeof(struct ndmsg)) < 0) {
|
||||||
perror("Cannot send dump request");
|
perror("Cannot send dump request");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue