From 6c5e4f9ab4f75adfdd1949f929bf6a2308ecd03b Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Tue, 11 Aug 2009 08:05:14 -0400 Subject: 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 --- src/network | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/network') diff --git a/src/network b/src/network index d65c899..12920de 100644 --- a/src/network +++ b/src/network @@ -338,16 +338,27 @@ set_interface() { INTERFACE="$2" case "$1" in - up) + up|up-old) at_interface_up - ip link set dev "$INTERFACE" up + if [ "$1" = old ]; then + ifconfig "$INTERFACE" up + else + ip link set dev "$INTERFACE" up + fi sleep "${UP_SLEEP:-2}" ;; - down|forcedown) + down|forcedown|down-old|forcedown-old) at_interface_down - ip addr flush dev "$INTERFACE" &>/dev/null - if ! quirk nodown || [ "$1" = forcedown ]; then - ip link set dev "$INTERFACE" down &>/dev/null + if [ "${1%-old}" != "$1" ]; then + ## ? + if ! quirk nodown || [ "$1" = forcedown-old ]; then + ifconfig "$INTERFACE" down + fi + else + ip addr flush dev "$INTERFACE" &>/dev/null + if ! quirk nodown || [ "$1" = forcedown ]; then + ip link set dev "$INTERFACE" down &>/dev/null + fi fi ;; *) -- cgit v1.2.3-24-g4f1b