mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-17 16:10:46 +01:00
Recode mask logic to use inet_ntoa() so host routes are valid.
This commit is contained in:
parent
ee1d861fbe
commit
d814fe83bd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=10595
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: options.c,v 1.3 1995/05/24 01:56:52 davidg Exp $";
|
||||
static char rcsid[] = "$Id: options.c,v 1.4 1995/05/30 03:51:14 rgrimes Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@ -1216,14 +1216,14 @@ static int
|
||||
setnetmask(argv)
|
||||
char **argv;
|
||||
{
|
||||
u_long mask;
|
||||
struct in_addr mask;
|
||||
|
||||
if ((mask = inet_addr(*argv)) == -1 || (netmask & ~mask) != 0) {
|
||||
if ((inet_aton(*argv, &mask) < 0) || (netmask & ~mask.s_addr)) {
|
||||
fprintf(stderr, "Invalid netmask %s\n", *argv);
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
netmask = mask;
|
||||
netmask = mask.s_addr;
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user