2008-05-06 Dan Williams <dcbw@redhat.com>
* src/dhcp-manager/nm-dhcp-manager.c - (nm_dhcp_manager_get_ip4_config): clean up; update for changes to NMIP4Config to support multiple IP addresses * src/NetworkManagerUtils.c - (nm_utils_merge_ip4_config): update for multiple IP addresses * src/nm-ip4-config.c src/nm-ip4-config.h - Store a list of IPv4 address/netmask/gateway tuples - (nm_ip4_config_get_gateway, nm_ip4_config_set_gateway, nm_ip4_config_get_netmask, nm_ip4_config_set_netmask, nm_ip4_config_get_broadcast, nm_ip4_config_set_broadcast, nm_ip4_config_set_address): remove - (nm_ip4_config_take_address, nm_ip4_config_add_address, nm_ip4_config_replace_address, nm_ip4_config_get_num_addresses): new functions; handle multiple IPv4 addresses * src/nm-device.c src/ppp-manager/nm-ppp-manager.c src/vpn-manager/nm-vpn-connection.c src/NetworkManagerPolicy.c test/nm-tool.c libnm-glib/libnm-glib-test.c - update for changes to NMIP4Config for multiple IPv4 addresses * src/NetworkManagerSystem.c - (nm_system_device_set_ip4_route): don't add the route if any address is on the same subnet as the destination - (check_one_address): ignore the exact match, just match family and interface index - (add_ip4_addresses): add all IPv4 addresses in an NMIP4Config to an interface - (nm_system_device_set_from_ip4_config): use add_ip4_addresses() - (nm_system_vpn_device_set_from_ip4_config): use add_ip4_addresses() * introspection/nm-ip4-config.xml - Remove 'address', 'gateway', 'netmask', and 'broadcast' properties - Add 'addresses' property which is an array of (uuu) tuples of address/netmask/gateway * libnm-util/nm-setting-ip4-config.c - (set_property): use ip-address <-> GValue converters from nm-utils.c * libnm-glib/nm-ip4-config.c libnm-glib/nm-ip4-config.h - Handle D-Bus interface changes to support multiple IP addresses git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3637 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -86,10 +86,11 @@ update_default_route (NMPolicy *policy, NMDevice *new)
|
||||
nm_system_device_replace_default_ip4_route (ip_iface, 0, 0);
|
||||
} else {
|
||||
NMIP4Config *config;
|
||||
const NMSettingIP4Address *def_addr;
|
||||
|
||||
config = nm_device_get_ip4_config (new);
|
||||
nm_system_device_replace_default_ip4_route (ip_iface, nm_ip4_config_get_gateway (config),
|
||||
nm_ip4_config_get_mss (config));
|
||||
def_addr = nm_ip4_config_get_address (config, 0);
|
||||
nm_system_device_replace_default_ip4_route (ip_iface, def_addr->gateway, nm_ip4_config_get_mss (config));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +130,8 @@ update_routing_and_dns (NMPolicy *policy, gboolean force_update)
|
||||
NMIP4Config *ip4_config;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
guint32 prio;
|
||||
guint i;
|
||||
gboolean have_gateway = FALSE;
|
||||
|
||||
if (nm_device_get_state (dev) != NM_DEVICE_STATE_ACTIVATED)
|
||||
continue;
|
||||
@@ -147,8 +150,18 @@ update_routing_and_dns (NMPolicy *policy, gboolean force_update)
|
||||
if (s_ip4 && !strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_AUTOIP))
|
||||
continue;
|
||||
|
||||
/* FIXME: handle more than one IP address */
|
||||
if (!nm_ip4_config_get_gateway (ip4_config))
|
||||
/* Make sure at least one of this device's IP addresses has a gateway */
|
||||
for (i = 0; i < nm_ip4_config_get_num_addresses (ip4_config); i++) {
|
||||
const NMSettingIP4Address *addr;
|
||||
|
||||
addr = nm_ip4_config_get_address (ip4_config, i);
|
||||
if (addr->gateway) {
|
||||
have_gateway = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!have_gateway)
|
||||
continue;
|
||||
|
||||
prio = get_device_priority (dev);
|
||||
|
Reference in New Issue
Block a user