]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - config/udev/network-hotplug-rename
core125: restart init after glibc uodate
[people/pmueller/ipfire-2.x.git] / config / udev / network-hotplug-rename
index 331b7881855d06f0463d22237a4c020001b99c6d..3a482d2dbff99615556bb7630f6b031b2918048c 100644 (file)
@@ -57,16 +57,37 @@ ADDRESS="$(</sys/class/net/${INTERFACE}/address)"
 for zone in ${ZONES}; do
        address="${zone}_MACADDR"
        device="${zone}_DEV"
+       mode="${zone}_MODE"
 
        # Skip if address or device is unset
        [ -n "${!address}" -a -n "${!device}" ] || continue
 
+       # Compare MAC addresses
+       [ "${ADDRESS}" = "${!address}" ] || continue
+
        # If a matching interface has been found we will
        # print the name to which udev will rename it.
-       if [ "${ADDRESS}" = "${!address}" ]; then
-               echo "${!device}"
-               exit 0
-       fi
+       case "${!mode}" in
+               bridge)
+                       echo "${!device%0}phys0"
+                       ;;
+
+               macvtap)
+                       # MACVTAP mode doesn't work for WiFi devices
+                       if [ -d "/sys/class/net/${INTERFACE}/phy80211" ]; then
+                               logger -t network "MACVTAP mode is not supported for wireless devices"
+                               echo "${!device}"
+                       else
+                               echo "${!device%0}phys0"
+                       fi
+                       ;;
+
+               *)
+                       echo "${!device}"
+                       ;;
+       esac
+
+       exit 0
 done
 
 # If we get here we have not found a matching device,