Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jun 1995 08:40:02 -0700
From:      Christopher Sean Hilton <chris@vindaloo.com>
To:        freebsd-bugs
Subject:   bin/569: Slattach behaviour inconsistant
Message-ID:  <199506271540.IAA18543@freefall.cdrom.com>
In-Reply-To: Your message of Tue, 27 Jun 1995 09:51:23 -0500 <199506271451.JAA00314@dagobah.vindaloo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

>Number:         569
>Category:       bin
>Synopsis:       Slattach behaviour inconsistant
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 27 08:40:01 1995
>Originator:     Christopher Sean Hilton
>Organization:
>Release:        FreeBSD 2.1.0-Development i386
>Environment:


>Description:

Slattach's behaviour when configuring the the slip interface through
the -u option is inconsistant and can cause problems when using
multiple slip interfaces. In it's current form slattach does nothing
to cleanup the interface on Termination. With my setup, SLIP to my
internet provider and SLIP to my laptop, this can lead to having both
slip interfaces set up with the same address pairs.

>How-To-Repeat:

Put up my SLIP internet connection with no active slip interfaces:

     slattach -a -h -u slipconfig -s 57600 /dev/cua01

     This assigns and configures sl0 to my slip - to internet 
     connection.

Attach my laptop to my main machine. 

     slattach -a -h -u laptopconfig -s 57600 /dev/cua00

     This assigns and configures sl1 to connect my laptop to my
     desktop machine.

Kill the slip connection to my Internet Provider.

     This detaches the interface sl0 but doesn't provide a mechanism
     for reflecting that change in the interface (e.g. I'd have to 
     manually ifconfig sl0 delete down here to remove it's routing
     and addresses.)

Kill the slip connection to my laptop.

     Same as above.

Reestablish the connection to my laptop.

     This won't work because sl0 and sl1 are now programmed for the
     same address pairs with the same routing metric. In order for
     this to work I'd have to manually delete the configuration in
     sl1.

>Fix:
	
Change slattach to run the configure script with parameters
current_unit -1 upon termination of the slattach daemon. (E.g.

     slattach -u slipconfig

runs:
     slipconfig 0 -1 

on termination if it has slip interface #0.

Further, the scripts to configure interfaces would be more symetric if
on startup the configuration script was called with a parameter of -1
for the old interface on startup. This call on interface startup:

     slipconfig -1 0

makes the script to configure the interfaces look like this:

old_unit=$1
new_unit=$2

if [ $old_unit != -1 ]; then
	ifconfig sl$old_unit delete down
	if [ $new_unit == -1 ]; then
		route delete default
	fi
fi

if [ $new_unit != -1]; then
	ifconfig sl$new_unit address1 address2 mtu 1006
	if [ $old_unit == -1 ]; then
		route add default address2
	fi
fi

Here are the diff's to the current slattach to make this all happen:

-------------------------
358,364d357
< 
<         /* 
< 	 * I don't like this behaviour. It removes some symetry that would make
<          * writing a little clearer. E.g. on the first call you go from no 
<          * slip interface (-1) to some slip interface. 
<          */
< #if 0         
367d359
< #endif
461,476d452
< 
< 	/*
<          * Send the configure interface command with a new unit of -1
< 	 * This way the script can delete the interface after use.
< 	 */
< 
< 	if (config_cmd) {
< 		char *s;
< 		s = (char*) malloc(strlen(config_cmd) + 32);
< 		sprintf (s, "%s %d %d", config_cmd, unit, -1);
< 		syslog(LOG_NOTICE, "Configuring %s (sl%d):", dev, unit);
< 		syslog(LOG_NOTICE, "  '%s'", s);
< 		system(s);
< 		free (s);
< 		unit = -1;
< 	}

-------------------------

I've been using this for the past couple of days and I'm sold.

C.

=~~--~~==~~--~~==~~--~~==~~--~~==~~--~~==~~--~~==~~--~~==~~--~~==~~--~~=
"Never tell me the odds."      | Chris Hilton <chris@chilton.chi.il.us>
                     -Han Solo | For PGP Key: finger chilton@mcs.net
-~~==~~--~~==~~--~~==~~--~~==~~--~~==~~--~~==~~--~~==~~--~~==~~--~~==~~-
>Audit-Trail:
>Unformatted:





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