2008-10-10 Dan Williams <dcbw@redhat.com>
Rework default route handling to consolidate decisions in the policy,
and to take active VPN connections into account when changing the default
route (bgo #545912)
* src/NetworkManager.c
- (main): pass the vpn_manager to the policy so it knows about active
VPN connections; clean up the named manager which wasn't done before
* src/NetworkManagerPolicy.c
src/NetworkManagerPolicy.h
- (nm_policy_new): get a clue about the vpn_manager
- (update_default_route): remove, fold into update_routing_and_dns()
- (update_routing_and_dns): handle active VPN connections too; an
active VPN connection becomes the default route if it does not have
server-specified or user-specified custom routes. Otherwise, the
best active device gets the default route
- (vpn_connection_activated, vpn_connection_deactivated, nm_policy_new,
nm_policy_destroy): track VPN connection activation and deactivation
and update the default route when appropriate
* src/NetworkManagerSystem.c
src/NetworkManagerSystem.h
- (nm_system_vpn_device_unset_from_ip4_config): remove, put functionality
in the VPN connection itself
- (nm_system_vpn_device_set_from_ip4_config,
nm_system_device_set_from_ip4_config): merge together to make
nm_system_apply_ip4_config()
- (add_vpn_gateway_route): add a route to the VPN's external gateway
via the parent device
- (nm_system_apply_ip4_config): simplify
- (add_ip4_route_to_gateway): new function; add a direct route to the
gateway if needed
- (nm_system_device_replace_default_ip4_route): simplify, break gateway
route stuff out into add_ip4_route_to_gateway() for clarity
* src/nm-device.c
- (nm_device_set_ip4_config): update for nm_system_apply_ip4_config()
* src/vpn-manager/nm-vpn-connection.c
src/vpn-manager/nm-vpn-connection.h
- (nm_vpn_connection_get_ip4_config, nm_vpn_connection_get_ip_iface,
nm_vpn_connection_get_parent_device): add
- (nm_vpn_connection_ip4_config_get): make the requirement of a tunnel
device explicit
- (connection_state_changed): update the named manager now that
nm_system_vpn_device_unset_from_ip4_config() is gone; do something
useful on errors
* src/vpn-manager/nm-vpn-manager.c
src/vpn-manager/nm-vpn-manager.h
- Add a 'connection-activated' signal
- (nm_vpn_manager_get_active_connections): new function; mainly for the
policy to find out about active VPN connections
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4167 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-10 23:05:45 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
2004-08-24 00:31:47 +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.
|
2004-08-24 00:31:47 +00:00
|
|
|
*
|
2010-06-22 14:21:25 +02:00
|
|
|
* Copyright (C) 2004 - 2010 Red Hat, Inc.
|
2008-11-03 04:13:42 +00:00
|
|
|
* Copyright (C) 2005 - 2008 Novell, Inc.
|
2004-08-24 00:31:47 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef NETWORK_MANAGER_SYSTEM_H
|
|
|
|
|
#define NETWORK_MANAGER_SYSTEM_H
|
|
|
|
|
|
2008-11-07 13:57:39 +00:00
|
|
|
#include <netlink/route/rtnl.h>
|
|
|
|
|
#include <netlink/route/route.h>
|
|
|
|
|
|
2010-06-22 14:21:25 +02:00
|
|
|
#include <net/ethernet.h>
|
|
|
|
|
|
2004-08-24 00:31:47 +00:00
|
|
|
#include <glib.h>
|
2005-12-31 08:21:24 +00:00
|
|
|
#include "nm-device.h"
|
|
|
|
|
#include "nm-ip4-config.h"
|
2011-10-18 13:48:44 +02:00
|
|
|
#include "nm-setting-bond.h"
|
2011-12-12 22:20:57 -05:00
|
|
|
#include "nm-setting-vlan.h"
|
2004-08-24 00:31:47 +00:00
|
|
|
|
2004-11-16 02:41:53 +00:00
|
|
|
/* Prototypes for system/distribution dependent functions,
|
|
|
|
|
* implemented in the backend files in backends/ directory
|
|
|
|
|
*/
|
2004-08-24 00:31:47 +00:00
|
|
|
|
2011-07-22 13:37:29 -05:00
|
|
|
gboolean nm_system_iface_flush_routes (int ifindex, int family);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2011-07-22 14:24:18 -05:00
|
|
|
gboolean nm_system_replace_default_ip4_route (int ifindex,
|
2008-10-11 14:26:41 +00:00
|
|
|
guint32 gw,
|
|
|
|
|
guint32 mss);
|
|
|
|
|
|
2011-07-22 14:24:18 -05:00
|
|
|
gboolean nm_system_replace_default_ip6_route (int ifindex,
|
2010-04-23 22:11:22 -07:00
|
|
|
const struct in6_addr *gw);
|
|
|
|
|
|
2011-07-22 14:24:18 -05:00
|
|
|
gboolean nm_system_replace_default_ip4_route_vpn (int ifindex,
|
2008-10-11 14:26:41 +00:00
|
|
|
guint32 ext_gw,
|
|
|
|
|
guint32 int_gw,
|
|
|
|
|
guint32 mss,
|
2011-07-22 14:24:18 -05:00
|
|
|
int parent_ifindex,
|
2008-10-11 14:26:41 +00:00
|
|
|
guint32 parent_mss);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2008-11-07 13:57:39 +00:00
|
|
|
struct rtnl_route *nm_system_add_ip4_vpn_gateway_route (NMDevice *parent_device, NMIP4Config *vpn_config);
|
|
|
|
|
|
|
|
|
|
|
2011-07-22 13:37:29 -05:00
|
|
|
gboolean nm_system_iface_flush_addresses (int ifindex, int family);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2011-07-22 14:09:16 -05:00
|
|
|
gboolean nm_system_apply_ip4_config (int ifindex,
|
2008-10-10 Dan Williams <dcbw@redhat.com>
Rework default route handling to consolidate decisions in the policy,
and to take active VPN connections into account when changing the default
route (bgo #545912)
* src/NetworkManager.c
- (main): pass the vpn_manager to the policy so it knows about active
VPN connections; clean up the named manager which wasn't done before
* src/NetworkManagerPolicy.c
src/NetworkManagerPolicy.h
- (nm_policy_new): get a clue about the vpn_manager
- (update_default_route): remove, fold into update_routing_and_dns()
- (update_routing_and_dns): handle active VPN connections too; an
active VPN connection becomes the default route if it does not have
server-specified or user-specified custom routes. Otherwise, the
best active device gets the default route
- (vpn_connection_activated, vpn_connection_deactivated, nm_policy_new,
nm_policy_destroy): track VPN connection activation and deactivation
and update the default route when appropriate
* src/NetworkManagerSystem.c
src/NetworkManagerSystem.h
- (nm_system_vpn_device_unset_from_ip4_config): remove, put functionality
in the VPN connection itself
- (nm_system_vpn_device_set_from_ip4_config,
nm_system_device_set_from_ip4_config): merge together to make
nm_system_apply_ip4_config()
- (add_vpn_gateway_route): add a route to the VPN's external gateway
via the parent device
- (nm_system_apply_ip4_config): simplify
- (add_ip4_route_to_gateway): new function; add a direct route to the
gateway if needed
- (nm_system_device_replace_default_ip4_route): simplify, break gateway
route stuff out into add_ip4_route_to_gateway() for clarity
* src/nm-device.c
- (nm_device_set_ip4_config): update for nm_system_apply_ip4_config()
* src/vpn-manager/nm-vpn-connection.c
src/vpn-manager/nm-vpn-connection.h
- (nm_vpn_connection_get_ip4_config, nm_vpn_connection_get_ip_iface,
nm_vpn_connection_get_parent_device): add
- (nm_vpn_connection_ip4_config_get): make the requirement of a tunnel
device explicit
- (connection_state_changed): update the named manager now that
nm_system_vpn_device_unset_from_ip4_config() is gone; do something
useful on errors
* src/vpn-manager/nm-vpn-manager.c
src/vpn-manager/nm-vpn-manager.h
- Add a 'connection-activated' signal
- (nm_vpn_manager_get_active_connections): new function; mainly for the
policy to find out about active VPN connections
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4167 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-10 23:05:45 +00:00
|
|
|
NMIP4Config *config,
|
|
|
|
|
int priority,
|
2008-11-07 13:57:39 +00:00
|
|
|
NMIP4ConfigCompareFlags flags);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2010-08-10 21:32:20 -05:00
|
|
|
int nm_system_set_ip6_route (int ifindex,
|
|
|
|
|
const struct in6_addr *ip6_dest,
|
|
|
|
|
guint32 ip6_prefix,
|
|
|
|
|
const struct in6_addr *ip6_gateway,
|
|
|
|
|
guint32 metric,
|
|
|
|
|
int mss,
|
|
|
|
|
int protocol,
|
|
|
|
|
int table,
|
|
|
|
|
struct rtnl_route **out_route);
|
|
|
|
|
|
2011-07-22 14:24:18 -05:00
|
|
|
gboolean nm_system_apply_ip6_config (int ifindex,
|
2009-07-29 12:12:41 -04:00
|
|
|
NMIP6Config *config,
|
|
|
|
|
int priority,
|
|
|
|
|
NMIP6ConfigCompareFlags flags);
|
|
|
|
|
|
2011-07-22 13:37:29 -05:00
|
|
|
gboolean nm_system_iface_set_up (int ifindex,
|
|
|
|
|
gboolean up,
|
|
|
|
|
gboolean *no_firmware);
|
2005-04-15 15:43:42 +00:00
|
|
|
|
2011-10-18 13:48:48 +02:00
|
|
|
guint32 nm_system_iface_get_flags (int ifindex);
|
2011-07-22 13:49:49 -05:00
|
|
|
gboolean nm_system_iface_is_up (int ifindex);
|
2008-04-30 12:54:00 +00:00
|
|
|
|
2011-07-22 14:09:16 -05:00
|
|
|
gboolean nm_system_iface_set_mtu (int ifindex, guint32 mtu);
|
|
|
|
|
|
|
|
|
|
gboolean nm_system_iface_set_mac (int ifindex, const struct ether_addr *mac);
|
2006-03-21 17:57:01 +00:00
|
|
|
|
2012-02-29 12:39:11 -06:00
|
|
|
gboolean nm_system_apply_bonding_config (const char *iface,
|
|
|
|
|
NMSettingBond *s_bond);
|
2012-02-10 13:25:39 -06:00
|
|
|
gboolean nm_system_add_bonding_master (const char *iface);
|
2012-02-28 18:35:30 -06:00
|
|
|
|
|
|
|
|
gboolean nm_system_iface_enslave (gint master_ifindex,
|
|
|
|
|
const char *master_iface,
|
|
|
|
|
gint slave_ifindex,
|
|
|
|
|
const char *slave_iface);
|
|
|
|
|
gboolean nm_system_iface_release (gint master_ifindex,
|
|
|
|
|
const char *master_iface,
|
|
|
|
|
gint slave_ifindex,
|
|
|
|
|
const char *slave_iface);
|
2011-10-18 13:48:44 +02:00
|
|
|
|
2011-11-09 11:22:39 +01:00
|
|
|
enum {
|
|
|
|
|
NM_IFACE_TYPE_UNSPEC = 0,
|
|
|
|
|
NM_IFACE_TYPE_BOND,
|
|
|
|
|
NM_IFACE_TYPE_VLAN,
|
|
|
|
|
NM_IFACE_TYPE_DUMMY,
|
|
|
|
|
};
|
|
|
|
|
|
2012-02-08 16:19:06 -06:00
|
|
|
int nm_system_get_iface_type (int ifindex, const char *name);
|
2011-10-18 13:48:45 +02:00
|
|
|
|
2012-02-05 23:56:15 -06:00
|
|
|
gboolean nm_system_get_iface_vlan_info (int ifindex,
|
2012-03-06 11:02:55 -06:00
|
|
|
int *out_parent_ifindex,
|
2012-02-05 23:56:15 -06:00
|
|
|
int *out_vlan_id);
|
|
|
|
|
|
2011-12-21 19:09:22 -06:00
|
|
|
gboolean nm_system_add_vlan_iface (NMConnection *connection,
|
|
|
|
|
const char *iface,
|
2012-02-22 23:40:18 -06:00
|
|
|
int parent_ifindex);
|
2011-12-21 19:09:22 -06:00
|
|
|
gboolean nm_system_del_vlan_iface (const char *iface);
|
2011-12-12 22:20:57 -05:00
|
|
|
|
2004-08-24 00:31:47 +00:00
|
|
|
#endif
|