Click to See Complete Forum and Search --> : module questions/issues rc.modules, rc.netdevice and rc.wireless


acid45
02-16-2005, 09:14 PM
Hey, I've installed madwifi yet another method. This time I downloaded the cvs snapshot using windows, grabbed it off of the drive, installed it, loaded the modules, configued it, added nameservers to /etc/resolv.conf. So now that I have everything, madwifif anyway, the way I want it I want to automate it at startup.

What I found to do this is a reference to

/etc/rc.d/rc.netdevice

adding the line

/sbin/modprobe ath_pci

When I went to check I couldn't find it. So I went for windows, x isn't configured yet, and looked for more info. I found someone suggesting adding it to rc.modules in the network device section. While browsing through the network device section I found this:

if [-x /etc/rc.d/rc.netdevice]; then
. /etc/rc.d/rc.netdevice
fi


So I think I may be able to create a file /etc/rc.d/rc.netdevice and when the system is booting it will check if rc.netdevice exists, then run it if it does.

Will/should this work?

About rc.wireless

I have a configuration that, according to the docs should be the same as running

iwconfig ath0 essid xxxxxxx ap xx:xx:xx:xx:xx:xx mode Managed freq x.xxxG rate 54M
iwpriv ath0 mode 3 authmode 1


When I do run the rc.wireless script all of the above are true except mode Managed is somehow being converted to mode Master, which ,from what I can find, is AP mode.

issueing the command iwconfig mode Managed does the trick but then I have to reset the frequency, rate, 802.11G, from 802.11B

to do this I run
iwpriv ath0 mode 3
iwconfig ath0 freq x.xxxG rate 54M

This works and if I put it in rc.local it works fine but I'd rather have it all in one script for when I start adding security onto my network, that I'm in the process of building, I don't have to modify two scripts just to get one thing done when both scripts do the same thing. Any ideas what could be causing rc.wireless to set mode Master instead of mode Managed?

acid45
02-17-2005, 11:05 AM
Well, I solved it all.

Yes making a script rc.netdevice in /etc/rc.d/, if rc.modules looks for it, will load net devices configured in it properly.

As for the wireless, after checking out /etc/rc.d/rc.wireless

I found the offending lines

#set _all_ desired settings via iwconfig
IWCOMMAND="IWPATH/iwconfig ${INTERFACE}"
IFCOMMAND="/sbin/ifconfig ${INTERFACE}"

combined with

if [-n "$IWPRIV"]; then
echo "$0: $IWCOMMAND $IWPRIV" | $LOGGER $IWCOMMAND $IWPRIV
fi

which would interpret as:
iwconfig ath0 mode 3
master
instead of
iwpriv ath0 mode 3
802.11g

I am so SMRT, S-M-R-T...I mean S-MA-R-T

I _THINK_ this should fix it

IWPRIVCOMMAND="IWPATH/iwpriv ${INTERFACE}"


if [-n "$IWPRIV"]; then
echo "$0: $IWPRIVCOMMAND $IWPRIV" | $LOGGER $IWPRIVCOMMAND $IWPRIV
fi

but I'm no linux expert so I'd like some commentary before I go messing with system scripts.

I'm too impatient :P it worked :D

quip
02-17-2005, 01:22 PM
Which distro? Slackware? (Looks like their init scripts)

I am eager to try this solution soon as recently I have been having a very similar (maybe same) problem with the hostap drivers.

acid45
02-17-2005, 08:33 PM
Yeah, slackware 10. I thought I mentioned that...guess not.

My script fix only fixes a bug where the iwpriv settings in the conf file weren't run by iwpriv but by iwconfig. :D my first bug fix :P bahahahqhahaha other than ones I made myself bahahahahahaha