Subject: bin/5394: usr.sbin/tcpdump does not compile
To: None <gnats-bugs@gnats.netbsd.org>
From: Chad Mynhier <mynhier@priapus.rmt.utk.edu>
List: netbsd-bugs
Date: 05/02/1998 17:00:33
>Number:         5394
>Category:       bin
>Synopsis:       tcpdump does not compile due to include problems
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May  2 14:05:00 1998
>Last-Modified:
>Originator:     Chad Mynhier
>Organization:
>Release:        NetBSD-current as of Sat May  2 14:33:29 EDT 1998
>Environment:
	
System: NetBSD priapus 1.3E NetBSD 1.3E (PRIAPUS) #11: Thu Apr 9 14:04:42 EDT 1998 root@priapus:/home/mynhier/netbsd/source-current/src/sys/arch/i386/compile/PRIAPUS i386


>Description:
	
	During a make build, I got error messages similar to the following:

priapus# pwd
/usr/src/usr.sbin/tcpdump
priapus# make
cc -O  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith  -DHAVE_FCNTL_H=1 -DHAVE_MALLOC_H=1 -DHAVE_MEMORY_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_NET_SLIP_H=1 -DHAVE_VFPRINTF=1 -DHAVE_STRCASECMP=1 -DHAVE_ETHER_NTOA=1 -DHAVE_SETLINEBUF=1 -DRETSIGTYPE=void -DRETSIGVAL= -DHAVE_SIGACTION=1 -DHAVE_SOCKADDR_SA_LEN=1 -DHAVE_FDDI -DLBL_ALIGN -c print-tcp.c
In file included from /usr/include/netinet/ip_var.h:42,
                 from print-tcp.c:40:
/usr/include/net/route.h:57: field `ro_dst' has incomplete type
In file included from /usr/include/netinet/ip_var.h:42,
                 from print-tcp.c:40:
/usr/include/net/route.h:119: field `rt_dst' has incomplete type
/usr/include/net/route.h:120: field `rt_gateway' has incomplete type
*** Error code 1

Stop.
priapus# 


	I stuck a '#include <sys/socket.h>' in /usr/include/net/route.h,
	and it compiled correctly.  I'm not sure exactly where this 
	include needs to occur, in /usr/include/net/route.h, 
	/usr/include/netinet/ip_var.h, or /usr/src/usr.sbin/tcpdump/print-tcp.c.
	Under src/usr.sbin, everything that includes either netinet/ip_var.h
	or net/route.h also includes sys/socket.h, with the exception of
	two:

		usr.sbin/sendmail/src/daemon.c
		usr.sbin/tcpdump/print-tcp.c

	For sendmail, the include of netinet/ip_var.h is wrapped like this:

# if IP_SRCROUTE 
#  include <netinet/in_systm.h>
#  include <netinet/ip.h>
#  include <netinet/ip_var.h>
# endif

	So I'm not tickling the problem when compiling.
	
>How-To-Repeat:
	
	Do a make build with sources as of the listed date.

>Fix:
	

	Here's the patch for /usr/src/sys/net/route.h, although I'm not 
	certain that this is the file that should be fixed:

priapus# diff -c route.h*
*** route.h     Sat May  2 11:55:32 1998
--- route.h.orig        Sat May  2 11:55:07 1998
***************
*** 39,45 ****
  #define _NET_ROUTE_H_
  
  #include <sys/queue.h>
- #include <sys/socket.h>
  
  /*
   * Kernel resident routing tables.
--- 39,44 ----
priapus# 

	Here's a patch for tcpdump, if that's where it should be fixed:

priapus# pwd
/usr/src/usr.sbin/tcpdump
priapus# diff -c print-tcp.c*
*** print-tcp.c Sat May  2 16:56:25 1998
--- print-tcp.c.orig    Sat Oct  4 08:31:39 1997
***************
*** 33,39 ****
  
  #include <sys/param.h>
  #include <sys/time.h>
- #include <sys/socket.h>
  
  #include <netinet/in.h>
  #include <netinet/in_systm.h>
--- 33,38 ----
priapus# 

>Audit-Trail:
>Unformatted: