2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
2005-04-15 15:43:42 +00:00
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
2008-06-26 18:31:52 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2005-04-15 15:43:42 +00:00
|
|
|
*
|
2008-11-03 04:13:42 +00:00
|
|
|
* Copyright (C) 2005 - 2008 Red Hat, Inc.
|
|
|
|
|
* Copyright (C) 2006 - 2008 Novell, Inc.
|
2005-04-15 15:43:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
2007-02-16 11:23:49 +00:00
|
|
|
#include "nm-ip4-config.h"
|
|
|
|
|
#include "nm-dbus-manager.h"
|
2005-04-15 15:43:42 +00:00
|
|
|
#include "NetworkManager.h"
|
2005-12-04 02:23:29 +00:00
|
|
|
#include "NetworkManagerUtils.h"
|
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
2008-05-06 21:53:22 +00:00
|
|
|
#include "nm-setting-ip4-config.h"
|
2013-04-04 10:20:24 -04:00
|
|
|
#include "nm-platform.h"
|
2008-06-02 08:44:48 +00:00
|
|
|
#include "nm-utils.h"
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2005-10-28 03:16:02 +00:00
|
|
|
#include <netlink/route/addr.h>
|
|
|
|
|
#include <netlink/utils.h>
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
#include "nm-ip4-config-glue.h"
|
2008-03-29 21:35:41 +00:00
|
|
|
#include "nm-dbus-glib-types.h"
|
2007-02-16 11:23:49 +00:00
|
|
|
|
2006-01-16 22:58:13 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
G_DEFINE_TYPE (NMIP4Config, nm_ip4_config, G_TYPE_OBJECT)
|
|
|
|
|
|
|
|
|
|
#define NM_IP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IP4_CONFIG, NMIP4ConfigPrivate))
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2008-09-05 02:55:40 +00:00
|
|
|
char *path;
|
|
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
GSList *addresses;
|
|
|
|
|
guint32 ptp_address;
|
2006-01-16 22:58:13 +00:00
|
|
|
|
2006-03-29 Robert Love <rml@novell.com>
Patch by Vinay R <rvinay@novell.com> and Robert Love <rml@novell.com>,
to add support for per-route MSS and improve support for per-interface
MTU:
* src/NetworkManagerSystem.c: Modify nm_system_device_set_ip4_route to
optionally take an MSS parameter and set it for the given route.
Remove nm_system_device_set_ip4_route_with_iface. Pass in the
NMIP4Config's stored MSS, if any.
* src/nm-ip4-config.c: Add 'mtu' and 'mss' to NMIP4Config, representing
the interface's MTU and the route's MSS, respectively. Add functions
nm_ip4_config_get_mtu, nm_ip4_config_set_mtu, nm_ip4_config_get_mss,
and nm_ip4_config_set_mss for retrieving and setting the MTU and the
MSS.
* src/nm-ip4-config.h: Add prototypes for nm_ip4_config_get_mtu,
nm_ip4_config_set_mtu, nm_ip4_config_get_mss, and
nm_ip4_config_set_mss.
* src/vpn-manager/nm-vpn-service.c: Modify to receive the MSS from the
VPN daemon.
* src/backends/NetworkManager{Arch,Debian,Gentoo,RedHat,Slackware,SUSE}.c:
Change the retval of nm_system_get_mtu to guint32.
* src/dhcp-manager/nm-dhcp-manager.c: Set the MTU on the new DHCP-given
NMIP4Config to the MTU provided by the system, if any. TODO: If DHCP
servers can specify MTU's, we should set it here if the MTU was not
provided.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1660 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-29 19:26:53 +00:00
|
|
|
guint32 mtu; /* Maximum Transmission Unit of the interface */
|
|
|
|
|
guint32 mss; /* Maximum Segment Size of the route */
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
GArray *nameservers;
|
|
|
|
|
GPtrArray *domains;
|
2008-03-09 05:11:22 +00:00
|
|
|
GPtrArray *searches;
|
2005-09-28 14:42:57 +00:00
|
|
|
|
2008-12-19 17:01:06 -05:00
|
|
|
GArray *wins;
|
|
|
|
|
|
2010-07-16 11:28:39 -07:00
|
|
|
GArray *nis;
|
|
|
|
|
char * nis_domain;
|
|
|
|
|
|
2008-08-06 22:23:48 +00:00
|
|
|
GSList *routes;
|
2008-12-09 20:01:49 +00:00
|
|
|
|
|
|
|
|
gboolean never_default;
|
2007-02-16 11:23:49 +00:00
|
|
|
} NMIP4ConfigPrivate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
PROP_0,
|
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
2008-05-06 21:53:22 +00:00
|
|
|
PROP_ADDRESSES,
|
2007-02-16 11:23:49 +00:00
|
|
|
PROP_NAMESERVERS,
|
|
|
|
|
PROP_DOMAINS,
|
2008-08-06 22:23:48 +00:00
|
|
|
PROP_ROUTES,
|
2008-12-19 17:01:06 -05:00
|
|
|
PROP_WINS_SERVERS,
|
2007-02-16 11:23:49 +00:00
|
|
|
|
|
|
|
|
LAST_PROP
|
2005-04-15 15:43:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2009-01-18 20:04:14 -05:00
|
|
|
static struct nl_addr *
|
|
|
|
|
nm_utils_ip4_addr_to_nl_addr (guint32 ip4_addr)
|
|
|
|
|
{
|
|
|
|
|
struct nl_addr * nla = NULL;
|
|
|
|
|
|
|
|
|
|
if (!(nla = nl_addr_alloc (sizeof (in_addr_t))))
|
|
|
|
|
return NULL;
|
|
|
|
|
nl_addr_set_family (nla, AF_INET);
|
|
|
|
|
nl_addr_set_binary_addr (nla, &ip4_addr, sizeof (guint32));
|
|
|
|
|
|
|
|
|
|
return nla;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
NMIP4Config *
|
|
|
|
|
nm_ip4_config_new (void)
|
2005-04-15 15:43:42 +00:00
|
|
|
{
|
2008-09-05 02:55:40 +00:00
|
|
|
return (NMIP4Config *) g_object_new (NM_TYPE_IP4_CONFIG, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-04 10:20:24 -04:00
|
|
|
NMIP4Config *
|
|
|
|
|
nm_ip4_config_new_for_interface (int ifindex)
|
|
|
|
|
{
|
|
|
|
|
NMIP4Config *ip4;
|
|
|
|
|
GArray *addrs_array, *routes_array;
|
|
|
|
|
NMPlatformIP4Address *addrs;
|
|
|
|
|
NMPlatformIP4Route *routes;
|
|
|
|
|
NMIP4Address *addr;
|
|
|
|
|
NMIP4Route *route;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
addrs_array = nm_platform_ip4_address_get_all (ifindex);
|
|
|
|
|
if (addrs_array->len == 0) {
|
|
|
|
|
g_array_unref (addrs_array);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ip4 = nm_ip4_config_new ();
|
|
|
|
|
|
|
|
|
|
addrs = (NMPlatformIP4Address *)addrs_array->data;
|
|
|
|
|
for (i = 0; i < addrs_array->len; i++) {
|
|
|
|
|
addr = nm_ip4_address_new ();
|
|
|
|
|
nm_ip4_address_set_address (addr, addrs[i].address);
|
|
|
|
|
nm_ip4_address_set_prefix (addr, addrs[i].plen);
|
|
|
|
|
nm_ip4_config_take_address (ip4, addr);
|
|
|
|
|
}
|
|
|
|
|
g_array_unref (addrs_array);
|
|
|
|
|
|
|
|
|
|
routes_array = nm_platform_ip4_route_get_all (ifindex);
|
|
|
|
|
routes = (NMPlatformIP4Route *)routes_array->data;
|
|
|
|
|
for (i = 0; i < routes_array->len; i++) {
|
2013-06-19 13:46:51 -05:00
|
|
|
/* Default route ignored; it's handled internally by NM and not
|
|
|
|
|
* tracked in the device's IP config.
|
|
|
|
|
*/
|
|
|
|
|
if (routes[i].plen == 0)
|
|
|
|
|
continue;
|
|
|
|
|
|
2013-04-04 10:20:24 -04:00
|
|
|
route = nm_ip4_route_new ();
|
|
|
|
|
nm_ip4_route_set_dest (route, routes[i].network);
|
|
|
|
|
nm_ip4_route_set_prefix (route, routes[i].plen);
|
|
|
|
|
nm_ip4_route_set_next_hop (route, routes[i].gateway);
|
|
|
|
|
nm_ip4_route_set_metric (route, routes[i].metric);
|
|
|
|
|
nm_ip4_config_take_route (ip4, route);
|
|
|
|
|
}
|
|
|
|
|
g_array_unref (routes_array);
|
|
|
|
|
|
|
|
|
|
return ip4;
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-05 02:55:40 +00:00
|
|
|
void
|
|
|
|
|
nm_ip4_config_export (NMIP4Config *config)
|
|
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv;
|
2007-02-16 11:23:49 +00:00
|
|
|
static guint32 counter = 0;
|
|
|
|
|
|
2008-09-05 02:55:40 +00:00
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2008-09-05 02:55:40 +00:00
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
|
|
|
g_return_if_fail (priv->path == NULL);
|
|
|
|
|
|
|
|
|
|
priv->path = g_strdup_printf (NM_DBUS_PATH "/IP4Config/%d", counter++);
|
2013-04-10 11:37:05 -05:00
|
|
|
nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, config);
|
2008-09-05 02:55:40 +00:00
|
|
|
}
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2008-10-06 19:30:59 +00:00
|
|
|
const char *
|
|
|
|
|
nm_ip4_config_get_dbus_path (NMIP4Config *config)
|
2008-09-05 02:55:40 +00:00
|
|
|
{
|
2011-03-14 01:05:51 -05:00
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
2008-09-05 02:55:40 +00:00
|
|
|
|
2008-10-06 19:30:59 +00:00
|
|
|
return NM_IP4_CONFIG_GET_PRIVATE (config)->path;
|
2005-04-15 15:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
void
|
2008-10-29 14:35:25 +00:00
|
|
|
nm_ip4_config_take_address (NMIP4Config *config, NMIP4Address *address)
|
2005-04-15 15:43:42 +00:00
|
|
|
{
|
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
2008-05-06 21:53:22 +00:00
|
|
|
NMIP4ConfigPrivate *priv;
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
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
2008-05-06 21:53:22 +00:00
|
|
|
g_return_if_fail (address != NULL);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
|
|
|
priv->addresses = g_slist_append (priv->addresses, address);
|
2005-04-15 15:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
void
|
|
|
|
|
nm_ip4_config_add_address (NMIP4Config *config,
|
2008-10-29 14:35:25 +00:00
|
|
|
NMIP4Address *address)
|
2006-01-16 22:58:13 +00:00
|
|
|
{
|
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
2008-05-06 21:53:22 +00:00
|
|
|
NMIP4ConfigPrivate *priv;
|
2012-05-14 10:35:39 -04:00
|
|
|
GSList *iter;
|
2006-01-16 22:58:13 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
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
2008-05-06 21:53:22 +00:00
|
|
|
g_return_if_fail (address != NULL);
|
2006-01-16 22:58:13 +00:00
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
2012-05-14 10:35:39 -04:00
|
|
|
for (iter = priv->addresses; iter; iter = g_slist_next (iter)) {
|
|
|
|
|
if (nm_ip4_address_compare ((NMIP4Address *) iter->data, address))
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-29 14:35:25 +00:00
|
|
|
priv->addresses = g_slist_append (priv->addresses, nm_ip4_address_dup (address));
|
2006-01-16 22:58:13 +00:00
|
|
|
}
|
|
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
void
|
|
|
|
|
nm_ip4_config_replace_address (NMIP4Config *config,
|
|
|
|
|
guint i,
|
2008-10-29 14:35:25 +00:00
|
|
|
NMIP4Address *new_address)
|
2005-04-15 15:43:42 +00:00
|
|
|
{
|
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
2008-05-06 21:53:22 +00:00
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
GSList *old;
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
2005-04-15 15:43:42 +00:00
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
|
|
|
old = g_slist_nth (priv->addresses, i);
|
|
|
|
|
g_return_if_fail (old != NULL);
|
2008-10-29 14:35:25 +00:00
|
|
|
nm_ip4_address_unref ((NMIP4Address *) old->data);
|
2008-08-10 22:37:21 +00:00
|
|
|
|
2008-10-29 14:35:25 +00:00
|
|
|
old->data = nm_ip4_address_dup (new_address);
|
2005-04-15 15:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
2008-10-29 14:35:25 +00:00
|
|
|
NMIP4Address *nm_ip4_config_get_address (NMIP4Config *config, guint i)
|
2005-04-15 15:43:42 +00:00
|
|
|
{
|
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
2008-05-06 21:53:22 +00:00
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2008-10-29 14:35:25 +00:00
|
|
|
return (NMIP4Address *) g_slist_nth_data (NM_IP4_CONFIG_GET_PRIVATE (config)->addresses, i);
|
2005-04-15 15:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
guint32 nm_ip4_config_get_num_addresses (NMIP4Config *config)
|
2005-04-15 15:43:42 +00:00
|
|
|
{
|
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
2008-05-06 21:53:22 +00:00
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
return g_slist_length (NM_IP4_CONFIG_GET_PRIVATE (config)->addresses);
|
2005-04-15 15:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
guint32 nm_ip4_config_get_ptp_address (NMIP4Config *config)
|
2005-04-15 15:43:42 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
return NM_IP4_CONFIG_GET_PRIVATE (config)->ptp_address;
|
2005-04-15 15:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
void nm_ip4_config_set_ptp_address (NMIP4Config *config, guint32 ptp_addr)
|
2005-04-15 15:43:42 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
2005-04-15 15:43:42 +00:00
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
NM_IP4_CONFIG_GET_PRIVATE (config)->ptp_address = ptp_addr;
|
2005-04-15 15:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ip4_config_add_nameserver (NMIP4Config *config, guint32 nameserver)
|
|
|
|
|
{
|
2008-12-19 17:01:06 -05:00
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
int i;
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
2008-12-19 17:01:06 -05:00
|
|
|
g_return_if_fail (nameserver > 0);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2008-12-19 17:01:06 -05:00
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
|
|
|
for (i = 0; i < priv->nameservers->len; i++) {
|
|
|
|
|
guint32 s = g_array_index (priv->nameservers, guint32, i);
|
|
|
|
|
|
|
|
|
|
/* No dupes */
|
2012-05-14 10:35:39 -04:00
|
|
|
if (nameserver == s)
|
|
|
|
|
return;
|
2008-12-19 17:01:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_array_append_val (priv->nameservers, nameserver);
|
2005-04-15 15:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
2006-01-11 Robert Love <rml@novell.com>
* configure.in: Add the gcc flags '-Wshadow' and '-Wfloat-equal'.
* gnome/applet/applet.c, gnome/vpn-properties/nm-vpn-properties.c,
src/NetworkManagerAPList.c, src/NetworkManagerDbus.c,
src/NetworkManagerPolicy.c, src/NetworkManagerSystem.c,
src/nm-dbus-device.c, src/nm-device-802-3-ethernet.c,
src/nm-ip4-config.c, src/vpn-manager/nm-vpn-manager.c,
test/nmtestdevices.c: Fix shadowed variable usage as appropriate.
* src/nm-device-802-11-wireless.c: Fix floating point comparison by
comparing values within DBL_EPSILON. Also fix shadowed variable
usage.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1318 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-01-11 21:07:29 +00:00
|
|
|
guint32 nm_ip4_config_get_nameserver (NMIP4Config *config, guint i)
|
2005-04-15 15:43:42 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
return g_array_index (NM_IP4_CONFIG_GET_PRIVATE (config)->nameservers, guint32, i);
|
2005-04-15 15:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
guint32 nm_ip4_config_get_num_nameservers (NMIP4Config *config)
|
|
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
return NM_IP4_CONFIG_GET_PRIVATE (config)->nameservers->len;
|
2005-04-15 15:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
2008-05-23 07:35:43 +00:00
|
|
|
void nm_ip4_config_reset_nameservers (NMIP4Config *config)
|
|
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
|
|
|
|
|
|
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
2008-07-01 21:03:15 +00:00
|
|
|
if (priv->nameservers->len)
|
|
|
|
|
g_array_remove_range (priv->nameservers, 0, priv->nameservers->len);
|
2008-05-23 07:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-19 17:01:06 -05:00
|
|
|
void nm_ip4_config_add_wins (NMIP4Config *config, guint32 wins)
|
|
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
|
|
|
|
g_return_if_fail (wins > 0);
|
|
|
|
|
|
|
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
|
|
|
for (i = 0; i < priv->wins->len; i++) {
|
|
|
|
|
guint32 s = g_array_index (priv->wins, guint32, i);
|
|
|
|
|
|
|
|
|
|
/* No dupes */
|
2012-05-14 10:35:39 -04:00
|
|
|
if (wins == s)
|
|
|
|
|
return;
|
2008-12-19 17:01:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_array_append_val (priv->wins, wins);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
guint32 nm_ip4_config_get_wins (NMIP4Config *config, guint i)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
|
|
|
|
|
|
|
|
|
return g_array_index (NM_IP4_CONFIG_GET_PRIVATE (config)->wins, guint32, i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
guint32 nm_ip4_config_get_num_wins (NMIP4Config *config)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
|
|
|
|
|
|
|
|
|
return NM_IP4_CONFIG_GET_PRIVATE (config)->wins->len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ip4_config_reset_wins (NMIP4Config *config)
|
|
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
|
|
|
|
|
|
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
|
|
|
if (priv->wins->len)
|
|
|
|
|
g_array_remove_range (priv->wins, 0, priv->wins->len);
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-02 08:44:48 +00:00
|
|
|
void
|
2008-10-29 14:35:25 +00:00
|
|
|
nm_ip4_config_take_route (NMIP4Config *config, NMIP4Route *route)
|
2007-11-28 22:38:33 +00:00
|
|
|
{
|
2008-06-02 08:44:48 +00:00
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
|
2007-11-28 22:38:33 +00:00
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
2008-08-06 22:23:48 +00:00
|
|
|
g_return_if_fail (route != NULL);
|
2007-11-28 22:38:33 +00:00
|
|
|
|
2008-06-02 08:44:48 +00:00
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
2008-08-06 22:23:48 +00:00
|
|
|
priv->routes = g_slist_append (priv->routes, route);
|
2007-11-28 22:38:33 +00:00
|
|
|
}
|
|
|
|
|
|
2008-06-02 08:44:48 +00:00
|
|
|
void
|
2008-10-29 14:35:25 +00:00
|
|
|
nm_ip4_config_add_route (NMIP4Config *config, NMIP4Route *route)
|
2007-11-28 22:38:33 +00:00
|
|
|
{
|
2008-06-02 08:44:48 +00:00
|
|
|
NMIP4ConfigPrivate *priv;
|
2012-05-14 10:35:39 -04:00
|
|
|
GSList *iter;
|
2008-06-02 08:44:48 +00:00
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
2008-08-06 22:23:48 +00:00
|
|
|
g_return_if_fail (route != NULL);
|
2007-11-28 22:38:33 +00:00
|
|
|
|
2008-06-02 08:44:48 +00:00
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
2012-05-14 10:35:39 -04:00
|
|
|
for (iter = priv->routes; iter; iter = g_slist_next (iter)) {
|
|
|
|
|
if (nm_ip4_route_compare ((NMIP4Route *) iter->data, route))
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-29 14:35:25 +00:00
|
|
|
priv->routes = g_slist_append (priv->routes, nm_ip4_route_dup (route));
|
2008-06-02 08:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2008-08-06 22:23:48 +00:00
|
|
|
nm_ip4_config_replace_route (NMIP4Config *config,
|
2008-06-02 08:44:48 +00:00
|
|
|
guint i,
|
2008-10-29 14:35:25 +00:00
|
|
|
NMIP4Route *new_route)
|
2008-06-02 08:44:48 +00:00
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
GSList *old;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
|
|
|
|
|
|
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
2008-08-06 22:23:48 +00:00
|
|
|
old = g_slist_nth (priv->routes, i);
|
2008-06-02 08:44:48 +00:00
|
|
|
g_return_if_fail (old != NULL);
|
2008-10-29 14:35:25 +00:00
|
|
|
nm_ip4_route_unref ((NMIP4Route *) old->data);
|
2008-08-10 22:37:21 +00:00
|
|
|
|
2008-10-29 14:35:25 +00:00
|
|
|
old->data = nm_ip4_route_dup (new_route);
|
2008-06-02 08:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
2008-10-29 14:35:25 +00:00
|
|
|
NMIP4Route *
|
2008-08-06 22:23:48 +00:00
|
|
|
nm_ip4_config_get_route (NMIP4Config *config, guint i)
|
2008-06-02 08:44:48 +00:00
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
|
|
|
|
|
2008-10-29 14:35:25 +00:00
|
|
|
return (NMIP4Route *) g_slist_nth_data (NM_IP4_CONFIG_GET_PRIVATE (config)->routes, i);
|
2007-11-28 22:38:33 +00:00
|
|
|
}
|
|
|
|
|
|
2008-08-06 22:23:48 +00:00
|
|
|
guint32 nm_ip4_config_get_num_routes (NMIP4Config *config)
|
2007-11-28 22:38:33 +00:00
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
|
|
|
|
|
2008-08-06 22:23:48 +00:00
|
|
|
return g_slist_length (NM_IP4_CONFIG_GET_PRIVATE (config)->routes);
|
2007-11-28 22:38:33 +00:00
|
|
|
}
|
|
|
|
|
|
2008-08-06 22:23:48 +00:00
|
|
|
void nm_ip4_config_reset_routes (NMIP4Config *config)
|
|
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
|
|
|
|
|
|
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
|
|
|
g_slist_foreach (priv->routes, (GFunc) g_free, NULL);
|
|
|
|
|
priv->routes = NULL;
|
|
|
|
|
}
|
2008-03-09 05:11:22 +00:00
|
|
|
|
|
|
|
|
void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain)
|
|
|
|
|
{
|
2009-05-11 20:02:07 -04:00
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
int i;
|
|
|
|
|
|
2008-03-09 05:11:22 +00:00
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
|
|
|
|
g_return_if_fail (domain != NULL);
|
|
|
|
|
g_return_if_fail (strlen (domain) > 0);
|
|
|
|
|
|
2009-05-11 20:02:07 -04:00
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
2008-03-09 05:11:22 +00:00
|
|
|
|
2009-05-11 20:02:07 -04:00
|
|
|
for (i = 0; i < priv->domains->len; i++) {
|
|
|
|
|
if (!strcmp (g_ptr_array_index (priv->domains, i), domain))
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_ptr_array_add (priv->domains, g_strdup (domain));
|
2008-03-09 05:11:22 +00:00
|
|
|
}
|
|
|
|
|
|
2006-01-11 Robert Love <rml@novell.com>
* configure.in: Add the gcc flags '-Wshadow' and '-Wfloat-equal'.
* gnome/applet/applet.c, gnome/vpn-properties/nm-vpn-properties.c,
src/NetworkManagerAPList.c, src/NetworkManagerDbus.c,
src/NetworkManagerPolicy.c, src/NetworkManagerSystem.c,
src/nm-dbus-device.c, src/nm-device-802-3-ethernet.c,
src/nm-ip4-config.c, src/vpn-manager/nm-vpn-manager.c,
test/nmtestdevices.c: Fix shadowed variable usage as appropriate.
* src/nm-device-802-11-wireless.c: Fix floating point comparison by
comparing values within DBL_EPSILON. Also fix shadowed variable
usage.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1318 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-01-11 21:07:29 +00:00
|
|
|
const char *nm_ip4_config_get_domain (NMIP4Config *config, guint i)
|
2005-04-15 15:43:42 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
return (const char *) g_ptr_array_index (NM_IP4_CONFIG_GET_PRIVATE (config)->domains, i);
|
2005-04-15 15:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
guint32 nm_ip4_config_get_num_domains (NMIP4Config *config)
|
|
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
return NM_IP4_CONFIG_GET_PRIVATE (config)->domains->len;
|
2005-04-15 15:43:42 +00:00
|
|
|
}
|
2005-10-28 03:16:02 +00:00
|
|
|
|
2009-05-11 20:02:07 -04:00
|
|
|
void nm_ip4_config_reset_domains (NMIP4Config *config)
|
|
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
|
|
|
|
|
|
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
|
|
|
for (i = 0; i < priv->domains->len; i++)
|
|
|
|
|
g_free (g_ptr_array_index (priv->domains, i));
|
|
|
|
|
g_ptr_array_free (priv->domains, TRUE);
|
|
|
|
|
priv->domains = g_ptr_array_sized_new (3);
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-09 05:11:22 +00:00
|
|
|
void nm_ip4_config_add_search (NMIP4Config *config, const char *search)
|
|
|
|
|
{
|
2009-05-11 20:02:07 -04:00
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
int i;
|
|
|
|
|
|
2008-03-09 05:11:22 +00:00
|
|
|
g_return_if_fail (config != NULL);
|
|
|
|
|
g_return_if_fail (search != NULL);
|
|
|
|
|
g_return_if_fail (strlen (search) > 0);
|
|
|
|
|
|
2009-05-11 20:02:07 -04:00
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < priv->searches->len; i++) {
|
|
|
|
|
if (!strcmp (g_ptr_array_index (priv->searches, i), search))
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_ptr_array_add (priv->searches, g_strdup (search));
|
2008-03-09 05:11:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *nm_ip4_config_get_search (NMIP4Config *config, guint i)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (config != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
return (const char *) g_ptr_array_index (NM_IP4_CONFIG_GET_PRIVATE (config)->searches, i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
guint32 nm_ip4_config_get_num_searches (NMIP4Config *config)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (config != NULL, 0);
|
|
|
|
|
|
|
|
|
|
return NM_IP4_CONFIG_GET_PRIVATE (config)->searches->len;
|
|
|
|
|
}
|
|
|
|
|
|
2008-05-23 07:35:43 +00:00
|
|
|
void nm_ip4_config_reset_searches (NMIP4Config *config)
|
|
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv;
|
2009-05-11 20:02:07 -04:00
|
|
|
int i;
|
2008-05-23 07:35:43 +00:00
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
|
|
|
|
|
|
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
2009-05-11 20:02:07 -04:00
|
|
|
for (i = 0; i < priv->searches->len; i++)
|
|
|
|
|
g_free (g_ptr_array_index (priv->searches, i));
|
|
|
|
|
g_ptr_array_free (priv->searches, TRUE);
|
|
|
|
|
priv->searches = g_ptr_array_sized_new (3);
|
2008-05-23 07:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
2006-03-29 Robert Love <rml@novell.com>
Patch by Vinay R <rvinay@novell.com> and Robert Love <rml@novell.com>,
to add support for per-route MSS and improve support for per-interface
MTU:
* src/NetworkManagerSystem.c: Modify nm_system_device_set_ip4_route to
optionally take an MSS parameter and set it for the given route.
Remove nm_system_device_set_ip4_route_with_iface. Pass in the
NMIP4Config's stored MSS, if any.
* src/nm-ip4-config.c: Add 'mtu' and 'mss' to NMIP4Config, representing
the interface's MTU and the route's MSS, respectively. Add functions
nm_ip4_config_get_mtu, nm_ip4_config_set_mtu, nm_ip4_config_get_mss,
and nm_ip4_config_set_mss for retrieving and setting the MTU and the
MSS.
* src/nm-ip4-config.h: Add prototypes for nm_ip4_config_get_mtu,
nm_ip4_config_set_mtu, nm_ip4_config_get_mss, and
nm_ip4_config_set_mss.
* src/vpn-manager/nm-vpn-service.c: Modify to receive the MSS from the
VPN daemon.
* src/backends/NetworkManager{Arch,Debian,Gentoo,RedHat,Slackware,SUSE}.c:
Change the retval of nm_system_get_mtu to guint32.
* src/dhcp-manager/nm-dhcp-manager.c: Set the MTU on the new DHCP-given
NMIP4Config to the MTU provided by the system, if any. TODO: If DHCP
servers can specify MTU's, we should set it here if the MTU was not
provided.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1660 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-29 19:26:53 +00:00
|
|
|
guint32 nm_ip4_config_get_mtu (NMIP4Config *config)
|
|
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
2006-03-29 Robert Love <rml@novell.com>
Patch by Vinay R <rvinay@novell.com> and Robert Love <rml@novell.com>,
to add support for per-route MSS and improve support for per-interface
MTU:
* src/NetworkManagerSystem.c: Modify nm_system_device_set_ip4_route to
optionally take an MSS parameter and set it for the given route.
Remove nm_system_device_set_ip4_route_with_iface. Pass in the
NMIP4Config's stored MSS, if any.
* src/nm-ip4-config.c: Add 'mtu' and 'mss' to NMIP4Config, representing
the interface's MTU and the route's MSS, respectively. Add functions
nm_ip4_config_get_mtu, nm_ip4_config_set_mtu, nm_ip4_config_get_mss,
and nm_ip4_config_set_mss for retrieving and setting the MTU and the
MSS.
* src/nm-ip4-config.h: Add prototypes for nm_ip4_config_get_mtu,
nm_ip4_config_set_mtu, nm_ip4_config_get_mss, and
nm_ip4_config_set_mss.
* src/vpn-manager/nm-vpn-service.c: Modify to receive the MSS from the
VPN daemon.
* src/backends/NetworkManager{Arch,Debian,Gentoo,RedHat,Slackware,SUSE}.c:
Change the retval of nm_system_get_mtu to guint32.
* src/dhcp-manager/nm-dhcp-manager.c: Set the MTU on the new DHCP-given
NMIP4Config to the MTU provided by the system, if any. TODO: If DHCP
servers can specify MTU's, we should set it here if the MTU was not
provided.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1660 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-29 19:26:53 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
return NM_IP4_CONFIG_GET_PRIVATE (config)->mtu;
|
2006-03-29 Robert Love <rml@novell.com>
Patch by Vinay R <rvinay@novell.com> and Robert Love <rml@novell.com>,
to add support for per-route MSS and improve support for per-interface
MTU:
* src/NetworkManagerSystem.c: Modify nm_system_device_set_ip4_route to
optionally take an MSS parameter and set it for the given route.
Remove nm_system_device_set_ip4_route_with_iface. Pass in the
NMIP4Config's stored MSS, if any.
* src/nm-ip4-config.c: Add 'mtu' and 'mss' to NMIP4Config, representing
the interface's MTU and the route's MSS, respectively. Add functions
nm_ip4_config_get_mtu, nm_ip4_config_set_mtu, nm_ip4_config_get_mss,
and nm_ip4_config_set_mss for retrieving and setting the MTU and the
MSS.
* src/nm-ip4-config.h: Add prototypes for nm_ip4_config_get_mtu,
nm_ip4_config_set_mtu, nm_ip4_config_get_mss, and
nm_ip4_config_set_mss.
* src/vpn-manager/nm-vpn-service.c: Modify to receive the MSS from the
VPN daemon.
* src/backends/NetworkManager{Arch,Debian,Gentoo,RedHat,Slackware,SUSE}.c:
Change the retval of nm_system_get_mtu to guint32.
* src/dhcp-manager/nm-dhcp-manager.c: Set the MTU on the new DHCP-given
NMIP4Config to the MTU provided by the system, if any. TODO: If DHCP
servers can specify MTU's, we should set it here if the MTU was not
provided.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1660 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-29 19:26:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ip4_config_set_mtu (NMIP4Config *config, guint32 mtu)
|
|
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
2006-03-29 Robert Love <rml@novell.com>
Patch by Vinay R <rvinay@novell.com> and Robert Love <rml@novell.com>,
to add support for per-route MSS and improve support for per-interface
MTU:
* src/NetworkManagerSystem.c: Modify nm_system_device_set_ip4_route to
optionally take an MSS parameter and set it for the given route.
Remove nm_system_device_set_ip4_route_with_iface. Pass in the
NMIP4Config's stored MSS, if any.
* src/nm-ip4-config.c: Add 'mtu' and 'mss' to NMIP4Config, representing
the interface's MTU and the route's MSS, respectively. Add functions
nm_ip4_config_get_mtu, nm_ip4_config_set_mtu, nm_ip4_config_get_mss,
and nm_ip4_config_set_mss for retrieving and setting the MTU and the
MSS.
* src/nm-ip4-config.h: Add prototypes for nm_ip4_config_get_mtu,
nm_ip4_config_set_mtu, nm_ip4_config_get_mss, and
nm_ip4_config_set_mss.
* src/vpn-manager/nm-vpn-service.c: Modify to receive the MSS from the
VPN daemon.
* src/backends/NetworkManager{Arch,Debian,Gentoo,RedHat,Slackware,SUSE}.c:
Change the retval of nm_system_get_mtu to guint32.
* src/dhcp-manager/nm-dhcp-manager.c: Set the MTU on the new DHCP-given
NMIP4Config to the MTU provided by the system, if any. TODO: If DHCP
servers can specify MTU's, we should set it here if the MTU was not
provided.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1660 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-29 19:26:53 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
NM_IP4_CONFIG_GET_PRIVATE (config)->mtu = mtu;
|
2006-03-29 Robert Love <rml@novell.com>
Patch by Vinay R <rvinay@novell.com> and Robert Love <rml@novell.com>,
to add support for per-route MSS and improve support for per-interface
MTU:
* src/NetworkManagerSystem.c: Modify nm_system_device_set_ip4_route to
optionally take an MSS parameter and set it for the given route.
Remove nm_system_device_set_ip4_route_with_iface. Pass in the
NMIP4Config's stored MSS, if any.
* src/nm-ip4-config.c: Add 'mtu' and 'mss' to NMIP4Config, representing
the interface's MTU and the route's MSS, respectively. Add functions
nm_ip4_config_get_mtu, nm_ip4_config_set_mtu, nm_ip4_config_get_mss,
and nm_ip4_config_set_mss for retrieving and setting the MTU and the
MSS.
* src/nm-ip4-config.h: Add prototypes for nm_ip4_config_get_mtu,
nm_ip4_config_set_mtu, nm_ip4_config_get_mss, and
nm_ip4_config_set_mss.
* src/vpn-manager/nm-vpn-service.c: Modify to receive the MSS from the
VPN daemon.
* src/backends/NetworkManager{Arch,Debian,Gentoo,RedHat,Slackware,SUSE}.c:
Change the retval of nm_system_get_mtu to guint32.
* src/dhcp-manager/nm-dhcp-manager.c: Set the MTU on the new DHCP-given
NMIP4Config to the MTU provided by the system, if any. TODO: If DHCP
servers can specify MTU's, we should set it here if the MTU was not
provided.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1660 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-29 19:26:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
guint32 nm_ip4_config_get_mss (NMIP4Config *config)
|
|
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
2006-03-29 Robert Love <rml@novell.com>
Patch by Vinay R <rvinay@novell.com> and Robert Love <rml@novell.com>,
to add support for per-route MSS and improve support for per-interface
MTU:
* src/NetworkManagerSystem.c: Modify nm_system_device_set_ip4_route to
optionally take an MSS parameter and set it for the given route.
Remove nm_system_device_set_ip4_route_with_iface. Pass in the
NMIP4Config's stored MSS, if any.
* src/nm-ip4-config.c: Add 'mtu' and 'mss' to NMIP4Config, representing
the interface's MTU and the route's MSS, respectively. Add functions
nm_ip4_config_get_mtu, nm_ip4_config_set_mtu, nm_ip4_config_get_mss,
and nm_ip4_config_set_mss for retrieving and setting the MTU and the
MSS.
* src/nm-ip4-config.h: Add prototypes for nm_ip4_config_get_mtu,
nm_ip4_config_set_mtu, nm_ip4_config_get_mss, and
nm_ip4_config_set_mss.
* src/vpn-manager/nm-vpn-service.c: Modify to receive the MSS from the
VPN daemon.
* src/backends/NetworkManager{Arch,Debian,Gentoo,RedHat,Slackware,SUSE}.c:
Change the retval of nm_system_get_mtu to guint32.
* src/dhcp-manager/nm-dhcp-manager.c: Set the MTU on the new DHCP-given
NMIP4Config to the MTU provided by the system, if any. TODO: If DHCP
servers can specify MTU's, we should set it here if the MTU was not
provided.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1660 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-29 19:26:53 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
return NM_IP4_CONFIG_GET_PRIVATE (config)->mss;
|
2006-03-29 Robert Love <rml@novell.com>
Patch by Vinay R <rvinay@novell.com> and Robert Love <rml@novell.com>,
to add support for per-route MSS and improve support for per-interface
MTU:
* src/NetworkManagerSystem.c: Modify nm_system_device_set_ip4_route to
optionally take an MSS parameter and set it for the given route.
Remove nm_system_device_set_ip4_route_with_iface. Pass in the
NMIP4Config's stored MSS, if any.
* src/nm-ip4-config.c: Add 'mtu' and 'mss' to NMIP4Config, representing
the interface's MTU and the route's MSS, respectively. Add functions
nm_ip4_config_get_mtu, nm_ip4_config_set_mtu, nm_ip4_config_get_mss,
and nm_ip4_config_set_mss for retrieving and setting the MTU and the
MSS.
* src/nm-ip4-config.h: Add prototypes for nm_ip4_config_get_mtu,
nm_ip4_config_set_mtu, nm_ip4_config_get_mss, and
nm_ip4_config_set_mss.
* src/vpn-manager/nm-vpn-service.c: Modify to receive the MSS from the
VPN daemon.
* src/backends/NetworkManager{Arch,Debian,Gentoo,RedHat,Slackware,SUSE}.c:
Change the retval of nm_system_get_mtu to guint32.
* src/dhcp-manager/nm-dhcp-manager.c: Set the MTU on the new DHCP-given
NMIP4Config to the MTU provided by the system, if any. TODO: If DHCP
servers can specify MTU's, we should set it here if the MTU was not
provided.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1660 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-29 19:26:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ip4_config_set_mss (NMIP4Config *config, guint32 mss)
|
|
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
2006-03-29 Robert Love <rml@novell.com>
Patch by Vinay R <rvinay@novell.com> and Robert Love <rml@novell.com>,
to add support for per-route MSS and improve support for per-interface
MTU:
* src/NetworkManagerSystem.c: Modify nm_system_device_set_ip4_route to
optionally take an MSS parameter and set it for the given route.
Remove nm_system_device_set_ip4_route_with_iface. Pass in the
NMIP4Config's stored MSS, if any.
* src/nm-ip4-config.c: Add 'mtu' and 'mss' to NMIP4Config, representing
the interface's MTU and the route's MSS, respectively. Add functions
nm_ip4_config_get_mtu, nm_ip4_config_set_mtu, nm_ip4_config_get_mss,
and nm_ip4_config_set_mss for retrieving and setting the MTU and the
MSS.
* src/nm-ip4-config.h: Add prototypes for nm_ip4_config_get_mtu,
nm_ip4_config_set_mtu, nm_ip4_config_get_mss, and
nm_ip4_config_set_mss.
* src/vpn-manager/nm-vpn-service.c: Modify to receive the MSS from the
VPN daemon.
* src/backends/NetworkManager{Arch,Debian,Gentoo,RedHat,Slackware,SUSE}.c:
Change the retval of nm_system_get_mtu to guint32.
* src/dhcp-manager/nm-dhcp-manager.c: Set the MTU on the new DHCP-given
NMIP4Config to the MTU provided by the system, if any. TODO: If DHCP
servers can specify MTU's, we should set it here if the MTU was not
provided.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1660 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-29 19:26:53 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
NM_IP4_CONFIG_GET_PRIVATE (config)->mss = mss;
|
2006-03-29 Robert Love <rml@novell.com>
Patch by Vinay R <rvinay@novell.com> and Robert Love <rml@novell.com>,
to add support for per-route MSS and improve support for per-interface
MTU:
* src/NetworkManagerSystem.c: Modify nm_system_device_set_ip4_route to
optionally take an MSS parameter and set it for the given route.
Remove nm_system_device_set_ip4_route_with_iface. Pass in the
NMIP4Config's stored MSS, if any.
* src/nm-ip4-config.c: Add 'mtu' and 'mss' to NMIP4Config, representing
the interface's MTU and the route's MSS, respectively. Add functions
nm_ip4_config_get_mtu, nm_ip4_config_set_mtu, nm_ip4_config_get_mss,
and nm_ip4_config_set_mss for retrieving and setting the MTU and the
MSS.
* src/nm-ip4-config.h: Add prototypes for nm_ip4_config_get_mtu,
nm_ip4_config_set_mtu, nm_ip4_config_get_mss, and
nm_ip4_config_set_mss.
* src/vpn-manager/nm-vpn-service.c: Modify to receive the MSS from the
VPN daemon.
* src/backends/NetworkManager{Arch,Debian,Gentoo,RedHat,Slackware,SUSE}.c:
Change the retval of nm_system_get_mtu to guint32.
* src/dhcp-manager/nm-dhcp-manager.c: Set the MTU on the new DHCP-given
NMIP4Config to the MTU provided by the system, if any. TODO: If DHCP
servers can specify MTU's, we should set it here if the MTU was not
provided.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1660 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-29 19:26:53 +00:00
|
|
|
}
|
2005-10-28 03:16:02 +00:00
|
|
|
|
2008-12-09 20:01:49 +00:00
|
|
|
gboolean
|
|
|
|
|
nm_ip4_config_get_never_default (NMIP4Config *config)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), FALSE);
|
|
|
|
|
|
|
|
|
|
return NM_IP4_CONFIG_GET_PRIVATE (config)->never_default;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
nm_ip4_config_set_never_default (NMIP4Config *config, gboolean never_default)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
|
|
|
|
|
|
|
|
|
NM_IP4_CONFIG_GET_PRIVATE (config)->never_default = never_default;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-16 11:28:39 -07:00
|
|
|
void nm_ip4_config_add_nis_server (NMIP4Config *config, guint32 nis)
|
|
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
|
|
|
|
g_return_if_fail (nis > 0);
|
|
|
|
|
|
|
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
|
|
|
for (i = 0; i < priv->nis->len; i++) {
|
|
|
|
|
guint32 s = g_array_index (priv->nis, guint32, i);
|
|
|
|
|
|
|
|
|
|
/* No dupes */
|
|
|
|
|
g_return_if_fail (nis != s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_array_append_val (priv->nis, nis);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
guint32 nm_ip4_config_get_nis_server (NMIP4Config *config, guint i)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
|
|
|
|
|
|
|
|
|
return g_array_index (NM_IP4_CONFIG_GET_PRIVATE (config)->nis, guint32, i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
guint32 nm_ip4_config_get_num_nis_servers (NMIP4Config *config)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
|
|
|
|
|
|
|
|
|
return NM_IP4_CONFIG_GET_PRIVATE (config)->nis->len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ip4_config_reset_nis_servers (NMIP4Config *config)
|
|
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
|
|
|
|
|
|
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
|
|
|
if (priv->nis->len)
|
|
|
|
|
g_array_remove_range (priv->nis, 0, priv->nis->len);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
nm_ip4_config_set_nis_domain (NMIP4Config *config, const char *domain)
|
|
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
|
|
|
|
|
|
|
|
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
|
|
|
g_free (priv->nis_domain);
|
|
|
|
|
priv->nis_domain = g_strdup (domain);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *
|
|
|
|
|
nm_ip4_config_get_nis_domain (NMIP4Config *config)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
|
|
|
|
|
|
|
|
|
return NM_IP4_CONFIG_GET_PRIVATE (config)->nis_domain;
|
|
|
|
|
}
|
|
|
|
|
|
2005-10-28 03:16:02 +00:00
|
|
|
/* libnl convenience/conversion functions */
|
|
|
|
|
|
|
|
|
|
static int ip4_addr_to_rtnl_local (guint32 ip4_address, struct rtnl_addr *addr)
|
|
|
|
|
{
|
|
|
|
|
struct nl_addr * local = NULL;
|
|
|
|
|
int err = 0;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (addr != NULL, -1);
|
|
|
|
|
|
2005-12-04 02:23:29 +00:00
|
|
|
local = nm_utils_ip4_addr_to_nl_addr (ip4_address);
|
2005-10-28 03:16:02 +00:00
|
|
|
err = rtnl_addr_set_local (addr, local);
|
|
|
|
|
nl_addr_put (local);
|
2005-12-04 02:23:29 +00:00
|
|
|
|
2005-10-28 03:16:02 +00:00
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int ip4_addr_to_rtnl_peer (guint32 ip4_address, struct rtnl_addr *addr)
|
|
|
|
|
{
|
|
|
|
|
struct nl_addr * peer = NULL;
|
|
|
|
|
int err = 0;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (addr != NULL, -1);
|
|
|
|
|
|
2005-12-04 02:23:29 +00:00
|
|
|
peer = nm_utils_ip4_addr_to_nl_addr (ip4_address);
|
2005-10-28 03:16:02 +00:00
|
|
|
err = rtnl_addr_set_peer (addr, peer);
|
|
|
|
|
nl_addr_put (peer);
|
2005-12-04 02:23:29 +00:00
|
|
|
|
2005-10-28 03:16:02 +00:00
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int ip4_addr_to_rtnl_broadcast (guint32 ip4_broadcast, struct rtnl_addr *addr)
|
|
|
|
|
{
|
|
|
|
|
struct nl_addr * local = NULL;
|
|
|
|
|
int err = 0;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (addr != NULL, -1);
|
|
|
|
|
|
2005-12-04 02:23:29 +00:00
|
|
|
local = nm_utils_ip4_addr_to_nl_addr (ip4_broadcast);
|
2005-10-28 03:16:02 +00:00
|
|
|
err = rtnl_addr_set_broadcast (addr, local);
|
|
|
|
|
nl_addr_put (local);
|
2005-12-04 02:23:29 +00:00
|
|
|
|
2005-10-28 03:16:02 +00:00
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
struct rtnl_addr *
|
|
|
|
|
nm_ip4_config_to_rtnl_addr (NMIP4Config *config, guint32 i, guint32 flags)
|
2005-10-28 03:16:02 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
2008-10-29 14:35:25 +00:00
|
|
|
NMIP4Address *config_addr;
|
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
2008-05-06 21:53:22 +00:00
|
|
|
struct rtnl_addr *addr;
|
|
|
|
|
gboolean success = TRUE;
|
2005-10-28 03:16:02 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
2005-10-28 03:16:02 +00:00
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
config_addr = nm_ip4_config_get_address (config, i);
|
|
|
|
|
g_return_val_if_fail (config_addr != NULL, NULL);
|
|
|
|
|
|
2005-10-28 03:16:02 +00:00
|
|
|
if (!(addr = rtnl_addr_alloc()))
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
if (flags & NM_RTNL_ADDR_ADDR)
|
2008-10-29 14:35:25 +00:00
|
|
|
success = (ip4_addr_to_rtnl_local (nm_ip4_address_get_address (config_addr), addr) >= 0);
|
2005-10-28 03:16:02 +00:00
|
|
|
|
|
|
|
|
if (flags & NM_RTNL_ADDR_PTP_ADDR)
|
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
2008-05-06 21:53:22 +00:00
|
|
|
success = (ip4_addr_to_rtnl_peer (priv->ptp_address, addr) >= 0);
|
2005-10-28 03:16:02 +00:00
|
|
|
|
2008-07-07 18:57:37 +00:00
|
|
|
if (flags & NM_RTNL_ADDR_PREFIX)
|
2008-10-29 14:35:25 +00:00
|
|
|
rtnl_addr_set_prefixlen (addr, nm_ip4_address_get_prefix (config_addr));
|
2005-10-28 03:16:02 +00:00
|
|
|
|
2008-04-21 20:31:23 +00:00
|
|
|
if (flags & NM_RTNL_ADDR_BROADCAST) {
|
2008-07-07 18:57:37 +00:00
|
|
|
guint32 hostmask, network, bcast, netmask;
|
2008-04-21 20:31:23 +00:00
|
|
|
|
2008-10-29 14:35:25 +00:00
|
|
|
netmask = nm_utils_ip4_prefix_to_netmask (nm_ip4_address_get_prefix (config_addr));
|
|
|
|
|
network = ntohl (nm_ip4_address_get_address (config_addr)) & ntohl (netmask);
|
2008-07-07 18:57:37 +00:00
|
|
|
hostmask = ~ntohl (netmask);
|
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
2008-05-06 21:53:22 +00:00
|
|
|
bcast = htonl (network | hostmask);
|
2008-04-21 20:31:23 +00:00
|
|
|
|
|
|
|
|
success = (ip4_addr_to_rtnl_broadcast (bcast, addr) >= 0);
|
|
|
|
|
}
|
2005-10-28 03:16:02 +00:00
|
|
|
|
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
2008-05-06 21:53:22 +00:00
|
|
|
if (!success) {
|
2005-10-28 03:16:02 +00:00
|
|
|
rtnl_addr_put (addr);
|
|
|
|
|
addr = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return addr;
|
|
|
|
|
}
|
2007-02-16 11:23:49 +00:00
|
|
|
|
2008-11-06 04:04:51 +00:00
|
|
|
static gboolean
|
|
|
|
|
addr_slist_compare (GSList *a, GSList *b)
|
|
|
|
|
{
|
|
|
|
|
GSList *iter_a, *iter_b;
|
|
|
|
|
gboolean found = FALSE;
|
|
|
|
|
|
|
|
|
|
for (iter_a = a; iter_a; iter_a = g_slist_next (iter_a)) {
|
|
|
|
|
NMIP4Address *addr_a = (NMIP4Address *) iter_a->data;
|
|
|
|
|
|
|
|
|
|
for (iter_b = b, found = FALSE; iter_b; iter_b = g_slist_next (iter_b)) {
|
|
|
|
|
NMIP4Address *addr_b = (NMIP4Address *) iter_b->data;
|
|
|
|
|
|
|
|
|
|
if (nm_ip4_address_compare (addr_a, addr_b)) {
|
|
|
|
|
found = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!found)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
route_slist_compare (GSList *a, GSList *b)
|
|
|
|
|
{
|
|
|
|
|
GSList *iter_a, *iter_b;
|
|
|
|
|
gboolean found = FALSE;
|
|
|
|
|
|
|
|
|
|
for (iter_a = a; iter_a; iter_a = g_slist_next (iter_a)) {
|
|
|
|
|
NMIP4Route *route_a = (NMIP4Route *) iter_a->data;
|
|
|
|
|
|
|
|
|
|
for (iter_b = b, found = FALSE; iter_b; iter_b = g_slist_next (iter_b)) {
|
|
|
|
|
NMIP4Route *route_b = (NMIP4Route *) iter_b->data;
|
|
|
|
|
|
|
|
|
|
if (nm_ip4_route_compare (route_a, route_b)) {
|
|
|
|
|
found = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!found)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
string_array_compare (GPtrArray *a, GPtrArray *b)
|
|
|
|
|
{
|
|
|
|
|
int i, j;
|
|
|
|
|
gboolean found = FALSE;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < a->len; i++) {
|
|
|
|
|
for (j = 0, found = FALSE; j < b->len; j++) {
|
|
|
|
|
const char *item_a = g_ptr_array_index (a, i);
|
|
|
|
|
const char *item_b = g_ptr_array_index (b, j);
|
|
|
|
|
|
|
|
|
|
if ((!item_a && !item_b) || (item_a && item_b && !strcmp (item_a, item_b))) {
|
|
|
|
|
found = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!found)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
addr_array_compare (GArray *a, GArray *b)
|
|
|
|
|
{
|
|
|
|
|
int i, j;
|
|
|
|
|
gboolean found = FALSE;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < a->len; i++) {
|
|
|
|
|
for (j = 0, found = FALSE; j < b->len; j++) {
|
|
|
|
|
if (g_array_index (a, guint32, i) == g_array_index (b, guint32, j)) {
|
|
|
|
|
found = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!found)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-07 13:43:15 +00:00
|
|
|
NMIP4ConfigCompareFlags
|
|
|
|
|
nm_ip4_config_diff (NMIP4Config *a, NMIP4Config *b)
|
2008-11-06 04:04:51 +00:00
|
|
|
{
|
2008-11-07 13:43:15 +00:00
|
|
|
NMIP4ConfigPrivate *a_priv;
|
|
|
|
|
NMIP4ConfigPrivate *b_priv;
|
|
|
|
|
NMIP4ConfigCompareFlags flags = NM_IP4_COMPARE_FLAG_NONE;
|
2008-11-06 04:04:51 +00:00
|
|
|
|
2008-11-07 13:43:15 +00:00
|
|
|
if ((a && !b) || (b && !a))
|
2012-05-29 17:02:31 -05:00
|
|
|
return NM_IP4_COMPARE_FLAG_ALL;
|
2008-11-07 13:43:15 +00:00
|
|
|
if (!a && !b)
|
|
|
|
|
return NM_IP4_COMPARE_FLAG_NONE;
|
2008-11-06 04:04:51 +00:00
|
|
|
|
2008-11-07 13:43:15 +00:00
|
|
|
a_priv = NM_IP4_CONFIG_GET_PRIVATE (a);
|
|
|
|
|
b_priv = NM_IP4_CONFIG_GET_PRIVATE (b);
|
2008-11-06 04:04:51 +00:00
|
|
|
|
2008-11-07 13:43:15 +00:00
|
|
|
if ( !addr_slist_compare (a_priv->addresses, b_priv->addresses)
|
|
|
|
|
|| !addr_slist_compare (b_priv->addresses, a_priv->addresses))
|
|
|
|
|
flags |= NM_IP4_COMPARE_FLAG_ADDRESSES;
|
2008-11-06 04:04:51 +00:00
|
|
|
|
2008-11-07 13:43:15 +00:00
|
|
|
if (a_priv->ptp_address != b_priv->ptp_address)
|
|
|
|
|
flags |= NM_IP4_COMPARE_FLAG_PTP_ADDRESS;
|
2008-11-06 04:04:51 +00:00
|
|
|
|
2008-11-07 13:43:15 +00:00
|
|
|
if ( (a_priv->nameservers->len != b_priv->nameservers->len)
|
|
|
|
|
|| !addr_array_compare (a_priv->nameservers, b_priv->nameservers)
|
|
|
|
|
|| !addr_array_compare (b_priv->nameservers, a_priv->nameservers))
|
|
|
|
|
flags |= NM_IP4_COMPARE_FLAG_NAMESERVERS;
|
2008-11-06 04:04:51 +00:00
|
|
|
|
2008-12-19 17:01:06 -05:00
|
|
|
if ( (a_priv->wins->len != b_priv->wins->len)
|
|
|
|
|
|| !addr_array_compare (a_priv->wins, b_priv->wins)
|
|
|
|
|
|| !addr_array_compare (b_priv->wins, a_priv->wins))
|
|
|
|
|
flags |= NM_IP4_COMPARE_FLAG_WINS_SERVERS;
|
|
|
|
|
|
2010-07-16 11:28:39 -07:00
|
|
|
if ( (a_priv->nis->len != b_priv->nis->len)
|
|
|
|
|
|| !addr_array_compare (a_priv->nis, b_priv->nis)
|
|
|
|
|
|| !addr_array_compare (b_priv->nis, a_priv->nis))
|
|
|
|
|
flags |= NM_IP4_COMPARE_FLAG_NIS_SERVERS;
|
|
|
|
|
|
|
|
|
|
if ( (a_priv->nis_domain || b_priv->nis_domain)
|
|
|
|
|
&& (g_strcmp0 (a_priv->nis_domain, b_priv->nis_domain) != 0))
|
|
|
|
|
flags |= NM_IP4_COMPARE_FLAG_NIS_DOMAIN;
|
|
|
|
|
|
2008-11-07 13:43:15 +00:00
|
|
|
if ( !route_slist_compare (a_priv->routes, b_priv->routes)
|
|
|
|
|
|| !route_slist_compare (b_priv->routes, a_priv->routes))
|
|
|
|
|
flags |= NM_IP4_COMPARE_FLAG_ROUTES;
|
2008-11-06 04:04:51 +00:00
|
|
|
|
2008-11-07 13:43:15 +00:00
|
|
|
if ( (a_priv->domains->len != b_priv->domains->len)
|
|
|
|
|
|| !string_array_compare (a_priv->domains, b_priv->domains)
|
|
|
|
|
|| !string_array_compare (b_priv->domains, a_priv->domains))
|
|
|
|
|
flags |= NM_IP4_COMPARE_FLAG_DOMAINS;
|
2008-11-06 04:04:51 +00:00
|
|
|
|
2008-11-07 13:43:15 +00:00
|
|
|
if ( (a_priv->searches->len != b_priv->searches->len)
|
|
|
|
|
|| !string_array_compare (a_priv->searches, b_priv->searches)
|
|
|
|
|
|| !string_array_compare (b_priv->searches, a_priv->searches))
|
|
|
|
|
flags |= NM_IP4_COMPARE_FLAG_SEARCHES;
|
2008-11-06 04:04:51 +00:00
|
|
|
|
2008-11-07 13:43:15 +00:00
|
|
|
if (a_priv->mtu != b_priv->mtu)
|
|
|
|
|
flags |= NM_IP4_COMPARE_FLAG_MTU;
|
2008-11-06 04:04:51 +00:00
|
|
|
|
2008-11-07 13:43:15 +00:00
|
|
|
if (a_priv->mss != b_priv->mss)
|
|
|
|
|
flags |= NM_IP4_COMPARE_FLAG_MSS;
|
2008-11-06 04:04:51 +00:00
|
|
|
|
2008-11-07 13:43:15 +00:00
|
|
|
return flags;
|
2008-11-06 04:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-29 22:24:51 -05:00
|
|
|
static inline void
|
|
|
|
|
hash_u32 (GChecksum *sum, guint32 n)
|
|
|
|
|
{
|
|
|
|
|
g_checksum_update (sum, (const guint8 *) &n, sizeof (n));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
nm_ip4_config_hash (NMIP4Config *config, GChecksum *sum, gboolean dns_only)
|
|
|
|
|
{
|
|
|
|
|
guint32 i, n;
|
|
|
|
|
const char *s;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (config != NULL);
|
|
|
|
|
g_return_if_fail (sum != NULL);
|
|
|
|
|
|
|
|
|
|
if (dns_only == FALSE) {
|
|
|
|
|
for (i = 0; i < nm_ip4_config_get_num_addresses (config); i++) {
|
|
|
|
|
NMIP4Address *a = nm_ip4_config_get_address (config, i);
|
|
|
|
|
|
|
|
|
|
hash_u32 (sum, nm_ip4_address_get_address (a));
|
|
|
|
|
hash_u32 (sum, nm_ip4_address_get_prefix (a));
|
|
|
|
|
hash_u32 (sum, nm_ip4_address_get_gateway (a));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nm_ip4_config_get_num_routes (config); i++) {
|
|
|
|
|
NMIP4Route *r = nm_ip4_config_get_route (config, i);
|
|
|
|
|
|
|
|
|
|
hash_u32 (sum, nm_ip4_route_get_dest (r));
|
|
|
|
|
hash_u32 (sum, nm_ip4_route_get_prefix (r));
|
|
|
|
|
hash_u32 (sum, nm_ip4_route_get_next_hop (r));
|
|
|
|
|
hash_u32 (sum, nm_ip4_route_get_metric (r));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
n = nm_ip4_config_get_ptp_address (config);
|
|
|
|
|
if (n)
|
|
|
|
|
hash_u32 (sum, n);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nm_ip4_config_get_num_nis_servers (config); i++)
|
|
|
|
|
hash_u32 (sum, nm_ip4_config_get_nis_server (config, i));
|
|
|
|
|
|
|
|
|
|
s = nm_ip4_config_get_nis_domain (config);
|
|
|
|
|
if (s)
|
|
|
|
|
g_checksum_update (sum, (const guint8 *) s, strlen (s));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nm_ip4_config_get_num_nameservers (config); i++)
|
|
|
|
|
hash_u32 (sum, nm_ip4_config_get_nameserver (config, i));
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nm_ip4_config_get_num_wins (config); i++)
|
|
|
|
|
hash_u32 (sum, nm_ip4_config_get_wins (config, i));
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nm_ip4_config_get_num_domains (config); i++) {
|
|
|
|
|
s = nm_ip4_config_get_domain (config, i);
|
|
|
|
|
g_checksum_update (sum, (const guint8 *) s, strlen (s));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nm_ip4_config_get_num_searches (config); i++) {
|
|
|
|
|
s = nm_ip4_config_get_search (config, i);
|
|
|
|
|
g_checksum_update (sum, (const guint8 *) s, strlen (s));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
static void
|
|
|
|
|
nm_ip4_config_init (NMIP4Config *config)
|
|
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
|
|
|
|
|
|
|
|
priv->nameservers = g_array_new (FALSE, TRUE, sizeof (guint32));
|
2008-12-19 17:01:06 -05:00
|
|
|
priv->wins = g_array_new (FALSE, TRUE, sizeof (guint32));
|
2009-05-11 20:02:07 -04:00
|
|
|
priv->domains = g_ptr_array_sized_new (3);
|
|
|
|
|
priv->searches = g_ptr_array_sized_new (3);
|
2010-07-16 11:28:39 -07:00
|
|
|
priv->nis = g_array_new (FALSE, TRUE, sizeof (guint32));
|
2007-02-16 11:23:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (object);
|
|
|
|
|
|
2013-05-29 17:11:44 -03:00
|
|
|
g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip4_address_unref);
|
|
|
|
|
g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip4_route_unref);
|
2008-12-19 17:01:06 -05:00
|
|
|
g_array_free (priv->wins, TRUE);
|
2007-02-16 11:23:49 +00:00
|
|
|
g_array_free (priv->nameservers, TRUE);
|
|
|
|
|
g_ptr_array_free (priv->domains, TRUE);
|
2008-03-10 13:08:37 +00:00
|
|
|
g_ptr_array_free (priv->searches, TRUE);
|
2010-07-16 11:28:39 -07:00
|
|
|
g_array_free (priv->nis, TRUE);
|
|
|
|
|
g_free (priv->nis_domain);
|
2009-02-25 13:50:34 -05:00
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (nm_ip4_config_parent_class)->finalize (object);
|
2007-02-16 11:23:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
get_property (GObject *object, guint prop_id,
|
|
|
|
|
GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (object);
|
|
|
|
|
|
|
|
|
|
switch (prop_id) {
|
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
2008-05-06 21:53:22 +00:00
|
|
|
case PROP_ADDRESSES:
|
2008-08-10 22:37:21 +00:00
|
|
|
nm_utils_ip4_addresses_to_gvalue (priv->addresses, value);
|
2007-02-16 11:23:49 +00:00
|
|
|
break;
|
|
|
|
|
case PROP_NAMESERVERS:
|
|
|
|
|
g_value_set_boxed (value, priv->nameservers);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_DOMAINS:
|
|
|
|
|
g_value_set_boxed (value, priv->domains);
|
|
|
|
|
break;
|
2008-08-06 22:23:48 +00:00
|
|
|
case PROP_ROUTES:
|
2008-08-10 22:37:21 +00:00
|
|
|
nm_utils_ip4_routes_to_gvalue (priv->routes, value);
|
2007-11-28 22:38:33 +00:00
|
|
|
break;
|
2008-12-19 17:01:06 -05:00
|
|
|
case PROP_WINS_SERVERS:
|
|
|
|
|
g_value_set_boxed (value, priv->wins);
|
|
|
|
|
break;
|
2007-02-16 11:23:49 +00:00
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nm_ip4_config_class_init (NMIP4ConfigClass *config_class)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (config_class);
|
|
|
|
|
|
|
|
|
|
g_type_class_add_private (config_class, sizeof (NMIP4ConfigPrivate));
|
|
|
|
|
|
|
|
|
|
/* virtual methods */
|
|
|
|
|
object_class->get_property = get_property;
|
|
|
|
|
object_class->finalize = finalize;
|
|
|
|
|
|
|
|
|
|
/* properties */
|
|
|
|
|
g_object_class_install_property
|
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
2008-05-06 21:53:22 +00:00
|
|
|
(object_class, PROP_ADDRESSES,
|
|
|
|
|
g_param_spec_boxed (NM_IP4_CONFIG_ADDRESSES,
|
|
|
|
|
"Addresses",
|
|
|
|
|
"IP4 addresses",
|
|
|
|
|
DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT,
|
2007-02-16 11:23:49 +00:00
|
|
|
G_PARAM_READABLE));
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_NAMESERVERS,
|
|
|
|
|
g_param_spec_boxed (NM_IP4_CONFIG_NAMESERVERS,
|
|
|
|
|
"Nameservers",
|
|
|
|
|
"DNS list",
|
|
|
|
|
DBUS_TYPE_G_UINT_ARRAY,
|
|
|
|
|
G_PARAM_READABLE));
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_DOMAINS,
|
|
|
|
|
g_param_spec_boxed (NM_IP4_CONFIG_DOMAINS,
|
|
|
|
|
"Domains",
|
|
|
|
|
"Domains",
|
2008-03-29 21:35:41 +00:00
|
|
|
DBUS_TYPE_G_ARRAY_OF_STRING,
|
2007-02-16 11:23:49 +00:00
|
|
|
G_PARAM_READABLE));
|
2007-11-28 22:38:33 +00:00
|
|
|
g_object_class_install_property
|
2008-08-06 22:23:48 +00:00
|
|
|
(object_class, PROP_ROUTES,
|
|
|
|
|
g_param_spec_boxed (NM_IP4_CONFIG_ROUTES,
|
|
|
|
|
"Routes",
|
|
|
|
|
"Routes",
|
2008-06-02 08:44:48 +00:00
|
|
|
DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT,
|
|
|
|
|
G_PARAM_READABLE));
|
2008-12-19 17:01:06 -05:00
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_WINS_SERVERS,
|
|
|
|
|
g_param_spec_boxed (NM_IP4_CONFIG_WINS_SERVERS,
|
|
|
|
|
"WinsServers",
|
|
|
|
|
"WINS server list",
|
|
|
|
|
DBUS_TYPE_G_UINT_ARRAY,
|
|
|
|
|
G_PARAM_READABLE));
|
2007-11-28 22:38:33 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (config_class),
|
|
|
|
|
&dbus_glib_nm_ip4_config_object_info);
|
|
|
|
|
}
|