]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
network-vlans: Use ip link command instead of vconfig.
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 4 Oct 2013 11:36:48 +0000 (13:36 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 4 Oct 2013 11:36:48 +0000 (13:36 +0200)
This patch gets rid of using vconfig for configuring VLAN
devices. ip link is much more suitable for that and creates
the interface with the right name and MAC address in just
one step.

src/initscripts/init.d/network-vlans

index c31f3e1f284a025b07b0267fbf43c0ff019bc6f0..a6a75c35f8a85aff2e43a073b98dcb6a8bb11b11 100644 (file)
@@ -80,13 +80,15 @@ for interface in green0 red0 blue0 orange0; do
                                continue
                        fi
 
-                       echo "Creating VLAN interface ${interface}..."
-                       vconfig add ${PARENT_DEV} ${VLAN_ID}
-                       ip link set ${PARENT_DEV}.${VLAN_ID} name ${interface}
-
+                       # Build command line.
+                       command="ip link add link ${PARENT_DEV} name ${interface}"
                        if [ -n "${MAC_ADDRESS}" ]; then
-                               ip link set ${interface} address ${MAC_ADDRESS}
+                               command="${command} address ${MAC_ADDRESS}"
                        fi
+                       command="${command} type vlan id ${VLAN_ID}"
+
+                       echo "Creating VLAN interface ${interface}..."
+                       ${command}
 
                        # Bring up the parent device.
                        ip link set ${PARENT_DEV} up
@@ -100,7 +102,7 @@ for interface in green0 red0 blue0 orange0; do
 
                        echo "Removing VLAN interface ${interface}..."
                        ip link set ${interface} down
-                       vconfig rem ${interface}
+                       ip link delete ${interface}
                        ;;
                
                *)