[PATCH] fix get_vid to return correct value for vlan ids larger than 255

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The function get_vid in the ifup.sh script in 40network uses the return
statement to return the vlan id, but exit values greater than 255 return an exit
code modulo 256 (see [1]). Thus vlan IDs greater than 255 always fail. The
attached patch fixes the issue.

[1] http://tldp.org/LDP/abs/html/exitcodes.html#AEN23444

[PATCH]
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index 6c3133e..1164af9 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
@@ -219,10 +219,10 @@ fi
 get_vid() {
     case "$1" in
     vlan*)
-        return ${1#vlan}
+        echo ${1#vlan}
         ;;
     *.*)
-        return ${1##*.}
+        echo ${1##*.}
         ;;
     esac
 }
@@ -234,7 +234,7 @@ if [ "$netif" = "$vlanname" ] && [ ! -e
/tmp/net.$vlanname.up ]; then
     else
         linkup "$phydevice"
     fi
-    ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid
$vlanname; echo $?)"
+    ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid
$vlanname)"
 fi
 
 # setup nameserver
[END]

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux