Commit 3ac7f475 authored by Dan Williams's avatar Dan Williams

2008-07-28 Dan Williams <dcbw@redhat.com>

	Patch from Fabrice Bellet <fabrice@bellet.info>

	* src/NetworkManagerSystem.c
		- (route_in_same_subnet): mask addresses and compare them so that the
			function actually does what it says it's going to do (rh #456685)



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3868 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 291019fb
2008-07-28 Dan Williams <dcbw@redhat.com>
Patch from Fabrice Bellet <fabrice@bellet.info>
* src/NetworkManagerSystem.c
- (route_in_same_subnet): mask addresses and compare them so that the
function actually does what it says it's going to do (rh #456685)
2008-07-27 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-ip6-config.c
......
......@@ -62,7 +62,7 @@
#include <netlink/route/link.h>
static gboolean
route_in_same_subnet (NMIP4Config *config, guint32 prefix)
route_in_same_subnet (NMIP4Config *config, guint32 dest, guint32 prefix)
{
int num;
int i;
......@@ -72,8 +72,13 @@ route_in_same_subnet (NMIP4Config *config, guint32 prefix)
const NMSettingIP4Address *addr;
addr = nm_ip4_config_get_address (config, i);
if (prefix == addr->prefix)
return TRUE;
if (prefix == addr->prefix) {
guint32 masked_addr = addr->address >> (32 - addr->prefix);
guint32 masked_dest = dest >> (32 - prefix);
if (masked_addr == masked_dest)
return TRUE;
}
}
return FALSE;
......@@ -110,7 +115,7 @@ nm_system_device_set_ip4_route (const char *iface,
struct nl_addr *gw_addr = NULL;
int err, iface_idx;
if (iface_config && route_in_same_subnet (iface_config, ip4_prefix))
if (iface_config && route_in_same_subnet (iface_config, ip4_dest, ip4_prefix))
return;
nlh = nm_netlink_get_default_handle ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment