2008-06-02 Tambet Ingo <tambet@gmail.com>
* libnm-util/nm-setting-ip4-config.[ch]: Add static routes property. * src/nm-ip4-config.[ch]: Store the static routes as a list of NMIP4Address, update the getters and setters. * src/dhcp-manager/nm-dhcp-manager.c (nm_dhcp_manager_get_ip4_config): Use the updated NMIP4Config routes api. * src/NetworkManagerUtils.c (nm_utils_merge_ip4_config): Merge static routes as well. * src/NetworkManagerSystem.c (netmask_to_prefix): Implement. (nm_system_device_set_from_ip4_config): Use the updated NMIP4Config routes api. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3715 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -309,6 +309,27 @@ nm_utils_merge_ip4_config (NMIP4Config *ip4_config, NMSettingIP4Config *setting)
|
||||
if (i == num)
|
||||
nm_ip4_config_add_address (ip4_config, setting_addr);
|
||||
}
|
||||
|
||||
/* IPv4 static routes */
|
||||
for (iter = setting->routes; iter; iter = g_slist_next (iter)) {
|
||||
NMSettingIP4Address *setting_route = (NMSettingIP4Address *) iter->data;
|
||||
guint32 i, num;
|
||||
|
||||
num = nm_ip4_config_get_num_static_routes (ip4_config);
|
||||
for (i = 0; i < num; i++) {
|
||||
const NMSettingIP4Address *cfg_route;
|
||||
|
||||
cfg_route = nm_ip4_config_get_static_route (ip4_config, i);
|
||||
/* Dupe, override with user-specified address */
|
||||
if (cfg_route->address == setting_route->address) {
|
||||
nm_ip4_config_replace_static_route (ip4_config, i, setting_route);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == num)
|
||||
nm_ip4_config_add_static_route (ip4_config, setting_route);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user