Sponsored Content
Top Forums Shell Programming and Scripting FreeBSD rc.subr wireless script Post 302657147 by regexp on Saturday 16th of June 2012 12:18:09 PM
Old 06-16-2012
FreeBSD rc.subr wireless script

Hi,

This is my first thread on Unix forums, so be gentle.Smilie

I'm trying to write a simple start/stop script for my wireless networking adapter, under FreeBSD, using the rc.subr framework.

Code:
 
#!/bin/sh

# PROVIDE Wireless
# KEYWORDS shutdown

. /etc/rc.subr

name="wireless"
start_cmd="${name}_start"
stop_cmd="${name}_stop"


wireless_start()
{

#Check whether wlan0 already exists

        for faces in `ifconfig -lu`
do
        if [ "$faces" != "wlan0" ]
then

//Create the device
ifconfig wlan0 create wlandev iwn0
        fi
done

#Add an ip address
ifconfig wlan0 inet 192.168.2.12 netmask 255.255.255.0

route add -net default 192.168.2.45

wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf &
}

wireless_stop()
{
        ifconfig wlan0 down 2> /dev/null
        route delete -net default 192.168.2.45
        ifconfig wlan0 destroy wlandev iwn0 2> /dev/null


}
load_rc_config $name
run_rc_command "$1"

Is this ok? Is there a better way ?

Regards Regexp
 

10 More Discussions You Might Find Interesting

1. HP-UX

Wireless

Can someone please point me in the correct direction for setting up a wireless card using HP-UX 11iV1? I know its different depending on the type of card I have, but im looking for a direction. Thanks! (0 Replies)
Discussion started by: nickwinnie
0 Replies

2. BSD

OpenBSD and wireless

I've just installed OpenBSD on my laptop (IBM Thinkpad T42) and since this is my first time with wireless networking in OpenBSD I'm a bit lost. What I would like to do is connect to a wireless network using WEP or WPA. Where do I place the key and essid? (3 Replies)
Discussion started by: Timmy66
3 Replies

3. BSD

FreeBSD Wireless - Can do WPA but not WEP or even open

Hello, I am using FreeBSD on my laptop (R60) and currently it is working great, however, I am having trouble connecting to open or WEP secured networks. I have read the FreeBSD handbook regarding this many times. That is how I found out how to connect to WPA networks. If anyone could post a... (4 Replies)
Discussion started by: kpedersen
4 Replies

4. Shell Programming and Scripting

My Wireless Script Wont Work.....anyone??

ive been trying to write a simple (at least i thought it was) script to launch my wireless usb under ubuntu with kde. im using nano. when i run it from a terminal it works fine, but it just wont run from the script. there is a caveat, but first heres the script. ... (7 Replies)
Discussion started by: braze
7 Replies

5. Programming

Application crashes in FreeBSD 7.1 while working ok in FreeBSD 6.3

Hello there, My mulithreaded application (which is too large to represent the source code here) is crashing after installing FreeBSD 7.1-RELEASE/amd64. It worked properly on others machines (Dual Cores with 4GB of RAM - FreeBSD 6.2-RELEASE/i386). The current machine has 2x Core 2 Duo... (1 Reply)
Discussion started by: Seenquev
1 Replies

6. Linux

how to configure wireless now ?

Hi, I've installed wireless card and I didn't receive any error in the installation process. Now I want to use it but I can't make internet to work. if I check my card with iwconfig I get the following message wlan0 IEEE 802.11g ESSID:"Alice-34376718" Mode:Managed ... (2 Replies)
Discussion started by: aneuryzma
2 Replies

7. Shell Programming and Scripting

FreeBSD new user login script

I am a beginner programmer and would like to know where to start to modify the login process so that a user can login as username new password new and have it prompt user for username and password and nothing else and then create said user account on the system so they can ssh back in and login... (9 Replies)
Discussion started by: deshi
9 Replies

8. UNIX for Dummies Questions & Answers

'awk' help for script to clean out wireless.

I've been working on a script to clean out the wireless connections on my MAC. I know the terminal command to do this (that part is not rocket science ;) ) So I thought I would have a go at automating this but I'm having trouble with the 'awk' command & the correct context. My code is := ... (7 Replies)
Discussion started by: Lord Lien
7 Replies

9. BSD

An installation script on freeBSD

Hello So i got my hands on some freebsd iso, installed it in a qcow2 image and installled git and bash. So far, so good. Git repositry retireved install script executed files got copied files have exec flag files are in $PATH / found by which / bash-completion works But still,... (3 Replies)
Discussion started by: sea
3 Replies

10. Programming

Changing script to work with freeBSD

hi all, i have made my machine a freeBSD machine instead of a centos machine and my script doesnt work anymore and i was wondering if anyone can help me into why, i thought the commands are the same, here it is - #!/bin/bash source=/vol/cha-work/_ARCHIVE/to_be_archived/audio... (9 Replies)
Discussion started by: robertkwild
9 Replies
MWL(4)							   BSD Kernel Interfaces Manual 						    MWL(4)

NAME
mwl -- Marvell 88W8363 IEEE 802.11n wireless network driver SYNOPSIS
To compile this driver into the kernel, place the following lines in your kernel configuration file: device mwl device mwlfw device wlan device firmware Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): if_mwl_load="YES" DESCRIPTION
The mwl driver provides support for IEEE 802.11n wireless network adapters based on Marvell 88W8363 parts. PCI and/or CardBus interfaces are supported. This driver requires the firmware built with the mwlfw module to work. Normally this module is loaded on demand by the driver but it may also be compiled into the kernel. Supported features include 802.11n, power management, BSS, MBSS, and host-based access point operation modes. All host/device interaction is via DMA. The mwl driver encapsulates IP and ARP traffic as 802.11 frames, however it can receive either 802.11 or 802.3 frames. Devices support 802.11n, 802.11a, 802.11g, and 802.11b operation with transmit speeds appropriate to each. The actual transmit speed used is dependent on signal quality and the ``rate control'' algorithm implemented in the firmware. All chips have hardware support for WEP, AES-CCM, TKIP, and Michael cryptographic operations. The driver supports station, hostap, mesh, and wds mode operation. Multiple hostap virtual interfaces may be configured for simultaneous use. When multiple interfaces are configured each may have a separate mac address that is formed by setting the U/L bits in the mac address assigned to the underlying device. Any number of wds virtual interfaces may be configured together with hostap interfaces. Multiple station interfaces may be operated together with hostap interfaces to construct a wireless repeater device. For more information on configuring this device, see ifconfig(8). Devices supported by the mwl driver come in either Cardbus or mini-PCI packages. Wireless cards in Cardbus slots may be inserted and ejected on the fly. EXAMPLES
Join an existing BSS network (ie: connect to an access point): ifconfig wlan create wlandev mwl0 inet 192.168.0.20 netmask 0xffffff00" Join a specific BSS network with network name ``my_net'': ifconfig wlan create wlandev mwl0 inet 192.168.0.20 netmask 0xffffff00 ssid my_net" Join a specific BSS network with WEP encryption: ifconfig wlan0 create wlandev mwl0 ifconfig wlan0 inet 192.168.0.20 netmask 0xffffff00 ssid my_net wepmode on wepkey 0x8736639624 Create an 802.11g host-based access point: ifconfig wlan0 create wlandev mwl0 wlanmode hostap ifconfig wlan0 inet 192.168.0.10 netmask 0xffffff00 ssid my_ap mode 11g Create an 802.11a mesh station: ifconfig wlan0 create wlandev mwl0 wlanmode mesh ifconfig wlan0 meshid my_mesh mode 11a inet 192.168.0.10/24 Create two virtual 802.11a host-based access points, one with WEP enabled and one with no security, and bridge them to the fxp0 (wired) device: ifconfig wlan0 create wlandev mwl0 wlanmode hostap ssid paying-customers wepmode on wepkey 0x1234567890 mode 11a up ifconfig wlan1 create wlandev mwl0 wlanmode hostap bssid ssid freeloaders up ifconfig bridge0 create addm wlan0 addm wlan1 addm fxp0 up DIAGNOSTICS
mwl%d: unable to setup builtin firmware There was a problem downloading and/or setting up the firmware. The device is not usable. mwl%d: failed to setup descriptors: %d There was a problem setting up the DMA data structures. This typically is caused by not being able to allocate contiguous memory. mwl%d: transmit timeout A frame dispatched to the hardware for transmission did not complete in time. This should not happen. mwl%d: device not present A cardbus device was ejected while active; the request to the firmware was not completed. SEE ALSO
cardbus(4), intro(4), mwlfw(4), pci(4), wlan(4), wlan_ccmp(4), wlan_tkip(4), wlan_wep(4), wlan_xauth(4), hostapd(8), ifconfig(8), wpa_supplicant(8) HISTORY
The mwl device driver first appeared in FreeBSD 8.0. BUGS
The driver does not support power-save operation in station mode; consequently power use is suboptimal (e.g. on a laptop). BSD
July 8, 2009 BSD
All times are GMT -4. The time now is 05:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy