mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-21 13:20:39 +01: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
This commit is contained in:
parent
348ed3e98d
commit
e79ccc1a10
18 changed files with 272 additions and 162 deletions
26
ChangeLog
26
ChangeLog
|
|
@ -1,3 +1,29 @@
|
|||
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.
|
||||
|
||||
2006-03-27 Jürg Billeter <j@bitron.ch>
|
||||
|
||||
* configure.in:
|
||||
|
|
|
|||
|
|
@ -52,8 +52,119 @@
|
|||
#include <netlink/route/link.h>
|
||||
|
||||
|
||||
static gboolean nm_system_device_set_ip4_route (NMDevice *dev, int ip4_gateway, int ip4_dest, int ip4_netmask);
|
||||
static gboolean nm_system_device_set_ip4_route_with_iface (NMDevice *dev, const char *iface, int ip4_gateway, int ip4_dest, int ip4_netmask);
|
||||
/*
|
||||
* nm_system_device_set_ip4_route
|
||||
*
|
||||
*/
|
||||
static gboolean nm_system_device_set_ip4_route (NMDevice *dev, int ip4_gateway, int ip4_dest, int ip4_netmask, int mss)
|
||||
{
|
||||
NMSock * sk;
|
||||
gboolean success = FALSE;
|
||||
struct rtentry rtent;
|
||||
struct sockaddr_in *p;
|
||||
const char * iface;
|
||||
int err;
|
||||
|
||||
iface = nm_device_get_iface (dev);
|
||||
|
||||
/*
|
||||
* Zero is not a legal gateway and the ioctl will fail. But zero is a
|
||||
* way of saying "no route" so we just return here. Hopefully the
|
||||
* caller flushed the routes, first.
|
||||
*/
|
||||
if (ip4_gateway == 0)
|
||||
return TRUE;
|
||||
|
||||
if ((sk = nm_dev_sock_open (dev, NETWORK_CONTROL, __FUNCTION__, NULL)) == NULL)
|
||||
return FALSE;
|
||||
|
||||
memset (&rtent, 0, sizeof (struct rtentry));
|
||||
p = (struct sockaddr_in *) &rtent.rt_dst;
|
||||
p->sin_family = AF_INET;
|
||||
p->sin_addr.s_addr = ip4_dest;
|
||||
p = (struct sockaddr_in *) &rtent.rt_gateway;
|
||||
p->sin_family = AF_INET;
|
||||
p->sin_addr.s_addr = ip4_gateway;
|
||||
p = (struct sockaddr_in *) &rtent.rt_genmask;
|
||||
p->sin_family = AF_INET;
|
||||
p->sin_addr.s_addr = ip4_netmask;
|
||||
rtent.rt_dev = (char *)iface;
|
||||
rtent.rt_metric = 1;
|
||||
rtent.rt_window = 0;
|
||||
rtent.rt_flags = RTF_UP | RTF_GATEWAY | (rtent.rt_window ? RTF_WINDOW : 0);
|
||||
|
||||
if (mss)
|
||||
{
|
||||
rtent.rt_flags |= RTF_MTU;
|
||||
rtent.rt_mtu = mss;
|
||||
}
|
||||
|
||||
#ifdef IOCTL_DEBUG
|
||||
nm_info ("%s: About to CADDRT\n", nm_device_get_iface (dev));
|
||||
#endif
|
||||
err = ioctl (nm_dev_sock_get_fd (sk), SIOCADDRT, &rtent);
|
||||
#ifdef IOCTL_DEBUG
|
||||
nm_info ("%s: About to CADDRT\n", nm_device_get_iface (dev));
|
||||
#endif
|
||||
|
||||
if (err == -1)
|
||||
{
|
||||
if (errno == ENETUNREACH) /* possibly gateway is over the bridge */
|
||||
{ /* try adding a route to gateway first */
|
||||
struct rtentry rtent2;
|
||||
|
||||
memset (&rtent2, 0, sizeof(struct rtentry));
|
||||
p = (struct sockaddr_in *)&rtent2.rt_dst;
|
||||
p->sin_family = AF_INET;
|
||||
p = (struct sockaddr_in *)&rtent2.rt_gateway;
|
||||
p->sin_family = AF_INET;
|
||||
p->sin_addr.s_addr = ip4_gateway;
|
||||
p = (struct sockaddr_in *)&rtent2.rt_genmask;
|
||||
p->sin_family = AF_INET;
|
||||
p->sin_addr.s_addr = 0xffffffff;
|
||||
rtent2.rt_dev = (char *)iface;
|
||||
rtent2.rt_metric = 0;
|
||||
rtent2.rt_flags = RTF_UP | RTF_HOST;
|
||||
|
||||
if (mss)
|
||||
{
|
||||
rtent2.rt_flags |= RTF_MTU;
|
||||
rtent2.rt_mtu = mss;
|
||||
}
|
||||
|
||||
#ifdef IOCTL_DEBUG
|
||||
nm_info ("%s: About to CADDRT (2)\n", nm_device_get_iface (dev));
|
||||
#endif
|
||||
err = ioctl (nm_dev_sock_get_fd (sk), SIOCADDRT, &rtent2);
|
||||
#ifdef IOCTL_DEBUG
|
||||
nm_info ("%s: About to CADDRT (2)\n", nm_device_get_iface (dev));
|
||||
#endif
|
||||
|
||||
if (!err)
|
||||
{
|
||||
#ifdef IOCTL_DEBUG
|
||||
nm_info ("%s: About to CADDRT (3)\n", nm_device_get_iface (dev));
|
||||
#endif
|
||||
err = ioctl (nm_dev_sock_get_fd (sk), SIOCADDRT, &rtent);
|
||||
#ifdef IOCTL_DEBUG
|
||||
nm_info ("%s: About to CADDRT (3)\n", nm_device_get_iface (dev));
|
||||
#endif
|
||||
|
||||
if (!err)
|
||||
success = TRUE;
|
||||
else
|
||||
nm_warning ("Failed to set IPv4 default route on '%s': %s", iface, strerror (errno));
|
||||
}
|
||||
}
|
||||
else
|
||||
nm_warning ("Failed to set IPv4 default route on '%s': %s", iface, strerror (errno));
|
||||
}
|
||||
else
|
||||
success = TRUE;
|
||||
|
||||
nm_dev_sock_close (sk);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
static struct nl_cache * get_link_cache (struct nl_handle *nlh)
|
||||
|
|
@ -73,6 +184,7 @@ static struct nl_cache * get_link_cache (struct nl_handle *nlh)
|
|||
return link_cache;
|
||||
}
|
||||
|
||||
|
||||
static void iface_to_rtnl_index (const char *iface, struct nl_handle *nlh, struct rtnl_addr *addr)
|
||||
{
|
||||
struct nl_cache * cache = NULL;
|
||||
|
|
@ -212,7 +324,7 @@ gboolean nm_system_device_set_from_ip4_config (NMDevice *dev)
|
|||
nl_handle_destroy (nlh);
|
||||
|
||||
sleep (1);
|
||||
nm_system_device_set_ip4_route (dev, nm_ip4_config_get_gateway (config), 0, 0);
|
||||
nm_system_device_set_ip4_route (dev, nm_ip4_config_get_gateway (config), 0, 0, nm_ip4_config_get_mss (config));
|
||||
|
||||
nm_named_manager_add_ip4_config (app_data->named_manager, config);
|
||||
|
||||
|
|
@ -296,49 +408,6 @@ out:
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_system_set_mtu
|
||||
*
|
||||
* Set the MTU for a given device.
|
||||
*/
|
||||
void nm_system_set_mtu (NMDevice *dev)
|
||||
{
|
||||
struct rtnl_link * request;
|
||||
struct rtnl_link * old;
|
||||
unsigned long mtu;
|
||||
struct nl_handle * nlh;
|
||||
const char * iface;
|
||||
|
||||
mtu = nm_system_get_mtu (dev);
|
||||
if (!mtu)
|
||||
return;
|
||||
|
||||
nlh = new_nl_handle ();
|
||||
if (!nlh)
|
||||
return;
|
||||
|
||||
request = rtnl_link_alloc ();
|
||||
if (!request)
|
||||
goto out_nl_close;
|
||||
|
||||
iface = nm_device_get_iface (dev);
|
||||
old = iface_to_rtnl_link (iface, nlh);
|
||||
if (!old)
|
||||
goto out_request;
|
||||
|
||||
nm_info ("Setting MTU of interface '%s' to %ld", iface, mtu);
|
||||
rtnl_link_set_mtu (request, mtu);
|
||||
rtnl_link_change (nlh, old, request, 0);
|
||||
|
||||
rtnl_link_put (old);
|
||||
out_request:
|
||||
rtnl_link_put (request);
|
||||
out_nl_close:
|
||||
nl_close (nlh);
|
||||
nl_handle_destroy (nlh);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_system_vpn_device_set_from_ip4_config
|
||||
*
|
||||
|
|
@ -356,7 +425,7 @@ gboolean nm_system_vpn_device_set_from_ip4_config (NMNamedManager *named, NMDevi
|
|||
|
||||
/* Set up a route to the VPN gateway through the real network device */
|
||||
if (active_device && (ad_config = nm_device_get_ip4_config (active_device)))
|
||||
nm_system_device_set_ip4_route (active_device, nm_ip4_config_get_gateway (ad_config), nm_ip4_config_get_gateway (config), 0xFFFFFFFF);
|
||||
nm_system_device_set_ip4_route (active_device, nm_ip4_config_get_gateway (ad_config), nm_ip4_config_get_gateway (config), 0xFFFFFFFF, nm_ip4_config_get_mss (config));
|
||||
|
||||
if (iface != NULL && strlen (iface))
|
||||
{
|
||||
|
|
@ -498,111 +567,43 @@ out:
|
|||
|
||||
|
||||
/*
|
||||
* nm_system_device_set_ip4_route
|
||||
*
|
||||
* Set the IPv4 broadcast address on a device.
|
||||
* nm_system_set_mtu
|
||||
*
|
||||
* Set the MTU for a given device.
|
||||
*/
|
||||
static gboolean nm_system_device_set_ip4_route (NMDevice *dev, int ip4_gateway, int ip4_dest, int ip4_netmask)
|
||||
void nm_system_set_mtu (NMDevice *dev)
|
||||
{
|
||||
g_return_val_if_fail (dev != NULL, FALSE);
|
||||
struct rtnl_link * request;
|
||||
struct rtnl_link * old;
|
||||
unsigned long mtu;
|
||||
struct nl_handle * nlh;
|
||||
const char * iface;
|
||||
|
||||
return nm_system_device_set_ip4_route_with_iface (dev, nm_device_get_iface (dev), ip4_gateway, ip4_dest, ip4_netmask);
|
||||
}
|
||||
|
||||
static gboolean nm_system_device_set_ip4_route_with_iface (NMDevice *dev, const char *iface, int ip4_gateway, int ip4_dest, int ip4_netmask)
|
||||
{
|
||||
NMSock * sk;
|
||||
gboolean success = FALSE;
|
||||
struct rtentry rtent;
|
||||
struct sockaddr_in *p;
|
||||
int err;
|
||||
|
||||
g_return_val_if_fail (iface != NULL, FALSE);
|
||||
|
||||
/*
|
||||
* Zero is not a legal gateway and the ioctl will fail. But zero is a
|
||||
* way of saying "no route" so we just return here. Hopefully the
|
||||
* caller flushed the routes, first.
|
||||
*/
|
||||
if (ip4_gateway == 0)
|
||||
return TRUE;
|
||||
|
||||
if ((sk = nm_dev_sock_open (dev, NETWORK_CONTROL, __FUNCTION__, NULL)) == NULL)
|
||||
return FALSE;
|
||||
|
||||
memset (&rtent, 0, sizeof (struct rtentry));
|
||||
p = (struct sockaddr_in *)&rtent.rt_dst;
|
||||
p->sin_family = AF_INET;
|
||||
p->sin_addr.s_addr = ip4_dest;
|
||||
p = (struct sockaddr_in *)&rtent.rt_gateway;
|
||||
p->sin_family = AF_INET;
|
||||
p->sin_addr.s_addr = ip4_gateway;
|
||||
p = (struct sockaddr_in *)&rtent.rt_genmask;
|
||||
p->sin_family = AF_INET;
|
||||
p->sin_addr.s_addr = ip4_netmask;
|
||||
rtent.rt_dev = (char *)iface;
|
||||
rtent.rt_metric = 1;
|
||||
rtent.rt_window = 0;
|
||||
rtent.rt_flags = RTF_UP | RTF_GATEWAY | (rtent.rt_window ? RTF_WINDOW : 0);
|
||||
|
||||
#ifdef IOCTL_DEBUG
|
||||
nm_info ("%s: About to CADDRT\n", nm_device_get_iface (dev));
|
||||
#endif
|
||||
err = ioctl (nm_dev_sock_get_fd (sk), SIOCADDRT, &rtent);
|
||||
#ifdef IOCTL_DEBUG
|
||||
nm_info ("%s: About to CADDRT\n", nm_device_get_iface (dev));
|
||||
#endif
|
||||
|
||||
if (err == -1)
|
||||
{
|
||||
if (errno == ENETUNREACH) /* possibly gateway is over the bridge */
|
||||
{ /* try adding a route to gateway first */
|
||||
struct rtentry rtent2;
|
||||
|
||||
memset (&rtent2, 0, sizeof(struct rtentry));
|
||||
p = (struct sockaddr_in *)&rtent2.rt_dst;
|
||||
p->sin_family = AF_INET;
|
||||
p = (struct sockaddr_in *)&rtent2.rt_gateway;
|
||||
p->sin_family = AF_INET;
|
||||
p->sin_addr.s_addr = ip4_gateway;
|
||||
p = (struct sockaddr_in *)&rtent2.rt_genmask;
|
||||
p->sin_family = AF_INET;
|
||||
p->sin_addr.s_addr = 0xffffffff;
|
||||
rtent2.rt_dev = (char *)iface;
|
||||
rtent2.rt_metric = 0;
|
||||
rtent2.rt_flags = RTF_UP | RTF_HOST;
|
||||
|
||||
#ifdef IOCTL_DEBUG
|
||||
nm_info ("%s: About to CADDRT (2)\n", nm_device_get_iface (dev));
|
||||
#endif
|
||||
err = ioctl (nm_dev_sock_get_fd (sk), SIOCADDRT, &rtent2);
|
||||
#ifdef IOCTL_DEBUG
|
||||
nm_info ("%s: About to CADDRT (2)\n", nm_device_get_iface (dev));
|
||||
#endif
|
||||
|
||||
if (err == 0)
|
||||
{
|
||||
#ifdef IOCTL_DEBUG
|
||||
nm_info ("%s: About to CADDRT (3)\n", nm_device_get_iface (dev));
|
||||
#endif
|
||||
err = ioctl (nm_dev_sock_get_fd (sk), SIOCADDRT, &rtent);
|
||||
#ifdef IOCTL_DEBUG
|
||||
nm_info ("%s: About to CADDRT (3)\n", nm_device_get_iface (dev));
|
||||
#endif
|
||||
|
||||
if (err == 0)
|
||||
success = TRUE;
|
||||
else
|
||||
nm_warning ("nm_system_device_set_ip4_route_with_iface (%s): failed to set IPv4 default route! error = %s", iface, strerror (errno));
|
||||
}
|
||||
}
|
||||
else
|
||||
nm_warning ("nm_system_device_set_ip4_route_with_iface (%s): failed to set IPv4 default route! error = %s", iface, strerror (errno));
|
||||
}
|
||||
else
|
||||
success = TRUE;
|
||||
|
||||
nm_dev_sock_close (sk);
|
||||
return (success);
|
||||
mtu = nm_system_get_mtu (dev);
|
||||
if (!mtu)
|
||||
return;
|
||||
|
||||
nlh = new_nl_handle ();
|
||||
if (!nlh)
|
||||
return;
|
||||
|
||||
request = rtnl_link_alloc ();
|
||||
if (!request)
|
||||
goto out_nl_close;
|
||||
|
||||
iface = nm_device_get_iface (dev);
|
||||
old = iface_to_rtnl_link (iface, nlh);
|
||||
if (!old)
|
||||
goto out_request;
|
||||
|
||||
nm_info ("Setting MTU of interface '%s' to %ld", iface, mtu);
|
||||
rtnl_link_set_mtu (request, mtu);
|
||||
rtnl_link_change (nlh, old, request, 0);
|
||||
|
||||
rtnl_link_put (old);
|
||||
out_request:
|
||||
rtnl_link_put (request);
|
||||
out_nl_close:
|
||||
nl_close (nlh);
|
||||
nl_handle_destroy (nlh);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ void nm_system_activate_nis (NMIP4Config *config);
|
|||
void nm_system_shutdown_nis (void);
|
||||
|
||||
void nm_system_set_mtu (NMDevice *dev);
|
||||
unsigned int nm_system_get_mtu (NMDevice *dev);
|
||||
guint32 nm_system_get_mtu (NMDevice *dev);
|
||||
|
||||
gboolean nm_system_should_modify_resolv_conf (void);
|
||||
|
||||
|
|
|
|||
|
|
@ -689,7 +689,7 @@ gboolean nm_system_should_modify_resolv_conf (void)
|
|||
* Return a user-provided or system-mandated MTU for this device or zero if
|
||||
* no such MTU is provided.
|
||||
*/
|
||||
unsigned int nm_system_get_mtu (NMDevice *dev)
|
||||
guint32 nm_system_get_mtu (NMDevice *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -590,7 +590,7 @@ gboolean nm_system_should_modify_resolv_conf (void)
|
|||
* Return a user-provided or system-mandated MTU for this device or zero if
|
||||
* no such MTU is provided.
|
||||
*/
|
||||
unsigned int nm_system_get_mtu (NMDevice *dev)
|
||||
guint32 nm_system_get_mtu (NMDevice *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -938,7 +938,7 @@ gboolean nm_system_should_modify_resolv_conf (void)
|
|||
* Return a user-provided or system-mandated MTU for this device or zero if
|
||||
* no such MTU is provided.
|
||||
*/
|
||||
unsigned int nm_system_get_mtu (NMDevice *dev)
|
||||
guint32 nm_system_get_mtu (NMDevice *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ gboolean nm_system_should_modify_resolv_conf (void)
|
|||
* Return a user-provided or system-mandated MTU for this device or zero if
|
||||
* no such MTU is provided.
|
||||
*/
|
||||
unsigned int nm_system_get_mtu (NMDevice *dev)
|
||||
guint32 nm_system_get_mtu (NMDevice *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ typedef struct SuSEDeviceConfigData
|
|||
NMIP4Config * config;
|
||||
gboolean use_dhcp;
|
||||
gboolean system_disabled;
|
||||
unsigned int mtu;
|
||||
guint32 mtu;
|
||||
} SuSEDeviceConfigData;
|
||||
|
||||
/*
|
||||
|
|
@ -524,12 +524,12 @@ found:
|
|||
|
||||
if ((buf = svGetValue (file, "MTU")))
|
||||
{
|
||||
unsigned long mtu;
|
||||
guint32 mtu;
|
||||
|
||||
errno = 0;
|
||||
mtu = strtoul (buf, NULL, 10);
|
||||
if (!errno && mtu > 500 && mtu < INT_MAX)
|
||||
sys_data->mtu = (unsigned int) mtu;
|
||||
sys_data->mtu = mtu;
|
||||
free (buf);
|
||||
}
|
||||
|
||||
|
|
@ -722,6 +722,8 @@ found:
|
|||
nm_ip4_config_set_broadcast (sys_data->config, broadcast);
|
||||
}
|
||||
|
||||
nm_ip4_config_set_mtu (sys_data->config, sys_data->mtu);
|
||||
|
||||
buf = NULL;
|
||||
if ((f = fopen (SYSCONFDIR"/sysconfig/network/routes", "r")))
|
||||
{
|
||||
|
|
@ -846,7 +848,6 @@ gboolean nm_system_device_get_disabled (NMDevice *dev)
|
|||
|
||||
g_return_val_if_fail (dev != NULL, FALSE);
|
||||
|
||||
|
||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
||||
return sys_data->system_disabled;
|
||||
|
||||
|
|
@ -1279,7 +1280,7 @@ out_gfree:
|
|||
* Return a user-provided or system-mandated MTU for this device or zero if
|
||||
* no such MTU is provided.
|
||||
*/
|
||||
unsigned int nm_system_get_mtu (NMDevice *dev)
|
||||
guint32 nm_system_get_mtu (NMDevice *dev)
|
||||
{
|
||||
SuSEDeviceConfigData * sys_data;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "nm-device.h"
|
||||
#include "NetworkManagerPolicy.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "NetworkManagerSystem.h"
|
||||
#include "nm-activation-request.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
|
|
@ -578,6 +579,12 @@ NMIP4Config * nm_dhcp_manager_get_ip4_config (NMDHCPManager *manager, NMActReque
|
|||
nm_info (" nis server %s", inet_ntoa (temp_addr));
|
||||
}
|
||||
|
||||
/*
|
||||
* Grab the MTU from the backend. If DHCP servers can send recommended MTU's,
|
||||
* should set that here if the backend returns zero.
|
||||
*/
|
||||
nm_ip4_config_set_mtu (ip4_config, nm_system_get_mtu (dev));
|
||||
|
||||
out:
|
||||
return ip4_config;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ struct NMIP4Config
|
|||
guint32 ip4_netmask;
|
||||
guint32 ip4_broadcast;
|
||||
|
||||
guint32 mtu; /* Maximum Transmission Unit of the interface */
|
||||
guint32 mss; /* Maximum Segment Size of the route */
|
||||
|
||||
GSList * nameservers;
|
||||
GSList * domains;
|
||||
|
||||
|
|
@ -326,6 +329,33 @@ guint32 nm_ip4_config_get_num_domains (NMIP4Config *config)
|
|||
return (g_slist_length (config->domains));
|
||||
}
|
||||
|
||||
guint32 nm_ip4_config_get_mtu (NMIP4Config *config)
|
||||
{
|
||||
g_return_val_if_fail (config != NULL, 0);
|
||||
|
||||
return config->mtu;
|
||||
}
|
||||
|
||||
void nm_ip4_config_set_mtu (NMIP4Config *config, guint32 mtu)
|
||||
{
|
||||
g_return_if_fail (config != NULL);
|
||||
|
||||
config->mtu = mtu;
|
||||
}
|
||||
|
||||
guint32 nm_ip4_config_get_mss (NMIP4Config *config)
|
||||
{
|
||||
g_return_val_if_fail (config != NULL, 0);
|
||||
|
||||
return config->mss;
|
||||
}
|
||||
|
||||
void nm_ip4_config_set_mss (NMIP4Config *config, guint32 mss)
|
||||
{
|
||||
g_return_if_fail (config != NULL);
|
||||
|
||||
config->mss = mss;
|
||||
}
|
||||
|
||||
/* libnl convenience/conversion functions */
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,11 @@ void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain);
|
|||
const char * nm_ip4_config_get_domain (NMIP4Config *config, guint i);
|
||||
guint32 nm_ip4_config_get_num_domains (NMIP4Config *config);
|
||||
|
||||
guint32 nm_ip4_config_get_mtu (NMIP4Config *config);
|
||||
void nm_ip4_config_set_mtu (NMIP4Config *config, guint32 mtu);
|
||||
|
||||
guint32 nm_ip4_config_get_mss (NMIP4Config *config);
|
||||
void nm_ip4_config_set_mss (NMIP4Config *config, guint32 mss);
|
||||
|
||||
/* Flags for nm_ip4_config_to_rtnl_addr() */
|
||||
#define NM_RTNL_ADDR_NONE 0x0000
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ static void print_vpn_config (guint32 ip4_vpn_gateway,
|
|||
guint32 ip4_dns_len,
|
||||
guint32 *ip4_nbns,
|
||||
guint32 ip4_nbns_len,
|
||||
guint32 mss,
|
||||
const char *dns_domain,
|
||||
const char *login_banner);
|
||||
#endif
|
||||
|
|
@ -809,13 +810,18 @@ nm_vpn_service_stage4_ip_config_get (NMVPNService *service,
|
|||
dbus_message_iter_next (&subiter);
|
||||
}
|
||||
|
||||
/* Eigth arg: DNS Domain (STRING) */
|
||||
/* Eighth arg: MSS (UINT32) */
|
||||
if (!get_dbus_guint32_helper (&iter, &num, "MSS"))
|
||||
goto out;
|
||||
nm_ip4_config_set_mss (config, num);
|
||||
|
||||
/* Ninth arg: DNS Domain (STRING) */
|
||||
if (!get_dbus_string_helper (&iter, &str, "DNS Domain"))
|
||||
goto out;
|
||||
if (strlen (str))
|
||||
nm_ip4_config_add_domain (config, str);
|
||||
|
||||
/* Ninth arg: VPN Login Banner (STRING) */
|
||||
/* Tenth arg: VPN Login Banner (STRING) */
|
||||
if (!get_dbus_string_helper (&iter, &login_banner, "Login Banner"))
|
||||
goto out;
|
||||
|
||||
|
|
@ -829,6 +835,7 @@ nm_vpn_service_stage4_ip_config_get (NMVPNService *service,
|
|||
ip4_dns_len,
|
||||
ip4_nbns,
|
||||
ip4_nbns_len,
|
||||
mss,
|
||||
dns_domain,
|
||||
login_banner);
|
||||
#endif
|
||||
|
|
@ -1057,6 +1064,7 @@ static void print_vpn_config (guint32 ip4_vpn_gateway,
|
|||
guint32 ip4_dns_len,
|
||||
guint32 *ip4_nbns,
|
||||
guint32 ip4_nbns_len,
|
||||
guint32 mss,
|
||||
const char *dns_domain,
|
||||
const char *login_banner)
|
||||
{
|
||||
|
|
@ -1072,6 +1080,7 @@ static void print_vpn_config (guint32 ip4_vpn_gateway,
|
|||
nm_info ("Internal IP4 Netmask: %s", inet_ntoa (temp_addr));
|
||||
temp_addr.s_addr = ip4_ptp_address;
|
||||
nm_info ("Internal IP4 Point-to-Point Address: %s", inet_ntoa (temp_addr));
|
||||
nm_info ("Maximum Segment Size (MSS): %d", mss);
|
||||
|
||||
for (i = 0; i < ip4_dns_len; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
2006-03-29 Robert Love <rml@novell.com>
|
||||
|
||||
* src/nm-openvpn-service.c: New eigth argument to DBUS VPN method, the
|
||||
per-route MSS. OpenVPN does not care about the MSS, so we send zero.
|
||||
|
||||
2006-03-02 Raphael Higino <raphaelh@cvs.gnome.org>
|
||||
|
||||
* configure.in: Added pt_BR to ALL_LINGUAS.
|
||||
|
|
|
|||
|
|
@ -1245,6 +1245,7 @@ nm_openvpn_dbus_process_helper_ip4_config (DBusConnection *con, DBusMessage *mes
|
|||
guint32 ip4_dns_len;
|
||||
guint32 * ip4_nbns;
|
||||
guint32 ip4_nbns_len;
|
||||
guint32 mss;
|
||||
gboolean success = FALSE;
|
||||
char * empty = "";
|
||||
|
||||
|
|
@ -1277,6 +1278,9 @@ nm_openvpn_dbus_process_helper_ip4_config (DBusConnection *con, DBusMessage *mes
|
|||
goto out;
|
||||
}
|
||||
|
||||
/* OpenVPN does not care about the MSS */
|
||||
mss = 0;
|
||||
|
||||
dbus_message_append_args (signal,
|
||||
DBUS_TYPE_UINT32, &ip4_vpn_gateway,
|
||||
DBUS_TYPE_STRING, &tundev,
|
||||
|
|
@ -1285,6 +1289,7 @@ nm_openvpn_dbus_process_helper_ip4_config (DBusConnection *con, DBusMessage *mes
|
|||
DBUS_TYPE_UINT32, &ip4_netmask,
|
||||
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &ip4_dns, ip4_dns_len,
|
||||
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &ip4_nbns, ip4_nbns_len,
|
||||
DBUS_TYPE_UINT32, &mss,
|
||||
DBUS_TYPE_STRING, &empty,
|
||||
DBUS_TYPE_STRING, &empty,
|
||||
DBUS_TYPE_INVALID);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
2006-03-29 Robert Love <rml@novell.com>
|
||||
|
||||
* src/nm-pptp-service.c: New eigth argument to DBUS VPN method, the
|
||||
per-route MSS. PPTP does not care about the MSS, so we send zero.
|
||||
|
||||
2006-01-05 Tim Niemueller <tim@niemueller.de>
|
||||
|
||||
* configure.in: Explicitly set AUX_DIR to . to prevent autoconf from
|
||||
|
|
|
|||
|
|
@ -831,6 +831,7 @@ static void nm_pptp_dbus_process_helper_ip4_config (DBusConnection *con, DBusMes
|
|||
guint32 ip4_nbns_len;
|
||||
guint32 ip4_nbns1;
|
||||
guint32 ip4_nbns2;
|
||||
guint32 mss;
|
||||
gboolean success = FALSE;
|
||||
char * empty = "";
|
||||
|
||||
|
|
@ -879,6 +880,9 @@ static void nm_pptp_dbus_process_helper_ip4_config (DBusConnection *con, DBusMes
|
|||
goto out;
|
||||
}
|
||||
|
||||
/* PPTP does not care about the MSS */
|
||||
mss = 0;
|
||||
|
||||
ip4_vpn_gateway=data->ip4_vpn_gateway.s_addr;
|
||||
dbus_message_append_args (signal,
|
||||
DBUS_TYPE_UINT32, &ip4_vpn_gateway,
|
||||
|
|
@ -888,6 +892,7 @@ static void nm_pptp_dbus_process_helper_ip4_config (DBusConnection *con, DBusMes
|
|||
DBUS_TYPE_UINT32, &ip4_netmask,
|
||||
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &ip4_dns, ip4_dns_len,
|
||||
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &ip4_nbns, ip4_nbns_len,
|
||||
DBUS_TYPE_UINT32, &mss,
|
||||
DBUS_TYPE_STRING, &empty,
|
||||
DBUS_TYPE_STRING, &empty,
|
||||
DBUS_TYPE_INVALID);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
2006-03-29 Robert Love <rml@novell.com>
|
||||
|
||||
* src/nm-vpnc-service.c: New eigth argument to DBUS VPN method, the
|
||||
per-route MSS. Cisco does not care about the MSS, so we send zero.
|
||||
|
||||
2006-03-20 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* configure.in: Bump release to 0.6
|
||||
|
|
|
|||
|
|
@ -869,6 +869,7 @@ static void nm_vpnc_dbus_process_helper_ip4_config (DBusConnection *con, DBusMes
|
|||
guint32 ip4_dns_len;
|
||||
guint32 * ip4_nbns;
|
||||
guint32 ip4_nbns_len;
|
||||
guint32 mss;
|
||||
char * cisco_def_domain;
|
||||
char * cisco_banner;
|
||||
gboolean success = FALSE;
|
||||
|
|
@ -897,6 +898,10 @@ static void nm_vpnc_dbus_process_helper_ip4_config (DBusConnection *con, DBusMes
|
|||
|
||||
/* For Cisco/vpnc, PtP address == local VPN address */
|
||||
ip4_ptp_address = ip4_address;
|
||||
|
||||
/* and we don't specify an MSS */
|
||||
mss = 0;
|
||||
|
||||
#if 0
|
||||
print_vpn_config (ip4_vpn_gateway, tundev, ip4_address, ip4_netmask,
|
||||
ip4_dns, ip4_dns_len, ip4_nbns, ip4_nbns_len,
|
||||
|
|
@ -914,6 +919,7 @@ static void nm_vpnc_dbus_process_helper_ip4_config (DBusConnection *con, DBusMes
|
|||
DBUS_TYPE_UINT32, &ip4_netmask,
|
||||
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &ip4_dns, ip4_dns_len,
|
||||
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &ip4_nbns, ip4_nbns_len,
|
||||
DBUS_TYPE_UINT32, &mss,
|
||||
DBUS_TYPE_STRING, &cisco_def_domain,
|
||||
DBUS_TYPE_STRING, &cisco_banner, DBUS_TYPE_INVALID);
|
||||
if (!dbus_connection_send (data->con, signal, NULL))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue