Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/netstat add MPLS clue for showing routes
details: https://anonhg.NetBSD.org/src/rev/020190c2b2fd
branches: trunk
changeset: 755885:020190c2b2fd
user: kefren <kefren%NetBSD.org@localhost>
date: Sat Jun 26 14:30:31 2010 +0000
description:
add MPLS clue for showing routes
diffstat:
usr.bin/netstat/show.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diffs (65 lines):
diff -r 918cd8cd5ca7 -r 020190c2b2fd usr.bin/netstat/show.c
--- a/usr.bin/netstat/show.c Sat Jun 26 14:29:36 2010 +0000
+++ b/usr.bin/netstat/show.c Sat Jun 26 14:30:31 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: show.c,v 1.8 2009/09/13 02:53:17 elad Exp $ */
+/* $NetBSD: show.c,v 1.9 2010/06/26 14:30:31 kefren Exp $ */
/* $OpenBSD: show.c,v 1.1 2006/05/27 19:16:37 claudio Exp $ */
/*
@@ -44,6 +44,7 @@
#include <net/route.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
+#include <netmpls/mpls.h>
#include <arpa/inet.h>
#include <err.h>
@@ -59,6 +60,7 @@
char *any_ntoa(const struct sockaddr *);
char *link_print(struct sockaddr *);
+char *mpls_ntoa(const struct sockaddr *);
#define ROUNDUP(a) \
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
@@ -288,6 +290,9 @@
case AF_APPLETALK:
afname = "AppleTalk";
break;
+ case AF_MPLS:
+ afname = "MPLS";
+ break;
default:
afname = NULL;
break;
@@ -420,6 +425,9 @@
case AF_LINK:
return (link_print(sa));
+ case AF_MPLS:
+ return mpls_ntoa(sa);
+
#if 0 /* XXX-elad */
case AF_UNSPEC:
if (sa->sa_len == sizeof(struct sockaddr_rtlabel)) {
@@ -684,3 +692,19 @@
return (link_ntoa(sdl));
}
}
+
+char *
+mpls_ntoa(const struct sockaddr *sa)
+{
+ static char obuf[100];
+ const struct sockaddr_mpls *sm;
+ union mpls_shim ms;
+
+ sm = (const struct sockaddr_mpls*)sa;
+ ms.s_addr = ntohl(sm->smpls_addr.s_addr);
+
+ snprintf(obuf, sizeof(obuf), "%u",
+ ms.shim.label);
+
+ return obuf;
+}
Home |
Main Index |
Thread Index |
Old Index