Hello community, here is the log from the commit of package netcontrol for openSUSE:Factory checked in at 2020-03-14 09:54:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/netcontrol (Old) and /work/SRC/openSUSE:Factory/.netcontrol.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "netcontrol" Sat Mar 14 09:54:31 2020 rev:19 rq:784086 version:0.3.1 Changes: -------- --- /work/SRC/openSUSE:Factory/netcontrol/netcontrol.changes 2019-04-17 10:04:23.598502260 +0200 +++ /work/SRC/openSUSE:Factory/.netcontrol.new.3160/netcontrol.changes 2020-03-14 09:54:32.767075154 +0100 @@ -1,0 +2,18 @@ +Wed Mar 11 23:13:15 UTC 2020 - [email protected] + +- bonding: don't complain about unknown options (bsc#1132794) + [+ 0005-bonding-don-t-complain-about-unknown-options.1132794.patch] + +------------------------------------------------------------------- +Wed Mar 11 15:06:33 UTC 2020 - [email protected] + +- udev: use correct udev rule (write) lock directory + [+ 0004-udev-use-correct-udev-rule-write-lock-directory.patch] +- sysconfig: fix segfault on missed end-quote (bsc#1027736) + [+ 0003-sysconfig-fix-segfault-on-missed-end-quote-bsc-10277.patch] +- fix segfault on invalid check in route creation (bsc#1148646) + [+ 0002-Fix-invalid-check-in-route-creation-bsc-1148646.patch] +- fix virsh iface-list not working as expected (bsc#1029201) + [+ 0001-virsh-iface-list-not-working-as-expected-bsc-1029201.patch] + +------------------------------------------------------------------- New: ---- 0001-virsh-iface-list-not-working-as-expected-bsc-1029201.patch 0002-Fix-invalid-check-in-route-creation-bsc-1148646.patch 0003-sysconfig-fix-segfault-on-missed-end-quote-bsc-10277.patch 0004-udev-use-correct-udev-rule-write-lock-directory.patch 0005-bonding-don-t-complain-about-unknown-options.1132794.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ netcontrol.spec ++++++ --- /var/tmp/diff_new_pack.8KdfJF/_old 2020-03-14 09:54:33.391075613 +0100 +++ /var/tmp/diff_new_pack.8KdfJF/_new 2020-03-14 09:54:33.395075615 +0100 @@ -1,7 +1,7 @@ # # spec file for package netcontrol # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -20,8 +20,6 @@ Version: 0.3.1 Release: 0 Summary: A network configuration library -License: LGPL-2.1+ -Group: Productivity/Networking/System # # License note: # libnetcontrol contains source code which is based on wicked. @@ -29,8 +27,15 @@ # granted by the authors of wicked to use the code derived from # wicked under the LGPL-2.1+ in libnetcontrol. # +License: LGPL-2.1-or-later +Group: Productivity/Networking/System Source0: %{name}-%{version}.tar.bz2 Source1: baselibs.conf +Patch1: 0001-virsh-iface-list-not-working-as-expected-bsc-1029201.patch +Patch2: 0002-Fix-invalid-check-in-route-creation-bsc-1148646.patch +Patch3: 0003-sysconfig-fix-segfault-on-missed-end-quote-bsc-10277.patch +Patch4: 0004-udev-use-correct-udev-rule-write-lock-directory.patch +Patch5: 0005-bonding-don-t-complain-about-unknown-options.1132794.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} >= 1310 BuildRequires: autoconf @@ -102,6 +107,11 @@ %prep %setup -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 %build export CFLAGS="-W -Wall $RPM_OPT_FLAGS" ++++++ 0001-virsh-iface-list-not-working-as-expected-bsc-1029201.patch ++++++ >From 9653faeead3d1a851c3cb2f20af353a629ee01a7 Mon Sep 17 00:00:00 2001 From: Nikola Pajkovsky <[email protected]> Date: Mon, 10 Jul 2017 11:52:09 +0100 References: bsc#1029201 Upstream: merged Subject: [PATCH] virsh iface-list not working as expected (bsc#1029201) commit f1592239fc68afd254e207ec833964b9c672db85 Author: Marius Tomaschewski <[email protected]> Date: Mon Jul 10 10:40:10 2017 +0200 filter inactive configs by iftype, not by arp-type commit 45271cb4fe11aa3415535247f480614af9472c5a Author: Marius Tomaschewski <[email protected]> Date: Mon Jul 10 10:29:25 2017 +0200 call regular ifstatus, do not try to shorten in read diff --git a/src/backend-suse.c b/src/backend-suse.c index 7e76a24..5e5e811 100644 --- a/src/backend-suse.c +++ b/src/backend-suse.c @@ -138,7 +138,7 @@ static int __suse_config_read_routes(nc_route_array_t *routes, const char *file, const char *ifname); static int __suse_system_read_state(nc_interface_t *ifp); -static int __suse_ifstatus(nc_interface_t *ifp, unsigned *status); + #define _SYSCONFIG_NETWORK_DIR "/etc/sysconfig/network" #define _CONFIG_GLOBAL "config" @@ -2109,7 +2109,6 @@ __suse_config_read_ifcfg(nc_handle_t *nh, nc_interface_t *ifp, nc_sysconfig_t *s __suse_ifcfg_bootproto_set(ifp, "static"); } - __suse_ifstatus(ifp, &ifp->ifflags); /* __suse_config_load_sysctls(nh, ifp, &sysctl); __suse_adjust_ipv6_autoconf(ifp, &sysctl); @@ -2528,8 +2527,6 @@ __suse_system_read_state(nc_interface_t *ifp) /* TODO: double check use of 'none' */ __nc_discover_bootproto(ifp); - __suse_ifstatus(ifp, &ifp->ifflags); - if(nc_sysfs_netif_get_string(ifp->name, "address", &value) < 0) { nc_warn("failed to read hwaddr from sysfs"); } else if(value && nc_string_len(value)) { @@ -2540,60 +2537,6 @@ __suse_system_read_state(nc_interface_t *ifp) return ret; } -int -__suse_ifstatus(nc_interface_t *ifp, unsigned *status) -{ - char if_file[PATH_MAX + 1] = {'\0'}; - nc_sysconfig_t *sc; - nc_var_t *v; -#if 0 - char *operstate = NULL; -#endif - - if(!ifp || !ifp->name || !status) - return -1; - - /* for now ... */ - - *status &= ~NC_IFF_NETWORK_UP; - -#if 0 /* Hmm... ifstatus usually check UP flag, not operstate... - * It is very expensive to call ifstatus in every refresh - * [~ every 3 secs with active virt-manager] ... - * - * => ncf_if_status for true ifstatus call. - */ - if(nc_sysfs_netif_get_string(ifp->name, "operstate", &operstate) == 0) { - if(nc_string_eq(operstate, "down") || - nc_string_eq(operstate, "lowerlayerdown")) { - nc_string_free(&operstate); - return 0; - } - nc_string_free(&operstate); - } -#endif - - snprintf(if_file, sizeof(if_file), "/dev/.sysconfig/network/if-%s", ifp->name); - sc = nc_sysconfig_read(if_file); - if(sc) { - if(NC_ADDRCONF_TEST(ifp->ipv4.addrconf, NC_ADDRCONF_DHCP)) { - v = nc_sysconfig_get(sc, "dhcp4_state"); - if(v && (nc_string_eq(v->value, "complete") || - nc_string_eq(v->value, "new") || - nc_string_eq(v->value, "up"))) { - *status |= NC_IFF_NETWORK_UP; - } - } else { - v = nc_sysconfig_get(sc, "status"); - if(v && nc_string_eq(v->value, "connected")) { - *status |= NC_IFF_NETWORK_UP; - } - } - nc_sysconfig_free(sc); - } - return 0; -} - void nc_ifcfg_trace_dump(const nc_sysconfig_t *sc) { diff --git a/src/netcf-xml.c b/src/netcf-xml.c index 02c6538..c4d938b 100644 --- a/src/netcf-xml.c +++ b/src/netcf-xml.c @@ -131,25 +131,31 @@ __get_iftype_name(unsigned int type) } static unsigned int -__map_iftype_to_netcf(unsigned int type) +__map_iftype_to_netcf(const nc_interface_t *ifp, unsigned int strict) { - switch(type) { + switch(ifp ? ifp->type : NC_IFTYPE_UNKNOWN) { + case NC_IFTYPE_ETHERNET: case NC_IFTYPE_BRIDGE: - case NC_IFTYPE_BOND: case NC_IFTYPE_VLAN: - return type; - break; + return ifp->type; + + case NC_IFTYPE_BOND: + if (strict && ifp->bonding && + ifp->bonding->slave_type != NC_IFTYPE_ETHERNET) + break; + return ifp->type; - case NC_IFTYPE_ETHERNET: case NC_IFTYPE_LOOPBACK: /* as netcf does ... */ case NC_IFTYPE_TOKENRING: - case NC_IFTYPE_INFINIBAND: /* hmm... for now */ + case NC_IFTYPE_INFINIBAND: + if (strict) + break; case NC_IFTYPE_DUMMY: case NC_IFTYPE_TAP: return NC_IFTYPE_ETHERNET; - break; + default: - break; + break; } return NC_IFTYPE_UNKNOWN; } @@ -244,10 +250,10 @@ __nc_netcf_supported_inteface( nc_syntax_t *syntax, if(!syntax || !handle || !ifp || !ifp->name) return -1; - if(syntax->strict && ifp->arp_type != ARPHRD_ETHER) + if(syntax->strict && ifp->ifindex && ifp->arp_type != ARPHRD_ETHER) return 1; - if(__map_iftype_to_netcf(ifp->type) == NC_IFTYPE_UNKNOWN) + if(__map_iftype_to_netcf(ifp, syntax->strict) == NC_IFTYPE_UNKNOWN) return 1; if(ifp->startmode == NC_STARTMODE_NFSROOT || @@ -356,7 +362,7 @@ __netcf_xml_from_interface( nc_syntax_t *syntax, return NULL; assert(ifp && ifp->name); - type = __map_iftype_to_netcf(ifp->type); + type = __map_iftype_to_netcf(ifp, syntax->strict); if(type == NC_IFTYPE_UNKNOWN) return NULL; diff --git a/src/netcf.c b/src/netcf.c index a3a78f9..33a0499 100644 --- a/src/netcf.c +++ b/src/netcf.c @@ -718,6 +718,7 @@ __ncf_list_interfaces(struct netcf *ncf, unsigned int flags, state = NETCF_IFACE_INACTIVE; cur = nc_interface_by_name(ncf->system.handle, ifp->name); if(cur) { + nc_interface_status(ncf->system.handle, cur); if(nc_interface_network_is_up(cur)) state = NETCF_IFACE_ACTIVE; } -- 2.16.4 ++++++ 0002-Fix-invalid-check-in-route-creation-bsc-1148646.patch ++++++ >From 1cd284f95ce47e0eb79314b3a27e099f443aefdb Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski <[email protected]> Date: Fri, 11 Oct 2019 12:37:31 +0200 References: bsc#1148646 Upstream: merged Subject: [PATCH] Fix invalid check in route creation (bsc#1148646) diff --git a/src/nutils.c b/src/nutils.c index bda1b64..a2b8223 100644 --- a/src/nutils.c +++ b/src/nutils.c @@ -578,8 +578,7 @@ nc_route_create(unsigned int prefixlen, const nc_sockaddr_t *dest, nc_error("Cannot create route - destination and gw are both 0/0"); return NULL; } - /* TODO: we have to parse opts (type + opts) */ - if(!nc_string_len(ifname) && !opts && !*opts) { + if(!nc_string_len(ifname)) { nc_error("Cannot create route - interface route requires an interface"); return NULL; } -- 2.16.4 ++++++ 0003-sysconfig-fix-segfault-on-missed-end-quote-bsc-10277.patch ++++++ >From ca57462e67fdbd30269117d0e75a2257efefdefd Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski <[email protected]> Date: Fri, 28 Feb 2020 16:10:53 +0100 References: bsc#1027736 Upstream: merged Subject: [PATCH] sysconfig: fix segfault on missed end-quote (bsc#1027736) diff --git a/src/sysconfig.c b/src/sysconfig.c index 48e929b..d03f23a 100644 --- a/src/sysconfig.c +++ b/src/sysconfig.c @@ -91,31 +91,32 @@ nc_sysconfig_free(nc_sysconfig_t *nsc) static int __unquote(char *string) { - char *src, *dst, cc; + char *src, *dst, qc = 0, lc = 0; + unsigned char cc; + int ret = 1; src = dst = string; - while ((cc = *src++) != '\0') { - if (isspace(cc)) + if (*string == '"' || *string == '\'') { + qc = *string; + src++; + } + do { + cc = *src; + if (!cc) { + ret = qc && lc == qc; break; - if (*string == '"') { - while ((cc = *src++) != '"') { - if (cc == '\\') { - cc = *src++; - if (cc == '\0') - return 0; - } - *dst++ = cc; - } - } else if (*string == '\'') { - while ((cc = *src++) != '\'') - *dst++ = cc; - string = dst; - } else { - *dst++ = cc; } - } + if (isspace(cc) && !qc) + break; + if (cc == qc) + break; + *dst = lc = cc; + dst++; + src++; + } while (1); + *dst = '\0'; - return 1; + return ret; } static int -- 2.16.4 ++++++ 0004-udev-use-correct-udev-rule-write-lock-directory.patch ++++++ >From 61b785184199f79f08d9ee023ce67ae56719499c Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski <[email protected]> Date: Wed, 11 Mar 2020 14:35:22 +0100 Upstream: merged Subject: [PATCH] udev: use correct udev rule (write) lock directory diff --git a/src/futils.c b/src/futils.c index b330f0a..9e9abd6 100644 --- a/src/futils.c +++ b/src/futils.c @@ -41,10 +41,35 @@ #include <limits.h> #include <errno.h> #include <assert.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> #include <futils.h> #include <logging.h> +int /* bool */ +nc_isdir(const char *path) +{ + struct stat stb; + + if (stat(path, &stb) < 0) + return 0; + + return S_ISDIR(stb.st_mode); +} + +int /* bool */ +nc_isreg(const char *path) +{ + struct stat stb; + + if (stat(path, &stb) < 0) + return 0; + + return S_ISREG(stb.st_mode); +} + int /* bool */ nc_file_exists(const char *filename) { @@ -64,6 +89,17 @@ nc_file_exists_fmt(const char *fmt, ...) return nc_file_exists(filename); } +const char * +nc_basename(const char *pathname) +{ + const char *basename; + + if (!pathname || !(basename = strrchr(pathname, '/'))) + return pathname; + else + return basename + 1; +} + int nc_readlink(const char *link, char **path) { diff --git a/src/futils.h b/src/futils.h index 55355e4..822ced4 100644 --- a/src/futils.h +++ b/src/futils.h @@ -47,6 +47,11 @@ int nc_scandir(const char *path, const char *filter, nc_string_array_t *result) int nc_readlink(const char *link, char **path); +const char * nc_basename(const char *path); + +int /* bool */ nc_isdir(const char *path); +int /* bool */ nc_isreg(const char *path); + int /* bool */ nc_file_exists(const char *filename); int /* bool */ nc_file_exists_fmt(const char *fmt, ...) __fmtattr(1,2); diff --git a/src/sutils.c b/src/sutils.c index fd67fc0..3f54c78 100644 --- a/src/sutils.c +++ b/src/sutils.c @@ -107,6 +107,12 @@ nc_string_len(const char *str) return str ? strlen(str) : 0; } +int /* bool */ +nc_string_empty(const char *str) +{ + return !str || !*str; +} + int /* bool */ nc_string_eq(const char *a, const char *b) { diff --git a/src/sutils.h b/src/sutils.h index b7734e0..51354ad 100644 --- a/src/sutils.h +++ b/src/sutils.h @@ -76,6 +76,7 @@ void nc_string_free(char **); char * nc_string_strip_spaces(char *str); size_t nc_string_len(const char *); +int /* bool */ nc_string_empty(const char *); int /* bool */ nc_string_eq(const char *a, const char *b); int nc_string_prefix_eq(const char *prefix, const char *str); int nc_string_suffix_eq(const char *suffix, const char *str); diff --git a/src/udev_utils.c b/src/udev_utils.c index 7ed4c86..3de2093 100644 --- a/src/udev_utils.c +++ b/src/udev_utils.c @@ -42,9 +42,10 @@ #include <assert.h> #include <sutils.h> +#include <futils.h> #include <logging.h> -#define UDEV_NET_NAME_LOCK "/dev/.udev/.lock-70-persistent-net.rules" +#define UDEV_NET_LOCK_MODE S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH #define UDEV_NET_NAME_RULE "/etc/udev/rules.d/70-persistent-net.rules" #define UDEV_NET_NAME_TEMP UDEV_NET_NAME_RULE".XXXXXX\0\0" #define UDEV_NET_NAME_SECS 5 /* running system shouldn't need more */ @@ -101,8 +102,8 @@ static void nc_udev_rule_init(nc_udev_rule_t *rule); static void nc_udev_rule_destroy(nc_udev_rule_t *rule); static int nc_udev_rule_append(nc_udev_rule_t *rule, nc_udev_rule_cmd_t *cmd); -static int nc_udev_rule_file_lock(const char *rule_lock, unsigned int retry_sec); -static int nc_udev_rule_file_unlock(const char *rule_lock); +static int nc_udev_rule_file_lock(const char *rule_file, unsigned int retry_sec); +static int nc_udev_rule_file_unlock(const char *rule_file); /* internal helpers */ static int __nc_udev_rule_realloc(nc_udev_rule_t *rule, unsigned int newsize); @@ -225,29 +226,82 @@ nc_udev_rule_append(nc_udev_rule_t *rule, nc_udev_rule_cmd_t *cmd) return 0; } +static const char * +nc_udev_rule_lock_dir(void) +{ + static const char *lock_dirs[] = { + "/run/udev", /* systemd systems (>=SLE12) */ + "/dev/.udev", /* sysvinit systems (SLES11) */ + NULL + }, **dir; + + for (dir = lock_dirs; *dir; ++dir) { + if (nc_isdir(*dir)) + return *dir; + } + return NULL; +} + +static int +nc_udev_rule_lock_file(nc_stringbuf_t *rule_lock, const char *rule_file) +{ + const char *rule_name; + const char *lock_dir; + + if (!rule_lock || !rule_file) + return -1; + + rule_name = nc_basename(rule_file); + if (nc_string_empty(rule_name)) + return -1; + + lock_dir = nc_udev_rule_lock_dir(); + if (nc_string_empty(lock_dir)) + return -1; + + nc_stringbuf_clear(rule_lock); + nc_stringbuf_puts(rule_lock, lock_dir); + nc_stringbuf_puts(rule_lock, "/.lock-"); + nc_stringbuf_puts(rule_lock, rule_name); + if (rule_lock->len && rule_lock->string) + return 0; + + nc_stringbuf_clear(rule_lock); + return -1; +} + static int -nc_udev_rule_file_lock(const char *rule_lock, unsigned int retry_sec) +nc_udev_rule_file_lock(const char *rule_file, unsigned int retry_sec) { - assert(rule_lock); - if(!rule_lock) + nc_stringbuf_t rule_lock = NC_STRINGBUF_INIT; + + if(nc_udev_rule_lock_file(&rule_lock, rule_file) != 0) return -1; - while(mkdir(rule_lock, 755) != 0) { + while(mkdir(rule_lock.string, UDEV_NET_LOCK_MODE) != 0) { if(retry_sec > 0) { retry_sec--; sleep(1); } else { + nc_stringbuf_destroy(&rule_lock); return 1; } } + nc_stringbuf_destroy(&rule_lock); return 0; } static int -nc_udev_rule_file_unlock(const char *rule_lock) +nc_udev_rule_file_unlock(const char *rule_file) { - assert(rule_lock); - return rule_lock ? rmdir(rule_lock) : -1; + nc_stringbuf_t rule_lock = NC_STRINGBUF_INIT; + + if(nc_udev_rule_lock_file(&rule_lock, rule_file) != 0) + return -1; + + rmdir(rule_lock.string); + nc_stringbuf_destroy(&rule_lock); + return 0; } static char * @@ -549,7 +603,6 @@ nc_udev_net_rule_hwaddr_for_name(const char *ifname, char **hwaddr) int nc_udev_net_rule_hwaddr_to_bus_id(nc_var_array_t *bus_id_map) { - const char * rule_lock = UDEV_NET_NAME_LOCK; const char * rule_file = UDEV_NET_NAME_RULE; char rule_temp[] = UDEV_NET_NAME_TEMP; int ret; @@ -559,14 +612,14 @@ nc_udev_net_rule_hwaddr_to_bus_id(nc_var_array_t *bus_id_map) if(!bus_id_map->count) return 0; - if(nc_udev_rule_file_lock(rule_lock, UDEV_NET_NAME_SECS) != 0) { + if(nc_udev_rule_file_lock(rule_file, UDEV_NET_NAME_SECS) != 0) { nc_error("Unable to acquire lock for %s: %m", rule_file); return 0; /* error, but we just report "not found" */ } ret = __nc_udev_net_rule_hwaddr_to_bus_id(bus_id_map, rule_file, rule_temp); - if(nc_udev_rule_file_unlock(rule_lock) != 0) { + if(nc_udev_rule_file_unlock(rule_file) != 0) { nc_error("Unable to release lock for %s: %m", rule_file); /* Hmm... and now? */ } -- 2.16.4 ++++++ 0005-bonding-don-t-complain-about-unknown-options.1132794.patch ++++++ >From 52e417d0bd10a57f69d7b5d986a30ed340dffd9e Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski <[email protected]> Date: Thu, 6 Jun 2019 10:45:12 +0200 References: 1132794 Upstream: merged Subject: [PATCH 1/2] logging: add ifcfg debug facility and log macro diff --git a/src/logging.c b/src/logging.c index 7fc5bf1..14f5df4 100644 --- a/src/logging.c +++ b/src/logging.c @@ -79,6 +79,7 @@ static void __nc_syslog_logger( const char *category, #define DEFAULT_CATEGORY "netcontrol" static const nc_intmap_t __nc_log_debug_flags_names[] = { { "netcf", NC_TRACE_NETCF }, + { "ifcfg", NC_TRACE_IFCFG }, { NULL, 0 }, }; diff --git a/src/logging.h b/src/logging.h index 96bf63a..5e0b958 100644 --- a/src/logging.h +++ b/src/logging.h @@ -56,6 +56,7 @@ extern void __nc_trace(const char *func, const char *file, long long line, enum { NC_TRACE_NETCF = 0x000001, + NC_TRACE_IFCFG = 0x000002, }; extern void __nc_debug(int facility, const char *func, const char *file, @@ -69,6 +70,9 @@ extern void __nc_debug(int facility, const char *func, const char *file, #define nc_debug_netcf(fmt, args...) __nc_debug(NC_TRACE_NETCF, \ __FUNCTION__,__FILE__,__LINE__, fmt, ##args) +#define nc_debug_ifcfg(fmt, args...) __nc_debug(NC_TRACE_IFCFG, \ + __FUNCTION__,__FILE__,__LINE__, fmt, ##args) + #undef __fmtattr #undef __noreturn -- 2.16.4 >From 727d49cc2924a24a10d8942330fb5ad31abee5be Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski <[email protected]> Date: Thu, 6 Jun 2019 11:42:48 +0200 Subject: [PATCH 2/2] bonding: don't complain about unknown options (bsc#1132794) diff --git a/src/backend-suse.c b/src/backend-suse.c index 7e76a24..0cc4cad 100644 --- a/src/backend-suse.c +++ b/src/backend-suse.c @@ -1284,7 +1284,7 @@ try_bonding(nc_handle_t *nh, nc_interface_t *ifp, nc_sysconfig_t *sc) nc_error_once_clear(nh, "/try_bonding/%s/slaves", ifp->name); nc_sysconfig_get_string(sc, "BONDING_MODULE_OPTS", &ifp->bonding->module_opts); - nc_bonding_parse_module_options(ifp->bonding); + nc_bonding_parse_module_options(ifp->bonding, nh, ifp->name); return 0; diff --git a/src/bonding.c b/src/bonding.c index bf2e46e..244af62 100644 --- a/src/bonding.c +++ b/src/bonding.c @@ -510,7 +510,7 @@ nc_bonding_format_module_attribute(const nc_bonding_t *bonding, const char *attr * fail_over_mac:For active-backup, do not set all slaves to the same MAC. none (default), active or follow (charp) */ void -nc_bonding_parse_module_options(nc_bonding_t *bonding) +nc_bonding_parse_module_options(nc_bonding_t *bonding, nc_handle_t *nh, const char *ifname) { char *temp, *s, *t, *saveptr = NULL; @@ -524,18 +524,29 @@ nc_bonding_parse_module_options(nc_bonding_t *bonding) int rv; if ((t = strchr(s, '=')) == NULL) { - nc_error("ignoring unknown bonding module option %s", s); + if(nc_error_once_check(nh, "/parse_bonding_module_option/token/%s/%s", ifname, s)) { + nc_info("%s: ignoring bonding module option without a value: %s", ifname, s); + } continue; } + nc_error_once_clear(nh, "parse_bonding_module_option/token/%s/%s", ifname, s); *t++ = '\0'; rv = nc_bonding_parse_module_attribute(bonding, s, t); if (rv == -2) { - nc_warn("ignoring unknown bonding module option %s=%s", s, t); + /* unknown, probably not yet supported option */ + if(nc_error_once_check(nh, "/parse_bonding_module_option/%s/%s", ifname, s)) { + nc_debug_ifcfg("%s: ignoring unknown bonding module option %s=%s", ifname, s, t); + } } else if (rv < 0) { - nc_error("unable to parse bonding module option %s=%s", s, t); - /* we should really return an error here */ + /* failure to parse a supported option (value) */ + if(nc_error_once_check(nh, "/parse_bonding_module_option/%s/%s", ifname, s)) { + nc_info("%s: unable to parse bonding module option %s=%s", ifname, s, t); + /* we should probably return an error here */ + } + } else { + nc_error_once_clear(nh, "/parse_bonding_module_option/%s/%s", ifname, s); } } @@ -693,16 +704,16 @@ nc_bonding_write_one_sysfs_attr(const char *ifname, const nc_bonding_t *bonding, } if (config_value[0] == '\0') { - nc_debug_ifconfig("%s: attr %s ignored", ifname, attrname); + nc_debug_ifcfg("%s: attr %s ignored", ifname, attrname); return 0; } if (!strcmp(current_value, config_value)) { - nc_debug_ifconfig("%s: attr %s unchanged", ifname, attrname); + nc_debug_ifcfg("%s: attr %s unchanged", ifname, attrname); return 0; } - nc_debug_ifconfig("%s: setting attr %s=%s", ifname, attrname, config_value); + nc_debug_ifcfg("%s: setting attr %s=%s", ifname, attrname, config_value); if (nc_sysfs_bonding_set_attr(ifname, attrname, config_value) < 0) { nc_error("%s: cannot set bonding attribute %s=%s", ifname, attrname, config_value); return -1; diff --git a/src/bonding.h b/src/bonding.h index 84d68f4..d8d0647 100644 --- a/src/bonding.h +++ b/src/bonding.h @@ -136,7 +136,8 @@ nc_bonding_t * nc_bonding_new(void); extern void nc_bonding_free(nc_bonding_t *); extern nc_bonding_t * nc_bonding_clone(const nc_bonding_t *); extern int nc_bonding_add_slave(nc_bonding_t *, const char *); -extern void nc_bonding_parse_module_options(nc_bonding_t *); +extern void nc_bonding_parse_module_options(nc_bonding_t *, + nc_handle_t *, const char *); extern void nc_bonding_build_module_options(nc_bonding_t *); extern int nc_bonding_parse_sysfs_attrs(const char *, nc_bonding_t *); extern int nc_bonding_write_sysfs_attrs(const char *ifname, -- 2.16.4
