summaryrefslogtreecommitdiff
path: root/usr.sbin/tcpdump
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2018-10-22 16:12:46 +0000
committerkn <kn@cvs.openbsd.org>2018-10-22 16:12:46 +0000
commit8590e4d240b850c595cbb0ca38c38b018e89ead8 (patch)
tree477ac9a4c05c39280eb4b7bccd2d6ab4f0ac78ae /usr.sbin/tcpdump
parent118fae76bd8258bcbbb2758eb76bc098a24b71c8 (diff)
Remove #ifdef INET6
There's not reason to build without IPv6 support, `-U INET6' builds were broken anyway. Fix an empty redefine for IPPROTO_IPV6 in print-ip.c while here. No object change on amd64 and sparc64 with clang, gcc compiles differently but behaviour stays the same. OK denis deraadt
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r--usr.sbin/tcpdump/addrtoname.c11
-rw-r--r--usr.sbin/tcpdump/addrtoname.h10
-rw-r--r--usr.sbin/tcpdump/interface.h6
-rw-r--r--usr.sbin/tcpdump/print-atm.c4
-rw-r--r--usr.sbin/tcpdump/print-bgp.c44
-rw-r--r--usr.sbin/tcpdump/print-dhcp6.c6
-rw-r--r--usr.sbin/tcpdump/print-domain.c4
-rw-r--r--usr.sbin/tcpdump/print-ether.c8
-rw-r--r--usr.sbin/tcpdump/print-frag6.c5
-rw-r--r--usr.sbin/tcpdump/print-gtp.c18
-rw-r--r--usr.sbin/tcpdump/print-icmp6.c7
-rw-r--r--usr.sbin/tcpdump/print-ip.c6
-rw-r--r--usr.sbin/tcpdump/print-ip6.c6
-rw-r--r--usr.sbin/tcpdump/print-ip6opts.c4
-rw-r--r--usr.sbin/tcpdump/print-ipsec.c13
-rw-r--r--usr.sbin/tcpdump/print-lwres.c2
-rw-r--r--usr.sbin/tcpdump/print-nfs.c20
-rw-r--r--usr.sbin/tcpdump/print-null.c11
-rw-r--r--usr.sbin/tcpdump/print-ospf6.c6
-rw-r--r--usr.sbin/tcpdump/print-pflog.c6
-rw-r--r--usr.sbin/tcpdump/print-ripng.c5
-rw-r--r--usr.sbin/tcpdump/print-rt6.c5
-rw-r--r--usr.sbin/tcpdump/print-sl.c4
-rw-r--r--usr.sbin/tcpdump/print-tcp.c47
-rw-r--r--usr.sbin/tcpdump/print-udp.c13
25 files changed, 38 insertions, 233 deletions
diff --git a/usr.sbin/tcpdump/addrtoname.c b/usr.sbin/tcpdump/addrtoname.c
index efae59212a6..693fa3b08b7 100644
--- a/usr.sbin/tcpdump/addrtoname.c
+++ b/usr.sbin/tcpdump/addrtoname.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: addrtoname.c,v 1.37 2016/12/14 19:12:16 jca Exp $ */
+/* $OpenBSD: addrtoname.c,v 1.38 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -34,10 +34,7 @@ struct rtentry;
#include <netinet/in.h>
#include <netinet/if_ether.h>
-
-#ifdef INET6
#include <netinet/ip6.h>
-#endif
#include <arpa/inet.h>
@@ -78,7 +75,6 @@ struct hnamemem eprototable[HASHNAMESIZE];
struct hnamemem dnaddrtable[HASHNAMESIZE];
struct hnamemem llcsaptable[HASHNAMESIZE];
-#ifdef INET6
struct h6namemem {
struct in6_addr addr;
char *name;
@@ -86,7 +82,6 @@ struct h6namemem {
};
struct h6namemem h6nametable[HASHNAMESIZE];
-#endif /* INET6 */
struct enamemem {
u_short e_addr0;
@@ -234,7 +229,6 @@ getname(const u_char *ap)
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.
@@ -293,7 +287,6 @@ getname6(const u_char *ap)
p->name = savestr(cp);
return (p->name);
}
-#endif /* INET6 */
static char hex[] = "0123456789abcdef";
@@ -902,7 +895,6 @@ newhnamemem(void)
return (p);
}
-#ifdef INET6
/* Return a zero'ed h6namemem struct and cuts down on calloc() overhead */
struct h6namemem *
newh6namemem(void)
@@ -921,4 +913,3 @@ newh6namemem(void)
p = ptr++;
return (p);
}
-#endif /* INET6 */
diff --git a/usr.sbin/tcpdump/addrtoname.h b/usr.sbin/tcpdump/addrtoname.h
index 4f9db79788d..ea31c969fcd 100644
--- a/usr.sbin/tcpdump/addrtoname.h
+++ b/usr.sbin/tcpdump/addrtoname.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: addrtoname.h,v 1.11 2007/10/07 16:41:05 deraadt Exp $ */
+/* $OpenBSD: addrtoname.h,v 1.12 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1990, 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: addrtoname.h,v 1.11 2007/10/07 16:41:05 deraadt Exp $ (LBL)
+ * @(#) $Id: addrtoname.h,v 1.12 2018/10/22 16:12:45 kn Exp $ (LBL)
*/
#ifndef BYTE_ORDER
@@ -39,18 +39,12 @@ extern char *tcpport_string(u_short);
extern char *udpport_string(u_short);
extern char *ipproto_string(u_int);
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 --git a/usr.sbin/tcpdump/interface.h b/usr.sbin/tcpdump/interface.h
index 5f83d7f12a5..83bd145e8e2 100644
--- a/usr.sbin/tcpdump/interface.h
+++ b/usr.sbin/tcpdump/interface.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.h,v 1.78 2018/07/06 07:13:21 dlg Exp $ */
+/* $OpenBSD: interface.h,v 1.79 2018/10/22 16:12:45 kn 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.78 2018/07/06 07:13:21 dlg Exp $ (LBL)
+ * @(#) $Id: interface.h,v 1.79 2018/10/22 16:12:45 kn Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@@ -287,7 +287,6 @@ extern void ofp_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern void usbpcap_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
-#ifdef INET6
extern void ip6_print(const u_char *, u_int);
extern void ip6_opt_print(const u_char *, int);
extern int hbhopt_print(const u_char *);
@@ -298,7 +297,6 @@ extern void ripng_print(const u_char *, int);
extern int rt6_print(const u_char *, const u_char *);
extern void ospf6_print(const u_char *, u_int);
extern void dhcp6_print(const u_char *, u_int, u_short, u_short);
-#endif /*INET6*/
extern uint32_t in_cksum_add(const void *, size_t, uint32_t);
extern uint16_t in_cksum_fini(uint32_t);
diff --git a/usr.sbin/tcpdump/print-atm.c b/usr.sbin/tcpdump/print-atm.c
index f9b1fdb94e8..edcf81eee3b 100644
--- a/usr.sbin/tcpdump/print-atm.c
+++ b/usr.sbin/tcpdump/print-atm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-atm.c,v 1.12 2015/01/16 06:40:21 deraadt Exp $ */
+/* $OpenBSD: print-atm.c,v 1.13 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1994, 1995, 1996, 1997
@@ -104,11 +104,9 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
ip_print(p, length);
break;
-#ifdef INET6
case ETHERTYPE_IPV6:
ip6_print(p, length);
break;
-#endif /*INET6*/
/*XXX this probably isn't right */
case ETHERTYPE_ARP:
diff --git a/usr.sbin/tcpdump/print-bgp.c b/usr.sbin/tcpdump/print-bgp.c
index 9fa40ed6369..bc9ee5c20d1 100644
--- a/usr.sbin/tcpdump/print-bgp.c
+++ b/usr.sbin/tcpdump/print-bgp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-bgp.c,v 1.25 2017/08/30 09:23:00 otto Exp $ */
+/* $OpenBSD: print-bgp.c,v 1.26 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (C) 1999 WIDE Project.
@@ -387,7 +387,6 @@ trunc:
return -2;
}
-#ifdef INET6
static int
decode_prefix6(const u_char *pd, char *buf, u_int buflen)
{
@@ -417,7 +416,6 @@ decode_prefix6(const u_char *pd, char *buf, u_int buflen)
trunc:
return -2;
}
-#endif
static int
bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
@@ -614,13 +612,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
}
p += 3;
- if (af == AFNUM_INET)
- ;
-#ifdef INET6
- else if (af == AFNUM_INET6)
- ;
-#endif
- else
+ if (af != AFNUM_INET && af != AFNUM_INET6)
break;
TCHECK(p[0]);
@@ -635,13 +627,11 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
printf(" %s", getname(p + 1 + i));
i += sizeof(struct in_addr);
break;
-#ifdef INET6
case AFNUM_INET6:
TCHECK2(p[1+i], sizeof(struct in6_addr));
printf(" %s", getname6(p + 1 + i));
i += sizeof(struct in6_addr);
break;
-#endif
default:
printf(" (unknown af)");
i = tlen; /*exit loop*/
@@ -671,11 +661,9 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
case AFNUM_INET:
advance = decode_prefix4(p, buf, sizeof(buf));
break;
-#ifdef INET6
case AFNUM_INET6:
advance = decode_prefix6(p, buf, sizeof(buf));
break;
-#endif
default:
printf(" (unknown af)");
advance = 0;
@@ -710,11 +698,9 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
case AFNUM_INET:
advance = decode_prefix4(p, buf, sizeof(buf));
break;
-#ifdef INET6
case AFNUM_INET6:
advance = decode_prefix6(p, buf, sizeof(buf));
break;
-#endif
default:
printf(" (unknown af)");
advance = 0;
@@ -900,31 +886,9 @@ bgp_update_print(const u_char *dat, int length)
/*
* Without keeping state from the original NLRI message,
* it's not possible to tell if this a v4 or v6 route,
- * so only try to decode it if we're not v6 enabled.
- */
-#ifdef INET6
+ * so do not try to decode it.
+ */
printf(" (Withdrawn routes: %d bytes)", len);
-#else
- char buf[HOST_NAME_MAX+1 + 100];
- int wpfx;
-
- TCHECK2(p[2], len);
- i = 2;
-
- printf(" (Withdrawn routes:");
-
- while(i < 2 + len) {
- wpfx = decode_prefix4(&p[i], buf, sizeof(buf));
- if (wpfx == -1) {
- printf(" (illegal prefix length)");
- break;
- } else if (wpfx == -2)
- goto trunc;
- i += wpfx;
- printf(" %s", buf);
- }
- printf(")");
-#endif
}
p += 2 + len;
diff --git a/usr.sbin/tcpdump/print-dhcp6.c b/usr.sbin/tcpdump/print-dhcp6.c
index 25a08846c88..95d24fa21c4 100644
--- a/usr.sbin/tcpdump/print-dhcp6.c
+++ b/usr.sbin/tcpdump/print-dhcp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-dhcp6.c,v 1.10 2015/11/18 15:36:20 mmcc Exp $ */
+/* $OpenBSD: print-dhcp6.c,v 1.11 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (C) 1998 and 1999 WIDE Project.
@@ -29,8 +29,6 @@
* SUCH DAMAGE.
*/
-#ifdef INET6
-
#include <sys/time.h>
#include <sys/socket.h>
@@ -329,5 +327,3 @@ dhcp6_print(const u_char *cp, u_int length,
trunc:
printf("%s", tstr);
}
-
-#endif /* INET6 */
diff --git a/usr.sbin/tcpdump/print-domain.c b/usr.sbin/tcpdump/print-domain.c
index b7d39f5e947..58f1e1c98c8 100644
--- a/usr.sbin/tcpdump/print-domain.c
+++ b/usr.sbin/tcpdump/print-domain.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-domain.c,v 1.25 2018/07/06 05:47:22 dlg Exp $ */
+/* $OpenBSD: print-domain.c,v 1.26 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -488,7 +488,6 @@ ns_rprint(const u_char *cp, const u_char *bp, int is_mdns)
EXTRACT_16BITS(cp), EXTRACT_16BITS(cp + 2));
break;
-#ifdef INET6
case T_AAAA:
if (!TTEST2(*cp, sizeof(struct in6_addr)))
return(NULL);
@@ -521,7 +520,6 @@ ns_rprint(const u_char *cp, const u_char *bp, int is_mdns)
}
break;
}
-#endif /*INET6*/
case T_OPT:
printf(" UDPsize=%u", class);
diff --git a/usr.sbin/tcpdump/print-ether.c b/usr.sbin/tcpdump/print-ether.c
index 72093a5b34a..a3163a8057b 100644
--- a/usr.sbin/tcpdump/print-ether.c
+++ b/usr.sbin/tcpdump/print-ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ether.c,v 1.32 2018/04/03 01:57:31 dlg Exp $ */
+/* $OpenBSD: print-ether.c,v 1.33 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -31,6 +31,7 @@ struct rtentry;
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>
+#include <netinet/ip6.h>
#include <netinet/ip_var.h>
#include <netinet/udp.h>
#include <netinet/udp_var.h>
@@ -39,9 +40,6 @@ struct rtentry;
#include <stdio.h>
#include <pcap.h>
-#ifdef INET6
-#include <netinet/ip6.h>
-#endif
#include "interface.h"
#include "addrtoname.h"
@@ -192,11 +190,9 @@ recurse:
ip_print(p, length);
return (1);
-#ifdef INET6
case ETHERTYPE_IPV6:
ip6_print(p, length);
return (1);
-#endif /*INET6*/
case ETHERTYPE_ARP:
case ETHERTYPE_REVARP:
diff --git a/usr.sbin/tcpdump/print-frag6.c b/usr.sbin/tcpdump/print-frag6.c
index 40a97f162d5..d608c9cda3c 100644
--- a/usr.sbin/tcpdump/print-frag6.c
+++ b/usr.sbin/tcpdump/print-frag6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-frag6.c,v 1.8 2015/11/16 00:16:39 mmcc Exp $ */
+/* $OpenBSD: print-frag6.c,v 1.9 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994
@@ -21,8 +21,6 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#ifdef INET6
-
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -84,4 +82,3 @@ trunc:
return 65535;
#undef TCHECK
}
-#endif /* INET6 */
diff --git a/usr.sbin/tcpdump/print-gtp.c b/usr.sbin/tcpdump/print-gtp.c
index 3f6f6b90fa8..71005b5b97b 100644
--- a/usr.sbin/tcpdump/print-gtp.c
+++ b/usr.sbin/tcpdump/print-gtp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-gtp.c,v 1.10 2018/07/06 05:47:22 dlg Exp $ */
+/* $OpenBSD: print-gtp.c,v 1.11 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 2009, 2010 Joel Sing <jsing@openbsd.org>
*
@@ -423,13 +423,11 @@ gtp_print_user_address(const u_char *cp, u_int len)
printf(": %s", ipaddr_string(cp));
else
printf(": IPv4");
-#ifdef INET6
} else if (org == 0x1 && type == 0x57) {
if (len == 18)
printf(": %s", ip6addr_string(cp));
else
printf(": IPv6");
-#endif
} else
printf(" (org 0x%x, type 0x%x)", org, type);
}
@@ -521,10 +519,8 @@ gtp_v0_print(const u_char *cp, u_int length, u_short sport, u_short dport)
if (version == 4)
ip_print(cp, len);
-#ifdef INET6
else if (version == 6)
ip6_print(cp, len);
-#endif
else
printf("Unknown IP version %u", version);
@@ -807,10 +803,8 @@ gtp_v0_print_tlv(const u_char *cp, u_int value)
printf("GSN Address");
if (len == 4)
printf(": %s", ipaddr_string(cp));
-#ifdef INET6
else if (len == 16)
printf(": %s", ip6addr_string(cp));
-#endif
break;
case GTPV0_TLV_MS_ISDN:
@@ -854,10 +848,8 @@ gtp_v0_print_tlv(const u_char *cp, u_int value)
printf("Recommended Node");
if (len == 4)
printf(": %s", ipaddr_string(cp));
-#ifdef INET6
else if (len == 16)
printf(": %s", ip6addr_string(cp));
-#endif
break;
case GTPV0_TLV_PRIVATE_EXTENSION:
@@ -1014,10 +1006,8 @@ gtp_v1_print_user(const u_char *cp, u_int hlen, struct gtp_v1_hdr *gh)
if (version == 4)
ip_print(cp, len);
-#ifdef INET6
else if (version == 6)
ip6_print(cp, len);
-#endif
else
printf("Unknown IP version %u", version);
@@ -1402,10 +1392,8 @@ gtp_v1_print_tlv(const u_char *cp, u_int value)
printf("GSN Address");
if (len == 4)
printf(": %s", ipaddr_string(cp));
-#ifdef INET6
else if (len == 16)
printf(": %s", ip6addr_string(cp));
-#endif
break;
case GTPV1_TLV_MSISDN:
@@ -1766,10 +1754,8 @@ gtp_v1_print_tlv(const u_char *cp, u_int value)
printf("Charging Gateway");
if (len == 4)
printf(": %s", ipaddr_string(cp));
-#ifdef INET6
else if (len == 16)
printf(": %s", ip6addr_string(cp));
-#endif
break;
case GTPV1_TLV_DATA_RECORD_PACKET:
@@ -1797,10 +1783,8 @@ gtp_v1_print_tlv(const u_char *cp, u_int value)
printf("Address of Recommended Node");
if (len == 4)
printf(": %s", ipaddr_string(cp));
-#ifdef INET6
else if (len == 16)
printf(": %s", ip6addr_string(cp));
-#endif
break;
case GTPV1_TLV_PRIVATE_EXTENSION:
diff --git a/usr.sbin/tcpdump/print-icmp6.c b/usr.sbin/tcpdump/print-icmp6.c
index 5823fd4c11b..b95e9fa297d 100644
--- a/usr.sbin/tcpdump/print-icmp6.c
+++ b/usr.sbin/tcpdump/print-icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-icmp6.c,v 1.21 2016/07/28 13:05:52 bluhm Exp $ */
+/* $OpenBSD: print-icmp6.c,v 1.22 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994
@@ -21,8 +21,6 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#ifdef INET6
-
#include <ctype.h>
#include <sys/time.h>
@@ -885,6 +883,3 @@ trunc:
(void)printf("[|icmp6]");
return;
}
-
-
-#endif /* INET6 */
diff --git a/usr.sbin/tcpdump/print-ip.c b/usr.sbin/tcpdump/print-ip.c
index 20bef72e9b3..5d6d8735110 100644
--- a/usr.sbin/tcpdump/print-ip.c
+++ b/usr.sbin/tcpdump/print-ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ip.c,v 1.50 2018/07/06 04:49:21 dlg Exp $ */
+/* $OpenBSD: print-ip.c,v 1.51 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -441,9 +441,8 @@ ip_print(const u_char *bp, u_int length)
}
break;
-#ifdef INET6
#ifndef IPPROTO_IPV6
-#define IPPROTO_IPV6
+#define IPPROTO_IPV6 41
#endif
case IPPROTO_IPV6:
/* ip6-in-ip encapsulation */
@@ -457,7 +456,6 @@ ip_print(const u_char *bp, u_int length)
goto out;
}
break;
-#endif /*INET6*/
#ifndef IPPROTO_GRE
#define IPPROTO_GRE 47
diff --git a/usr.sbin/tcpdump/print-ip6.c b/usr.sbin/tcpdump/print-ip6.c
index 541b6cb3558..615742d71d5 100644
--- a/usr.sbin/tcpdump/print-ip6.c
+++ b/usr.sbin/tcpdump/print-ip6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ip6.c,v 1.27 2018/09/29 15:53:07 kn Exp $ */
+/* $OpenBSD: print-ip6.c,v 1.28 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994
@@ -21,8 +21,6 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#ifdef INET6
-
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -244,5 +242,3 @@ ip6_print(const u_char *bp, u_int length)
packetp = pktp;
snapend = send;
}
-
-#endif /* INET6 */
diff --git a/usr.sbin/tcpdump/print-ip6opts.c b/usr.sbin/tcpdump/print-ip6opts.c
index eb2e9c602ac..36036cfc365 100644
--- a/usr.sbin/tcpdump/print-ip6opts.c
+++ b/usr.sbin/tcpdump/print-ip6opts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ip6opts.c,v 1.5 2015/11/16 00:16:39 mmcc Exp $ */
+/* $OpenBSD: print-ip6opts.c,v 1.6 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -29,7 +29,6 @@
* SUCH DAMAGE.
*/
-#ifdef INET6
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -151,4 +150,3 @@ dstopt_print(const u_char *bp)
fputs("[|DSTOPT]", stdout);
return(dstoptlen);
}
-#endif /* INET6 */
diff --git a/usr.sbin/tcpdump/print-ipsec.c b/usr.sbin/tcpdump/print-ipsec.c
index 733ecdb75cc..cee2fcaaed5 100644
--- a/usr.sbin/tcpdump/print-ipsec.c
+++ b/usr.sbin/tcpdump/print-ipsec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ipsec.c,v 1.24 2018/07/06 05:47:22 dlg Exp $ */
+/* $OpenBSD: print-ipsec.c,v 1.25 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
@@ -31,6 +31,7 @@
#include <netinet/in.h>
#include <netinet/ip.h>
+#include <netinet/ip6.h>
#include <netinet/ip_var.h>
#include <netinet/udp.h>
#include <netinet/udp_var.h>
@@ -41,10 +42,6 @@
#include <string.h>
#include <unistd.h>
-#ifdef INET6
-#include <netinet/ip6.h>
-#endif
-
#include "addrtoname.h"
#include "interface.h"
#include "extract.h" /* must come after interface.h */
@@ -233,22 +230,16 @@ ah_print (const u_char *bp, u_int len, const u_char *bp2)
const struct ip *ip;
const struct ah_hdr *ah;
u_int pl_len = len;
-#ifdef INET6
const struct ip6_hdr *ip6;
-#endif
ip = (const struct ip *)bp2;
-#ifdef INET6
if (ip->ip_v == 6) {
ip6 = (const struct ip6_hdr *)bp2;
printf("ah %s > %s", ip6addr_string(&ip6->ip6_src),
ip6addr_string(&ip6->ip6_dst));
} else
-#endif
- {
printf("ah %s > %s",
ipaddr_string(&ip->ip_src), ipaddr_string(&ip->ip_dst));
- }
if (pl_len < sizeof(struct ah_hdr)) {
printf("[|ah]");
diff --git a/usr.sbin/tcpdump/print-lwres.c b/usr.sbin/tcpdump/print-lwres.c
index 685012f96a6..441009e3792 100644
--- a/usr.sbin/tcpdump/print-lwres.c
+++ b/usr.sbin/tcpdump/print-lwres.c
@@ -323,12 +323,10 @@ lwres_printaddr(lwres_addr_t *ap)
printf(" %s", ipaddr_string(p));
p += sizeof(struct in_addr);
break;
-#ifdef INET6
case 2: /* IPv6 */
printf(" %s", ip6addr_string(p));
p += sizeof(struct in6_addr);
break;
-#endif
default:
printf(" %lu/", (unsigned long)ntohl(ap->family));
for (i = 0; i < l; i++)
diff --git a/usr.sbin/tcpdump/print-nfs.c b/usr.sbin/tcpdump/print-nfs.c
index 1fdc56af4f7..774144ddefe 100644
--- a/usr.sbin/tcpdump/print-nfs.c
+++ b/usr.sbin/tcpdump/print-nfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-nfs.c,v 1.22 2016/01/15 03:03:07 mmcc Exp $ */
+/* $OpenBSD: print-nfs.c,v 1.23 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -31,11 +31,8 @@ struct rtentry;
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>
-#include <netinet/ip_var.h>
-
-#ifdef INET6
#include <netinet/ip6.h>
-#endif /*INET6*/
+#include <netinet/ip_var.h>
#include <rpc/rpc.h>
@@ -748,13 +745,8 @@ nfs_printfh(const u_int32_t *dp, const u_int len)
struct xid_map_entry {
u_int32_t xid; /* transaction ID (net order) */
int ipver; /* IP version (4 or 6) */
-#ifdef INET6
struct in6_addr client; /* client IP address (net order) */
struct in6_addr server; /* server IP address (net order) */
-#else
- struct in_addr client; /* client IP address (net order) */
- struct in_addr server; /* server IP address (net order) */
-#endif /*INET6*/
u_int32_t proc; /* call proc number (host order) */
u_int32_t vers; /* program version (host order) */
};
@@ -776,9 +768,7 @@ static void
xid_map_enter(const struct rpc_msg *rp, const u_char *bp)
{
struct ip *ip = NULL;
-#ifdef INET6
struct ip6_hdr *ip6 = NULL;
-#endif /*INET6*/
struct xid_map_entry *xmep;
ip = (struct ip *)bp;
@@ -796,7 +786,6 @@ xid_map_enter(const struct rpc_msg *rp, const u_char *bp)
memcpy(&xmep->client, &ip->ip_src, sizeof(ip->ip_src));
memcpy(&xmep->server, &ip->ip_dst, sizeof(ip->ip_dst));
break;
-#ifdef INET6
case 6:
ip6 = (struct ip6_hdr *)bp;
memcpy(&xmep->client, &ip6->ip6_src, sizeof(ip6->ip6_src));
@@ -804,7 +793,6 @@ xid_map_enter(const struct rpc_msg *rp, const u_char *bp)
break;
default:
return;
-#endif /*INET6*/
}
xmep->proc = ntohl(rp->rm_call.cb_proc);
xmep->vers = ntohl(rp->rm_call.cb_vers);
@@ -822,9 +810,7 @@ xid_map_find(const struct rpc_msg *rp, const u_char *bp, u_int32_t *proc,
struct xid_map_entry *xmep;
u_int32_t xid = rp->rm_xid;
struct ip *ip = (struct ip *)bp;
-#ifdef INET6
struct ip6_hdr *ip6 = (struct ip6_hdr *)bp;
-#endif /*INET6*/
int cmp;
/* Start searching from where we last left off */
@@ -843,7 +829,6 @@ xid_map_find(const struct rpc_msg *rp, const u_char *bp, u_int32_t *proc,
cmp = 0;
}
break;
-#ifdef INET6
case 6:
if (memcmp(&ip6->ip6_src, &xmep->server,
sizeof(ip6->ip6_src)) != 0 ||
@@ -852,7 +837,6 @@ xid_map_find(const struct rpc_msg *rp, const u_char *bp, u_int32_t *proc,
cmp = 0;
}
break;
-#endif /*INET6*/
default:
cmp = 0;
break;
diff --git a/usr.sbin/tcpdump/print-null.c b/usr.sbin/tcpdump/print-null.c
index 707e856a3c8..a42b3599a86 100644
--- a/usr.sbin/tcpdump/print-null.c
+++ b/usr.sbin/tcpdump/print-null.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-null.c,v 1.22 2015/11/05 17:57:37 jca Exp $ */
+/* $OpenBSD: print-null.c,v 1.23 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
@@ -32,6 +32,7 @@ struct rtentry;
#include <netinet/in.h>
#include <netinet/ip.h>
+#include <netinet/ip6.h>
#include <netinet/if_ether.h>
#include <netinet/ip_var.h>
#include <netinet/udp.h>
@@ -42,10 +43,6 @@ struct rtentry;
#include <stdio.h>
#include <string.h>
-#ifdef INET6
-#include <netinet/ip6.h>
-#endif
-
#include "interface.h"
#include "addrtoname.h"
@@ -76,11 +73,9 @@ null_print(const u_char *p, const struct ip *ip, u_int length)
printf("ip: ");
break;
-#ifdef INET6
case AF_INET6:
printf("ip6: ");
break;
-#endif
case AF_NS:
printf("ns: ");
@@ -142,11 +137,9 @@ null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
ip_print(p + NULL_HDRLEN, length);
break;
-#ifdef INET6
case AF_INET6:
ip6_print(p + NULL_HDRLEN, length);
break;
-#endif /*INET6*/
case AF_MPLS:
mpls_print(p + NULL_HDRLEN, length);
diff --git a/usr.sbin/tcpdump/print-ospf6.c b/usr.sbin/tcpdump/print-ospf6.c
index 6cf665bb3b3..a683c01b0e1 100644
--- a/usr.sbin/tcpdump/print-ospf6.c
+++ b/usr.sbin/tcpdump/print-ospf6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ospf6.c,v 1.9 2015/11/16 00:16:39 mmcc Exp $ */
+/* $OpenBSD: print-ospf6.c,v 1.10 2018/10/22 16:12:45 kn Exp $ */
/*
@@ -24,8 +24,6 @@
* OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu)
*/
-#ifdef INET6
-
#include <sys/time.h>
#include <sys/socket.h>
@@ -657,5 +655,3 @@ ospf6_print(const u_char *bp, u_int length)
trunc:
fputs(tstr, stdout);
}
-
-#endif /* INET6 */
diff --git a/usr.sbin/tcpdump/print-pflog.c b/usr.sbin/tcpdump/print-pflog.c
index 7fbf4605517..26475f9df33 100644
--- a/usr.sbin/tcpdump/print-pflog.c
+++ b/usr.sbin/tcpdump/print-pflog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-pflog.c,v 1.31 2017/05/24 16:20:26 bluhm Exp $ */
+/* $OpenBSD: print-pflog.c,v 1.32 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
@@ -62,9 +62,7 @@ pflog_if_print(u_char *user, const struct pcap_pkthdr *h,
u_int hdrlen;
u_int caplen = h->caplen;
const struct ip *ip;
-#ifdef INET6
const struct ip6_hdr *ip6;
-#endif
const struct pfloghdr *hdr;
u_int8_t af;
@@ -178,13 +176,11 @@ pflog_if_print(u_char *user, const struct pcap_pkthdr *h,
default_print((const u_char *)ip,
caplen - hdrlen);
} else {
-#ifdef INET6
ip6 = (struct ip6_hdr *)(p + hdrlen);
ip6_print((const u_char *)ip6, length);
if (xflag)
default_print((const u_char *)ip6,
caplen - hdrlen);
-#endif
}
out:
diff --git a/usr.sbin/tcpdump/print-ripng.c b/usr.sbin/tcpdump/print-ripng.c
index 9d16bf00508..46d3b7a63a8 100644
--- a/usr.sbin/tcpdump/print-ripng.c
+++ b/usr.sbin/tcpdump/print-ripng.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ripng.c,v 1.6 2018/07/06 05:47:22 dlg Exp $ */
+/* $OpenBSD: print-ripng.c,v 1.7 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1989, 1990, 1991, 1993, 1994
@@ -21,8 +21,6 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#ifdef INET6
-
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -115,4 +113,3 @@ ripng_print(const u_char *dat, int length)
if (rp->rip6_vers != RIP6_VERSION)
printf(" [vers %d]", rp->rip6_vers);
}
-#endif /* INET6 */
diff --git a/usr.sbin/tcpdump/print-rt6.c b/usr.sbin/tcpdump/print-rt6.c
index 1928cec7f7a..5f293811c8a 100644
--- a/usr.sbin/tcpdump/print-rt6.c
+++ b/usr.sbin/tcpdump/print-rt6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-rt6.c,v 1.6 2015/11/16 00:16:39 mmcc Exp $ */
+/* $OpenBSD: print-rt6.c,v 1.7 2018/10/22 16:12:45 kn Exp $ */
/*
@@ -22,8 +22,6 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#ifdef INET6
-
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -109,4 +107,3 @@ rt6_print(const u_char *bp, const u_char *bp2)
fputs(", [|srcrt]", stdout);
return 65535; /* XXX */
}
-#endif /* INET6 */
diff --git a/usr.sbin/tcpdump/print-sl.c b/usr.sbin/tcpdump/print-sl.c
index 9a49b03e8fb..72eb2625333 100644
--- a/usr.sbin/tcpdump/print-sl.c
+++ b/usr.sbin/tcpdump/print-sl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-sl.c,v 1.20 2017/10/30 10:07:44 mpi Exp $ */
+/* $OpenBSD: print-sl.c,v 1.21 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1989, 1990, 1991, 1993, 1994, 1995, 1996, 1997
@@ -101,11 +101,9 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
case 4:
ip_print((u_char *)ip, length);
break;
-#ifdef INET6
case 6:
ip6_print((u_char *)ip, length);
break;
-#endif
default:
printf ("ip v%d", ip->ip_v);
}
diff --git a/usr.sbin/tcpdump/print-tcp.c b/usr.sbin/tcpdump/print-tcp.c
index 16928ed0d8a..6317cbc355f 100644
--- a/usr.sbin/tcpdump/print-tcp.c
+++ b/usr.sbin/tcpdump/print-tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-tcp.c,v 1.37 2016/11/16 13:47:27 reyk Exp $ */
+/* $OpenBSD: print-tcp.c,v 1.38 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -26,6 +26,7 @@
#include <netinet/in.h>
#include <netinet/ip.h>
+#include <netinet/ip6.h>
#include <netinet/ip_var.h>
#include <netinet/tcp.h>
#include <net/if.h>
@@ -38,10 +39,6 @@
#include <string.h>
#include <unistd.h>
-#ifdef INET6
-#include <netinet/ip6.h>
-#endif
-
#include "interface.h"
#include "addrtoname.h"
#include "extract.h"
@@ -94,13 +91,8 @@ static void print_tcp_rst_data(const u_char *sp, u_int length);
#endif
struct tha {
-#ifndef INET6
- struct in_addr src;
- struct in_addr dst;
-#else
struct in6_addr src;
struct in6_addr dst;
-#endif /*INET6*/
u_int port;
};
@@ -155,7 +147,6 @@ static int tcp_cksum(const struct ip *ip, const struct tcphdr *tp, int len)
return in_cksum((u_short *)tp, len, sum);
}
-#ifdef INET6
static int tcp6_cksum(const struct ip6_hdr *ip6, const struct tcphdr *tp,
u_int len)
{
@@ -184,8 +175,6 @@ static int tcp6_cksum(const struct ip6_hdr *ip6, const struct tcphdr *tp,
return in_cksum((u_short *)tp, len, sum);
}
-#endif
-
void
tcp_print(const u_char *bp, u_int length, const u_char *bp2)
@@ -199,24 +188,18 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2)
int rev = 0;
u_int16_t sport, dport, win, urp;
tcp_seq seq, ack;
-#ifdef INET6
const struct ip6_hdr *ip6;
-#endif
tp = (struct tcphdr *)bp;
switch (((struct ip *)bp2)->ip_v) {
case 4:
ip = (struct ip *)bp2;
-#ifdef INET6
ip6 = NULL;
-#endif
break;
-#ifdef INET6
case 6:
ip = NULL;
ip6 = (struct ip6_hdr *)bp2;
break;
-#endif
default:
(void)printf("invalid ip version");
return;
@@ -229,14 +212,11 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2)
}
if (!TTEST(tp->th_dport)) {
-#ifdef INET6
if (ip6) {
(void)printf("%s > %s: [|tcp]",
ip6addr_string(&ip6->ip6_src),
ip6addr_string(&ip6->ip6_dst));
- } else
-#endif /*INET6*/
- {
+ } else {
(void)printf("%s > %s: [|tcp]",
ipaddr_string(&ip->ip_src),
ipaddr_string(&ip->ip_dst));
@@ -247,7 +227,6 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2)
sport = ntohs(tp->th_sport);
dport = ntohs(tp->th_dport);
-#ifdef INET6
if (ip6) {
if (ip6->ip6_nxt == IPPROTO_TCP) {
(void)printf("%s.%s > %s.%s: ",
@@ -259,9 +238,7 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2)
(void)printf("%s > %s: ",
tcpport_string(sport), tcpport_string(dport));
}
- } else
-#endif /*INET6*/
- {
+ } else {
if (ip->ip_p == IPPROTO_TCP) {
(void)printf("%s.%s > %s.%s: ",
ipaddr_string(&ip->ip_src),
@@ -330,7 +307,6 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2)
* collating order so there's only one entry for
* both directions).
*/
-#ifdef INET6
bzero(&tha, sizeof(tha));
rev = 0;
if (ip6) {
@@ -372,19 +348,6 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2)
tha.port = sport << 16 | dport;
}
}
-#else
- if (sport < dport ||
- (sport == dport &&
- ip->ip_src.s_addr < ip->ip_dst.s_addr)) {
- tha.src = ip->ip_src, tha.dst = ip->ip_dst;
- tha.port = sport << 16 | dport;
- rev = 0;
- } else {
- tha.src = ip->ip_dst, tha.dst = ip->ip_src;
- tha.port = dport << 16 | sport;
- rev = 1;
- }
-#endif
for (th = &tcp_seq_hash[tha.port % TSEQ_HASHSIZE];
th->nxt; th = th->nxt)
@@ -429,7 +392,6 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2)
(void)printf(" [tcp sum ok]");
}
}
-#ifdef INET6
if (ip6 && ip6->ip6_plen && vflag) {
if (TTEST2(tp->th_sport, length)) {
u_int16_t sum, tcp_sum;
@@ -442,7 +404,6 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2)
(void)printf(" [tcp sum ok]");
}
}
-#endif
/* OS Fingerprint */
if (oflag && (flags & (TH_SYN|TH_ACK)) == TH_SYN) {
diff --git a/usr.sbin/tcpdump/print-udp.c b/usr.sbin/tcpdump/print-udp.c
index f1d8d47e4d9..f27ff8959a7 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.50 2018/07/10 00:38:52 dlg Exp $ */
+/* $OpenBSD: print-udp.c,v 1.51 2018/10/22 16:12:45 kn Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
@@ -26,6 +26,7 @@
#include <netinet/in.h>
#include <netinet/ip.h>
+#include <netinet/ip6.h>
#include <netinet/ip_var.h>
#include <netinet/udp.h>
#include <netinet/udp_var.h>
@@ -49,10 +50,6 @@
#include <stdio.h>
#include <string.h>
-#ifdef INET6
-#include <netinet/ip6.h>
-#endif
-
#include "interface.h"
#include "addrtoname.h"
#include "extract.h"
@@ -318,11 +315,9 @@ rtcp_print(const u_char *hdr, const u_char *ep)
#define MULTICASTDNS_PORT 5353
#define MPLS_PORT 6635
-#ifdef INET6
#define RIPNG_PORT 521 /*XXX*/
#define DHCP6_PORT1 546 /*XXX*/
#define DHCP6_PORT2 547 /*XXX*/
-#endif
void
udp_print(const u_char *bp, u_int length, const void *iph)
@@ -343,7 +338,6 @@ udp_print(const u_char *bp, u_int length, const void *iph)
ipv = ip->ip_v;
switch (ipv) {
-#ifdef INET6
case 6: {
const struct ip6_hdr *ip6 = iph;
@@ -356,7 +350,6 @@ udp_print(const u_char *bp, u_int length, const void *iph)
sizeof(ip6->ip6_dst), cksum);
break;
}
-#endif /*INET6*/
case 4:
ipsrc = ipaddr_string(&ip->ip_src);
ipdst = ipaddr_string(&ip->ip_dst);
@@ -570,13 +563,11 @@ udp_print(const u_char *bp, u_int length, const void *iph)
vxlan_print(cp, length);
else if (ISPORT(MPLS_PORT))
mpls_print(cp, length);
-#ifdef INET6
else if (ISPORT(RIPNG_PORT))
ripng_print(cp, length);
else if (ISPORT(DHCP6_PORT1) || ISPORT(DHCP6_PORT2)) {
dhcp6_print(cp, length, sport, dport);
}
-#endif /*INET6*/
else if (ISPORT(GTP_C_PORT) || ISPORT(GTP_U_PORT) ||
ISPORT(GTP_PRIME_PORT))
gtp_print(cp, length, sport, dport);