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:
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user