File 0005-bonding-don-t-complain-about-unknown-options.1132794.patch of Package netcontrol.19459

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

openSUSE Build Service is sponsored by