pfkey.c (153809) | pfkey.c (160787) |
---|---|
1/* $FreeBSD: head/usr.bin/netstat/pfkey.c 153809 2005-12-28 20:36:55Z kbyanc $ */ | 1/* $FreeBSD: head/usr.bin/netstat/pfkey.c 160787 2006-07-28 16:09:19Z yar $ */ |
2/* $NetBSD: inet.c,v 1.35.2.1 1999/04/29 14:57:08 perry Exp $ */ 3/* $KAME: ipsec.c,v 1.25 2001/03/12 09:04:39 itojun Exp $ */ 4 5/* 6 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without --- 55 unchanged lines hidden (view full) --- 65 */ 66 67#include <sys/cdefs.h> 68#ifndef lint 69/* 70static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95"; 71*/ 72static const char rcsid[] = | 2/* $NetBSD: inet.c,v 1.35.2.1 1999/04/29 14:57:08 perry Exp $ */ 3/* $KAME: ipsec.c,v 1.25 2001/03/12 09:04:39 itojun Exp $ */ 4 5/* 6 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without --- 55 unchanged lines hidden (view full) --- 65 */ 66 67#include <sys/cdefs.h> 68#ifndef lint 69/* 70static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95"; 71*/ 72static const char rcsid[] = |
73 "$FreeBSD: head/usr.bin/netstat/pfkey.c 153809 2005-12-28 20:36:55Z kbyanc $"; | 73 "$FreeBSD: head/usr.bin/netstat/pfkey.c 160787 2006-07-28 16:09:19Z yar $"; |
74#endif /* not lint */ 75 76#include <sys/param.h> 77#include <sys/queue.h> 78#include <sys/socket.h> 79 80#include <netinet/in.h> 81 82#if defined(IPSEC) && !defined(FAST_IPSEC) 83#include <netkey/keysock.h> 84#endif 85 86#ifdef FAST_IPSEC 87#include <netipsec/keysock.h> 88#endif 89 | 74#endif /* not lint */ 75 76#include <sys/param.h> 77#include <sys/queue.h> 78#include <sys/socket.h> 79 80#include <netinet/in.h> 81 82#if defined(IPSEC) && !defined(FAST_IPSEC) 83#include <netkey/keysock.h> 84#endif 85 86#ifdef FAST_IPSEC 87#include <netipsec/keysock.h> 88#endif 89 |
90#include <stdint.h> |
|
90#include <stdio.h> 91#include <string.h> 92#include <unistd.h> 93#include "netstat.h" 94 95#ifdef IPSEC 96 97static const char *pfkey_msgtypenames[] = { --- 27 unchanged lines hidden (view full) --- 125 unsigned first, type; 126 127 if (off == 0) 128 return; 129 printf ("%s:\n", name); 130 kread(off, (char *)&pfkeystat, sizeof(pfkeystat)); 131 132#define p(f, m) if (pfkeystat.f || sflag <= 1) \ | 91#include <stdio.h> 92#include <string.h> 93#include <unistd.h> 94#include "netstat.h" 95 96#ifdef IPSEC 97 98static const char *pfkey_msgtypenames[] = { --- 27 unchanged lines hidden (view full) --- 126 unsigned first, type; 127 128 if (off == 0) 129 return; 130 printf ("%s:\n", name); 131 kread(off, (char *)&pfkeystat, sizeof(pfkeystat)); 132 133#define p(f, m) if (pfkeystat.f || sflag <= 1) \ |
133 printf(m, (unsigned long long)pfkeystat.f, plural(pfkeystat.f)) | 134 printf(m, (uintmax_t)pfkeystat.f, plural(pfkeystat.f)) |
134 135 /* userland -> kernel */ | 135 136 /* userland -> kernel */ |
136 p(out_total, "\t%llu request%s sent from userland\n"); 137 p(out_bytes, "\t%llu byte%s sent from userland\n"); | 137 p(out_total, "\t%ju request%s sent from userland\n"); 138 p(out_bytes, "\t%ju byte%s sent from userland\n"); |
138 for (first = 1, type = 0; 139 type < sizeof(pfkeystat.out_msgtype)/sizeof(pfkeystat.out_msgtype[0]); 140 type++) { 141 if (pfkeystat.out_msgtype[type] <= 0) 142 continue; 143 if (first) { 144 printf("\thistogram by message type:\n"); 145 first = 0; 146 } | 139 for (first = 1, type = 0; 140 type < sizeof(pfkeystat.out_msgtype)/sizeof(pfkeystat.out_msgtype[0]); 141 type++) { 142 if (pfkeystat.out_msgtype[type] <= 0) 143 continue; 144 if (first) { 145 printf("\thistogram by message type:\n"); 146 first = 0; 147 } |
147 printf("\t\t%s: %llu\n", pfkey_msgtype_names(type), 148 (unsigned long long)pfkeystat.out_msgtype[type]); | 148 printf("\t\t%s: %ju\n", pfkey_msgtype_names(type), 149 (uintmax_t)pfkeystat.out_msgtype[type]); |
149 } | 150 } |
150 p(out_invlen, "\t%llu message%s with invalid length field\n"); 151 p(out_invver, "\t%llu message%s with invalid version field\n"); 152 p(out_invmsgtype, "\t%llu message%s with invalid message type field\n"); 153 p(out_tooshort, "\t%llu message%s too short\n"); 154 p(out_nomem, "\t%llu message%s with memory allocation failure\n"); 155 p(out_dupext, "\t%llu message%s with duplicate extension\n"); 156 p(out_invexttype, "\t%llu message%s with invalid extension type\n"); 157 p(out_invsatype, "\t%llu message%s with invalid sa type\n"); 158 p(out_invaddr, "\t%llu message%s with invalid address extension\n"); | 151 p(out_invlen, "\t%ju message%s with invalid length field\n"); 152 p(out_invver, "\t%ju message%s with invalid version field\n"); 153 p(out_invmsgtype, "\t%ju message%s with invalid message type field\n"); 154 p(out_tooshort, "\t%ju message%s too short\n"); 155 p(out_nomem, "\t%ju message%s with memory allocation failure\n"); 156 p(out_dupext, "\t%ju message%s with duplicate extension\n"); 157 p(out_invexttype, "\t%ju message%s with invalid extension type\n"); 158 p(out_invsatype, "\t%ju message%s with invalid sa type\n"); 159 p(out_invaddr, "\t%ju message%s with invalid address extension\n"); |
159 160 /* kernel -> userland */ | 160 161 /* kernel -> userland */ |
161 p(in_total, "\t%llu request%s sent to userland\n"); 162 p(in_bytes, "\t%llu byte%s sent to userland\n"); | 162 p(in_total, "\t%ju request%s sent to userland\n"); 163 p(in_bytes, "\t%ju byte%s sent to userland\n"); |
163 for (first = 1, type = 0; 164 type < sizeof(pfkeystat.in_msgtype)/sizeof(pfkeystat.in_msgtype[0]); 165 type++) { 166 if (pfkeystat.in_msgtype[type] <= 0) 167 continue; 168 if (first) { 169 printf("\thistogram by message type:\n"); 170 first = 0; 171 } | 164 for (first = 1, type = 0; 165 type < sizeof(pfkeystat.in_msgtype)/sizeof(pfkeystat.in_msgtype[0]); 166 type++) { 167 if (pfkeystat.in_msgtype[type] <= 0) 168 continue; 169 if (first) { 170 printf("\thistogram by message type:\n"); 171 first = 0; 172 } |
172 printf("\t\t%s: %llu\n", pfkey_msgtype_names(type), 173 (unsigned long long)pfkeystat.in_msgtype[type]); | 173 printf("\t\t%s: %ju\n", pfkey_msgtype_names(type), 174 (uintmax_t)pfkeystat.in_msgtype[type]); |
174 } 175 p(in_msgtarget[KEY_SENDUP_ONE], | 175 } 176 p(in_msgtarget[KEY_SENDUP_ONE], |
176 "\t%llu message%s toward single socket\n"); | 177 "\t%ju message%s toward single socket\n"); |
177 p(in_msgtarget[KEY_SENDUP_ALL], | 178 p(in_msgtarget[KEY_SENDUP_ALL], |
178 "\t%llu message%s toward all sockets\n"); | 179 "\t%ju message%s toward all sockets\n"); |
179 p(in_msgtarget[KEY_SENDUP_REGISTERED], | 180 p(in_msgtarget[KEY_SENDUP_REGISTERED], |
180 "\t%llu message%s toward registered sockets\n"); 181 p(in_nomem, "\t%llu message%s with memory allocation failure\n"); | 181 "\t%ju message%s toward registered sockets\n"); 182 p(in_nomem, "\t%ju message%s with memory allocation failure\n"); |
182#undef p 183} 184#endif /* IPSEC */ | 183#undef p 184} 185#endif /* IPSEC */ |