diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-11-29 17:15:27 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-11-29 17:15:27 -0800 |
commit | fdef8b73c4208d97c2d799bde3dd837a871e9666 (patch) | |
tree | 7b59adb17827521851ca590fcf41130eaffe4a4f /scripts | |
parent | f790ecbc1151161be94f83f2a30258ff32ecfef9 (diff) | |
download | vyatta-cfg-quagga-fdef8b73c4208d97c2d799bde3dd837a871e9666.tar.gz vyatta-cfg-quagga-fdef8b73c4208d97c2d799bde3dd837a871e9666.zip |
Automatically configure physical device for wireless interfaces
When system is booted with newly detected wireless device, both
the hw-id and physical-device need to be setup.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/system/vyatta_interface_rescan | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/system/vyatta_interface_rescan b/scripts/system/vyatta_interface_rescan index a33f8ee9..e93bbdfc 100755 --- a/scripts/system/vyatta_interface_rescan +++ b/scripts/system/vyatta_interface_rescan @@ -84,6 +84,18 @@ sub get_hwid { return $hwaddr; } +# Determine phy for wlan device +# (This is ugly) +sub get_phy { + my $wlan = shift; + my $phypath = "/sys/class/net/$wlan/phy80211"; + + # link should be: ../../ieee80211/phy0 + return unless (readlink($phypath) =~ m!../../ieee80211/(phy[0-9]+)$!); + + return $1; +} + # vyatta_net_name leaves files in /dev/.udev/vyatta # the filename is the interface and the contents are the hardware id sub interface_rescan { @@ -112,6 +124,13 @@ sub interface_rescan { syslog(LOG_INFO, "add config for %s hw-id %s", $ifname, $hwaddr); $xcp->create_node(['interfaces',$ifpath,"hw-id $hwaddr"]); + + # Add existing phy entry for wireless + if ($ifname =~ /^wlan/) { + my $phy = get_phy($ifname); + $xcp->create_node(['interfaces',$ifpath,"physical-device $phy"]) if $phy; + } + } # Rewrite new config file |