SHA256
1
0
forked from pool/systemd
systemd/1053-better-checks-in-write_net_rules.patch
Robert Milasan eeefc3c924 Accepting request 241979 from home:rmilasan:branches:Base:System
- Enable better checks in write_net_rules to skip adding duplicated
  entries in the generate rules (bnc#888178).
  Add 1053-better-checks-in-write_net_rules.patch 

- Enable better checks in write_net_rules to skip adding duplicated
  entries in the generate rules (bnc#888178).
  Add 1053-better-checks-in-write_net_rules.patch

OBS-URL: https://build.opensuse.org/request/show/241979
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=726
2014-07-23 09:23:13 +00:00

30 lines
1.1 KiB
Diff

Index: systemd-210/src/udev/rule_generator/write_net_rules
===================================================================
--- systemd-210.orig/src/udev/rule_generator/write_net_rules
+++ systemd-210/src/udev/rule_generator/write_net_rules
@@ -89,6 +89,12 @@ choose_rules_file
# the DRIVERS key is needed to not match bridges and VLAN sub-interfaces
if [ "$MATCHADDR" ]; then
+ # Check if MACADDR doesn't exist already in the generated rules
+ MAC="$(/usr/bin/grep -w -o -C1 -m1 "$MATCHADDR" "$RULES_FILE" 2>/dev/null || true)"
+ if [ "$MAC" == "$MATCHADDR" ]; then
+ unlock_rules_file
+ exit 0
+ fi
match="$match, DRIVERS==\"?*\", ATTR{address}==\"$MATCHADDR\""
fi
@@ -101,8 +107,9 @@ if [ "$MATCHDEVID" ]; then
fi
if [ "$MATCHID" ]; then
- ID="$(find_all_rules 'KERNELS==' "$MATCHID")"
- if [ "$ID" == "$MATCHID" ]; then
+ # Check if KERNEL doesn't exist already in the generated rules
+ KERNEL="$(find_all_rules 'KERNELS==' "$MATCHID")"
+ if [ "$KERNEL" == "$MATCHID" ]; then
unlock_rules_file
exit 0
fi