summaryrefslogtreecommitdiff
path: root/usr.sbin/tcpdump
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r--usr.sbin/tcpdump/interface.h8
-rw-r--r--usr.sbin/tcpdump/print-cnfp.c10
-rw-r--r--usr.sbin/tcpdump/print-ipsec.c14
-rw-r--r--usr.sbin/tcpdump/print-ppp.c20
-rw-r--r--usr.sbin/tcpdump/print-radius.c62
-rw-r--r--usr.sbin/tcpdump/print-rip.c7
-rw-r--r--usr.sbin/tcpdump/print-tcp.c10
-rw-r--r--usr.sbin/tcpdump/print-udp.c6
-rw-r--r--usr.sbin/tcpdump/tcpdump.c5
9 files changed, 84 insertions, 58 deletions
diff --git a/usr.sbin/tcpdump/interface.h b/usr.sbin/tcpdump/interface.h
index c687cc2bf17..a3d432bb11f 100644
--- a/usr.sbin/tcpdump/interface.h
+++ b/usr.sbin/tcpdump/interface.h
@@ -1,3 +1,5 @@
+/* $OpenBSD: interface.h,v 1.17 2000/10/03 14:21:56 ho Exp $ */
+
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
@@ -18,7 +20,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/interface.h,v 1.16 2000/04/26 21:35:38 jakob Exp $ (LBL)
+ * @(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/interface.h,v 1.17 2000/10/03 14:21:56 ho Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@@ -171,6 +173,7 @@ struct pcap_pkthdr;
extern int ether_encap_print(u_short, const u_char *, u_int, u_int);
extern int llc_print(const u_char *, u_int, u_int, const u_char *,
const u_char *);
+extern int pppoe_if_print(u_short, const u_char *, u_int, u_int);
extern void aarp_print(const u_char *, u_int);
extern void arp_print(const u_char *, u_int, u_int);
extern void atalk_print(const u_char *, u_int);
@@ -212,10 +215,13 @@ extern void sl_bsdos_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern void snmp_print(const u_char *, u_int);
extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
+extern void cnfp_print(const u_char *, u_int, const u_char *);
extern void tcp_print(const u_char *, u_int, const u_char *);
extern void tftp_print(const u_char *, u_int);
extern void udp_print(const u_char *, u_int, const u_char *);
extern void wb_print(const void *, u_int);
+extern void isakmp_print(const u_char *, u_int);
+extern void ah_print(const u_char *, u_int, const u_char *);
extern void esp_print(const u_char *, u_int, const u_char *);
extern void radius_print(const u_char *, u_int);
diff --git a/usr.sbin/tcpdump/print-cnfp.c b/usr.sbin/tcpdump/print-cnfp.c
index 805762240cf..9bf2b59c87c 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.2 1998/06/25 20:26:59 mickey Exp $ */
+/* $OpenBSD: print-cnfp.c,v 1.3 2000/10/03 14:21:56 ho Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -39,6 +39,7 @@
#include <netinet/in.h>
#include <netinet/tcp.h>
+#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
@@ -55,9 +56,9 @@ struct nfhdr {
};
struct nfrec {
- in_addr_t src_ina;
- in_addr_t dst_ina;
- in_addr_t nhop_ina;
+ struct in_addr src_ina;
+ struct in_addr dst_ina;
+ struct in_addr nhop_ina;
u_int32_t ifaces; /* src,dst ifaces */
u_int32_t packets;
u_int32_t octets;
@@ -79,7 +80,6 @@ cnfp_print(register const u_char *cp, u_int len, register const u_char *bp)
struct protoent *pent;
int nrecs, ver;
time_t t;
- char *p;
ip = (struct ip *)bp;
nh = (struct nfhdr *)cp;
diff --git a/usr.sbin/tcpdump/print-ipsec.c b/usr.sbin/tcpdump/print-ipsec.c
index 474e234ef44..80f1f0cc007 100644
--- a/usr.sbin/tcpdump/print-ipsec.c
+++ b/usr.sbin/tcpdump/print-ipsec.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: print-ipsec.c,v 1.5 2000/10/03 14:21:56 ho Exp $ */
+
/*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
* The Regents of the University of California. All rights reserved.
@@ -26,7 +28,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-ipsec.c,v 1.4 2000/04/26 21:35:41 jakob Exp $ (XXX)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-ipsec.c,v 1.5 2000/10/03 14:21:56 ho Exp $ (XXX)";
#endif
#include <sys/param.h>
@@ -59,8 +61,9 @@ struct esp_hdr {
u_int esp_seq;
};
-void esp_print(register const u_char *bp, register u_int len,
- register const u_char *bp2)
+void
+esp_print (register const u_char *bp, register u_int len,
+ register const u_char *bp2)
{
const struct ip *ip;
const struct esp_hdr *esp;
@@ -86,8 +89,9 @@ struct ah_hdr {
u_int ah_seq;
};
-ah_print(register const u_char *bp, register u_int len,
- register const u_char *bp2)
+void
+ah_print (register const u_char *bp, register u_int len,
+ register const u_char *bp2)
{
const struct ip *ip;
const struct ah_hdr *ah;
diff --git a/usr.sbin/tcpdump/print-ppp.c b/usr.sbin/tcpdump/print-ppp.c
index 42fe2490c92..b32859e7e3c 100644
--- a/usr.sbin/tcpdump/print-ppp.c
+++ b/usr.sbin/tcpdump/print-ppp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ppp.c,v 1.12 2000/07/31 05:11:09 jason Exp $ */
+/* $OpenBSD: print-ppp.c,v 1.13 2000/10/03 14:21:56 ho Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-ppp.c,v 1.12 2000/07/31 05:11:09 jason Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-ppp.c,v 1.13 2000/10/03 14:21:56 ho Exp $ (LBL)";
#endif
#ifdef PPP
@@ -207,11 +207,11 @@ static char *papcode[] = {
#define IPCP_CP 2
#define IPCP_ADDR 3
-static int handle_lcp(const u_char *p, int length);
static int print_lcp_config_options(u_char *p);
-static int handle_chap(const u_char *p, int length);
-static int handle_ipcp(const u_char *p, int length);
-static int handle_pap(const u_char *p, int length);
+static void handle_lcp(const u_char *p, int length);
+static void handle_chap(const u_char *p, int length);
+static void handle_ipcp(const u_char *p, int length);
+static void handle_pap(const u_char *p, int length);
struct pppoe_header {
u_int8_t vertype; /* PPPoE version/type */
@@ -274,7 +274,7 @@ ppp_hdlc_print(p, length)
/* print LCP frame */
-static int
+static void
handle_lcp(p, length)
const u_char *p;
int length;
@@ -394,7 +394,7 @@ print_lcp_config_options(p)
/* CHAP */
-static int
+static void
handle_chap(p, length)
const u_char *p;
int length;
@@ -431,7 +431,7 @@ handle_chap(p, length)
/* PAP */
-static int
+static void
handle_pap(p, length)
const u_char *p;
int length;
@@ -470,7 +470,7 @@ handle_pap(p, length)
/* IPCP */
-static int
+static void
handle_ipcp(p, length)
const u_char *p;
int length;
diff --git a/usr.sbin/tcpdump/print-radius.c b/usr.sbin/tcpdump/print-radius.c
index e3e35a9da5e..09ed2a6e2b5 100644
--- a/usr.sbin/tcpdump/print-radius.c
+++ b/usr.sbin/tcpdump/print-radius.c
@@ -1,5 +1,8 @@
+/* $OpenBSD: print-radius.c,v 1.4 2000/10/03 14:21:56 ho Exp $ */
+
#include <sys/types.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
@@ -63,11 +66,11 @@ struct radius_atable {
static struct radius_atable radius_atts[] = {
-{ RADIUS_ATT_USER_NAME, RD_STRING, "Name", NULL },
-{ RADIUS_ATT_PASSWORD, RD_HEX, "Pass", NULL },
-{ RADIUS_ATT_CHAP_PASS, RD_HEX, "CPass", NULL },
-{ RADIUS_ATT_NAS_IP, RD_ADDRESS, "NAS-IP", NULL },
-{ RADIUS_ATT_NAS_PORT, RD_INT, "NAS-Pt", NULL },
+{ RADIUS_ATT_USER_NAME, RD_STRING, "Name", { NULL } },
+{ RADIUS_ATT_PASSWORD, RD_HEX, "Pass", { NULL } },
+{ RADIUS_ATT_CHAP_PASS, RD_HEX, "CPass", { NULL } },
+{ RADIUS_ATT_NAS_IP, RD_ADDRESS, "NAS-IP", { NULL } },
+{ RADIUS_ATT_NAS_PORT, RD_INT, "NAS-Pt", { NULL } },
{ RADIUS_ATT_USER_SERVICE, RD_INT, "USvc",
{ "", "Login", "Framed", "DB-Lgn", "DB-Frm", "Out", "Shell", NULL } },
@@ -75,38 +78,38 @@ static struct radius_atable radius_atts[] = {
{ RADIUS_ATT_PROTOCOL, RD_INT, "FProt",
{ "", "PPP", "SLIP", NULL } },
-{ RADIUS_ATT_FRAMED_ADDRESS, RD_ADDRESS, "F-IP", NULL },
-{ RADIUS_ATT_NETMASK, RD_ADDRESS, "F-Msk", NULL },
-{ RADIUS_ATT_ROUTING, RD_INT, "F-Rtg", NULL },
-{ RADIUS_ATT_FILTER, RD_STRING, "FltID", NULL },
-{ RADIUS_ATT_MTU, RD_INT, "F-MTU", NULL },
-{ RADIUS_ATT_COMPRESSION, RD_INT, "F-Comp", NULL },
-{ RADIUS_ATT_LOGIN_HOST, RD_ADDRESS, "L-Hst", NULL },
+{ RADIUS_ATT_FRAMED_ADDRESS, RD_ADDRESS, "F-IP", { NULL } },
+{ RADIUS_ATT_NETMASK, RD_ADDRESS, "F-Msk", { NULL } },
+{ RADIUS_ATT_ROUTING, RD_INT, "F-Rtg", { NULL } },
+{ RADIUS_ATT_FILTER, RD_STRING, "FltID", { NULL } },
+{ RADIUS_ATT_MTU, RD_INT, "F-MTU", { NULL } },
+{ RADIUS_ATT_COMPRESSION, RD_INT, "F-Comp", { NULL } },
+{ RADIUS_ATT_LOGIN_HOST, RD_ADDRESS, "L-Hst", { NULL } },
{ RADIUS_ATT_LOGIN_SERVICE, RD_INT, "L-Svc",
{ "", "Telnt", "Rlog", "Clear", "PortM", NULL } },
-{ RADIUS_ATT_LOGIN_TCP_PORT, RD_INT, "L-Pt", NULL },
-{ RADIUS_ATT_OLD_PASSWORD, RD_HEX, "OPass", NULL },
-{ RADIUS_ATT_PORT_MESSAGE, RD_STRING, "PMsg", NULL },
-{ RADIUS_ATT_DIALBACK_NO, RD_STRING, "DB#", NULL },
-{ RADIUS_ATT_DIALBACK_NAME, RD_STRING, "DBNm", NULL },
-{ RADIUS_ATT_EXPIRATION, RD_DATE, "PExp", NULL },
-{ RADIUS_ATT_FRAMED_ROUTE, RD_STRING, "F-Rt", NULL },
-{ RADIUS_ATT_FRAMED_IPX, RD_ADDRESS, "F-IPX", NULL },
-{ RADIUS_ATT_CHALLENGE_STATE, RD_STRING, "CState", NULL },
-{ RADIUS_ATT_CLASS, RD_STRING, "Class", NULL },
-{ RADIUS_ATT_VENDOR_SPECIFIC, RD_HEX, "Vendor", NULL },
-{ RADIUS_ATT_SESSION_TIMEOUT, RD_INT, "S-TO", NULL },
-{ RADIUS_ATT_IDLE_TIMEOUT, RD_INT, "I-TO", NULL },
-{ RADIUS_ATT_TERMINATE_ACTION, RD_INT, "TermAct", NULL },
-{ RADIUS_ATT_CALLED_ID, RD_STRING, "Callee", NULL },
-{ RADIUS_ATT_CALLER_ID, RD_STRING, "Caller", NULL },
+{ RADIUS_ATT_LOGIN_TCP_PORT, RD_INT, "L-Pt", { NULL } },
+{ RADIUS_ATT_OLD_PASSWORD, RD_HEX, "OPass", { NULL } },
+{ RADIUS_ATT_PORT_MESSAGE, RD_STRING, "PMsg", { NULL } },
+{ RADIUS_ATT_DIALBACK_NO, RD_STRING, "DB#", { NULL } },
+{ RADIUS_ATT_DIALBACK_NAME, RD_STRING, "DBNm", { NULL } },
+{ RADIUS_ATT_EXPIRATION, RD_DATE, "PExp", { NULL } },
+{ RADIUS_ATT_FRAMED_ROUTE, RD_STRING, "F-Rt", { NULL } },
+{ RADIUS_ATT_FRAMED_IPX, RD_ADDRESS, "F-IPX", { NULL } },
+{ RADIUS_ATT_CHALLENGE_STATE, RD_STRING, "CState", { NULL } },
+{ RADIUS_ATT_CLASS, RD_STRING, "Class", { NULL } },
+{ RADIUS_ATT_VENDOR_SPECIFIC, RD_HEX, "Vendor", { NULL } },
+{ RADIUS_ATT_SESSION_TIMEOUT, RD_INT, "S-TO", { NULL } },
+{ RADIUS_ATT_IDLE_TIMEOUT, RD_INT, "I-TO", { NULL } },
+{ RADIUS_ATT_TERMINATE_ACTION, RD_INT, "TermAct", { NULL } },
+{ RADIUS_ATT_CALLED_ID, RD_STRING, "Callee", { NULL } },
+{ RADIUS_ATT_CALLER_ID, RD_STRING, "Caller", { NULL } },
{ RADIUS_ATT_STATUS_TYPE, RD_INT, "Stat",
{ "", "Start", "Stop", NULL } },
-{ -1, -1, NULL, NULL }
+{ -1, -1, NULL, { NULL } }
};
@@ -236,6 +239,7 @@ void radius_print(register const u_char *data, u_int len) {
else
pp = data + RADFIXEDSZ;
+ i = 0; /* XXX I don't see what 'i' is supposed to do here. */
while(l) {
if(!i) fputc(',', stdout); i = 0;
diff --git a/usr.sbin/tcpdump/print-rip.c b/usr.sbin/tcpdump/print-rip.c
index b25aaeb576c..fddadd701e8 100644
--- a/usr.sbin/tcpdump/print-rip.c
+++ b/usr.sbin/tcpdump/print-rip.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: print-rip.c,v 1.8 2000/10/03 14:21:57 ho Exp $ */
+
/*
* Copyright (c) 1989, 1990, 1991, 1993, 1994, 1996
* The Regents of the University of California. All rights reserved.
@@ -21,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-rip.c,v 1.7 2000/06/18 09:39:28 jakob Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-rip.c,v 1.8 2000/10/03 14:21:57 ho Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -36,6 +38,7 @@ static const char rcsid[] =
#include <netinet/udp_var.h>
#include <stdio.h>
+#include <ctype.h>
#include "interface.h"
#include "addrtoname.h"
@@ -171,9 +174,11 @@ rip_print(const u_char *dat, u_int length)
case 0:
/* RFC 1058 */
printf(" RIPv0: ");
+#if 0 /* XXX this is broken, ni is uninitialized */
rip_printblk((u_char *)&ni->rip_family,
(u_char *)&ni->rip_metric +
sizeof(ni->rip_metric));
+#endif
break;
default:
switch (rp->rip_cmd) {
diff --git a/usr.sbin/tcpdump/print-tcp.c b/usr.sbin/tcpdump/print-tcp.c
index 71c2d665596..aa47da701b1 100644
--- a/usr.sbin/tcpdump/print-tcp.c
+++ b/usr.sbin/tcpdump/print-tcp.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: print-tcp.c,v 1.12 2000/10/03 14:21:56 ho Exp $ */
+
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
@@ -21,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-tcp.c,v 1.11 2000/04/26 21:35:43 jakob Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-tcp.c,v 1.12 2000/10/03 14:21:56 ho Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -172,8 +174,8 @@ tcp_print(register const u_char *bp, register u_int length,
register u_char flags;
register int hlen;
register char ch;
- register struct tcp_seq_hash *th;
- register int rev;
+ register struct tcp_seq_hash *th = NULL;
+ register int rev = 0;
u_int16_t sport, dport, win, urp;
tcp_seq seq, ack;
#ifdef INET6
@@ -475,7 +477,7 @@ tcp_print(register const u_char *bp, register u_int length,
e -= th->ack;
}
}
- (void) printf("{%u:%u} ", s, e);
+ (void) printf("{%lu:%lu} ", s, e);
}
break;
}
diff --git a/usr.sbin/tcpdump/print-udp.c b/usr.sbin/tcpdump/print-udp.c
index a52b37a9317..370f5a1e488 100644
--- a/usr.sbin/tcpdump/print-udp.c
+++ b/usr.sbin/tcpdump/print-udp.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: print-udp.c,v 1.14 2000/10/03 14:21:57 ho Exp $ */
+
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
* The Regents of the University of California. All rights reserved.
@@ -21,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-udp.c,v 1.13 2000/05/05 17:12:08 jakob Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-udp.c,v 1.14 2000/10/03 14:21:57 ho Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -450,7 +452,7 @@ udp_print(register const u_char *bp, u_int length, register const u_char *bp2)
cp = rtcp_print(cp, ep);
break;
case PT_CNFP:
- cnfp_print(cp, length, ip);
+ cnfp_print(cp, length, (u_char *)ip);
break;
}
return;
diff --git a/usr.sbin/tcpdump/tcpdump.c b/usr.sbin/tcpdump/tcpdump.c
index ff35de965c3..e620922dace 100644
--- a/usr.sbin/tcpdump/tcpdump.c
+++ b/usr.sbin/tcpdump/tcpdump.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: tcpdump.c,v 1.19 2000/10/03 14:21:57 ho Exp $ */
+
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
@@ -24,7 +26,7 @@ static const char copyright[] =
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n\
The Regents of the University of California. All rights reserved.\n";
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/tcpdump.c,v 1.18 2000/04/30 05:23:28 ericj Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/tcpdump.c,v 1.19 2000/10/03 14:21:57 ho Exp $ (LBL)";
#endif
/*
@@ -46,6 +48,7 @@ static const char rcsid[] =
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <ctype.h>
#include "interface.h"
#include "addrtoname.h"