diff options
| author | Jeff Roberson <jeff@FreeBSD.org> | 2011-03-21 09:58:24 +0000 |
|---|---|---|
| committer | Jeff Roberson <jeff@FreeBSD.org> | 2011-03-21 09:58:24 +0000 |
| commit | aa0a1e58f0189b0fde359a8bda032887e72057fa (patch) | |
| tree | 3051c12f4ce44a65c025b72ec5821b35b2ec46be /usr.bin/netstat | |
| parent | e4cd31dd3c7adc94a486ca5309c7096f81fa70f1 (diff) | |
Notes
Diffstat (limited to 'usr.bin/netstat')
| -rw-r--r-- | usr.bin/netstat/Makefile | 4 | ||||
| -rw-r--r-- | usr.bin/netstat/inet.c | 24 | ||||
| -rw-r--r-- | usr.bin/netstat/main.c | 8 |
3 files changed, 28 insertions, 8 deletions
diff --git a/usr.bin/netstat/Makefile b/usr.bin/netstat/Makefile index 8f009016ff8d..ce5cdab4c2b3 100644 --- a/usr.bin/netstat/Makefile +++ b/usr.bin/netstat/Makefile @@ -18,6 +18,10 @@ SRCS+= inet6.c CFLAGS+=-DINET6 .endif +.if ${MK_OFED} != "no" +CFLAGS+=-DSDP +.endif + BINGRP= kmem BINMODE=2555 DPADD= ${LIBKVM} ${LIBMEMSTAT} ${LIBUTIL} diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index bc0456d72d34..29595af729ca 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -85,11 +85,11 @@ __FBSDID("$FreeBSD$"); char *inetname(struct in_addr *); void inetprint(struct in_addr *, int, const char *, int); #ifdef INET6 -static int udp_done, tcp_done; +static int udp_done, tcp_done, sdp_done; #endif /* INET6 */ static int -pcblist_sysctl(int proto, char **bufp, int istcp) +pcblist_sysctl(int proto, const char *name, char **bufp, int istcp) { const char *mibvar; char *buf; @@ -109,7 +109,8 @@ pcblist_sysctl(int proto, char **bufp, int istcp) mibvar = "net.inet.raw.pcblist"; break; } - + if (strncmp(name, "sdp", 3) == 0) + mibvar = "net.inet.sdp.pcblist"; len = 0; if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) { if (errno != ENOENT) @@ -315,10 +316,17 @@ protopr(u_long off, const char *name, int af1, int proto) switch (proto) { case IPPROTO_TCP: #ifdef INET6 - if (tcp_done != 0) - return; - else - tcp_done = 1; + if (strncmp(name, "sdp", 3) != 0) { + if (tcp_done != 0) + return; + else + tcp_done = 1; + } else { + if (sdp_done != 0) + return; + else + sdp_done = 1; + } #endif istcp = 1; break; @@ -332,7 +340,7 @@ protopr(u_long off, const char *name, int af1, int proto) break; } if (live) { - if (!pcblist_sysctl(proto, &buf, istcp)) + if (!pcblist_sysctl(proto, name, &buf, istcp)) return; } else { if (!pcblist_kvm(off, &buf, istcp)) diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 17166f50b77d..09c009685671 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -208,6 +208,10 @@ struct protox { { -1, N_SCTPSTAT, 1, sctp_protopr, sctp_stats, NULL, "sctp", 1, IPPROTO_SCTP }, #endif +#ifdef SDP + { -1, -1, 1, protopr, + NULL, NULL, "sdp", 1, IPPROTO_TCP }, +#endif { N_DIVCBINFO, -1, 1, protopr, NULL, NULL, "divert", 1, IPPROTO_DIVERT }, { N_RIPCBINFO, N_IPSTAT, 1, protopr, @@ -248,6 +252,10 @@ struct protox ip6protox[] = { ip6_stats, ip6_ifstats, "ip6", 1, IPPROTO_RAW }, { N_RIPCBINFO, N_ICMP6STAT, 1, protopr, icmp6_stats, icmp6_ifstats, "icmp6", 1, IPPROTO_ICMPV6 }, +#ifdef SDP + { -1, -1, 1, protopr, + NULL, NULL, "sdp", 1, IPPROTO_TCP }, +#endif #ifdef IPSEC { -1, N_IPSEC6STAT, 1, NULL, ipsec_stats, NULL, "ipsec6", 0, 0 }, |
