*BSD News Article 36069


Return to BSD News archive

Xref: sserve comp.sys.next.programmer:17769 comp.protocols.ppp:5923 comp.unix.bsd:14931
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!spool.mu.edu!howland.reston.ans.net!math.ohio-state.edu!jussieu.fr!ensta!itesec!frmug.fr.net!fasterix.frmug.fr.net!fasterix.frmug.fr.net!not-for-mail
From: pb@fasterix.frmug.fr.net (Pierre Beyssac)
Newsgroups: comp.sys.next.programmer,comp.protocols.ppp,comp.unix.bsd
Subject: problem with ppp-2.1.2 interfaces & routes, NextStep3.2/SunOS4.1.3
Date: 23 Sep 1994 02:26:29 +0200
Organization: considered harmful
Lines: 78
Message-ID: <35t7c8$167@fasterix.frmug.fr.net>
NNTP-Posting-Host: fasterix.frmug.fr.net
Keywords: PPP, SunOS, NextStep, routes

I have a problem with PPP interface addresses and routes under
different flavors of BSD Unix (namely, NextStep 3.2 and SunOS
4.1.3).

I remarked this using Philip Prindeville's port of ppp 2.1.2 under
NextStep 3.2, but it seems to be a generic problem.

1) When the interface addresses are set, a route is added by the
   kernel *and* the route for the old adresses is deleted.

   If I try this by hand :

	ifconfig ppp0 1.2.3.4 5.6.7.8

   a netstat -r shows a route for 5.6.7.8.

   Then if I try this :

	ifconfig ppp0 down
	ifconfig ppp1 1.2.3.4 5.6.7.8

   the route for 5.6.7.8 is still there.
   So far, so good, everything works fine.
   Now if I do :
	ifconfig ppp0 9.10.11.12 13.14.15.16
   the route for 5.6.7.8 is deleted, even though the ppp1 interface
   is still up !

   This situation can occur on a dialup server in the following
   circonstances :

	1) "A" connects on ppp0
	2) "B" connects on ppp1
	3) "A" and "B" leave
	4) "B" reconnects, getting ppp0

		at this time, both ppp0 and ppp1 have B as remote
		address.
		ppp0 is up, ppp1 is down.

	5) "anybody" reconnects, getting ppp1.
		ppp1 changes addresses, the route for B is deleted.

   This behaviour shows up in the ppp-2.1.2 implementation, at
   least under NextStep, and possibly under SunOS 4.1.3 as well (I
   have not been able to try the latter, but trying the ifconfigs
   above by hand seems to produce the same result as on NextStep).

   It can be fixed by deleting any route associated with an interface
   when the interface comes down.

   To do this, the only way I've found is :

	do a SIOCSIFADDR (NextStep does not seem to have SIOCDIFADDR)
	to set the interface addresses to 0.0.0.0, 0.0.0.0

	The old route is deleted and a new route is created to
	0.0.0.0 for 0.0.0.0, which is *bad*

	--> delete that route (with SIOCDELRT)

   Is there a cleaner/better way to do this ?

2) A probably related problem is that I don't know, under NextStep
   or SunOS 4, once an interface's addresses have been set, how to
   "remove" them so as to get ifconfig to reply "none" instead of
   something like :

        inet 0.0.0.0 --> 0.0.0.0 netmask ffffff00 

   Is it supposed to be done with SIOCDIFADDR (sorry, it might
   exist under SunOS 4, I don't have one handy :-)) ? How to do
   without it ?
-- 
Pierre Beyssac                  FreeBSD@home: pb@fasterix.frmug.fr.net

FreeBSD, NetBSD, Linux 	-- Il y a moins bien, mais c'est plus cher.
You can also get less bang for more bucks. (translation F. Berjon)