Blame SOURCES/rh1103702-tui-ipv6-route-crash-fix.patch

708502
From 92898e84d6aebc3ab11799476d7ab8c0d1627949 Mon Sep 17 00:00:00 2001
708502
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
708502
Date: Tue, 3 Jun 2014 12:38:07 +0200
708502
Subject: [PATCH 1/3] tui: fix a crash when editing IPv6 routes
708502
MIME-Version: 1.0
708502
Content-Type: text/plain; charset=UTF-8
708502
Content-Transfer-Encoding: 8bit
708502
708502
708502
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
708502
---
708502
 tui/nm-editor-bindings.c | 14 +++++++-------
708502
 tui/nmt-route-entry.c    |  2 +-
708502
 2 files changed, 8 insertions(+), 8 deletions(-)
708502
708502
diff --git a/tui/nm-editor-bindings.c b/tui/nm-editor-bindings.c
708502
index 7f76f14..5be1358 100644
708502
--- a/tui/nm-editor-bindings.c
708502
+++ b/tui/nm-editor-bindings.c
708502
@@ -772,7 +772,7 @@ ip6_addresses_to_strv (GBinding     *binding,
708502
 	for (i = 0; i < addrs->len; i++) {
708502
 		addrbytes = addrs->pdata[i];
708502
 		if (IP6_ADDRESS_SET (addrbytes))
708502
-			inet_ntop (AF_INET, addrbytes->data, buf, sizeof (buf));
708502
+			inet_ntop (AF_INET6, addrbytes->data, buf, sizeof (buf));
708502
 		else
708502
 			buf[0] = '\0';
708502
 		strings[i] = g_strdup (buf);
708502
@@ -1002,7 +1002,7 @@ ip6_route_transform_to_next_hop_string (GBinding     *binding,
708502
 		addrbytes = &in6addr_any;
708502
 
708502
 	if (IN6_ADDR_SET (addrbytes))
708502
-		inet_ntop (AF_INET, &addrbytes, buf, sizeof (buf));
708502
+		inet_ntop (AF_INET6, addrbytes, buf, sizeof (buf));
708502
 	else
708502
 		buf[0] = '\0';
708502
 	g_value_set_string (target_value, buf);
708502
@@ -1035,7 +1035,7 @@ ip6_route_transform_from_dest_string (GBinding     *binding,
708502
 {
708502
 	NMIP6Route *route;
708502
 	const char *text;
708502
-	const struct in6_addr *addrbytes;
708502
+	struct in6_addr addrbytes;
708502
 	guint32 prefix;
708502
 
708502
 	text = g_value_get_string (source_value);
708502
@@ -1047,7 +1047,7 @@ ip6_route_transform_from_dest_string (GBinding     *binding,
708502
 	              g_binding_get_source_property (binding), &route,
708502
 	              NULL);
708502
 
708502
-	nm_ip6_route_set_dest (route, addrbytes);
708502
+	nm_ip6_route_set_dest (route, &addrbytes);
708502
 	nm_ip6_route_set_prefix (route, prefix);
708502
 
708502
 	g_value_take_boxed (target_value, route);
708502
@@ -1062,21 +1062,21 @@ ip6_route_transform_from_next_hop_string (GBinding     *binding,
708502
 {
708502
 	NMIP6Route *route;
708502
 	const char *text;
708502
-	const struct in6_addr *addrbytes;
708502
+	struct in6_addr addrbytes;
708502
 
708502
 	text = g_value_get_string (source_value);
708502
 	if (*text) {
708502
 		if (!ip_string_parse (text, AF_INET6, &addrbytes, NULL))
708502
 			return FALSE;
708502
 	} else
708502
-		addrbytes = 0;
708502
+		addrbytes = in6addr_any;
708502
 
708502
 	/* Fetch the original property value */
708502
 	g_object_get (g_binding_get_source (binding),
708502
 	              g_binding_get_source_property (binding), &route,
708502
 	              NULL);
708502
 
708502
-	nm_ip6_route_set_next_hop (route, addrbytes);
708502
+	nm_ip6_route_set_next_hop (route, &addrbytes);
708502
 
708502
 	g_value_take_boxed (target_value, route);
708502
 	return TRUE;
708502
diff --git a/tui/nmt-route-entry.c b/tui/nmt-route-entry.c
708502
index db8c254..1b20ca6 100644
708502
--- a/tui/nmt-route-entry.c
708502
+++ b/tui/nmt-route-entry.c
708502
@@ -206,7 +206,7 @@ nmt_route_entry_set_property (GObject      *object,
708502
 		priv->ip4_route = g_value_dup_boxed (value);
708502
 		break;
708502
 	case PROP_IP6_ROUTE:
708502
-		g_return_if_fail (priv->family == AF_INET);
708502
+		g_return_if_fail (priv->family == AF_INET6);
708502
 		if (priv->ip6_route)
708502
 			nm_ip6_route_unref (priv->ip6_route);
708502
 		priv->ip6_route = g_value_dup_boxed (value);
708502
-- 
708502
1.7.11.7
708502
708502
708502
From 5ee85fe46e86fdc9e063c22700697802435503a6 Mon Sep 17 00:00:00 2001
708502
From: Dan Winship <danw@gnome.org>
708502
Date: Tue, 3 Jun 2014 09:13:43 -0400
708502
Subject: [PATCH 2/3] tui: fix setting Clone MAC Address properties
708502
MIME-Version: 1.0
708502
Content-Type: text/plain; charset=UTF-8
708502
Content-Transfer-Encoding: 8bit
708502
708502
NmtMacEntry wasn't notifying its mac-address property when it changed,
708502
so the change never got saved to the NMSetting.
708502
708502
https://bugzilla.gnome.org/show_bug.cgi?id=731160
708502
708502
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
708502
---
708502
 tui/nmt-mac-entry.c | 14 ++++++++++++++
708502
 1 file changed, 14 insertions(+)
708502
708502
diff --git a/tui/nmt-mac-entry.c b/tui/nmt-mac-entry.c
708502
index d76c097..b065640 100644
708502
--- a/tui/nmt-mac-entry.c
708502
+++ b/tui/nmt-mac-entry.c
708502
@@ -28,6 +28,8 @@
708502
 
708502
 #include "config.h"
708502
 
708502
+#include <string.h>
708502
+
708502
 #include <dbus/dbus-glib.h>
708502
 #include <nm-utils.h>
708502
 
708502
@@ -129,6 +131,17 @@ nmt_mac_entry_init (NmtMacEntry *entry)
708502
 }
708502
 
708502
 static void
708502
+nmt_mac_entry_notify (GObject    *object,
708502
+                      GParamSpec *pspec)
708502
+{
708502
+	if (G_OBJECT_CLASS (nmt_mac_entry_parent_class)->notify)
708502
+		G_OBJECT_CLASS (nmt_mac_entry_parent_class)->notify (object, pspec);
708502
+
708502
+	if (pspec->owner_type == NMT_TYPE_NEWT_ENTRY && !strcmp (pspec->name, "text"))
708502
+		g_object_notify (object, "mac-address");
708502
+}
708502
+
708502
+static void
708502
 nmt_mac_entry_set_property (GObject      *object,
708502
                             guint         prop_id,
708502
                             const GValue *value,
708502
@@ -189,6 +202,7 @@ nmt_mac_entry_class_init (NmtMacEntryClass *entry_class)
708502
 	g_type_class_add_private (entry_class, sizeof (NmtMacEntryPrivate));
708502
 
708502
 	/* virtual methods */
708502
+	object_class->notify = nmt_mac_entry_notify;
708502
 	object_class->set_property = nmt_mac_entry_set_property;
708502
 	object_class->get_property = nmt_mac_entry_get_property;
708502
 
708502
-- 
708502
1.7.11.7
708502
708502
708502
From d57795d474aaae7865d4d052605d5ddec65c429d Mon Sep 17 00:00:00 2001
708502
From: Dan Winship <danw@gnome.org>
708502
Date: Tue, 3 Jun 2014 09:36:17 -0400
708502
Subject: [PATCH 3/3] tui: fix NmtMacEntry validation/display
708502
MIME-Version: 1.0
708502
Content-Type: text/plain; charset=UTF-8
708502
Content-Transfer-Encoding: 8bit
708502
708502
NmtMacEntry would allow you to input 1 character more than it should
708502
have. Fix that.
708502
708502
Also, the code to insert ":"s automatically was bumping against some
708502
weirdness in NmtNewtEntry that made it so that the ":" didn't get
708502
displayed until you typed one more character after the one where it
708502
got inserted. Hack around that by manually requesting a redraw.
708502
708502
https://bugzilla.gnome.org/show_bug.cgi?id=731160
708502
708502
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
708502
---
708502
 tui/nmt-mac-entry.c | 11 ++++++++---
708502
 1 file changed, 8 insertions(+), 3 deletions(-)
708502
708502
diff --git a/tui/nmt-mac-entry.c b/tui/nmt-mac-entry.c
708502
index b065640..5e1c417 100644
708502
--- a/tui/nmt-mac-entry.c
708502
+++ b/tui/nmt-mac-entry.c
708502
@@ -82,7 +82,7 @@ mac_filter (NmtNewtEntry *entry,
708502
 {
708502
 	NmtMacEntryPrivate *priv = NMT_MAC_ENTRY_GET_PRIVATE (entry);
708502
 
708502
-	if (position > priv->mac_str_length)
708502
+	if (position >= priv->mac_str_length)
708502
 		return FALSE;
708502
 
708502
 	return g_ascii_isxdigit (ch) || ch == ':';
708502
@@ -116,8 +116,13 @@ mac_validator (NmtNewtEntry *entry,
708502
 	if (g_ascii_isxdigit (p[0]) && !p[1]) {
708502
 		char *fixed = g_strdup_printf ("%.*s:%c", (int)(p - text), text, *p);
708502
 
708502
-		g_object_set (G_OBJECT (entry), "text", fixed, NULL);
708502
-		return TRUE;
708502
+		nmt_newt_entry_set_text (entry, fixed);
708502
+		g_free (fixed);
708502
+
708502
+		/* FIXME: NmtNewtEntry doesn't correctly deal with us calling set_text()
708502
+		 * from inside the validator.
708502
+		 */
708502
+		nmt_newt_widget_needs_rebuild (NMT_NEWT_WIDGET (entry));
708502
 	}
708502
 
708502
 	return FALSE;
708502
-- 
708502
1.7.11.7
708502
708502
From 7f5b2f81b0b4bf86a0086d4004461e4d1bc95950 Mon Sep 17 00:00:00 2001
708502
From: Dan Winship <danw@gnome.org>
708502
Date: Fri, 25 Apr 2014 11:01:21 -0400
708502
Subject: [PATCH] tui: fix route editing (rh #1090422)
708502
MIME-Version: 1.0
708502
Content-Type: text/plain; charset=UTF-8
708502
Content-Transfer-Encoding: 8bit
708502
708502
NmtRouteTable's ip4-routes and ip6-routes properties have the
708502
D-Bus-based route list types (like the corresponding NMSetting
708502
properties) so we have to convert our GSList-of-NMIP[46]Route data
708502
into those types when updating the property.
708502
708502
https://bugzilla.gnome.org/show_bug.cgi?id=728958
708502
708502
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
708502
---
708502
 tui/nmt-route-table.c | 9 ++++++++-
708502
 1 file changed, 8 insertions(+), 1 deletion(-)
708502
708502
diff --git a/tui/nmt-route-table.c b/tui/nmt-route-table.c
708502
index 75b2b67..d6173a0 100644
708502
--- a/tui/nmt-route-table.c
708502
+++ b/tui/nmt-route-table.c
708502
@@ -119,7 +119,14 @@ route_list_transform_from_route (GBinding     *binding,
708502
 			nm_ip6_route_unref (nth->data);
708502
 	}
708502
 	nth->data = g_value_dup_boxed (source_value);
708502
-	g_value_take_boxed (target_value, routes);
708502
+
708502
+	if (priv->family == AF_INET) {
708502
+		nm_utils_ip4_routes_to_gvalue (routes, target_value);
708502
+		g_slist_free_full (routes, (GDestroyNotify) nm_ip4_route_unref);
708502
+	} else if (priv->family == AF_INET6) {
708502
+		nm_utils_ip6_routes_to_gvalue (routes, target_value);
708502
+		g_slist_free_full (routes, (GDestroyNotify) nm_ip6_route_unref);
708502
+	}
708502
 
708502
 	return TRUE;
708502
 }
708502
-- 
708502
1.7.11.7
708502