NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/10911 (ifconfig requires address to set netmask, broadcast)



The following reply was made to PR bin/10911; it has been noted by GNATS.

From: Martin Husemann <martin%duskware.de@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/10911 (ifconfig requires address to set netmask, broadcast)
Date: Thu, 18 Aug 2022 17:04:54 +0200

 I like this suggestion - and it is easy to implement.
 
 Martin
 
 Index: ifconfig.c
 ===================================================================
 RCS file: /cvsroot/src/sbin/ifconfig/ifconfig.c,v
 retrieving revision 1.248
 diff -u -p -r1.248 ifconfig.c
 --- ifconfig.c	14 Oct 2020 13:37:14 -0000	1.248
 +++ ifconfig.c	18 Aug 2022 15:02:27 -0000
 @@ -994,6 +994,9 @@ setifnetmask(prop_dictionary_t env, prop
  {
  	prop_data_t d;
  
 +	if (prop_dictionary_get(env, "address") == NULL)
 +		errx(EXIT_FAILURE, "can not set netmask without address");
 +
  	d = (prop_data_t)prop_dictionary_get(env, "dstormask");
  	assert(d != NULL);
  
 @@ -1015,6 +1018,9 @@ setifbroadaddr(prop_dictionary_t env, pr
  	if ((flags & IFF_BROADCAST) == 0)
  		errx(EXIT_FAILURE, "not a broadcast interface");
  
 +	if (prop_dictionary_get(env, "address") == NULL)
 +		errx(EXIT_FAILURE, "can not set broadcast without address");
 +
  	d = (prop_data_t)prop_dictionary_get(env, "broadcast");
  	assert(d != NULL);
  
 


Home | Main Index | Thread Index | Old Index