2006-03-21 Robert Love <rml@novell.com>
* src/NetworkManagerSystem.c, src/NetworkManagerSystem.h: Add nm_system_get_mtu(), which returns a user-provided or system-mandated MTU value for a given device, if any, or zero if no such value exists. Add nm_system_set_mtu() to set the MTU for a given device if we have a provided value. * src/nm-device.c: Set the MTU of devices. * src/backends/NetworkManagerSuSE.c: Read MTU, if any, from sysconfig. * src/backends/NetworkManagerDebian.c, src/backends/NetworkManagerGentoo.c, src/backends/NetworkManagerRedHat.c, src/backends/NetworkManagerSlackware.c: Implement stub functions. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1626 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -354,6 +354,7 @@ typedef struct SuSEDeviceConfigData
|
||||
NMIP4Config * config;
|
||||
gboolean use_dhcp;
|
||||
gboolean system_disabled;
|
||||
unsigned int mtu;
|
||||
} SuSEDeviceConfigData;
|
||||
|
||||
/*
|
||||
@@ -521,6 +522,17 @@ found:
|
||||
free (buf);
|
||||
}
|
||||
|
||||
if ((buf = svGetValue (file, "MTU")))
|
||||
{
|
||||
unsigned long mtu;
|
||||
|
||||
errno = 0;
|
||||
mtu = strtoul (buf, NULL, 10);
|
||||
if (!errno && mtu > 500 && mtu < INT_MAX)
|
||||
sys_data->mtu = (unsigned int) mtu;
|
||||
free (buf);
|
||||
}
|
||||
|
||||
if ((buf = svGetValue (file, "WIRELESS_ESSID")) && strlen (buf) > 1)
|
||||
{
|
||||
NMAccessPoint * ap;
|
||||
@@ -763,6 +775,9 @@ out:
|
||||
nm_debug ("mask=%s", ip_str);
|
||||
g_free (ip_str);
|
||||
|
||||
if (sys_data->mtu)
|
||||
nm_debug ("mtu=%u", sys_data->mtu);
|
||||
|
||||
len = nm_ip4_config_get_num_nameservers (sys_data->config);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
@@ -1252,3 +1267,20 @@ out_gfree:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_system_get_mtu
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
SuSEDeviceConfigData * sys_data;
|
||||
|
||||
sys_data = nm_device_get_system_config_data (dev);
|
||||
if (!sys_data)
|
||||
return 0;
|
||||
|
||||
return sys_data->mtu;
|
||||
}
|
||||
|
Reference in New Issue
Block a user