diff options
| author | 2004-01-28 19:44:55 +0000 | |
|---|---|---|
| committer | 2004-01-28 19:44:55 +0000 | |
| commit | 231a0e502b93533f031bc24624d701c95e5be9f1 (patch) | |
| tree | d7cbf0c901b324e2dddc4d114145bbb2968c24a0 /usr.sbin/tcpdump/print-cnfp.c | |
| parent | update and sort openssl pkcs{7,8,12}; (diff) | |
| download | wireguard-openbsd-231a0e502b93533f031bc24624d701c95e5be9f1.tar.xz wireguard-openbsd-231a0e502b93533f031bc24624d701c95e5be9f1.zip | |
privilege separated tcpdump, joint work with otto@
tested by avsm@ vincent@ dhartmei@ markus@ hshoexer@ and others
go for it deraadt@
Diffstat (limited to 'usr.sbin/tcpdump/print-cnfp.c')
| -rw-r--r-- | usr.sbin/tcpdump/print-cnfp.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/usr.sbin/tcpdump/print-cnfp.c b/usr.sbin/tcpdump/print-cnfp.c index 80c2ec97155..a981b93751f 100644 --- a/usr.sbin/tcpdump/print-cnfp.c +++ b/usr.sbin/tcpdump/print-cnfp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-cnfp.c,v 1.5 2003/06/02 20:37:14 mickey Exp $ */ +/* $OpenBSD: print-cnfp.c,v 1.6 2004/01/28 19:44:55 canacar Exp $ */ /* * Copyright (c) 1998 Michael Shalayeff @@ -40,6 +40,7 @@ #include <string.h> #include "interface.h" +#include "addrtoname.h" struct nfhdr { u_int32_t ver_cnt; /* version [15], and # of records */ @@ -72,8 +73,7 @@ cnfp_print(register const u_char *cp, u_int len, register const u_char *bp) register const struct nfhdr *nh; register const struct nfrec *nr; register const struct ip *ip; - struct protoent *pent; - int nrecs, ver; + int nrecs, ver, proto; time_t t; ip = (struct ip *)bp; @@ -131,14 +131,11 @@ cnfp_print(register const u_char *cp, u_int len, register const u_char *bp) printf(">> %s\n ", inet_ntoa(nr->nhop_ina)); - pent = getprotobynumber((ntohl(nr->proto_tos) >> 8) & 0xff); - if (!pent || nflag) - printf("%u ", (ntohl(nr->proto_tos) >> 8) & 0xff); - else - printf("%s ", pent->p_name); + proto = (ntohl(nr->proto_tos) >> 8) & 0xff; + printf("%s ", ipproto_string(proto)); /* tcp flags for tcp only */ - if (pent && pent->p_proto == IPPROTO_TCP) { + if (proto == IPPROTO_TCP) { int flags; if (ver == 1) flags = (ntohl(nr->asses) >> 24) & 0xff; |
