Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 Sep 1995 08:48:21 -0700
From:      Paul Traina <pst@shockwave.com>
To:        michael butler <imb@scgt.oz.au>
Cc:        current@freebsd.org
Subject:   Re: pppd & netmask 255.255.255.255 
Message-ID:  <199509061549.IAA12224@precipice.shockwave.com>
In-Reply-To: Your message of "Thu, 07 Sep 1995 01:28:02 %2B1000." <199509061528.BAA15734@asstdc.scgt.oz.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
The problem here is the use of inet_addr().  This function should never
be used when 255.255.255.255 is a legitimate return value (-1).

This needs to be recoded to use inet_aton().

Paul

  From: michael butler <imb@scgt.oz.au>
  Subject: pppd & netmask 255.255.255.255
  I'm currently set up to allow dial-in IP access via a (small) modem pool and
  I have two basic problems that I'm sure other intending ISPs will strike:
  
  i) we have no dynamic allocation of IP numbers :-(
  
  ii) the following code fragment from /usr/src/usr.sbin/pppd/options.c
  refuses a netmask for a host route (255.255.255.255) ..
  
  /*
   * setnetmask - set the netmask to be used on the interface.
   */
  static int
  setnetmask(argv)
      char **argv;
  {
      u_long mask;
  
      if ((mask = inet_addr(*argv)) == -1 || (netmask & ~mask) != 0) {
  	fprintf(stderr, "Invalid netmask %s\n", *argv);
  	return 0;
      }
  
      netmask = mask;
      return (1);
  }
  
  The result is that "ifconfig -a" shows a netmask of 255.255.255.0 :-(. The
  "natural netmask" on this (sub)net is 255.255.255.240 but that's not what I
  want either .. these are single-interface Windows boxes dialling in.
  
  On the same machine, however, gated apparently advertises just the host
  route as intended. gated is configured NOT to export kernel routes (obtained
  via routing socket). Which is wrong .. ifconfig or gated ?
  
  	michael



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509061549.IAA12224>