summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Luebbe <jlu@pengutronix.de>2012-01-31 15:58:52 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2012-01-31 19:57:14 +0100
commit85b0f592b2328ac1c18ab89730f280cc851f992b (patch)
treea103eeae29ce283737df673c3e32844d3c361b88
parent82a61ea9e60237a848a5c29f71ecad7cae649340 (diff)
downloadptxdist-85b0f592b2328ac1c18ab89730f280cc851f992b.tar.gz
ptxdist-85b0f592b2328ac1c18ab89730f280cc851f992b.tar.xz
connman: ignore interfaces which are up before connman has been started
Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rwxr-xr-xgeneric/lib/systemd/connman-ignore11
-rw-r--r--generic/lib/systemd/system/connman-ignore.service12
-rw-r--r--generic/lib/systemd/system/connman.service12
-rw-r--r--rules/connman.make8
4 files changed, 42 insertions, 1 deletions
diff --git a/generic/lib/systemd/connman-ignore b/generic/lib/systemd/connman-ignore
new file mode 100755
index 000000000..8172b5c26
--- /dev/null
+++ b/generic/lib/systemd/connman-ignore
@@ -0,0 +1,11 @@
+#!/bin/sh
+CONNMAN_IGNORE_OPTS=""
+for IF in $(ls /sys/class/net); do
+ IF_FLAGS="$(cat /sys/class/net/$IF/flags)"
+ if [ "$((IF_FLAGS&1))" = "1" -a "$IF" != "lo" ]; then
+ CONNMAN_IGNORE_OPTS="$CONNMAN_IGNORE_OPTS -I $IF"
+ fi
+done
+
+echo "CONNMAN_IGNORE_OPTS=\"$CONNMAN_IGNORE_OPTS\"" > /run/connman-ignore
+
diff --git a/generic/lib/systemd/system/connman-ignore.service b/generic/lib/systemd/system/connman-ignore.service
new file mode 100644
index 000000000..ac80f517c
--- /dev/null
+++ b/generic/lib/systemd/system/connman-ignore.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Connection Manager configuration (ignore kernel activated network interfaces)
+Before=connman.service
+ConditionPathExists=!/run/connman-ignore
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/lib/systemd/connman-ignore
+
+[Install]
+WantedBy=connman.service
diff --git a/generic/lib/systemd/system/connman.service b/generic/lib/systemd/system/connman.service
new file mode 100644
index 000000000..b90a4fdc6
--- /dev/null
+++ b/generic/lib/systemd/system/connman.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Connection service
+After=syslog.target
+
+[Service]
+Type=dbus
+BusName=net.connman
+EnvironmentFile=-/run/connman-ignore
+ExecStart=/usr/sbin/connmand -n $CONNMAN_IGNORE_OPTS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/rules/connman.make b/rules/connman.make
index 71ce71e09..68e7987e1 100644
--- a/rules/connman.make
+++ b/rules/connman.make
@@ -155,10 +155,16 @@ endif
endif
endif
ifdef PTXCONF_CONNMAN_SYSTEMD_UNIT
- @$(call install_copy, connman, 0, 0, 0644, -, \
+ @$(call install_alternative, connman, 0, 0, 0644, \
/lib/systemd/system/connman.service)
@$(call install_link, connman, ../connman.service, \
/lib/systemd/system/multi-user.target.wants/connman.service)
+ @$(call install_alternative, connman, 0, 0, 0644, \
+ /lib/systemd/system/connman-ignore.service)
+ @$(call install_link, connman, ../connman-ignore.service, \
+ /lib/systemd/system/connman.service.wants/connman-ignore.service)
+ @$(call install_alternative, connman, 0, 0, 0755, \
+ /lib/systemd/connman-ignore)
endif
# # dbus config