From b878cf381de0a0d158f1e97cf8726ea1756fd2fa Mon Sep 17 00:00:00 2001 From: Adrian Dudau Date: Fri, 29 Jan 2016 14:12:23 +0100 Subject: connman: Rewrite to a patch to the connman file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original .bbappend was adding a new "connman" file that replaced the one provided in the original recipe. This meant that any changes in the original file from poky would be overwritten. The .bbappend now patches the connman file so that any changes in it are either included or caught with merge conflict. To achieve this I did an artifice of copying the connman file in S to be patched by do_patch, then copied it back in WORKDIR to be installed on target by do_install. Also renamed the recipe .bbappend to cover all versions of connman and renamed the files folder. Signed-off-by: Adrian Dudau Signed-off-by: Nora Björklund --- .../connman/0001-added-noipconfig-option.patch | 353 +++++++++++++++++++++ recipes-connectivity/connman/connman/connman.patch | 18 ++ recipes-connectivity/connman/connman_%.bbappend | 20 ++ recipes-connectivity/connman/connman_1.25.bbappend | 5 - .../files/0001-added-noipconfig-option.patch | 353 --------------------- recipes-connectivity/connman/files/connman | 83 ----- 6 files changed, 391 insertions(+), 441 deletions(-) create mode 100644 recipes-connectivity/connman/connman/0001-added-noipconfig-option.patch create mode 100644 recipes-connectivity/connman/connman/connman.patch create mode 100644 recipes-connectivity/connman/connman_%.bbappend delete mode 100644 recipes-connectivity/connman/connman_1.25.bbappend delete mode 100644 recipes-connectivity/connman/files/0001-added-noipconfig-option.patch delete mode 100644 recipes-connectivity/connman/files/connman diff --git a/recipes-connectivity/connman/connman/0001-added-noipconfig-option.patch b/recipes-connectivity/connman/connman/0001-added-noipconfig-option.patch new file mode 100644 index 0000000..d86b778 --- /dev/null +++ b/recipes-connectivity/connman/connman/0001-added-noipconfig-option.patch @@ -0,0 +1,353 @@ +Disabling interface index for desired interfaces so that all methods dealing +with those indexes (ifup, ifdown, new route, new gateway, etc.) will exit +immediately. This is obtained through a new option called "noipconfig". +Helpful when dealing with NFS dhcp method like: +root=/dev/nfs rw nfsroot=172.21.3.8:/unix/enea_linux_rootfs/user/p2041rdb \ + ip=dhcp console=ttyS0,115200 memmap=16M$0xf7000000 \ + mem=4080M max_addr=f6ffffff + +This ports the https://www.cvg.de/people/ensc/0001-added-noipconfig-option.patch + change to connman_1.25. In http://patchwork.openembedded.org/patch/57539/ that + change is considered too intrusive and specific to be upstreamed. + +Signed-off-by: George Nita +Upstream-Status: Not Applicable + + +diff --git a/src/connman.h b/src/connman.h +index db6461f..8f4f4d0 100644 +--- a/src/connman.h ++++ b/src/connman.h +@@ -544,7 +544,8 @@ void __connman_technology_notify_regdom_by_device(struct connman_device *device, + + #include + +-int __connman_device_init(const char *device, const char *nodevice); ++int __connman_device_init(const char *device, const char *nodevice, ++ const char *noipconfig); + void __connman_device_cleanup(void); + + void __connman_device_list(DBusMessageIter *iter, void *user_data); +diff --git a/src/device.c b/src/device.c +index c0683ab..6582c51 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -37,6 +37,7 @@ + static GSList *device_list = NULL; + static gchar **device_filter = NULL; + static gchar **nodevice_filter = NULL; ++static gchar **noipconfig_filter = NULL; + + enum connman_pending_type { + PENDING_NONE = 0, +@@ -1314,6 +1315,20 @@ done: + return device; + } + ++static bool __connman_device_noipconfig(const char *devname) ++{ ++ char **pattern; ++ ++ for (pattern = noipconfig_filter; *pattern; pattern++) { ++ if (g_pattern_match_simple(*pattern, devname) == TRUE) { ++ DBG("do not configure device %s", devname); ++ return TRUE; ++ } ++ } ++ ++ return FALSE; ++} ++ + bool __connman_device_isfiltered(const char *devname) + { + char **pattern; +@@ -1403,6 +1418,9 @@ static void cleanup_devices(void) + if (index < 0) + continue; + ++ if (__connman_device_noipconfig(interfaces[i])) ++ __connman_inet_disable_index(index); ++ + if (!__connman_inet_get_address_netmask(index, &sin_addr, + &sin_mask)) { + char *address = g_strdup(inet_ntoa(sin_addr.sin_addr)); +@@ -1435,7 +1453,8 @@ static void cleanup_devices(void) + g_strfreev(interfaces); + } + +-int __connman_device_init(const char *device, const char *nodevice) ++int __connman_device_init(const char *device, const char *nodevice, ++ const char *noipconfig) + { + DBG(""); + +@@ -1445,6 +1464,9 @@ int __connman_device_init(const char *device, const char *nodevice) + if (nodevice) + nodevice_filter = g_strsplit(nodevice, ",", -1); + ++ if (noipconfig != NULL) ++ noipconfig_filter = g_strsplit(noipconfig, ",", -1); ++ + cleanup_devices(); + + return 0; +diff --git a/src/inet.c b/src/inet.c +index fb37143..d1f2c2f 100644 +--- a/src/inet.c ++++ b/src/inet.c +@@ -55,6 +55,45 @@ + ((struct rtattr *) (((uint8_t*) (nmsg)) + \ + NLMSG_ALIGN((nmsg)->nlmsg_len))) + ++static GHashTable *g_disabled_indices; ++ ++static guint g_intptr_hash(gconstpointer p) ++{ ++ uintptr_t v = (uintptr_t)p; ++ return g_int_hash(&v); ++} ++ ++static gboolean g_intptr_equal(gconstpointer p1, ++ gconstpointer p2) ++{ ++ uintptr_t v1 = (uintptr_t)p1; ++ uintptr_t v2 = (uintptr_t)p2; ++ ++ return g_int_equal(&v1, &v2); ++} ++ ++void __connman_inet_disable_index(int index) ++{ ++ connman_info("disabling interface #%d for ipconfig", index); ++ ++ if (g_disabled_indices == NULL) ++ g_disabled_indices = g_hash_table_new_full(g_intptr_hash, ++ g_intptr_equal, ++ NULL, NULL); ++ ++ g_hash_table_add(g_disabled_indices, (void *)index); ++} ++ ++static bool __connman_inet_is_disabled_index(int index) ++{ ++ bool rc; ++ ++ rc = (g_disabled_indices != NULL && ++ g_hash_table_contains(g_disabled_indices, (void *)index)); ++ ++ return rc; ++} ++ + int __connman_inet_rtnl_addattr_l(struct nlmsghdr *n, size_t max_length, + int type, const void *data, size_t data_length) + { +@@ -98,6 +137,11 @@ int __connman_inet_modify_address(int cmd, int flags, + "prefixlen %hhu broadcast %s", cmd, flags, index, family, + address, peer, prefixlen, broadcast); + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + if (!address) + return -EINVAL; + +@@ -275,6 +319,11 @@ int connman_inet_ifup(int index) + struct ifreq ifr; + int sk, err; + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); + if (sk < 0) + return -errno; +@@ -318,6 +367,11 @@ int connman_inet_ifdown(int index) + struct sockaddr_in *addr; + int sk, err; + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); + if (sk < 0) + return -errno; +@@ -519,6 +573,11 @@ int connman_inet_add_network_route(int index, const char *host, + DBG("index %d host %s gateway %s netmask %s", index, + host, gateway, netmask); + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); + if (sk < 0) { + err = -errno; +@@ -589,6 +648,11 @@ int connman_inet_del_network_route(int index, const char *host) + + DBG("index %d host %s", index, host); + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); + if (sk < 0) { + err = -errno; +@@ -637,6 +701,11 @@ int connman_inet_del_ipv6_network_route(int index, const char *host, + + DBG("index %d host %s", index, host); + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + if (!host) + return -EINVAL; + +@@ -687,6 +756,11 @@ int connman_inet_add_ipv6_network_route(int index, const char *host, + + DBG("index %d host %s gateway %s", index, host, gateway); + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + if (!host) + return -EINVAL; + +@@ -741,6 +815,11 @@ int connman_inet_clear_ipv6_gateway_address(int index, const char *gateway) + + DBG("index %d gateway %s", index, gateway); + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping clear_ipv6_gateway operation"); ++ return 0; ++ } ++ + if (!gateway) + return -EINVAL; + +@@ -784,6 +863,11 @@ int connman_inet_set_gateway_interface(int index) + + DBG("index %d", index); + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); + if (sk < 0) { + err = -errno; +@@ -837,6 +921,11 @@ int connman_inet_set_ipv6_gateway_interface(int index) + + DBG("index %d", index); + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + sk = socket(PF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0); + if (sk < 0) { + err = -errno; +@@ -889,6 +978,11 @@ int connman_inet_clear_gateway_address(int index, const char *gateway) + + DBG("index %d gateway %s", index, gateway); + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); + if (sk < 0) { + err = -errno; +@@ -946,6 +1040,11 @@ int connman_inet_clear_gateway_interface(int index) + + DBG("index %d", index); + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); + if (sk < 0) { + err = -errno; +@@ -999,6 +1098,11 @@ int connman_inet_clear_ipv6_gateway_interface(int index) + + DBG("index %d", index); + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + sk = socket(PF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0); + if (sk < 0) { + err = -errno; +@@ -1059,6 +1163,11 @@ bool connman_inet_compare_subnet(int index, const char *host) + return -1; + host_addr = _host_addr.s_addr; + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); + if (sk < 0) + return false; +@@ -1159,6 +1268,11 @@ int connman_inet_set_mtu(int index, int mtu) + struct ifreq ifr; + int sk, err; + ++ if (__connman_inet_is_disabled_index(index)) { ++ connman_info("index disabled; skipping %s", __func__); ++ return 0; ++ } ++ + sk = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); + if (sk < 0) + return sk; +diff --git a/src/main.c b/src/main.c +index 7cf6c9a..e06f25c 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -453,6 +453,7 @@ static gchar *option_debug = NULL; + static gchar *option_device = NULL; + static gchar *option_plugin = NULL; + static gchar *option_nodevice = NULL; ++static gchar *option_noipconfig = NULL; + static gchar *option_noplugin = NULL; + static gchar *option_wifi = NULL; + static gboolean option_detach = TRUE; +@@ -482,6 +483,8 @@ static GOptionEntry options[] = { + "Specify networking device or interface", "DEV" }, + { "nodevice", 'I', 0, G_OPTION_ARG_STRING, &option_nodevice, + "Specify networking interface to ignore", "DEV" }, ++ { "noipconfig", 0, 0, G_OPTION_ARG_STRING, &option_noipconfig, ++ "Specify networking interface which shall not be configured", "DEV" }, + { "plugin", 'p', 0, G_OPTION_ARG_STRING, &option_plugin, + "Specify plugins to load", "NAME,..." }, + { "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin, +@@ -648,7 +651,7 @@ int main(int argc, char *argv[]) + __connman_provider_init(); + __connman_network_init(); + __connman_config_init(); +- __connman_device_init(option_device, option_nodevice); ++ __connman_device_init(option_device, option_nodevice, option_noipconfig); + + __connman_ippool_init(); + __connman_iptables_init(); diff --git a/recipes-connectivity/connman/connman/connman.patch b/recipes-connectivity/connman/connman/connman.patch new file mode 100644 index 0000000..e3ff2f9 --- /dev/null +++ b/recipes-connectivity/connman/connman/connman.patch @@ -0,0 +1,18 @@ +--- ./connman.orig 2016-01-28 17:03:08.000315610 +0100 ++++ ./connman 2016-01-28 17:05:24.393956927 +0100 +@@ -36,13 +36,13 @@ do_start() { + if [ "$NET_ADDR" = dhcp ]; then + ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"` + if [ ! -z "$ethn" ]; then +- EXTRA_PARAM="-I $ethn" ++ EXTRA_PARAM="--noipconfig $ethn" + fi + else + for i in $NET_DEVS; do + ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'` + if [ "$NET_ADDR" = "$ADDR" ]; then +- EXTRA_PARAM="-I $i" ++ EXTRA_PARAM="--noipconfig $i" + break + fi + done diff --git a/recipes-connectivity/connman/connman_%.bbappend b/recipes-connectivity/connman/connman_%.bbappend new file mode 100644 index 0000000..a32d4b3 --- /dev/null +++ b/recipes-connectivity/connman/connman_%.bbappend @@ -0,0 +1,20 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/connman:" + +SRC_URI += "file://0001-added-noipconfig-option.patch \ + file://connman.patch \ + " + +python do_patch_prepend() { + import shutil + workdir = d.getVar('WORKDIR', True) + source = d.getVar('S', True) + shutil.move(os.path.join(workdir, "connman"), source) +} + + +python do_patch_append() { + import shutil + workdir = d.getVar('WORKDIR', True) + source = d.getVar('S', True) + shutil.move(os.path.join(source, "connman"), workdir) +} diff --git a/recipes-connectivity/connman/connman_1.25.bbappend b/recipes-connectivity/connman/connman_1.25.bbappend deleted file mode 100644 index 4f72ec3..0000000 --- a/recipes-connectivity/connman/connman_1.25.bbappend +++ /dev/null @@ -1,5 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -SRC_URI += "file://0001-added-noipconfig-option.patch \ - file://connman \ - " diff --git a/recipes-connectivity/connman/files/0001-added-noipconfig-option.patch b/recipes-connectivity/connman/files/0001-added-noipconfig-option.patch deleted file mode 100644 index d86b778..0000000 --- a/recipes-connectivity/connman/files/0001-added-noipconfig-option.patch +++ /dev/null @@ -1,353 +0,0 @@ -Disabling interface index for desired interfaces so that all methods dealing -with those indexes (ifup, ifdown, new route, new gateway, etc.) will exit -immediately. This is obtained through a new option called "noipconfig". -Helpful when dealing with NFS dhcp method like: -root=/dev/nfs rw nfsroot=172.21.3.8:/unix/enea_linux_rootfs/user/p2041rdb \ - ip=dhcp console=ttyS0,115200 memmap=16M$0xf7000000 \ - mem=4080M max_addr=f6ffffff - -This ports the https://www.cvg.de/people/ensc/0001-added-noipconfig-option.patch - change to connman_1.25. In http://patchwork.openembedded.org/patch/57539/ that - change is considered too intrusive and specific to be upstreamed. - -Signed-off-by: George Nita -Upstream-Status: Not Applicable - - -diff --git a/src/connman.h b/src/connman.h -index db6461f..8f4f4d0 100644 ---- a/src/connman.h -+++ b/src/connman.h -@@ -544,7 +544,8 @@ void __connman_technology_notify_regdom_by_device(struct connman_device *device, - - #include - --int __connman_device_init(const char *device, const char *nodevice); -+int __connman_device_init(const char *device, const char *nodevice, -+ const char *noipconfig); - void __connman_device_cleanup(void); - - void __connman_device_list(DBusMessageIter *iter, void *user_data); -diff --git a/src/device.c b/src/device.c -index c0683ab..6582c51 100644 ---- a/src/device.c -+++ b/src/device.c -@@ -37,6 +37,7 @@ - static GSList *device_list = NULL; - static gchar **device_filter = NULL; - static gchar **nodevice_filter = NULL; -+static gchar **noipconfig_filter = NULL; - - enum connman_pending_type { - PENDING_NONE = 0, -@@ -1314,6 +1315,20 @@ done: - return device; - } - -+static bool __connman_device_noipconfig(const char *devname) -+{ -+ char **pattern; -+ -+ for (pattern = noipconfig_filter; *pattern; pattern++) { -+ if (g_pattern_match_simple(*pattern, devname) == TRUE) { -+ DBG("do not configure device %s", devname); -+ return TRUE; -+ } -+ } -+ -+ return FALSE; -+} -+ - bool __connman_device_isfiltered(const char *devname) - { - char **pattern; -@@ -1403,6 +1418,9 @@ static void cleanup_devices(void) - if (index < 0) - continue; - -+ if (__connman_device_noipconfig(interfaces[i])) -+ __connman_inet_disable_index(index); -+ - if (!__connman_inet_get_address_netmask(index, &sin_addr, - &sin_mask)) { - char *address = g_strdup(inet_ntoa(sin_addr.sin_addr)); -@@ -1435,7 +1453,8 @@ static void cleanup_devices(void) - g_strfreev(interfaces); - } - --int __connman_device_init(const char *device, const char *nodevice) -+int __connman_device_init(const char *device, const char *nodevice, -+ const char *noipconfig) - { - DBG(""); - -@@ -1445,6 +1464,9 @@ int __connman_device_init(const char *device, const char *nodevice) - if (nodevice) - nodevice_filter = g_strsplit(nodevice, ",", -1); - -+ if (noipconfig != NULL) -+ noipconfig_filter = g_strsplit(noipconfig, ",", -1); -+ - cleanup_devices(); - - return 0; -diff --git a/src/inet.c b/src/inet.c -index fb37143..d1f2c2f 100644 ---- a/src/inet.c -+++ b/src/inet.c -@@ -55,6 +55,45 @@ - ((struct rtattr *) (((uint8_t*) (nmsg)) + \ - NLMSG_ALIGN((nmsg)->nlmsg_len))) - -+static GHashTable *g_disabled_indices; -+ -+static guint g_intptr_hash(gconstpointer p) -+{ -+ uintptr_t v = (uintptr_t)p; -+ return g_int_hash(&v); -+} -+ -+static gboolean g_intptr_equal(gconstpointer p1, -+ gconstpointer p2) -+{ -+ uintptr_t v1 = (uintptr_t)p1; -+ uintptr_t v2 = (uintptr_t)p2; -+ -+ return g_int_equal(&v1, &v2); -+} -+ -+void __connman_inet_disable_index(int index) -+{ -+ connman_info("disabling interface #%d for ipconfig", index); -+ -+ if (g_disabled_indices == NULL) -+ g_disabled_indices = g_hash_table_new_full(g_intptr_hash, -+ g_intptr_equal, -+ NULL, NULL); -+ -+ g_hash_table_add(g_disabled_indices, (void *)index); -+} -+ -+static bool __connman_inet_is_disabled_index(int index) -+{ -+ bool rc; -+ -+ rc = (g_disabled_indices != NULL && -+ g_hash_table_contains(g_disabled_indices, (void *)index)); -+ -+ return rc; -+} -+ - int __connman_inet_rtnl_addattr_l(struct nlmsghdr *n, size_t max_length, - int type, const void *data, size_t data_length) - { -@@ -98,6 +137,11 @@ int __connman_inet_modify_address(int cmd, int flags, - "prefixlen %hhu broadcast %s", cmd, flags, index, family, - address, peer, prefixlen, broadcast); - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - if (!address) - return -EINVAL; - -@@ -275,6 +319,11 @@ int connman_inet_ifup(int index) - struct ifreq ifr; - int sk, err; - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); - if (sk < 0) - return -errno; -@@ -318,6 +367,11 @@ int connman_inet_ifdown(int index) - struct sockaddr_in *addr; - int sk, err; - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); - if (sk < 0) - return -errno; -@@ -519,6 +573,11 @@ int connman_inet_add_network_route(int index, const char *host, - DBG("index %d host %s gateway %s netmask %s", index, - host, gateway, netmask); - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); - if (sk < 0) { - err = -errno; -@@ -589,6 +648,11 @@ int connman_inet_del_network_route(int index, const char *host) - - DBG("index %d host %s", index, host); - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); - if (sk < 0) { - err = -errno; -@@ -637,6 +701,11 @@ int connman_inet_del_ipv6_network_route(int index, const char *host, - - DBG("index %d host %s", index, host); - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - if (!host) - return -EINVAL; - -@@ -687,6 +756,11 @@ int connman_inet_add_ipv6_network_route(int index, const char *host, - - DBG("index %d host %s gateway %s", index, host, gateway); - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - if (!host) - return -EINVAL; - -@@ -741,6 +815,11 @@ int connman_inet_clear_ipv6_gateway_address(int index, const char *gateway) - - DBG("index %d gateway %s", index, gateway); - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping clear_ipv6_gateway operation"); -+ return 0; -+ } -+ - if (!gateway) - return -EINVAL; - -@@ -784,6 +863,11 @@ int connman_inet_set_gateway_interface(int index) - - DBG("index %d", index); - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); - if (sk < 0) { - err = -errno; -@@ -837,6 +921,11 @@ int connman_inet_set_ipv6_gateway_interface(int index) - - DBG("index %d", index); - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - sk = socket(PF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0); - if (sk < 0) { - err = -errno; -@@ -889,6 +978,11 @@ int connman_inet_clear_gateway_address(int index, const char *gateway) - - DBG("index %d gateway %s", index, gateway); - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); - if (sk < 0) { - err = -errno; -@@ -946,6 +1040,11 @@ int connman_inet_clear_gateway_interface(int index) - - DBG("index %d", index); - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); - if (sk < 0) { - err = -errno; -@@ -999,6 +1098,11 @@ int connman_inet_clear_ipv6_gateway_interface(int index) - - DBG("index %d", index); - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - sk = socket(PF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0); - if (sk < 0) { - err = -errno; -@@ -1059,6 +1163,11 @@ bool connman_inet_compare_subnet(int index, const char *host) - return -1; - host_addr = _host_addr.s_addr; - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); - if (sk < 0) - return false; -@@ -1159,6 +1268,11 @@ int connman_inet_set_mtu(int index, int mtu) - struct ifreq ifr; - int sk, err; - -+ if (__connman_inet_is_disabled_index(index)) { -+ connman_info("index disabled; skipping %s", __func__); -+ return 0; -+ } -+ - sk = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); - if (sk < 0) - return sk; -diff --git a/src/main.c b/src/main.c -index 7cf6c9a..e06f25c 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -453,6 +453,7 @@ static gchar *option_debug = NULL; - static gchar *option_device = NULL; - static gchar *option_plugin = NULL; - static gchar *option_nodevice = NULL; -+static gchar *option_noipconfig = NULL; - static gchar *option_noplugin = NULL; - static gchar *option_wifi = NULL; - static gboolean option_detach = TRUE; -@@ -482,6 +483,8 @@ static GOptionEntry options[] = { - "Specify networking device or interface", "DEV" }, - { "nodevice", 'I', 0, G_OPTION_ARG_STRING, &option_nodevice, - "Specify networking interface to ignore", "DEV" }, -+ { "noipconfig", 0, 0, G_OPTION_ARG_STRING, &option_noipconfig, -+ "Specify networking interface which shall not be configured", "DEV" }, - { "plugin", 'p', 0, G_OPTION_ARG_STRING, &option_plugin, - "Specify plugins to load", "NAME,..." }, - { "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin, -@@ -648,7 +651,7 @@ int main(int argc, char *argv[]) - __connman_provider_init(); - __connman_network_init(); - __connman_config_init(); -- __connman_device_init(option_device, option_nodevice); -+ __connman_device_init(option_device, option_nodevice, option_noipconfig); - - __connman_ippool_init(); - __connman_iptables_init(); diff --git a/recipes-connectivity/connman/files/connman b/recipes-connectivity/connman/files/connman deleted file mode 100644 index a7b7c7b..0000000 --- a/recipes-connectivity/connman/files/connman +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh - -DAEMON=/usr/sbin/connmand -PIDFILE=/var/run/connmand.pid -DESC="Connection Manager" - -if [ -f /etc/default/connman ] ; then - . /etc/default/connman -fi - -set -e - -nfsroot=0 - -exec 9<&0 < /proc/mounts -while read dev mtpt fstype rest; do - if test $mtpt = "/" ; then - case $fstype in - nfs | nfs4) - nfsroot=1 - break - ;; - *) - ;; - esac - fi -done - -do_start() { - EXTRA_PARAM="" - if test $nfsroot -eq 1 ; then - NET_DEVS=`cat /proc/net/dev | sed -ne 's/^\([a-zA-Z0-9 ]*\):.*$/\1/p'` - NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'` - - if [ ! -z "$NET_ADDR" ]; then - if [ "$NET_ADDR" = dhcp ]; then - ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"` - if [ ! -z "$ethn" ]; then - EXTRA_PARAM="--noipconfig $ethn" - fi - else - for i in $NET_DEVS; do - ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'` - if [ "$NET_ADDR" = "$ADDR" ]; then - EXTRA_PARAM="--noipconfig $i" - break - fi - done - fi - fi - fi - if [ -f @LIBDIR@/connman/wired-setup ] ; then - . @LIBDIR@/connman/wired-setup - fi - $DAEMON $EXTRA_PARAM -} - -do_stop() { - start-stop-daemon --stop --name connmand --quiet -} - -case "$1" in - start) - echo "Starting $DESC" - do_start - ;; - stop) - echo "Stopping $DESC" - do_stop - ;; - restart|force-reload) - echo "Restarting $DESC" - do_stop - sleep 1 - do_start - ;; - *) - echo "Usage: $0 {start|stop|restart|force-reload}" >&2 - exit 1 - ;; -esac - -exit 0 -- cgit v1.2.3-54-g00ecf