ipmi-net: ensure eth device present
Some OpenBMC systems may support a mix of eth0-only and eth0/eth1 ports
on their BMC device. In some cases, this support may be in a shared
flash image that supports both systems.
For example, IBM is building a system under the "p10bmc" bitbake machine
that only has a single ethernet port, eth0, wired up on it. The system
is still utilizing an AST2600, but only wired eth0 out of the system for
cost purposes.
Since the "p10bmc" machine is a shared target there is no way to remove
services that assume eth1 is present during the build process. Instead,
rely on the fact that the device will be present in /sys/class/net/
if in fact the system supports the network device.
Tested:
- Verified that a p10bmc Rainier machine with 2 eth ports still ran
these units for both ports
- Verified that a p10bmc Bonnell machine with only eth0 ran these units
for eth0 but not eth1
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I7e9db01fe26a4195802db4dcccffb412fbbe4a86
diff --git a/phosphor-ipmi-net@.service b/phosphor-ipmi-net@.service
index c3ea0a0..7008066 100644
--- a/phosphor-ipmi-net@.service
+++ b/phosphor-ipmi-net@.service
@@ -4,6 +4,7 @@
After=phosphor-ipmi-host.service
Requires=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
+ConditionPathExists=/sys/class/net/%i
[Service]
ExecStart=/usr/bin/netipmid -c %i
diff --git a/phosphor-ipmi-net@.socket b/phosphor-ipmi-net@.socket
index 5e56541..7dddfb6 100644
--- a/phosphor-ipmi-net@.socket
+++ b/phosphor-ipmi-net@.socket
@@ -1,3 +1,6 @@
+[Unit]
+ConditionPathExists=/sys/class/net/%i
+
[Socket]
ListenDatagram=623
BindToDevice=sys-subsystem-net-devices-%i.device