Use %i instead of %I in dhcp-interface@.service

Per the bug report, %I results in -'s in the interface name being
replaced with /'s, which means when we try to look up the interface
by path in dhcp-all-interfaces.sh we end up at an invalid path.
Using %i instead should fix the problem.

See https://www.freedesktop.org/software/systemd/man/systemd.unit.html

Essentially what is happening is that we start with a name like
br-ex that wasn't escaped in the first place.  However, because of
the - it looks like it could have been escaped to systemd.  When
we use %I, which tries to unescape escaped values, it unescapes a
value that was already not escaped.

Change-Id: I434ed2e084d4477dc7a2b7827164586f8ea0c1e3
Closes-Bug: 1649409
This commit is contained in:
Ben Nemec 2016-12-12 15:46:25 -06:00
parent 359892aa4b
commit d20754f6ed

View File

@ -1,5 +1,5 @@
[Unit]
Description=DHCP interface %I
Description=DHCP interface %i
# We want to run after network.target so it doesn't try to bring
# up the interfaces a second time, but network-online should not
# be reached until after we've brought up the interfaces.
@ -7,13 +7,13 @@ After=network.target
Before=network-online.target
Wants=network-online.target
ConditionPathExists=!/etc/sysconfig/network-scripts/ifcfg-%I
ConditionPathExists=!/etc/sysconfig/network-scripts/ifcfg-%i
[Service]
Type=oneshot
User=root
ExecStartPre=/usr/local/sbin/dhcp-all-interfaces.sh %I
ExecStart=/sbin/ifup %I
ExecStartPre=/usr/local/sbin/dhcp-all-interfaces.sh %i
ExecStart=/sbin/ifup %i
RemainAfterExit=true
TimeoutStartSec=DIB_DHCP_TIMEOUT