Bug 21489

Summary: /etc/pccard_ether feature request
Product: Base System Reporter: dannyman <dannyman>
Component: confAssignee: Warner Losh <imp>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.1-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description dannyman 2000-09-23 02:22:08 UTC
>Number:         21489
>Category:       conf
>Synopsis:       /etc/pccard_ether feature request
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 22 18:30:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     dannyman
>Release:        FreeBSD 4.1-RELEASE i386
>Organization:
Tellme Networks
>Environment:
>Description:

In trying to get my WaveLAN card to work, I found I needed to change a default
config with wicontrol prior to configuring the interface.  I wanted to do this
at bootup so I hacked /etc/pccard_ether to read a variable,
pccard_preconfig_wi0, out of rc.conf, to run the "preconfig" command prior to
attempting dhclient.  This struck me as the "right" way and I thought I'd send
my diff in so that something like this could be considered for commit in to
the source tree.

>How-To-Repeat:
>Fix:

Diffs:

*** /etc/pccard_ether.orig	Fri Sep 22 09:25:18 2000
--- /etc/pccard_ether	Fri Sep 22 09:53:12 2000
***************
*** 19,24 ****
--- 19,29 ----
  interface=$1
  shift
  
+ eval pccard_preconfig=\$pccard_preconfig_${interface}
+ if [ -n "${pccard_preconfig}" ]; then
+ 	${pccard_preconfig}
+ fi
+ 
  case ${pccard_ifconfig} in
  [Nn][Oo] | '')
          ;;
*** /etc/defaults/rc.conf.orig	Fri Sep 22 09:29:16 2000
--- /etc/defaults/rc.conf	Fri Sep 22 09:32:56 2000
***************
*** 29,34 ****
--- 29,35 ----
  pccard_ifconfig="NO"	# Specialized pccard ethernet configuration (or NO).
  pccardd_flags=""	# Additional flags for pccardd.
  pccard_conf="/etc/defaults/pccard.conf"	# pccardd(8) config file
+ #pccard_preconfig_wi0="/usr/sbin/wicontrol -i wi0 -p 1" # specialized startup for pccard ethernet
  local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d"	# startup script dirs.
  local_periodic="/usr/local/etc/periodic /usr/X11R6/etc/periodic" # periodic script dirs
  rc_conf_files="/etc/rc.conf /etc/rc.conf.local"

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


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Comment 1 dannyman 2000-09-23 02:30:01 UTC
In trying to get my WaveLAN card to work, I found I needed to change a default
config with wicontrol prior to configuring the interface.  I wanted to do this
at bootup so I hacked /etc/pccard_ether to read a variable,
pccard_preconfig_wi0, out of rc.conf, to run the "preconfig" command prior to
attempting dhclient.  This struck me as the "right" way and I thought I'd send
my diff in so that something like this could be considered for commit in to
the source tree.

Fix: Diffs:
Comment 2 brooks 2000-09-23 03:25:39 UTC
On Fri, Sep 22, 2000 at 06:22:08PM -0700, dannyman@tellme.com wrote:
> 
> In trying to get my WaveLAN card to work, I found I needed to change a default
> config with wicontrol prior to configuring the interface.  I wanted to do this
> at bootup so I hacked /etc/pccard_ether to read a variable,
> pccard_preconfig_wi0, out of rc.conf, to run the "preconfig" command prior to
> attempting dhclient.  This struck me as the "right" way and I thought I'd send
> my diff in so that something like this could be considered for commit in to
> the source tree.

This is an intresting idea, but after doing some work with a WaveLAN
card here, I'm not sure it's enough.  The problem is that you need to
be able to set several settings in some environments.  For example,
in the system I'm setting up, you'll have to set the port type, the SSID,
the first WEP key, enable encryption, etc.  I'd like to see something
that can handle this if it's going to be commited.  For added fun, the
Aironet cards have virtually the same issues (though they can optionaly
remember WEP keys), but the PCI and ISA versions don't actually use PC
Card support at all so you can't use /etc/pccard_ether to configure them.
I'm planning to work on something next week and haven't really thought
it out all the way yet so any suggestions would be appreciated.

-- Brooks

-- 
Any statement of the form "X is the one, true Y" is FALSE.
Comment 3 dannyman 2000-09-23 03:29:52 UTC
On Fri, Sep 22, 2000 at 07:25:39PM -0700, Brooks Davis wrote:
> 
> This is an intresting idea, but after doing some work with a WaveLAN
> card here, I'm not sure it's enough.  The problem is that you need to
> be able to set several settings in some environments.  For example,
> in the system I'm setting up, you'll have to set the port type, the SSID,
[...]

I'd think you could write a script to plug in for pre-config.

