Commit 1b31191d authored by Marco d'Itri's avatar Marco d'Itri Committed by Michael Biebl

Avoid writing duplicate entries in 70-persistent-net.rules

Double check if the new udev rule has already been written for the given
interface. This happens if multiple add events are generated before the
write_net_rules script returns and udevd renames the interface.

Closes: #765577
parent 5ff84d86
......@@ -22,6 +22,13 @@ systemd (215-14) UNRELEASED; urgency=medium
* Make the journald to syslog forwarding more robust by increasing the
maximum datagram queue length from 10 to 512. (Closes: #762700)
[ Marco d'Itri ]
* Avoid writing duplicate entries in 70-persistent-net.rules by double
checking if the new udev rule has already been written for the given
interface. This happens if multiple add events are generated before the
write_net_rules script returns and udevd renames the interface.
(Closes: #765577)
-- Michael Biebl <biebl@debian.org> Sat, 28 Mar 2015 09:27:07 +0100
systemd (215-13) unstable; urgency=medium
......
......@@ -117,6 +117,17 @@ fi
basename=${INTERFACE%%[0-9]*}
match="$match, KERNEL==\"$basename*\""
# build a regular expression that matches the new rule that we want to write
new_rule_pattern=$(echo "^SUBSYSTEM==\"net\", ACTION==\"add\"$match" | sed -re 's/([\?\*])/\\\1/g')
# Double check if the new rule has already been written. This happens if
# multiple add events are generated before the script returns and udevd
# renames the interfaces. See #765577 for details.
if egrep -qs "$new_rule_pattern" $RO_RULES_FILE $RULES_FILE; then
unlock_rules_file
exit 0
fi
if [ "$INTERFACE_NAME" ]; then
# external tools may request a custom name
COMMENT="$COMMENT (custom name provided by external tool)"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment