Subject: bin/11720: pppd mishandles IP address directives
To: None <gnats-bugs@gnats.netbsd.org>
From: Donald Lee <donlee@host-199.icompute.com>
List: netbsd-bugs
Date: 12/12/2000 22:25:17
>Number:         11720
>Category:       bin
>Synopsis:       pppd mishandles IP address directives
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 12 22:25:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Donald Lee
>Release:        NetBSD 1.5 release
>Organization:
icompute.com
>Environment:
	PMac 7600
	NetBSD 1.5
	pppd 2.4.0
System: NetBSD pm7600 1.5 NetBSD 1.5 (GENERIC) #1: Sun Nov 19 13:58:47 PST 2000 matt@duel.local:/u1/kobj/GENERIC macppc


>Description:
	The pppd daemon appears to have a problem with
	directive processing that prevents it from handling the "my-ip:rem-ip"
	directive.  This is ignored - apparently only when a speed
	(like 57600) is specified previously in the /etc/ppp/options
	file. (dial-in setup)

	My setup has a bunch of stuff in /etc/ppp/options like

		passive
		login
		57600
		auth
		etc..

	In /etc/ppp/options.tty00 I have

		:209.46.51.200

	and when I run it, pppd complains of needing to use the
	default IP remotely , presumably because it has not "seen"
	this :290... directive.
>How-To-Repeat:
	For dial-up, use the following in /etc/ppp/options:

nodetach	# Don't detach from controlling terminal - no background
auth		# force peer to authenticate
login		# use system login for auth
local		# ignore modem control
passive
crtscts		# Hardware flow control
57600
netmask 255.255.255.240
proxyarp
idle 895
silent
persist

	and in /etc/ppp/options use:

:209.46.51.205

	then try to dial up.  pppd will complain with:

Dec 10 23:31:10 pm7600 pppd[1866]: Could not determine remote IP address: defaul
ting to 10.64.64.64
Dec 10 23:31:10 pm7600 pppd[1866]: Cannot determine ethernet address for proxy A
RP
Dec 10 23:31:10 pm7600 pppd[1866]: local  IP address 209.46.51.199
Dec 10 23:31:10 pm7600 pppd[1866]: remote IP address 10.64.64.64

>Fix:
The (to be) deleted statements below prevent the calling compound if() at
line 342 from ever seeing the ipaddr spec if provided in ppp/options.ttyname.

I think the code is wrong, because it should not check override or
inspeed until *after* it has determined that the input string is
a number.  The code, as is, returns "success" any time it's parsing
an options.xxx file and a speed is already set, which prevents
processing the IP address.

Not sure what this code is supposed to do.  It looks like a dup of the
if() stmt at lined 1356 and 1357, but reversed....  When I remove these
lines, it works again.

/usr/src/usr.sbin/pppd/pppd/options.c:
*** options.c   Tue Oct 17 12:50:28 2000
--- options.mod Mon Dec 11 00:21:55 2000
***************
*** 1348,1355 ****
      char *ptr;
      int spd;

-     if (no_override && inspeed != 0)
-       return 1;
      spd = strtol(arg, &ptr, 0);
      if (ptr == arg || *ptr != 0 || spd == 0)
        return 0;
--- 1348,1353 ----

>Release-Note:
>Audit-Trail:
>Unformatted: