[pptp-server] pppd netmask problem - can we track it down?

Allan Clark allanc at sco.com
Wed Jul 14 15:06:01 CDT 1999


In the words of "Mr Burns" from "The Simpsons":

"Smithers!  Release the Hounds!"

We could track it down, and if we wanted to, release a ppp-poptop version.

Brian Dupras wrote:

> I'm not a system level programmer for linux, but I think we've either run into
> a bug in pppd, or we've run into a case of mass confusion about a "feature".
> Isn't this where the open source in us should be cracking the code open for
> pppd and seeing what's going on?
>
> >From the pppd man page:
>
>       netmask n
>               Set the interface netmask to n, a 32 bit netmask in
>               "decimal  dot"  notation  (e.g. 255.255.255.0).  If
>               this option is given, the value specified  is  ORed
>               with  the  default netmask[ ... ]
>
> I think it is this OR operation that is either flawed, or we just don't
> understand what it's doing properly.  It would seem that pppd is trying to be
> smart about the netmask setting, but something's not right.

The code you've provided seems to determine the user-specified netmask, but
doesn't do any OR.  Near the end, after it has determined a netmask in "mask" (and
converted to network byte-order):

>     if (*p != 0 || (netmask & ~mask) != 0) {
>  option_error("invalid netmask value '%s'", *argv);
>  return 0;
>     }

Right there it seems to check (*p == 0) for a bad entry value, then it checks an
OR:
(netmask & ~mask) == 0   is ~(~netmask | mask) == 0

The following part:

>     netmask = mask;
>     return (1);
> }

.. sets the netmask, and returns -- it sets the user-specified netmask.  Unless
I'm missing something, this code is not using the "class of the IP address" in
determining the effective netmask -- it's check the user-supplied one, but it
seems to be only checking to see if it's LESS RESTRICTIVE than the existing one
===>> ((netmask & ~mask) == 0) is a check for less-restrictive netmask I think.

Does this function return an error indicating an improper netmask?  Or is it
silently ignored ?

Allan





More information about the pptp-server mailing list