The trick is how the system would determine appropriate settings for a card
before it can even determine the network it is on.  My hunch is that the wi
driver should be able to try a few different settings, but this is a lot more
work than the simple kludge suggested here, which will get a lot of folks like
me working right away. :)

-danny
Comment 4 brooks 2000-09-23 03:40:42 UTC
On Fri, Sep 22, 2000 at 07:29:52PM -0700, Danny Howard wrote:
> I'd think you could write a script to plug in for pre-config.
> 
> The trick is how the system would determine appropriate settings for a card
> before it can even determine the network it is on.  My hunch is that the wi
> driver should be able to try a few different settings, but this is a lot more
> work than the simple kludge suggested here, which will get a lot of folks like
> me working right away. :)

Writing a script like thatmay be the solution I choose in the end.
I'm scheduled to spend next week on these issues for a project at work
so I should have a more flexiable solution by next Friday.  I'm sure
you can wait that long. ;-)

-- Brooks

-- 
Any statement of the form "X is the one, true Y" is FALSE.
Comment 5 brooks 2000-09-27 03:04:00 UTC
On Fri, Sep 22, 2000 at 07:29:52PM -0700, Danny Howard wrote:
> I'd think you could write a script to plug in for pre-config.

After some additional thought this is basically the approach I'm taking.
I've attached a diff which adds support like your's except that it adds
it to both /etc/pccard_ether and /etc/rc.network.  It also provides a
method by which this code can reset the ifconfig arguments in the
preifconfig code.  The reason is that if you know which network you
attached to you may know more about how to configure your IP address
then you did before.  Of the three ways I though about integrating this,
your's turned out to be the cleanest IMO.

If any committer wants to add this code, I'd suggest
investigating the possibility of removing rc.network's support for
/etc/start_if.<interface> files in favor of preifconfig as you can always
add back support with preifconfig like this:

preifconfig_fxp0=". /etc/start_if.fxp0"

and I doubt start_if.* is widely used.

> The trick is how the system would determine appropriate settings for a card
> before it can even determine the network it is on.  My hunch is that the wi
> driver should be able to try a few different settings, but this is a lot more
> work than the simple kludge suggested here, which will get a lot of folks like
> me working right away. :)

Following a suggestion from someone at BSDi who had a personal script
that does this, I've created a script which does just that though his
attempted to acquire an IP via DHCP to check for a connection and mine
instead just checks to see if you are talking to someone with appropriate
parsing of the wicontrol and (soon) ancontrol output and lets the existing
ifconfig code handle actually configuring an interface.

Since I've spent a fair bit of time on this, I've got to run it past our
software release board before I can submit it for inclusion, but I'm
hoping that won't take more then a couple weeks.  In the mean time, I
fully support integrating the attached patch or something with
equivalent functionality as it paves the way for a full solution (which
should make your network configuration work right out of the box.)

-- Brooks

-- 
Any statement of the form "X is the one, true Y" is FALSE.

--- /usr/src/etc/pccard_ether	Wed Sep 13 23:21:48 2000
+++ pccard_ether	Tue Sep 26 17:39:09 2000
@@ -19,6 +19,16 @@
 interface=$1
 shift
 
+preifconfig_ifconfig=""
+preifconfig_interface=${interface}
+eval preifconfig=\$preifconfig_${interface}
+if [ -n "${preifconfig}" ]; then
+	$preifconfig
+fi
+if [ -n "${preifconfig_ifconfig}" ]; then
+	pccard_ifconfig=${ifconfig}
+fi
+
 case ${pccard_ifconfig} in
 [Nn][Oo] | '')
         ;;
--- /usr/src/etc/rc.network	Wed Sep  6 22:56:31 2000
+++ rc.network	Tue Sep 26 17:40:13 2000
@@ -91,9 +91,20 @@
 			eval showstat_$ifn=1
 		fi
 
+		preifconfig_ifconfig=""
+		preifconfig_interface=${ifn}
+		eval preifconfig=\$preifconfig_${interface}
+		if [ -n "${preifconfig}" ]; then
+			$preifconfig
+		fi
+
 		# Do the primary ifconfig if specified
 		#
-		eval ifconfig_args=\$ifconfig_${ifn}
+		if [ -n "${preifconfig_ifconfig}" ]; then
+			ifconfig_args=${ifconfig}
+		else
+			eval ifconfig_args=\$ifconfig_${ifn}
+		fi
 
 		case ${ifconfig_args} in
 		'')
Comment 6 unfurl freebsd_committer freebsd_triage 2001-05-31 06:37:20 UTC
Responsible Changed
From-To: freebsd-bugs->imp

imp asked for it
Comment 7 Warner Losh freebsd_committer freebsd_triage 2001-11-15 06:04:12 UTC
State Changed
From-To: open->closed

on freebsd, then can be done with the /etc/start_if.${interface} 
hook.