Subject: misc/12381: INET_ONLY version of ifconfig does not build in 1.5-release
To: None <gnats-bugs@gnats.netbsd.org>
From: None <andreas@planix.com>
List: netbsd-bugs
Date: 03/11/2001 12:21:16
>Number:         12381
>Category:       misc
>Synopsis:       INET_ONLY version of ifconfig does not build for bootfloopy
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 11 09:22:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Andreas Wrede
>Release:        <NetBSD-current source date>
>Organization:
Planix, Inc.
>Environment:
	
System: NetBSD woffi.planix.com 1.5.1_ALPHA NetBSD 1.5.1_ALPHA (PLANIX-IPv6) #5: Mon Feb 26 10:38:04 EST 2001 root@woffi.planix.com:/usr/src/sys/arch/i386/compile/WOFFI i386


>Description:
	
The INET_ONLY version of ifconfig.c fails to compile because of
recently added vlan and cloning support.
>How-To-Repeat:
	
cd /usr/src/distrib/i386
make
>Fix:
	
The following patch removes vlan and clone support from ifconfig.c 
when INET_ONLY is defined. Note, the patch based on the 1.5-release branch

Index: ifconfig.c
===================================================================
RCS file: /u5/NetBSD-CVS/main/basesrc/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.79.4.6
diff -c -r1.79.4.6 ifconfig.c
*** ifconfig.c	2001/01/26 01:37:09	1.79.4.6
--- ifconfig.c	2001/03/11 16:52:02
***************
*** 93,99 ****
--- 93,101 ----
  #include <net/if_media.h>
  #include <net/if_ether.h>
  #include <net/if_ieee80211.h>
+ #ifndef INET_ONLY
  #include <net/if_vlanvar.h>
+ #endif
  #include <netinet/in.h>
  #include <netinet/in_var.h>
  #ifdef INET6
***************
*** 149,155 ****
--- 151,159 ----
  #endif
  int	reset_if_flags;
  int	explicit_prefix = 0;
+ #ifndef INET_ONLY
  u_int	vlan_tag = (u_int)-1;
+ #endif
  
  void 	notealias __P((const char *, int));
  void 	notrailers __P((const char *, int));
***************
*** 181,192 ****
--- 185,200 ----
  void	setmediaopt __P((const char *, int));
  void	unsetmediaopt __P((const char *, int));
  void	setmediainst __P((const char *, int));
+ #ifndef INET_ONLY
  void	clone_create __P((const char *, int));
  void	clone_destroy __P((const char *, int));
+ #endif
  void	fixnsel __P((struct sockaddr_iso *));
+ #ifndef INET_ONLY
  void	setvlan __P((const char *, int));
  void	setvlanif __P((const char *, int));
  void	unsetvlanif __P((const char *, int));
+ #endif
  int	main __P((int, char *[]));
  
  /*
***************
*** 260,274 ****
--- 268,286 ----
  	{ "tunnel",	NEXTARG2,	0,		NULL,
  							settunnel } ,
  	{ "deletetunnel", 0,		0,		deletetunnel },
+ #ifndef INET_ONLY
  	{ "vlan",	NEXTARG,	0,		setvlan } ,
  	{ "vlanif",	NEXTARG,	0,		setvlanif } ,
  	{ "-vlanif",	0,		0,		unsetvlanif } ,
+ #endif  /* INET_ONLY */
  	{ "deletetunnel", 0,		0,		deletetunnel },
+ #ifndef INET_ONLY
  #if 0
  	/* XXX `create' special-cased below */
  	{ "create",	0,		0,		clone_create } ,
  #endif
  	{ "destroy",	0,		0,		clone_destroy } ,
+ #endif
  	{ "link0",	IFF_LINK0,	0,		setifflags } ,
  	{ "-link0",	-IFF_LINK0,	0,		setifflags } ,
  	{ "link1",	IFF_LINK1,	0,		setifflags } ,
***************
*** 289,295 ****
--- 301,309 ----
  int	carrier __P((void));
  void	getsock __P((int));
  void	printall __P((void));
+ #ifndef INET_ONLY
  void	list_cloners __P((void));
+ #endif
  void 	printb __P((const char *, unsigned short, const char *));
  int	prefix __P((void *, int));
  void 	status __P((const u_int8_t *, int));
***************
*** 331,337 ****
--- 345,353 ----
  
  void	ieee80211_status __P((void));
  void	tunnel_status __P((void));
+ #ifndef INET_ONLY
  void	vlan_status __P((void));
