Commits

braindamaged committed 15aad6c Merge

Comments (0)

Files changed (1)

rules/60-persistent-net.rules

+# do not edit this file, it will be overwritten on update
+#
+# General idea: Set up ID_* entries in the udev db that can be looked up by the
+# distro's network config later to find the right NIC device to configure. This
+# is compatible with the persistent-net-generator rules if those are enabled.
+#
+# Find the NIC for a given attribute with something like:
+# $(find-nic [ mac-{address} | path-{path specifier} | ethN ])
+#
+# where find-nic looks something like:
+#
+# #!/bin/bash
+# # Accept real interfaces as well as identifiers
+# if [ -e /sys/class/net/"${1}" ] ; then
+#   echo "${1}"
+#   exit 0
+# fi
+#
+# id="${1#*-}"
+#
+# case "$1" in
+#   mac-*)
+#     for dev in /sys/class/net/* ; do
+#       if /sbin/udevadm info -q env -p "$dev" | grep -q "ID_ADDRESS=${id}\$" ; then
+#         echo "${dev##*/}"
+#         exit 0
+#       fi
+#     done
+#     exit 1
+#     ;;
+#   path-*)
+#     for dev in /sys/class/net/* ; do
+#       if /sbin/udevadm info -q env -p "$dev" | grep -q "ID_PATH=${id}\$" ; then
+#         echo "${dev##*/}"
+#         exit 0
+#       fi
+#     done
+#     exit 1
+#     ;;
+#   *)
+#     echo "Don't know how to dereference $1." >&2
+#     exit 2
+#     ;;
+# esac
+
+ACTION=="remove", GOTO="persistent_net_end"
+SUBSYSTEM!="net", GOTO="persistent_net_end"
+
+# Stash away the MAC address into the udev db
+ENV{ID_ADDRESS}="$attr{address}"
+
+# Grab a set of path-id exports as well
+IMPORT{builtin}="path_id"
+
+LABEL="persistent_net_end"