On Sat, Sep 29, 2018 at 10:26:45PM +0200, Klemens Nanni wrote:
> The build is broken with `-U INET6' anyway and I see no reason to
> disable IPv6 support.
> 
> Removing these macro guards leaves NSD and Unbound as last remaining
> programs in base to have them.
> 
> This diff also fixes an empty redefine for IPPROTO_IPV6 in print-ip.c.
> 
> No object change on amd64 and sparc64 when built with clang.
> Using gcc results in changes on both platforms, but I'm still unsure how
> to handle this.  Testing gcc builds on my machines did not reveal any
> breakage or change in behaviour.
> 
> Feedback? Objections? OK?
> 

Tested on amd64 and octeon, no regress found.

OK denis@

> Index: Makefile
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/Makefile,v
> retrieving revision 1.63
> diff -u -p -r1.63 Makefile
> --- Makefile  3 Feb 2018 13:39:48 -0000       1.63
> +++ Makefile  29 Sep 2018 19:15:37 -0000
> @@ -28,7 +28,7 @@ CFLAGS+=-Wall -I${.CURDIR}/../../sbin/pf
>  # for pcap-int.h
>  CFLAGS+=-I${.CURDIR}/../../lib/libpcap
>  
> -CFLAGS+=-DCSLIP -DPPP -DHAVE_FDDI -DETHER_SERVICE -DHAVE_ETHER_NTOHOST 
> -DINET6
> +CFLAGS+=-DCSLIP -DPPP -DHAVE_FDDI -DETHER_SERVICE -DHAVE_ETHER_NTOHOST
>  
>  LDADD+=      -lpcap -ll -lcrypto
>  DPADD+=      ${LIBL} ${LIBPCAP} ${LIBCRYPTO}
> Index: addrtoname.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/addrtoname.c,v
> retrieving revision 1.37
> diff -u -p -r1.37 addrtoname.c
> --- addrtoname.c      14 Dec 2016 19:12:16 -0000      1.37
> +++ addrtoname.c      29 Sep 2018 18:56:46 -0000
> @@ -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 */
> Index: addrtoname.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/addrtoname.h,v
> retrieving revision 1.11
> diff -u -p -r1.11 addrtoname.h
> --- addrtoname.h      7 Oct 2007 16:41:05 -0000       1.11
> +++ addrtoname.h      29 Sep 2018 18:57:02 -0000
> @@ -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
> Index: interface.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/interface.h,v
> retrieving revision 1.78
> diff -u -p -r1.78 interface.h
> --- interface.h       6 Jul 2018 07:13:21 -0000       1.78
> +++ interface.h       29 Sep 2018 18:57:28 -0000
> @@ -287,7 +287,6 @@ extern void ofp_if_print(u_char *, const
>  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 *, 
>  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);
> Index: print-atm.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-atm.c,v
> retrieving revision 1.12
> diff -u -p -r1.12 print-atm.c
> --- print-atm.c       16 Jan 2015 06:40:21 -0000      1.12
> +++ print-atm.c       29 Sep 2018 18:58:02 -0000
> @@ -104,11 +104,9 @@ atm_if_print(u_char *user, const struct 
>               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:
> Index: print-bgp.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-bgp.c,v
> retrieving revision 1.25
> diff -u -p -r1.25 print-bgp.c
> --- print-bgp.c       30 Aug 2017 09:23:00 -0000      1.25
> +++ print-bgp.c       29 Sep 2018 19:01:34 -0000
> @@ -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 *b
>  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 *at
>               }
>               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 *at
>                                       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 *at
>                       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 *at
>                       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 
>               /*
>                * 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;
>  
> Index: print-dhcp6.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-dhcp6.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 print-dhcp6.c
> --- print-dhcp6.c     18 Nov 2015 15:36:20 -0000      1.10
> +++ print-dhcp6.c     29 Sep 2018 19:02:36 -0000
> @@ -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 leng
>  trunc:
>       printf("%s", tstr);
>  }
> -
> -#endif /* INET6 */
> Index: print-domain.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-domain.c,v
> retrieving revision 1.25
> diff -u -p -r1.25 print-domain.c
> --- print-domain.c    6 Jul 2018 05:47:22 -0000       1.25
> +++ print-domain.c    29 Sep 2018 19:02:47 -0000
> @@ -488,7 +488,6 @@ ns_rprint(const u_char *cp, const u_char
>                       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
>               }
>               break;
>           }
> -#endif /*INET6*/
>  
>       case T_OPT:
>               printf(" UDPsize=%u", class);
> Index: print-ether.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-ether.c,v
> retrieving revision 1.32
> diff -u -p -r1.32 print-ether.c
> --- print-ether.c     3 Apr 2018 01:57:31 -0000       1.32
> +++ print-ether.c     29 Sep 2018 19:03:28 -0000
> @@ -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:
> Index: print-frag6.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-frag6.c,v
> retrieving revision 1.8
> diff -u -p -r1.8 print-frag6.c
> --- print-frag6.c     16 Nov 2015 00:16:39 -0000      1.8
> +++ print-frag6.c     29 Sep 2018 19:03:40 -0000
> @@ -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 */
> Index: print-gtp.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-gtp.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 print-gtp.c
> --- print-gtp.c       6 Jul 2018 05:47:22 -0000       1.10
> +++ print-gtp.c       29 Sep 2018 19:04:30 -0000
> @@ -423,13 +423,11 @@ gtp_print_user_address(const u_char *cp,
>                       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 len
>  
>               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
>               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
>               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_in
>  
>               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
>               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
>               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
>               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:
> Index: print-icmp6.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-icmp6.c,v
> retrieving revision 1.21
> diff -u -p -r1.21 print-icmp6.c
> --- print-icmp6.c     28 Jul 2016 13:05:52 -0000      1.21
> +++ print-icmp6.c     29 Sep 2018 19:04:43 -0000
> @@ -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 */
> Index: print-ip.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-ip.c,v
> retrieving revision 1.50
> diff -u -p -r1.50 print-ip.c
> --- print-ip.c        6 Jul 2018 04:49:21 -0000       1.50
> +++ print-ip.c        29 Sep 2018 19:06:38 -0000
> @@ -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
> Index: print-ip6.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-ip6.c,v
> retrieving revision 1.27
> diff -u -p -r1.27 print-ip6.c
> --- print-ip6.c       29 Sep 2018 15:53:07 -0000      1.27
> +++ print-ip6.c       29 Sep 2018 19:04:59 -0000
> @@ -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 */
> Index: print-ip6opts.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-ip6opts.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 print-ip6opts.c
> --- print-ip6opts.c   16 Nov 2015 00:16:39 -0000      1.5
> +++ print-ip6opts.c   29 Sep 2018 19:06:50 -0000
> @@ -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 */
> Index: print-ipsec.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-ipsec.c,v
> retrieving revision 1.24
> diff -u -p -r1.24 print-ipsec.c
> --- print-ipsec.c     6 Jul 2018 05:47:22 -0000       1.24
> +++ print-ipsec.c     29 Sep 2018 19:07:45 -0000
> @@ -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, c
>       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]");
> Index: print-lwres.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-lwres.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 print-lwres.c
> --- print-lwres.c     6 Jul 2018 05:47:22 -0000       1.9
> +++ print-lwres.c     29 Sep 2018 19:08:07 -0000
> @@ -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++)
> Index: print-nfs.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-nfs.c,v
> retrieving revision 1.22
> diff -u -p -r1.22 print-nfs.c
> --- print-nfs.c       15 Jan 2016 03:03:07 -0000      1.22
> +++ print-nfs.c       29 Sep 2018 19:09:07 -0000
> @@ -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
>  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, 
>               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, 
>               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, c
>       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, c
>                               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, c
>                               cmp = 0;
>                       }
>                       break;
> -#endif /*INET6*/
>               default:
>                       cmp = 0;
>                       break;
> Index: print-null.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-null.c,v
> retrieving revision 1.22
> diff -u -p -r1.22 print-null.c
> --- print-null.c      5 Nov 2015 17:57:37 -0000       1.22
> +++ print-null.c      29 Sep 2018 19:09:38 -0000
> @@ -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
>               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
>               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);
> Index: print-ospf6.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-ospf6.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 print-ospf6.c
> --- print-ospf6.c     16 Nov 2015 00:16:39 -0000      1.9
> +++ print-ospf6.c     29 Sep 2018 19:10:11 -0000
> @@ -24,8 +24,6 @@
>   * OSPF support contributed by Jeffrey Honig (j...@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 leng
>  trunc:
>       fputs(tstr, stdout);
>  }
> -
> -#endif /* INET6 */
> Index: print-pflog.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-pflog.c,v
> retrieving revision 1.31
> diff -u -p -r1.31 print-pflog.c
> --- print-pflog.c     24 May 2017 16:20:26 -0000      1.31
> +++ print-pflog.c     29 Sep 2018 19:10:22 -0000
> @@ -62,9 +62,7 @@ pflog_if_print(u_char *user, const struc
>       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 struc
>                       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:
> Index: print-ripng.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-ripng.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 print-ripng.c
> --- print-ripng.c     6 Jul 2018 05:47:22 -0000       1.6
> +++ print-ripng.c     29 Sep 2018 19:10:53 -0000
> @@ -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 lengt
>       if (rp->rip6_vers != RIP6_VERSION)
>               printf(" [vers %d]", rp->rip6_vers);
>  }
> -#endif /* INET6 */
> Index: print-rt6.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-rt6.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 print-rt6.c
> --- print-rt6.c       16 Nov 2015 00:16:39 -0000      1.6
> +++ print-rt6.c       29 Sep 2018 19:11:01 -0000
> @@ -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
>       fputs(", [|srcrt]", stdout);
>       return 65535;           /* XXX */
>  }
> -#endif /* INET6 */
> Index: print-sl.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-sl.c,v
> retrieving revision 1.20
> diff -u -p -r1.20 print-sl.c
> --- print-sl.c        30 Oct 2017 10:07:44 -0000      1.20
> +++ print-sl.c        29 Sep 2018 19:11:12 -0000
> @@ -101,11 +101,9 @@ sl_if_print(u_char *user, const struct 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);
>       }
> Index: print-tcp.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-tcp.c,v
> retrieving revision 1.37
> diff -u -p -r1.37 print-tcp.c
> --- print-tcp.c       16 Nov 2016 13:47:27 -0000      1.37
> +++ print-tcp.c       29 Sep 2018 19:13:04 -0000
> @@ -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_c
>  #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
>       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_h
>  
>       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
>       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
>       }
>  
>       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
>       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
>                       (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
>                * 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
>                               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
>                               (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
>                               (void)printf(" [tcp sum ok]");
>               }
>       }
> -#endif
>  
>       /* OS Fingerprint */
>       if (oflag && (flags & (TH_SYN|TH_ACK)) == TH_SYN) {
> Index: print-udp.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-udp.c,v
> retrieving revision 1.50
> diff -u -p -r1.50 print-udp.c
> --- print-udp.c       10 Jul 2018 00:38:52 -0000      1.50
> +++ print-udp.c       29 Sep 2018 19:13:42 -0000
> @@ -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_ch
>  #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
>               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
>                           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
>                       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);
> 

Reply via email to