aboutsummaryrefslogtreecommitdiffstats
path: root/meta-mentor-staging/recipes-connectivity/connman/files/0001-connman-implement-network-interface-management-techn.patch
blob: 06695ea5669699a95e0f0dc312cb64525a07bf07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From e6dedb531096f29825bddaf428ca8d3c4ad1df26 Mon Sep 17 00:00:00 2001
From: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
Date: Tue, 1 Jul 2014 23:47:15 +0530
Subject: [PATCH] connman: implement network interface management techniques

This is required to obtain a managed network interface before connman
tries to call cleanup_devices function, this will let connman
create new routing table without bringing down the ethernet interface.

Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>

---
 src/connman.service.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/connman.service.in b/src/connman.service.in
index 79e75d6..0e7275a 100644
--- a/src/connman.service.in
+++ b/src/connman.service.in
@@ -12,7 +12,10 @@ Conflicts=systemd-resolved.service
 Type=dbus
 BusName=net.connman
 Restart=on-failure
-ExecStart=@sbindir@/connmand -n
+EnvironmentFile=-/tmp/connman.env
+ExecStartPre=/bin/sh -c "if grep 'nfsroot\|ip=' /proc/cmdline; then ETH_IFACE=$(ip addr | grep 'eth[0-9]:' | grep 'UP' | sed -e 's,\(eth[0-9]\)\(.*\),\1,' -e 's,^.*: ,,' ); NET_ADDR=$(cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'); echo -e 'OPT=-I '$ETH_IFACE'\nOPT2='$ETH_IFACE'\nNET_ADDR='$NET_ADDR' ' > /tmp/connman.env; fi "
+ExecStart=/bin/sh -c "if [ \"$NET_ADDR\" = \"off\" ] || [ \"$NET_ADDR\" = \"none\" ]; then /usr/sbin/connmand -n; else /usr/sbin/connmand -n $OPT; fi"
+ExecStartPost=/bin/sh -c "if [ ! -z \"$OPT\" ] && [ \"$NET_ADDR\" = \"dhcp\" ]; then /sbin/udhcpc -i $OPT2; fi"
 StandardOutput=null
 CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_ADMIN
 ProtectHome=true