diff options
author | Jim Pryor <profjim@jimpryor.net> | 2009-08-11 14:05:14 +0200 |
---|---|---|
committer | James Rayner <james@archlinux.org> | 2009-08-15 04:28:30 +0200 |
commit | 6c5e4f9ab4f75adfdd1949f929bf6a2308ecd03b (patch) | |
tree | ed0f89b7de81f8f05e306123a35f9f255a12ab31 /src/connections | |
parent | e27d094577f874613c49cc3d93796162230ca2c8 (diff) | |
download | netctl-6c5e4f9ab4f75adfdd1949f929bf6a2308ecd03b.tar.gz netctl-6c5e4f9ab4f75adfdd1949f929bf6a2308ecd03b.tar.xz |
Isolate ip to ethernet-iproute, ifconfig to ethernet + wireless
* The point of having both ethernet and ethernet-iproute
was presumably to transition slowly from ifconfig/net-tools to
iproute2. But the current codebase mixes the two in handling
ethernet and wireless connections. This commit separates
all the ip calls to the newer connections, and the ifconfig
calls to the older connections. The latter now call set_interface
with up-old, down-old, forcedown-old.
* I'm not urging that ifconfig code sticks around. Just trying
to make the code consistent with what seems to me to be
its implicit design principles.
* the check for NO-CARRIER in ethernet is now also done without
calling iproute2 tools. I saw this technique recommended somewhere
but have no citation. I don't know how many kernel revisions one
can rely on any given part of /sys to remain stable for.
It may be possible to achieve the same goal here in other ways.
If in fact it's worth the effort to keep the ifconfig code
around.
* Began also to integrate the IPROUTE variable introduced in
ethernet, but stopped. If that's integrated everywhere, shouldn't
it make connection=ethernet equivalent to
connection=ethernet-iproute? Is there justification for
using it at some places but not everywhere? I just let it alone
for now.
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
Diffstat (limited to 'src/connections')
-rw-r--r-- | src/connections/ethernet | 11 | ||||
-rw-r--r-- | src/connections/wireless | 9 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/connections/ethernet b/src/connections/ethernet index 64a8513..71124d0 100644 --- a/src/connections/ethernet +++ b/src/connections/ethernet @@ -12,9 +12,10 @@ ethernet_up() { fi report_debug ethernet_up ifup - set_interface up "$INTERFACE" + set_interface up-old "$INTERFACE" - if ip link show $INTERFACE| fgrep -q "NO-CARRIER"; then + # don't think it's possible to detect carrier using ifconfig alone (at least, not without ifdown/ifupping the interface) + if [[ $(cat /sys/class/net/$INTERFACE/carrier 2>/dev/null) -ne 1 ]]; then # gives err if iface inactive (i.e. ifdown) report_fail "No connection" return 1 fi @@ -31,7 +32,7 @@ ethernet_up() { if ! wpa_check "$INTERFACE"; then # ignore quirk nodown---is that appropriate? # this adds a flush call as well---is that appropriate? - set_interface forcedown "$INTERFACE" + set_interface forcedown-old "$INTERFACE" report_fail "WPA Authentication/Association Failed" return 1 fi @@ -78,7 +79,7 @@ ethernet_up() { # JP: don't we want to add this to all the aborts? # ignore quirk nodown---is that appropriate? # this adds a flush call as well---is that appropriate? - set_interface forcedown "$INTERFACE" + set_interface forcedown-old "$INTERFACE" report_fail "Adding gateway $GATEWAY failed." return 1 fi @@ -144,7 +145,7 @@ ethernet_down() { report_debug ethernet_down ifdown # ignore quirk nodown---is that appropriate? # this adds a flush call as well---is that appropriate? - set_interface forcedown "$INTERFACE" + set_interface forcedown-old "$INTERFACE" } # Returns status of profile - is it still functional? diff --git a/src/connections/wireless b/src/connections/wireless index fffd048..c50acfa 100644 --- a/src/connections/wireless +++ b/src/connections/wireless @@ -52,8 +52,7 @@ wireless_up() { fi report_debug wireless_up ifup - set_interface up "$INTERFACE" || return 1 - ## wireless_control "$INTERFACE" up || return 1 + set_interface up-old "$INTERFACE" || return 1 quirk prescan && iwlist "$INTERFACE" scan &> /dev/null # bcm43xx if quirk preessid; then # ipw3945 @@ -110,7 +109,7 @@ wireless_up() { if quirk "predown"; then # madwifi FS#10585 # ignore quirk nodown---is that appropriate? # this adds a flush call as well---is that appropriate? - set_interface forcedown "$INTERFACE" + set_interface forcedown-old "$INTERFACE" fi report_debug wireless_up iwconfig "$INTERFACE" $WEP_OPTS @@ -120,7 +119,7 @@ wireless_up() { fi if quirk "predown"; then # madwifi FS#10585 - set_interface up "$INTERFACE" + set_interface up-old "$INTERFACE" fi report_debug ethernet_up wep_check @@ -211,7 +210,7 @@ wireless_down() { # respects quirk nodown---is that appropriate? # wasn't this already called in ethernet_down? but does the call there respect quirk nodown? # this adds a flush call as well---is that appropriate? - set_interface down "$INTERFACE" + set_interface down-old "$INTERFACE" # If rfkill is specified, disable device. if [[ -n "$RFKILL_NAME" ]]; then |