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:
14
ChangeLog
14
ChangeLog
@@ -1,3 +1,17 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2006-03-21 Robert Love <rml@novell.com>
|
2006-03-21 Robert Love <rml@novell.com>
|
||||||
|
|
||||||
* src/backends/NetworkManagerSuSE.c: Strip hypens from hex key in
|
* src/backends/NetworkManagerSuSE.c: Strip hypens from hex key in
|
||||||
|
@@ -296,6 +296,49 @@ 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
|
* nm_system_vpn_device_set_from_ip4_config
|
||||||
*
|
*
|
||||||
|
@@ -85,6 +85,9 @@ void nm_system_set_hostname (NMIP4Config *config);
|
|||||||
void nm_system_activate_nis (NMIP4Config *config);
|
void nm_system_activate_nis (NMIP4Config *config);
|
||||||
void nm_system_shutdown_nis (void);
|
void nm_system_shutdown_nis (void);
|
||||||
|
|
||||||
|
void nm_system_set_mtu (NMDevice *dev);
|
||||||
|
unsigned int nm_system_get_mtu (NMDevice *dev);
|
||||||
|
|
||||||
gboolean nm_system_should_modify_resolv_conf (void);
|
gboolean nm_system_should_modify_resolv_conf (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -681,3 +681,15 @@ gboolean nm_system_should_modify_resolv_conf (void)
|
|||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -583,3 +583,14 @@ gboolean nm_system_should_modify_resolv_conf (void)
|
|||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -930,3 +930,15 @@ gboolean nm_system_should_modify_resolv_conf (void)
|
|||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -423,3 +423,15 @@ gboolean nm_system_should_modify_resolv_conf (void)
|
|||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -354,6 +354,7 @@ typedef struct SuSEDeviceConfigData
|
|||||||
NMIP4Config * config;
|
NMIP4Config * config;
|
||||||
gboolean use_dhcp;
|
gboolean use_dhcp;
|
||||||
gboolean system_disabled;
|
gboolean system_disabled;
|
||||||
|
unsigned int mtu;
|
||||||
} SuSEDeviceConfigData;
|
} SuSEDeviceConfigData;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -521,6 +522,17 @@ found:
|
|||||||
free (buf);
|
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)
|
if ((buf = svGetValue (file, "WIRELESS_ESSID")) && strlen (buf) > 1)
|
||||||
{
|
{
|
||||||
NMAccessPoint * ap;
|
NMAccessPoint * ap;
|
||||||
@@ -763,6 +775,9 @@ out:
|
|||||||
nm_debug ("mask=%s", ip_str);
|
nm_debug ("mask=%s", ip_str);
|
||||||
g_free (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);
|
len = nm_ip4_config_get_num_nameservers (sys_data->config);
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
@@ -1252,3 +1267,20 @@ out_gfree:
|
|||||||
return ret;
|
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;
|
||||||
|
}
|
||||||
|
@@ -1228,6 +1228,7 @@ nm_device_activate_stage5_ip_config_commit (NMActRequest *req)
|
|||||||
nm_system_restart_mdns_responder ();
|
nm_system_restart_mdns_responder ();
|
||||||
nm_system_set_hostname (self->priv->ip4_config);
|
nm_system_set_hostname (self->priv->ip4_config);
|
||||||
nm_system_activate_nis (self->priv->ip4_config);
|
nm_system_activate_nis (self->priv->ip4_config);
|
||||||
|
nm_system_set_mtu (self);
|
||||||
if (NM_DEVICE_GET_CLASS (self)->update_link)
|
if (NM_DEVICE_GET_CLASS (self)->update_link)
|
||||||
NM_DEVICE_GET_CLASS (self)->update_link (self);
|
NM_DEVICE_GET_CLASS (self)->update_link (self);
|
||||||
nm_policy_schedule_activation_finish (req);
|
nm_policy_schedule_activation_finish (req);
|
||||||
|
Reference in New Issue
Block a user