Subject: bin/2954: pppd doesn't allow "netmask 255.255.255.255"
To: None <gnats-bugs@gnats.netbsd.org>
From: Matthias Scheler <tron@lyssa.owl.de>
List: netbsd-bugs
Date: 11/20/1996 04:44:00
>Number:         2954
>Category:       bin
>Synopsis:       pppd doesn't allow "netmask 255.255.255.255"
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 19 19:50:00 1996
>Last-Modified:
>Originator:     Matthias Scheler
>Organization:
Matthias Scheler
tron@lyssa.owl.de
>Release:        961118
>Environment:
	
System: NetBSD lyssa 1.2B NetBSD 1.2B (LYSSA) #0: Wed Nov 20 01:22:59 MET 1996 tron@lyssa:/usr/src/sys/arch/i386/compile/LYSSA i386


>Description:
Today I discoverd a routing problem on a NetBSD 1.1 driven router system
caused by wrong netmasks on its two PPP interfaces. The netmask was
255.255.255.248 but should have been 255.255.255.255. So I tried to start
"pppd" with "netmask 255.255.255.255" as argument but it didn't work
because it doesn't accept this netmask.


>How-To-Repeat:
/usr/sbin/pppd netmask 255.255.255.255

>Fix:

*** src/usr.sbin/pppd/options.c.orig	Thu Mar 28 14:42:02 1996
--- src/usr.sbin/pppd/options.c	Wed Nov 20 04:40:05 1996
*************** static int
*** 1477,1490 ****
  setnetmask(argv)
      char **argv;
  {
!     u_int32_t mask;
  
!     if ((mask = inet_addr(*argv)) == -1 || (netmask & ~mask) != 0) {
  	fprintf(stderr, "Invalid netmask %s\n", *argv);
  	return 0;
      }
  
!     netmask = mask;
      return (1);
  }
  
--- 1477,1490 ----
  setnetmask(argv)
      char **argv;
  {
!     struct in_addr val;
  
!     if (!inet_aton(*argv, &val) || (netmask & ~val.s_addr) != 0) {
  	fprintf(stderr, "Invalid netmask %s\n", *argv);
  	return 0;
      }
  
!     netmask = val.s_addr;
      return (1);
  }
  
>Audit-Trail:
>Unformatted: