From 3b8a8567a1f613f2835102f37a934d2e75057364 Mon Sep 17 00:00:00 2001 From: Jun-ichiro itojun Hagino Date: Wed, 5 Jul 2000 02:02:54 +0000 Subject: [PATCH] add pfkeystat. sync with kame --- usr.bin/netstat/main.c | 23 +++++++++++++++++++++++ usr.bin/netstat/netstat.h | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 87c3a73f930d..453eb791c905 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -143,6 +143,8 @@ static struct nlist nl[] = { { "_mf6ctable" }, #define N_MIF6TABLE 36 { "_mif6table" }, +#define N_PFKEYSTAT 37 + { "_pfkeystat" }, { "" }, }; @@ -203,6 +205,15 @@ struct protox ip6protox[] = { }; #endif /*INET6*/ +#ifdef IPSEC +struct protox pfkeyprotox[] = { + { -1, N_PFKEYSTAT, 1, 0, + pfkey_stats, NULL, "pfkey", 0 }, + { -1, -1, 0, 0, + 0, NULL, 0, 0 } +}; +#endif + struct protox atalkprotox[] = { { N_DDPCB, N_DDPSTAT, 1, atalkprotopr, ddp_stats, NULL, "ddp" }, @@ -260,6 +271,9 @@ struct protox *protoprotox[] = { protox, #ifdef INET6 ip6protox, +#endif +#ifdef IPSEC + pfkeyprotox, #endif ipxprotox, atalkprotox, #ifdef NS @@ -315,6 +329,10 @@ main(argc, argv) #ifdef INET6 else if (strcmp(optarg, "inet6") == 0) af = AF_INET6; +#endif /*INET6*/ +#ifdef INET6 + else if (strcmp(optarg, "pfkey") == 0) + af = PF_KEY; #endif /*INET6*/ else if (strcmp(optarg, "unix") == 0) af = AF_UNIX; @@ -505,6 +523,11 @@ main(argc, argv) for (tp = ip6protox; tp->pr_name; tp++) printproto(tp, tp->pr_name); #endif /*INET6*/ +#ifdef IPSEC + if (af == PF_KEY || af == AF_UNSPEC) + for (tp = pfkeyprotox; tp->pr_name; tp++) + printproto(tp, tp->pr_name); +#endif /*IPSEC*/ if (af == AF_IPX || af == AF_UNSPEC) { kread(0, 0, 0); for (tp = ipxprotox; tp->pr_name; tp++) diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h index 6a329f9c14a2..70bfbf0c6471 100644 --- a/usr.bin/netstat/netstat.h +++ b/usr.bin/netstat/netstat.h @@ -88,6 +88,10 @@ char *routename6 __P((struct sockaddr_in6 *)); char *netname6 __P((struct sockaddr_in6 *, struct in6_addr *)); #endif /*INET6*/ +#ifdef IPSEC +void pfkey_stats __P((u_long, char *)); +#endif + void bdg_stats __P((u_long, char *)); void mbpr __P((void));