summaryrefslogtreecommitdiffstats
path: root/package/systemd/network.service
diff options
context:
space:
mode:
authorIvan Sergeev <vsergeev@kumunetworks.com>2014-06-13 17:35:35 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-06-14 18:41:08 +0200
commiteb981cf80be9dae210e940847e291f4cdcfa636f (patch)
tree6d732b0001a223455deaab18e75b760f7979c359 /package/systemd/network.service
parent91fc913510c493b133c8b02987684e365e33b09b (diff)
downloadbuildroot-eb981cf80be9dae210e940847e291f4cdcfa636f.tar.gz
buildroot-eb981cf80be9dae210e940847e291f4cdcfa636f.zip
systemd: add network unit file
Add and enable a systemd unit file to bring up or down network with ifup / ifdown, analogous to the skeleton/etc/init.d/S40network init script. Signed-off-by: Ivan Sergeev <vsergeev@kumunetworks.com> [eric.le.bihan.dev@free.fr: - rebase - install service only if systemd-networkd is not selected] Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/systemd/network.service')
-rw-r--r--package/systemd/network.service21
1 files changed, 21 insertions, 0 deletions
diff --git a/package/systemd/network.service b/package/systemd/network.service
new file mode 100644
index 0000000000..0d77bb824a
--- /dev/null
+++ b/package/systemd/network.service
@@ -0,0 +1,21 @@
+[Unit]
+Description=Network Connectivity
+Wants=network.target
+Before=network.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+
+# lo is brought up earlier, which will cause the upcoming "ifup -a" to fail
+# with exit code 1, due to an "ip: RTNETLINK answers: File exists" error during
+# its "ip addr add ..." command, subsequently causing this unit to fail even
+# though it is a benign error. Flushing the lo address with the command below
+# before ifup prevents this failure.
+ExecStart=/sbin/ip addr flush dev lo
+
+ExecStart=/sbin/ifup -a
+ExecStop=/sbin/ifdown -a
+
+[Install]
+WantedBy=multi-user.target
OpenPOWER on IntegriCloud