summaryrefslogtreecommitdiff
path: root/scripts/system
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-29 17:15:27 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-29 17:15:27 -0800
commitfdef8b73c4208d97c2d799bde3dd837a871e9666 (patch)
tree7b59adb17827521851ca590fcf41130eaffe4a4f /scripts/system
parentf790ecbc1151161be94f83f2a30258ff32ecfef9 (diff)
downloadvyatta-cfg-system-fdef8b73c4208d97c2d799bde3dd837a871e9666.tar.gz
vyatta-cfg-system-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/system')
-rwxr-xr-xscripts/system/vyatta_interface_rescan19
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