1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-11-01 00:51:08 +03:00

rules_generator: add S/390 persistent network support

This commit is contained in:
Hannes Reinecke 2007-07-25 15:42:39 +02:00 committed by Kay Sievers
parent 19096c087f
commit 49369cafe4
2 changed files with 42 additions and 12 deletions

View File

@ -1,19 +1,21 @@
# these rules generate rules for persistent network device naming # these rules generate rules for persistent network device naming
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*|ath*|wlan*|ra*|sta*" \ ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*|ath*|wlan*|ra*|sta*|ctc*|lcs*|hsi*" \
NAME!="?*", DRIVERS=="?*", GOTO="persistent_net_generator_do" NAME!="?*", DRIVERS=="?*", GOTO="persistent_net_generator_do"
GOTO="persistent_net_generator_end" GOTO="persistent_net_generator_end"
LABEL="persistent_net_generator_do" LABEL="persistent_net_generator_do"
# build device description string to add a comment the generated rule # build device description string to add a comment the generated rule
SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($attr{driver})" SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($driver)"
SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($attr{driver})" SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)"
SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{NETDEV}="$id", ENV{NETDRV}="$driver"
SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})"
SUBSYSTEMS=="xen", ENV{COMMENT}="Xen virtual device" SUBSYSTEMS=="xen", ENV{COMMENT}="Xen virtual device"
ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device ($attr{driver})" ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device ($driver)"
IMPORT{program}="write_net_rules $attr{address}" ENV{NETDEV}=="?*", IMPORT{program}="write_net_rules --driver $env{NETDRV} --id $env{NETDEV}"
ENV{NETDEV}!="?*", IMPORT{program}="write_net_rules $attr{address}"
ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}"
LABEL="persistent_net_generator_end" LABEL="persistent_net_generator_end"

View File

@ -69,7 +69,7 @@ if [ "$1" = "all_interfaces" ]; then
for INTERFACE in *; do for INTERFACE in *; do
case $INTERFACE in case $INTERFACE in
eth*|ath*|wlan*|ra*|sta*) ;; eth*|ath*|wlan*|ra*|sta*|ctc*|hsi*) ;;
*) continue ;; *) continue ;;
esac esac
@ -86,18 +86,42 @@ if [ -z "$INTERFACE" ]; then
fi fi
if [ "$1" ]; then if [ "$1" ]; then
MAC_ADDR="$1" while [ "$*" ] ; do
case $1 in
--mac)
shift
MAC_ADDR=$1
shift
;;
--driver)
shift
DRIVER=$1
shift
;;
--id)
shift
ID=$1
shift
;;
*)
MAC_ADDR=$1
shift
;;
esac
done
else else
MAC_ADDR=$(sysread address) MAC_ADDR=$(sysread address)
fi fi
if [ -z "$MAC_ADDR" ]; then if [ -z "$DRIVER" ] && [ -z "$ID" ] ; then
if [ -z "$MAC_ADDR" ]; then
echo "No MAC address for $INTERFACE." >&2 echo "No MAC address for $INTERFACE." >&2
exit 1 exit 1
fi fi
if [ "$MAC_ADDR" = "00:00:00:00:00:00" ]; then if [ "$MAC_ADDR" = "00:00:00:00:00:00" ]; then
echo "NULL MAC address for $INTERFACE." >&2 echo "NULL MAC address for $INTERFACE." >&2
exit 1 exit 1
fi
fi fi
# Prevent concurrent processes from modifying the file at the same time. # Prevent concurrent processes from modifying the file at the same time.
@ -117,7 +141,11 @@ if interface_name_taken; then
fi fi
# the DRIVERS key is needed to not match bridges and VLAN sub-interfaces # the DRIVERS key is needed to not match bridges and VLAN sub-interfaces
match="DRIVERS==\"?*\", ATTRS{address}==\"$MAC_ADDR\"" if [ "$MAC_ADDR" ] ; then
match="DRIVERS==\"?*\", ATTRS{address}==\"$MAC_ADDR\""
else
match="DRIVERS==\"$DRIVER\", KERNELS==\"$ID\""
fi
if [ $basename = "ath" -o $basename = "wlan" ]; then if [ $basename = "ath" -o $basename = "wlan" ]; then
match="$match, ATTRS{type}==\"1\"" # do not match the wifi* interfaces match="$match, ATTRS{type}==\"1\"" # do not match the wifi* interfaces
fi fi