From chris@vindaloo.com  Tue Jun 27 08:31:53 1995
Received: from kitten.mcs.com (Kitten.mcs.com [192.160.127.90])
          by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id IAA18315
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 Jun 1995 08:31:52 -0700
Received: from mailbox.mcs.com (Mailbox.mcs.com [192.160.127.87]) by kitten.mcs.com (8.6.10/8.6.9) with SMTP id KAA03375 for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 Jun 1995 10:31:50 -0500
Received: by mailbox.mcs.com (/\==/\ Smail3.1.28.1 #28.5)
	id <m0sQcUo-000k7KC@mailbox.mcs.com>; Tue, 27 Jun 95 10:24 CDT
Received: from dagobah.vindaloo.com (dagobah.vindaloo.com [192.168.133.3]) by yavin.vindaloo.com (8.6.12/8.6.12) with ESMTP id JAA04957 for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 Jun 1995 09:51:52 -0500
Received: (chris@localhost) by dagobah.vindaloo.com (8.6.12/8.6.12) id JAA00314; Tue, 27 Jun 1995 09:51:23 -0500
Message-Id: <199506271451.JAA00314@dagobah.vindaloo.com>
Date: Tue, 27 Jun 1995 09:51:23 -0500
From: Christopher Sean Hilton <chris@vindaloo.com>
Reply-To: chris@vindaloo.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: Slattach behaviour inconsistant
X-Send-Pr-Version: 3.2

>Number:         569
>Category:       bin
>Synopsis:       Slattach behaviour inconsistant
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ache
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 27 08:40:01 1995
>Closed-Date:    Sat Feb 17 11:52:15 PST 1996
>Last-Modified:  Sat Feb 17 11:53:10 PST 1996
>Originator:     Christopher Sean Hilton
>Release:        FreeBSD 2.1.0-Development i386
>Organization:
>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
-~~==~~--~~==~~--~~==~~--~~==~~--~~==~~--~~==~~--~~==~~--~~==~~--~~==~~-
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->ache 
Responsible-Changed-By: pst 
Responsible-Changed-When: Wed Feb 7 17:39:12 PST 1996 
Responsible-Changed-Why:  
slip master 
State-Changed-From-To: open->closed 
State-Changed-By: ache 
State-Changed-When: Sat Feb 17 11:52:15 PST 1996 
State-Changed-Why:  
Fix applied 
>Unformatted:


