- 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] OBS-URL: https://build.opensuse.org/package/show/network:utilities/netcontrol?expand=0&rev=30
This commit is contained in:
parent
2d2b0314ab
commit
0c6a0b8bde
192
0001-virsh-iface-list-not-working-as-expected-bsc-1029201.patch
Normal file
192
0001-virsh-iface-list-not-working-as-expected-bsc-1029201.patch
Normal file
@ -0,0 +1,192 @@
|
||||
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
|
||||
|
25
0002-Fix-invalid-check-in-route-creation-bsc-1148646.patch
Normal file
25
0002-Fix-invalid-check-in-route-creation-bsc-1148646.patch
Normal file
@ -0,0 +1,25 @@
|
||||
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
|
||||
|
@ -0,0 +1,68 @@
|
||||
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
|
||||
|
255
0004-udev-use-correct-udev-rule-write-lock-directory.patch
Normal file
255
0004-udev-use-correct-udev-rule-write-lock-directory.patch
Normal file
@ -0,0 +1,255 @@
|
||||
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,3 +1,15 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 11 15:06:33 UTC 2020 - mt@suse.com
|
||||
|
||||
- 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]
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 25 16:58:41 UTC 2019 - olaf@aepfle.de
|
||||
|
||||
|
@ -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 @@ Name: netcontrol
|
||||
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,14 @@ Group: Productivity/Networking/System
|
||||
# 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
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%if 0%{?suse_version} >= 1310
|
||||
BuildRequires: autoconf
|
||||
@ -102,6 +106,10 @@ Authors:
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
|
||||
%build
|
||||
export CFLAGS="-W -Wall $RPM_OPT_FLAGS"
|
||||
|
Loading…
x
Reference in New Issue
Block a user