OpenVZ Forum


Home » Mailing lists » Devel » [PATCH iproute2 0/2] Modify iproute2 to display neighbour proxies
[PATCH iproute2 0/2] Modify iproute2 to display neighbour proxies [message #45074] Thu, 26 January 2012 14:50 Go to next message
Tony Zelenoff is currently offline  Tony Zelenoff
Messages: 6
Registered: January 2012
Junior Member
This modification use new kernel functionality to display
neighbour proxies.

Old kernel versions will work nice in case the 'family' member
has the same place and size in rtgenmsg and ndmsg structures.
Also kernel did not check size of incoming structure.

Tony Zelenoff (2):
Modify neighbour show according to new kernel ability
Adjust man page for new functionality

ip/ipneigh.c | 12 ++++++++++--
man/man8/ip-neighbour.8 | 6 +++++-
2 files changed, 15 insertions(+), 3 deletions(-)
[PATCH iproute2 1/2] Modify neighbour proxy show [message #45075 is a reply to message #45074] Thu, 26 January 2012 14:50 Go to previous messageGo to next message
Tony Zelenoff is currently offline  Tony Zelenoff
Messages: 6
Registered: January 2012
Junior Member
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>
---
ip/ipneigh.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ip/ipneigh.c b/ip/ipneigh.c
index c8f745e..313cc63 100644
--- a/ip/ipneigh.c
+++ b/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)
return 0;
if (!(filter.state&r->ndm_state) &&
+ !(r->ndm_flags & NTF_PROXY) &&
(r->ndm_state || !(filter.state&0x100)) &&
(r->ndm_family != AF_DECnet))
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) {
fprintf(fp, " router");
}
+ if (r->ndm_flags & NTF_PROXY) {
+ fprintf(fp, " proxy");
+ }
if (tb[NDA_CACHEINFO] && show_stats) {
struct nda_cacheinfo *ci = RTA_DATA(tb[NDA_CACHEINFO]);
int hz = get_user_hz();
@@ -314,6 +318,7 @@ int do_show_or_flush(int argc, char **argv, int flush)
{
char *filter_dev = NULL;
int state_given = 0;
+ struct ndmsg ndm = { 0 };

ipneigh_reset_filter();

@@ -354,7 +359,9 @@ int do_show_or_flush(int argc, char **argv, int flush)
if (state == 0)
state = 0x100;
filter.state |= state;
- } else {
+ } else if (strcmp(*argv, "proxy") == 0)
+ ndm.ndm_flags = NTF_PROXY;
+ else {
if (strcmp(*argv, "to") == 0) {
NEXT_ARG();
}
@@ -418,7 +425,9 @@ int do_show_or_flush(int argc, char **argv, int flush)
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");
exit(1);
}
--
1.7.1
[PATCH iproute2 2/2] Adjust man page for new functionality [message #45076 is a reply to message #45074] Thu, 26 January 2012 14:50 Go to previous message
Tony Zelenoff is currently offline  Tony Zelenoff
Messages: 6
Registered: January 2012
Junior Member
Signed-off-by: Tony Zelenoff <antonz@parallels.com>
---
man/man8/ip-neighbour.8 | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/man/man8/ip-neighbour.8 b/man/man8/ip-neighbour.8
index f4ea0db..db383e3 100644
--- a/man/man8/ip-neighbour.8
+++ b/man/man8/ip-neighbour.8
@@ -24,7 +24,7 @@ ip neighbour \- neighbour/arp tables management.
.IR DEV " ]"

.ti -8
-.BR "ip neigh" " { " show " | " flush " } [ " to
+.BR "ip neigh" " { " show " | " flush " } [ " proxy " ] [ " to
.IR PREFIX " ] [ "
.B dev
.IR DEV " ] [ "
@@ -133,6 +133,10 @@ the prefix selecting the neighbours to list.
only list the neighbours attached to this device.

.TP
+.BI proxy
+list neighbour proxies.
+
+.TP
.B unused
only list neighbours which are not currently in use.

--
1.7.1
Previous Topic: [PATCH 0/5] NFS: various small fixes and updates for conteinerization
Next Topic: [PATCH rhel6] Allow ipv6 proxies and arp proxies be shown with iproute2
Goto Forum:
  


Current Time: Tue Mar 19 03:28:41 GMT 2024

Total time taken to generate the page: 0.02499 seconds