summary refs log tree commit diff
path: root/src/devices
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2020-06-29 22:15:58 +0200
committerMichael Biebl <biebl@debian.org>2020-06-29 22:15:58 +0200
commit10ae7d8cd706062742d0cdb1803d49909aef9e06 (patch)
treecb89e8b475cec18f22b1abfe45f1d63da7e3f440 /src/devices
parenta54ac63bbf9b2c71026ac9028a8ffaf186cf3c82 (diff)
New upstream version 1.25.91 upstream/1.25.91
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/nm-device.c89
1 files changed, 10 insertions, 79 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 63fa5a5c..90178b68 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -6353,85 +6353,13 @@ check_connection_compatible (NMDevice *self, NMConnection *connection, GError **
 			return FALSE;
 		}
 
-		{
-			const char *const*proc_cmdline;
-			gboolean pos_patterns = FALSE;
-			guint i;
-
-			patterns = nm_setting_match_get_kernel_command_lines (s_match, &num_patterns);
-			proc_cmdline = nm_utils_proc_cmdline_split ();
-
-			for (i = 0; i < num_patterns; i++) {
-				const char *patterns_i = patterns[i];
-				const char *const*proc_cmdline_i;
-				gboolean negative = FALSE;
-				gboolean found = FALSE;
-				const char *equal;
-
-				if (patterns_i[0] == '!') {
-					++patterns_i;
-					negative = TRUE;
-				} else
-					pos_patterns = TRUE;
-
-				equal = strchr (patterns_i, '=');
-
-				proc_cmdline_i = proc_cmdline;
-				while (*proc_cmdline_i) {
-					if (equal) {
-						/* if pattern contains = compare full key=value */
-						found = nm_streq (*proc_cmdline_i, patterns_i);
-					} else {
-						gsize l = strlen (patterns_i);
-
-						/* otherwise consider pattern as key only */
-						if (   strncmp (*proc_cmdline_i, patterns_i, l) == 0
-						    && NM_IN_SET ((*proc_cmdline_i)[l], '\0', '='))
-							found = TRUE;
-					}
-					if (   found
-					    && negative) {
-						/* first negative match */
-						nm_utils_error_set (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
-						                    "device does not satisfy match.kernel-command-line property %s",
-						                    patterns[i]);
-						return FALSE;
-					}
-					proc_cmdline_i++;
-				}
-
-				/* FIXME(release-blocker): match.interface-name and match.driver have the meaning,
-				 * that any of the matches may yield success. For match.kernel-command-line, we
-				 * do here that all must match. This inconsistency is undesired.
-				 *
-				 * 1) improve gtk-doc documentation explaining how these options match.
-				 *
-				 * 2) possibly unify the behavior so that kernel-command-line behaves like other
-				 *    matches (and ANY may match). Note that this would be contrary to systemd's
-				 *    Conditions, which by default requires that ALL conditions match (AND). We
-				 *    should be consistent within our match options, and not with systemd here.
-				 *
-				 * 2b) Note that systemd supports special token like "=|", to indicate that
-				 *    ANY behavior. If we want, we could also introduce two special prefixes
-				 *    "&..." and "|...", to support either. It's slightly complicated how
-				 *    these work in combinations with "!".
-				 *    Unless we fully decide what we do about this, NMSettingMatch.verify() should
-				 *    reject matches that start with '&' or '|', because these will be reserved for
-				 *    future use.
-				 *
-				 * 3) while fixing this, this code should move to a separate function so we
-				 *    can unit test the match of kernel command lines.
-				 */
-				if (   pos_patterns
-				    && !found) {
-					/* positive patterns configured but no match */
-					nm_utils_error_set (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
-					                    "device does not satisfy any match.kernel-command-line property %s...",
-					                    patterns[0]);
-					return FALSE;
-				}
-			}
-		}
+		patterns = nm_setting_match_get_kernel_command_lines (s_match, &num_patterns);
+		if (   num_patterns > 0
+		    && !nm_utils_kernel_cmdline_match_check (nm_utils_proc_cmdline_split (),
+		                                             patterns,
+		                                             num_patterns,
+		                                             error))
+			return FALSE;
 
 		device_driver = nm_device_get_driver (self);
 		patterns = nm_setting_match_get_drivers (s_match, &num_patterns);
@@ -10934,8 +10862,11 @@ act_stage3_ip_config_start (NMDevice *self,
 					platform = nm_device_get_platform (self);
 
 					if (ifindex > 0) {
+						gs_unref_object NMIP6Config *config = nm_device_ip6_config_new (self);
+
 						nm_platform_ip_route_flush (platform, AF_INET6, ifindex);
 						nm_platform_ip_address_flush (platform, AF_INET6, ifindex);
+						nm_device_set_ip_config (self, AF_INET6, (NMIPConfig *) config, FALSE, NULL);
 					}
 				} else {
 					gboolean ipv6ll_handle_old = priv->ipv6ll_handle;