diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2018-07-06 06:43:20 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2018-07-06 06:43:20 +0000 |
commit | 941fda411eeb8fcd2a1959f662fa76b3357c6f8e (patch) | |
tree | 435cfb39e7422955b8ccd44420b855a88b3ca47d | |
parent | be3f94127143aab165f4271e2d1fa7ce991dc13d (diff) |
add "tftp" as a type to use with -T
This forces UDP packets to be parsed as tftp messages, which is useful
to see the DATA and ACK packets. They're usually on high ports which don't
get matched by udp_print, which by default only handled tftp packets on
port 69.
-rw-r--r-- | usr.sbin/tcpdump/interface.h | 5 | ||||
-rw-r--r-- | usr.sbin/tcpdump/print-udp.c | 5 | ||||
-rw-r--r-- | usr.sbin/tcpdump/tcpdump.8 | 4 | ||||
-rw-r--r-- | usr.sbin/tcpdump/tcpdump.c | 4 |
4 files changed, 13 insertions, 5 deletions
diff --git a/usr.sbin/tcpdump/interface.h b/usr.sbin/tcpdump/interface.h index 3ff78122bff..8cd27507a63 100644 --- a/usr.sbin/tcpdump/interface.h +++ b/usr.sbin/tcpdump/interface.h @@ -1,4 +1,4 @@ -/* $OpenBSD: interface.h,v 1.76 2018/07/06 06:35:46 dlg Exp $ */ +/* $OpenBSD: interface.h,v 1.77 2018/07/06 06:43:19 dlg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -20,7 +20,7 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#) $Id: interface.h,v 1.76 2018/07/06 06:35:46 dlg Exp $ (LBL) + * @(#) $Id: interface.h,v 1.77 2018/07/06 06:43:19 dlg Exp $ (LBL) */ #ifndef tcpdump_interface_h @@ -62,6 +62,7 @@ extern char *device; /* as specified by -i */ #define PT_TCP 8 /* TCP */ #define PT_GRE 9 /* Generic Routing Encapsulation (over UDP) */ #define PT_MPLS 10 /* MPLS (over UDP) */ +#define PT_TFTP 11 /* Trivial File Transfer Protocol */ #ifndef min #define min(a,b) ((a)>(b)?(b):(a)) diff --git a/usr.sbin/tcpdump/print-udp.c b/usr.sbin/tcpdump/print-udp.c index 8c5883a642f..3ebe0e96e69 100644 --- a/usr.sbin/tcpdump/print-udp.c +++ b/usr.sbin/tcpdump/print-udp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-udp.c,v 1.46 2018/07/06 06:35:46 dlg Exp $ */ +/* $OpenBSD: print-udp.c,v 1.47 2018/07/06 06:43:19 dlg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 @@ -476,6 +476,9 @@ udp_print(const u_char *bp, u_int length, const void *iph) case PT_MPLS: mpls_print(cp, length); break; + case PT_TFTP: + tftp_print(cp, length); + break; } return; } diff --git a/usr.sbin/tcpdump/tcpdump.8 b/usr.sbin/tcpdump/tcpdump.8 index ca7e558cfdd..2f96fb1b8b0 100644 --- a/usr.sbin/tcpdump/tcpdump.8 +++ b/usr.sbin/tcpdump/tcpdump.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tcpdump.8,v 1.96 2018/07/06 06:35:46 dlg Exp $ +.\" $OpenBSD: tcpdump.8,v 1.97 2018/07/06 06:43:19 dlg Exp $ .\" .\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996 .\" The Regents of the University of California. All rights reserved. @@ -211,6 +211,8 @@ Force packets selected by to be interpreted as the specified .Ar type . Currently known types are +.Cm tftp +.Pq Trivial File Transfer Protocol , .Cm vrrp .Pq Virtual Router Redundancy protocol , .Cm cnfp diff --git a/usr.sbin/tcpdump/tcpdump.c b/usr.sbin/tcpdump/tcpdump.c index 880e3809398..ed0112f9b70 100644 --- a/usr.sbin/tcpdump/tcpdump.c +++ b/usr.sbin/tcpdump/tcpdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcpdump.c,v 1.85 2018/07/06 06:35:46 dlg Exp $ */ +/* $OpenBSD: tcpdump.c,v 1.86 2018/07/06 06:43:19 dlg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -351,6 +351,8 @@ main(int argc, char **argv) packettype = PT_GRE; else if (strcasecmp(optarg, "mpls") == 0) packettype = PT_MPLS; + else if (strcasecmp(optarg, "tftp") == 0) + packettype = PT_TFTP; else if (strcasecmp(optarg, "sack") == 0) /* * kept for compatibility; DEFAULT_SNAPLEN |