Add Fedora DHCP interfaces via udev rules

Updates the dhcp-all-interfaces element so that
we add new DHCP interfaces using a udev rule
instead of a systemd service.

The previous approach (using the systemd service)
was proving to be problematic when used with
the new Fedora constistent network naming
convention rules (em1, em2, etc.). We aren't using
these device names as a default yet... but we will
need to soon and when we do udev rules seem to be the
best way to avoid racy behaviour when calling
dhcp-all-interfaces.sh from the systemd service.

Change-Id: I87e0aed1f34718e896bd414388886a1f1073b0c0
This commit is contained in:
Dan Prince 2014-02-07 13:44:00 -05:00
parent a1b469b10b
commit 201c9e8527
3 changed files with 2 additions and 16 deletions

View File

@ -9,6 +9,5 @@ DIB_INIT_SYSTEM=$(dib-init-system)
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.conf /etc/init/dhcp-all-interfaces.conf
elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.service /usr/lib/systemd/system/dhcp-all-interfaces.service
systemctl enable dhcp-all-interfaces.service
install -D -g root -o root -m 0644 ${SCRIPTDIR}/udev.rules /etc/udev/rules.d/99-dhcp-all-interfaces.rules
fi

View File

@ -1,14 +0,0 @@
[Unit]
Description=DHCP All Interfaces Service
Wants=local-fs.target systemd-udev-settle.service
After=local-fs.target systemd-udev-settle.service
Before=network.service
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/dhcp-all-interfaces.sh
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Alias=dhcp-all-interfaces.service

View File

@ -0,0 +1 @@
SUBSYSTEM=="net", ACTION=="add", RUN+="/usr/local/sbin/dhcp-all-interfaces.sh $name", RUN+="/sbin/ifup $name"