Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/tcpdump Pv6, IPsec, ospf6, ripng, dhcp and other pr...
details: https://anonhg.NetBSD.org/src/rev/4b8d0440c14d
branches: trunk
changeset: 474258:4b8d0440c14d
user: itojun <itojun%NetBSD.org@localhost>
date: Fri Jul 02 11:31:28 1999 +0000
description:
Pv6, IPsec, ospf6, ripng, dhcp and other protocols support.
diffstat:
usr.sbin/tcpdump/Makefile | 6 +-
usr.sbin/tcpdump/addrtoname.c | 104 +++-
usr.sbin/tcpdump/addrtoname.h | 11 +-
usr.sbin/tcpdump/bootp.h | 60 ++-
usr.sbin/tcpdump/interface.h | 23 +-
usr.sbin/tcpdump/ipsec_doi.h | 164 +++++
usr.sbin/tcpdump/isakmp.h | 449 ++++++++++++++++
usr.sbin/tcpdump/oakley.h | 126 ++++
usr.sbin/tcpdump/ospf6.h | 280 ++++++++++
usr.sbin/tcpdump/print-ah.c | 82 ++
usr.sbin/tcpdump/print-atm.c | 10 +-
usr.sbin/tcpdump/print-bootp.c | 76 ++-
usr.sbin/tcpdump/print-domain.c | 56 +-
usr.sbin/tcpdump/print-esp.c | 93 +++
usr.sbin/tcpdump/print-ether.c | 10 +-
usr.sbin/tcpdump/print-frag6.c | 80 ++
usr.sbin/tcpdump/print-icmp.c | 6 +-
usr.sbin/tcpdump/print-icmp6.c | 543 +++++++++++++++++++
usr.sbin/tcpdump/print-ip.c | 78 ++-
usr.sbin/tcpdump/print-ip6.c | 218 +++++++
usr.sbin/tcpdump/print-ip6opts.c | 151 +++++
usr.sbin/tcpdump/print-ipcomp.c | 111 ++++
usr.sbin/tcpdump/print-isakmp.c | 1053 ++++++++++++++++++++++++++++++++++++++
usr.sbin/tcpdump/print-null.c | 11 +-
usr.sbin/tcpdump/print-ospf.c | 6 +-
usr.sbin/tcpdump/print-ospf6.c | 663 +++++++++++++++++++++++
usr.sbin/tcpdump/print-pim.c | 491 +++++++++++++++++-
usr.sbin/tcpdump/print-ppp.c | 19 +-
usr.sbin/tcpdump/print-ripng.c | 111 ++++
usr.sbin/tcpdump/print-rt6.c | 116 ++++
usr.sbin/tcpdump/print-tcp.c | 110 +++-
usr.sbin/tcpdump/print-udp.c | 59 ++-
usr.sbin/tcpdump/route6d.h | 49 +
usr.sbin/tcpdump/tcpdump.8 | 83 ++-
usr.sbin/tcpdump/tcpdump.c | 11 +-
35 files changed, 5448 insertions(+), 71 deletions(-)
diffs (truncated from 6347 to 300 lines):
diff -r b850890a04c0 -r 4b8d0440c14d usr.sbin/tcpdump/Makefile
--- a/usr.sbin/tcpdump/Makefile Fri Jul 02 10:05:22 1999 +0000
+++ b/usr.sbin/tcpdump/Makefile Fri Jul 02 11:31:28 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.14 1999/03/23 00:02:24 bad Exp $
+# $NetBSD: Makefile,v 1.15 1999/07/02 11:31:28 itojun Exp $
PROG= tcpdump
MAN= tcpdump.8
@@ -9,6 +9,7 @@
CPPFLAGS+=-DRETSIGTYPE=void -DRETSIGVAL= -DHAVE_SIGACTION=1
CPPFLAGS+=-DHAVE_SOCKADDR_SA_LEN=1 -DHAVE_FDDI -DHAVE_TOKEN -DLBL_ALIGN
CPPFLAGS+=-DHAVE_HDLC
+CPPFLAGS+=-DINET6 -DHAVE_LIBZ -DHAVE_ZLIB_H
LDADD+= -lpcap -ll
DPADD+= ${LIBPCAP} ${LIBL}
@@ -22,6 +23,9 @@
print-hdlc.c print-token.c \
print-atalk.c print-arp.c parsenfsfh.c machdep.c gmt2local.c bpf_dump.c \
addrtoname.c print-mobile.c
+SRCS+= print-ah.c print-esp.c print-frag6.c print-icmp6.c print-ip6.c \
+ print-ip6opts.c print-ipcomp.c print-isakmp.c print-ospf6.c \
+ print-ripng.c print-rt6.c
SRCS+= version.c
AWKS= atime.awk packetdat.awk stime.awk send-ack.awk
diff -r b850890a04c0 -r 4b8d0440c14d usr.sbin/tcpdump/addrtoname.c
--- a/usr.sbin/tcpdump/addrtoname.c Fri Jul 02 10:05:22 1999 +0000
+++ b/usr.sbin/tcpdump/addrtoname.c Fri Jul 02 11:31:28 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: addrtoname.c,v 1.7 1997/11/02 14:25:23 lukem Exp $ */
+/* $NetBSD: addrtoname.c,v 1.8 1999/07/02 11:31:28 itojun Exp $ */
/*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -29,7 +29,7 @@
static const char rcsid[] =
"@(#) Header: addrtoname.c,v 1.61 97/06/15 13:20:18 leres Exp (LBL)";
#else
-__RCSID("$NetBSD: addrtoname.c,v 1.7 1997/11/02 14:25:23 lukem Exp $");
+__RCSID("$NetBSD: addrtoname.c,v 1.8 1999/07/02 11:31:28 itojun Exp $");
#endif
#endif
@@ -52,6 +52,10 @@
#include <arpa/inet.h>
+#ifdef INET6
+#include <netinet6/ip6.h>
+#endif
+
#include <ctype.h>
#include <netdb.h>
#include <pcap.h>
@@ -96,6 +100,16 @@
struct hnamemem dnaddrtable[HASHNAMESIZE];
struct hnamemem llcsaptable[HASHNAMESIZE];
+#ifdef INET6
+struct h6namemem {
+ struct in6_addr addr;
+ char *name;
+ struct h6namemem *nxt;
+};
+
+struct h6namemem h6nametable[HASHNAMESIZE];
+#endif /* INET6 */
+
struct enamemem {
u_short e_addr0;
u_short e_addr1;
@@ -262,6 +276,71 @@
return (p->name);
}
+#ifdef INET6
+/*
+ * Return a name for the IP6 address pointed to by ap. This address
+ * is assumed to be in network byte order.
+ */
+char *
+getname6(const u_char *ap)
+{
+ register struct hostent *hp;
+ struct in6_addr addr;
+ static struct h6namemem *p; /* static for longjmp() */
+ register char *cp;
+ char ntop_buf[INET6_ADDRSTRLEN];
+
+ memcpy(&addr, ap, sizeof(addr));
+ p = &h6nametable[addr.s6_addr16[7] & (HASHNAMESIZE-1)];
+ for (; p->nxt; p = p->nxt) {
+ if (memcmp(&p->addr, &addr, sizeof(addr)) == 0)
+ return (p->name);
+ }
+ p->addr = addr;
+ p->nxt = newh6namemem();
+
+ /*
+ * Only print names when:
+ * (1) -n was not given.
+ * (2) Address is foreign and -f was given. (If -f was not
+ * give, f_netmask and f_local are 0 and the test
+ * evaluates to true)
+ * (3) -a was given or the host portion is not all ones
+ * nor all zeros (i.e. not a network or broadcast address)
+ */
+ if (!nflag
+#if 0
+ &&
+ (addr & f_netmask) == f_localnet &&
+ (aflag ||
+ !((addr & ~netmask) == 0 || (addr | netmask) == 0xffffffff))
+#endif
+ ) {
+ if (!setjmp(getname_env)) {
+ (void)setsignal(SIGALRM, nohostname);
+ (void)alarm(20);
+ hp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET6);
+ (void)alarm(0);
+ if (hp) {
+ char *dotp;
+
+ p->name = savestr(hp->h_name);
+ if (Nflag) {
+ /* Remove domain qualifications */
+ dotp = strchr(p->name, '.');
+ if (dotp)
+ *dotp = '\0';
+ }
+ return (p->name);
+ }
+ }
+ }
+ cp = (char *)inet_ntop(AF_INET6, &addr, ntop_buf, sizeof(ntop_buf));
+ p->name = savestr(cp);
+ return (p->name);
+}
+#endif /* INET6 */
+
static char hex[] = "0123456789abcdef";
@@ -852,3 +931,24 @@
p = ptr++;
return (p);
}
+
+#ifdef INET6
+/* Return a zero'ed h6namemem struct and cuts down on calloc() overhead */
+struct h6namemem *
+newh6namemem(void)
+{
+ register struct h6namemem *p;
+ static struct h6namemem *ptr = NULL;
+ static u_int num = 0;
+
+ if (num <= 0) {
+ num = 64;
+ ptr = (struct h6namemem *)calloc(num, sizeof (*ptr));
+ if (ptr == NULL)
+ error("newh6namemem: calloc");
+ }
+ --num;
+ p = ptr++;
+ return (p);
+}
+#endif /* INET6 */
diff -r b850890a04c0 -r 4b8d0440c14d usr.sbin/tcpdump/addrtoname.h
--- a/usr.sbin/tcpdump/addrtoname.h Fri Jul 02 10:05:22 1999 +0000
+++ b/usr.sbin/tcpdump/addrtoname.h Fri Jul 02 11:31:28 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: addrtoname.h,v 1.5 1998/02/01 13:48:08 christos Exp $ */
+/* $NetBSD: addrtoname.h,v 1.6 1999/07/02 11:31:28 itojun Exp $ */
/*
* Copyright (c) 1990, 1992, 1993, 1994, 1995, 1996, 1997
@@ -39,9 +39,18 @@
extern char *tcpport_string(u_short);
extern char *udpport_string(u_short);
extern char *getname(const u_char *);
+#ifdef INET6
+extern char *getname6(const u_char *);
+#endif
extern char *intoa(u_int32_t);
extern void init_addrtoname(u_int32_t, u_int32_t);
extern struct hnamemem *newhnamemem(void);
+#ifdef INET6
+extern struct h6namemem *newh6namemem(void);
+#endif
#define ipaddr_string(p) getname((const u_char *)(p))
+#ifdef INET6
+#define ip6addr_string(p) getname6((const u_char *)(p))
+#endif
diff -r b850890a04c0 -r 4b8d0440c14d usr.sbin/tcpdump/bootp.h
--- a/usr.sbin/tcpdump/bootp.h Fri Jul 02 10:05:22 1999 +0000
+++ b/usr.sbin/tcpdump/bootp.h Fri Jul 02 11:31:28 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootp.h,v 1.3 1997/10/03 19:54:20 christos Exp $ */
+/* $NetBSD: bootp.h,v 1.4 1999/07/02 11:31:28 itojun Exp $ */
/* @(#) Header: bootp.h,v 1.7 95/05/04 17:52:46 mccanne Exp (LBL) */
/*
@@ -88,6 +88,64 @@
#define TAG_SWAP_SERVER ((unsigned char) 16)
#define TAG_ROOTPATH ((unsigned char) 17)
#define TAG_EXTPATH ((unsigned char) 18)
+/* RFC1533 tags */
+#define TAG_IP_FORWARD ((unsigned char) 19)
+#define TAG_IP_SRCRT ((unsigned char) 20)
+#define TAG_IP_FILTER ((unsigned char) 21)
+#define TAG_IP_REASS ((unsigned char) 22)
+#define TAG_IP_TTL ((unsigned char) 23)
+#define TAG_IP_PMTUTO ((unsigned char) 24)
+#define TAG_IP_PMTUPTAB ((unsigned char) 25)
+#define TAG_IPIF_MTU ((unsigned char) 26)
+#define TAG_IPIF_LSUBNET ((unsigned char) 27)
+#define TAG_IPIF_BADDR ((unsigned char) 28)
+#define TAG_IPIF_MDISC ((unsigned char) 29)
+#define TAG_IPIF_MSUPP ((unsigned char) 30)
+#define TAG_IPIF_RDISC ((unsigned char) 31)
+#define TAG_IPIF_RSOLADDR ((unsigned char) 32)
+#define TAG_IPIF_SROUTE ((unsigned char) 33)
+#define TAG_LINK_TRAILER ((unsigned char) 34)
+#define TAG_LINK_ARPTO ((unsigned char) 35)
+#define TAG_LINK_ETHER802 ((unsigned char) 36)
+#define TAG_TCP_DEFTTL ((unsigned char) 37)
+#define TAG_TCP_KAINT ((unsigned char) 38)
+#define TAG_TCP_KAGARBAGE ((unsigned char) 39)
+#define TAG_APP_NISDOM ((unsigned char) 40)
+#define TAG_APP_NISOPT ((unsigned char) 41)
+#define TAG_APP_NTPSRV ((unsigned char) 42)
+#define TAG_VENDOR ((unsigned char) 43)
+#define TAG_APP_NB_NS_SERVER ((unsigned char) 44)
+#define TAG_APP_NB_DD_SERVER ((unsigned char) 45)
+#define TAG_APP_NB_NODETYPE ((unsigned char) 46)
+#define TAG_APP_NB_SCOPE ((unsigned char) 47)
+#define TAG_APP_X_FS ((unsigned char) 48)
+#define TAG_APP_X_DM ((unsigned char) 49)
+#define TAG_APP_NISPDOM ((unsigned char) 64)
+#define TAG_APP_NISPSRV ((unsigned char) 65)
+#define TAG_APP_MIPHA ((unsigned char) 68)
+#define TAG_APP_SMTPSRV ((unsigned char) 69)
+#define TAG_APP_POP3SRV ((unsigned char) 70)
+#define TAG_APP_NNTPSRV ((unsigned char) 71)
+#define TAG_APP_HTTPSRV ((unsigned char) 72)
+#define TAG_APP_FINGERSRV ((unsigned char) 73)
+#define TAG_APP_IRCSRV ((unsigned char) 74)
+#define TAG_APP_STREETTALKSRV ((unsigned char) 75)
+#define TAG_APP_STREETTALKDA ((unsigned char) 76)
+/* (post-)RFC1533 DHCP extensions */
+#define TAG_DHCP_REQIPADDR ((unsigned char) 50)
+#define TAG_DHCP_LEASETIME ((unsigned char) 51)
+#define TAG_DHCP_OVERLOAD ((unsigned char) 52)
+#define TAG_DHCP_TFTPSRV ((unsigned char) 66)
+#define TAG_DHCP_BOOTFILE ((unsigned char) 67)
+#define TAG_DHCP_MSGTYP ((unsigned char) 53)
+#define TAG_DHCP_SRVID ((unsigned char) 54)
+#define TAG_DHCP_PRMREQ ((unsigned char) 55)
+#define TAG_DHCP_MSG ((unsigned char) 56)
+#define TAG_DHCP_MAXSIZ ((unsigned char) 57)
+#define TAG_DHCP_T1 ((unsigned char) 58)
+#define TAG_DHCP_T2 ((unsigned char) 59)
+#define TAG_DHCP_CLASSID ((unsigned char) 60)
+#define TAG_DHCP_CLIENTID ((unsigned char) 61)
diff -r b850890a04c0 -r 4b8d0440c14d usr.sbin/tcpdump/interface.h
--- a/usr.sbin/tcpdump/interface.h Fri Jul 02 10:05:22 1999 +0000
+++ b/usr.sbin/tcpdump/interface.h Fri Jul 02 11:31:28 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: interface.h,v 1.8 1999/05/11 02:54:29 thorpej Exp $ */
+/* $NetBSD: interface.h,v 1.9 1999/07/02 11:31:28 itojun Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -43,6 +43,7 @@
extern int nflag; /* leave addresses as numbers */
extern int Nflag; /* remove domains from printed host names */
extern int qflag; /* quick (shorter) output */
+extern int Rflag; /* print sequence # field in AH/ESP*/
extern int Sflag; /* print raw TCP sequence numbers */
extern int tflag; /* print packet arrival time */
extern int vflag; /* verbose */
@@ -62,6 +63,7 @@
#define max(a,b) ((b)>(a)?(b):(a))
#endif
+#ifndef INET6
/*
* The default snapshot length. This value allows most printers to print
* useful information while keeping the amount of unwanted data down.
@@ -69,6 +71,9 @@
* 14 bytes of data (assuming no ip options).
*/
Home |
Main Index |
Thread Index |
Old Index