+ #endif
  
  /* Known address families */
  struct afswtch {
***************
*** 385,391 ****
  
  	/* Parse command-line options */
  	aflag = mflag = 0;
! 	while ((ch = getopt(argc, argv, "AabCdlmsu"
  #ifdef INET6
  					"L"
  #endif
--- 401,410 ----
  
  	/* Parse command-line options */
  	aflag = mflag = 0;
! 	while ((ch = getopt(argc, argv, "Aabdlmsu"
! #ifdef INET_ONLY
! 					"C"
! #endif
  #ifdef INET6
  					"L"
  #endif
***************
*** 403,412 ****
  			bflag = 1;
  			break;
  			
! 
  		case 'C':
  			Cflag = 1;
  			break;
  
  		case 'd':
  			dflag = 1;
--- 422,432 ----
  			bflag = 1;
  			break;
  			
! #ifndef INET_ONLY
  		case 'C':
  			Cflag = 1;
  			break;
+ #endif 
  
  		case 'd':
  			dflag = 1;
***************
*** 460,471 ****
--- 480,493 ----
  #endif
  	if (lflag && Cflag)
  		usage();
+ #ifndef INET_ONLY
  	if (Cflag) {
  		if (argc)
  			usage();
  		list_cloners();
  		exit(0);
  	}
+ #endif
  	if (aflag || lflag) {
  		if (argc > 1)
  			usage();
***************
*** 492,503 ****
--- 514,527 ----
  	 * NOTE:  We must special-case the `create' command right
  	 * here as we would otherwise fail in getinfo().
  	 */
+ #ifndef INET_ONLY
  	if (argc > 0 && strcmp(argv[0], "create") == 0) {
  		clone_create(argv[0], 0);
  		argc--, argv++;
  		if (argc == 0)
  			exit(0);
  	}
+ #endif
  
  	/* Check for address family. */
  	afp = NULL;
***************
*** 822,828 ****
  		putchar('\n');
  #endif
  }
! 
  void
  list_cloners(void)
  {
--- 846,852 ----
  		putchar('\n');
  #endif
  }
! #ifndef INET_ONLY
  void
  list_cloners(void)
  {
***************
*** 890,896 ****
  	if (ioctl(s, SIOCIFDESTROY, &ifr) < 0)
  		err(1, "SIOCIFDESTROY");
  }
! 
  #define RIDADDR 0
  #define ADDR	1
  #define MASK	2
--- 914,920 ----
  	if (ioctl(s, SIOCIFDESTROY, &ifr) < 0)
  		err(1, "SIOCIFDESTROY");
  }
! #endif
  #define RIDADDR 0
  #define ADDR	1
  #define MASK	2
***************
*** 999,1005 ****
  	if (ioctl(s, SIOCDIFPHYADDR, &ifr) < 0)
  		err(1, "SIOCDIFPHYADDR");
  }
! 
  void setvlan(val, d)
  	const char *val;
  	int d;
--- 1023,1029 ----
  	if (ioctl(s, SIOCDIFPHYADDR, &ifr) < 0)
  		err(1, "SIOCDIFPHYADDR");
  }
! #ifndef INET_ONLY
  void setvlan(val, d)
  	const char *val;
  	int d;
***************
*** 1076,1082 ****
  	if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1)
  		err(EXIT_FAILURE, "SIOCSETVLAN");
  }
! 
  void
  setifnetmask(addr, d)
  	const char *addr;
--- 1100,1106 ----
  	if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1)
  		err(EXIT_FAILURE, "SIOCSETVLAN");
  }
! #endif
  void
  setifnetmask(addr, d)
  	const char *addr;
***************
*** 1801,1807 ****
--- 1825,1833 ----
  	putchar('\n');
  
  	ieee80211_status();
+ #ifndef INET_ONLY
  	vlan_status();
+ #endif
  	tunnel_status();
  
  	if (ap && alen > 0) {
***************
*** 1970,1976 ****
  	printf("\ttunnel inet%s %s --> %s\n", ver,
  	    psrcaddr, pdstaddr);
  }
! 
  void
  vlan_status()
  {
--- 1996,2002 ----
  	printf("\ttunnel inet%s %s --> %s\n", ver,
  	    psrcaddr, pdstaddr);
  }
! #ifndef INET_ONLY
  void
  vlan_status()
  {
***************
*** 1991,1997 ****
  		    vlr.vlr_tag, vlr.vlr_parent[0] == '\0' ?
  		    "<none>" : vlr.vlr_parent);
  }
! 
  void
  in_alias(creq)
  	struct ifreq *creq;
--- 2017,2023 ----
  		    vlr.vlr_tag, vlr.vlr_parent[0] == '\0' ?
  		    "<none>" : vlr.vlr_parent);
  }
! #endif
  void
  in_alias(creq)
  	struct ifreq *creq;

>Release-Note:
>Audit-Trail:
>Unformatted: