diff options
author | jeff <jeff@FreeBSD.org> | 2011-03-21 09:58:24 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2011-03-21 09:58:24 +0000 |
commit | 5115240a6cdc054f7eea804355742f97c74578d8 (patch) | |
tree | 3051c12f4ce44a65c025b72ec5821b35b2ec46be /usr.bin/netstat | |
parent | 2d7d8c05e7404fbebf1f0fe24c13bc5bb58d2338 (diff) | |
download | FreeBSD-src-5115240a6cdc054f7eea804355742f97c74578d8.zip FreeBSD-src-5115240a6cdc054f7eea804355742f97c74578d8.tar.gz |
- Merge in OFED 1.5.3 from projects/ofed/head
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 8f00901..ce5cdab 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 bc0456d..29595af 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 17166f5..09c0096 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 }, |