|
Harald Hoyer |
2d3fda |
From f1e7add2bf74b836bc29d20df2e4e53638e49936 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
2d3fda |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
2d3fda |
Date: Fri, 6 Jul 2012 12:57:17 +0200
|
|
Harald Hoyer |
2d3fda |
Subject: [PATCH] network/ifname-genrules.sh: check for multiple ifname= lines
|
|
Harald Hoyer |
2d3fda |
|
|
Harald Hoyer |
2d3fda |
---
|
|
Harald Hoyer |
2d3fda |
modules.d/40network/ifname-genrules.sh | 18 +++++++++++++++++-
|
|
Harald Hoyer |
2d3fda |
1 file changed, 17 insertions(+), 1 deletion(-)
|
|
Harald Hoyer |
2d3fda |
|
|
Harald Hoyer |
2d3fda |
diff --git a/modules.d/40network/ifname-genrules.sh b/modules.d/40network/ifname-genrules.sh
|
|
Harald Hoyer |
2d3fda |
index d5f8b0f..3cf4be7 100755
|
|
Harald Hoyer |
2d3fda |
--- a/modules.d/40network/ifname-genrules.sh
|
|
Harald Hoyer |
2d3fda |
+++ b/modules.d/40network/ifname-genrules.sh
|
|
Harald Hoyer |
2d3fda |
@@ -12,7 +12,23 @@ command -v parse_ifname_opts >/dev/null || . /lib/net-lib.sh
|
|
Harald Hoyer |
2d3fda |
{
|
|
Harald Hoyer |
2d3fda |
for p in $(getargs ifname=); do
|
|
Harald Hoyer |
2d3fda |
parse_ifname_opts $p
|
|
Harald Hoyer |
2d3fda |
+
|
|
Harald Hoyer |
2d3fda |
+ if [ -f /tmp/ifname-$ifname_mac ]; then
|
|
Harald Hoyer |
2d3fda |
+ read oldif < /tmp/ifname-$ifname_mac
|
|
Harald Hoyer |
2d3fda |
+ fi
|
|
Harald Hoyer |
2d3fda |
+ if [ -f /tmp/ifname-$ifname_if ]; then
|
|
Harald Hoyer |
2d3fda |
+ read oldmac < /tmp/ifname-$ifname_if
|
|
Harald Hoyer |
2d3fda |
+ fi
|
|
Harald Hoyer |
2d3fda |
+ if [ -n "$oldif" -a -n "$oldmac" -a "$oldif" = "$ifname_if" -a "$oldmac" = "$ifname_mac" ]; then
|
|
Harald Hoyer |
2d3fda |
+ # skip same ifname= declaration
|
|
Harald Hoyer |
2d3fda |
+ continue
|
|
Harald Hoyer |
2d3fda |
+ fi
|
|
Harald Hoyer |
2d3fda |
+
|
|
Harald Hoyer |
2d3fda |
+ [ -n "$oldif" ] && warn "Multiple interface names specified for MAC $ifname_mac: $oldif"
|
|
Harald Hoyer |
2d3fda |
+ [ -n "$oldmac" ] && warn "Multiple MAC specified for $ifname_if: $oldmac"
|
|
Harald Hoyer |
2d3fda |
+
|
|
Harald Hoyer |
2d3fda |
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"
|
|
Harald Hoyer |
2d3fda |
+ echo $ifname_if > /tmp/ifname-$ifname_mac
|
|
Harald Hoyer |
2d3fda |
+ echo $ifname_mac > /tmp/ifname-$ifname_if
|
|
Harald Hoyer |
2d3fda |
done
|
|
Harald Hoyer |
2d3fda |
-
|
|
Harald Hoyer |
2d3fda |
} >> /etc/udev/rules.d/80-ifname.rules
|