Accepting request 900198 from network:utilities
- version 0.3.2 - use SPDX shortname lincense and PKG_INSTALLDIR autoconf macro - virsh iface-list takes too long with many interfaces (bsc#1179144) - Cleanup netcf functions, include elapsed time in debug messages - Changed to refresh config and system info to keep them consistent - Add (fix or) adaptive refresh caching, set to double refresh-time - Implemented new backend refresh using wicked config/system queries - remove packages included in 0.3.2 source archive: [- 0005-bonding-don-t-complain-about-unknown-options.1132794.patch] [- 0004-udev-use-correct-udev-rule-write-lock-directory.patch] [- 0003-sysconfig-fix-segfault-on-missed-end-quote-bsc-10277.patch] [- 0002-Fix-invalid-check-in-route-creation-bsc-1148646.patch] [- 0001-virsh-iface-list-not-working-as-expected-bsc-1029201.patch] OBS-URL: https://build.opensuse.org/request/show/900198 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/netcontrol?expand=0&rev=20
This commit is contained in:
commit
dae7c7eeef
@ -1,192 +0,0 @@
|
||||
From 9653faeead3d1a851c3cb2f20af353a629ee01a7 Mon Sep 17 00:00:00 2001
|
||||
From: Nikola Pajkovsky <npajkovsky@suse.de>
|
||||
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 <mt@suse.de>
|
||||
Date: Mon Jul 10 10:40:10 2017 +0200
|
||||
|
||||
filter inactive configs by iftype, not by arp-type
|
||||
|
||||
commit 45271cb4fe11aa3415535247f480614af9472c5a
|
||||
Author: Marius Tomaschewski <mt@suse.de>
|
||||
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
|
||||
|
@ -1,25 +0,0 @@
|
||||
From 1cd284f95ce47e0eb79314b3a27e099f443aefdb Mon Sep 17 00:00:00 2001
|
||||
From: Marius Tomaschewski <mt@suse.de>
|
||||
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
|
||||
|
@ -1,68 +0,0 @@
|
||||
From ca57462e67fdbd30269117d0e75a2257efefdefd Mon Sep 17 00:00:00 2001
|
||||
From: Marius Tomaschewski <mt@suse.de>
|
||||
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
|
||||
|
@ -1,255 +0,0 @@
|
||||
From 61b785184199f79f08d9ee023ce67ae56719499c Mon Sep 17 00:00:00 2001
|
||||
From: Marius Tomaschewski <mt@suse.de>
|
||||
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
|
||||
|
@ -1,150 +0,0 @@
|
||||
From 52e417d0bd10a57f69d7b5d986a30ed340dffd9e Mon Sep 17 00:00:00 2001
|
||||
From: Marius Tomaschewski <mt@suse.de>
|
||||
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 <mt@suse.de>
|
||||
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
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c9ba1fac7310e6009d516bccfdafe329ea518d87cefde49958dd55771843a5da
|
||||
size 359500
|
BIN
netcontrol-0.3.2.tar.bz2
(Stored with Git LFS)
Normal file
BIN
netcontrol-0.3.2.tar.bz2
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,3 +1,20 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 15 15:48:36 UTC 2021 - Marius Tomaschewski <mt@suse.com>
|
||||
|
||||
- version 0.3.2
|
||||
- use SPDX shortname lincense and PKG_INSTALLDIR autoconf macro
|
||||
- virsh iface-list takes too long with many interfaces (bsc#1179144)
|
||||
- Cleanup netcf functions, include elapsed time in debug messages
|
||||
- Changed to refresh config and system info to keep them consistent
|
||||
- Add (fix or) adaptive refresh caching, set to double refresh-time
|
||||
- Implemented new backend refresh using wicked config/system queries
|
||||
- remove packages included in 0.3.2 source archive:
|
||||
[- 0005-bonding-don-t-complain-about-unknown-options.1132794.patch]
|
||||
[- 0004-udev-use-correct-udev-rule-write-lock-directory.patch]
|
||||
[- 0003-sysconfig-fix-segfault-on-missed-end-quote-bsc-10277.patch]
|
||||
[- 0002-Fix-invalid-check-in-route-creation-bsc-1148646.patch]
|
||||
[- 0001-virsh-iface-list-not-working-as-expected-bsc-1029201.patch]
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 11 23:13:15 UTC 2020 - mt@suse.com
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package netcontrol
|
||||
#
|
||||
# Copyright (c) 2020 SUSE LLC
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -17,25 +17,20 @@
|
||||
|
||||
|
||||
Name: netcontrol
|
||||
Version: 0.3.1
|
||||
Version: 0.3.2
|
||||
Release: 0
|
||||
Summary: A network configuration library
|
||||
#
|
||||
# License note:
|
||||
# libnetcontrol contains source code which is based on wicked.
|
||||
# Wicked is licensed under the GPL-2.0+, but permission has been
|
||||
# granted by the authors of wicked to use the code derived from
|
||||
# wicked under the LGPL-2.1+ in libnetcontrol.
|
||||
# Wicked is licensed under the GPL-2.0-or-later, but permission has
|
||||
# been granted by the authors of wicked to use the code derived from
|
||||
# wicked under the LGPL-2.1-or-later 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
|
||||
@ -107,11 +102,6 @@ Authors:
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
|
||||
%build
|
||||
export CFLAGS="-W -Wall $RPM_OPT_FLAGS"
|
||||
@ -124,7 +114,7 @@ export CFLAGS="-W -Wall $RPM_OPT_FLAGS"
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
make install DESTDIR=$RPM_BUILD_ROOT pkgconfigdir=%{_libdir}/pkgconfig
|
||||
make install DESTDIR=$RPM_BUILD_ROOT
|
||||
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
|
||||
|
||||
%post -n libnetcontrol0
|
||||
|
Loading…
x
Reference in New Issue
Block a user