mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-19 07:48:30 +02:00
2006-01-18 Robert Love <rml@novell.com>
* src/NetworkManager.c, src/NetworkManagerSystem.h, src/nm-device.c: Allow backends to flag a device (in whatever distro-dependent way they so desire) as disabled. NM will ignore any such device. * src/backends/NetworkManagerDebian.c, src/backends/NetworkManagerRedHat.c, src/backends/NetworkManagerSlackware.c: Add stub function nm_system_device_get_disabled() that always returns FALSE (enabled). * src/backends/NetworkManagerSuSE.c: Add system_disabled field to the SUSE-specific configuration structure. Fill it in from the NM_CONTROLLED variable in the system networking scripts. If this var exists and is "no", we ignore the device. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1361 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
48c3750cee
commit
cbd27080ed
8 changed files with 109 additions and 16 deletions
14
ChangeLog
14
ChangeLog
|
|
@ -1,3 +1,17 @@
|
|||
2006-01-18 Robert Love <rml@novell.com>
|
||||
|
||||
* src/NetworkManager.c, src/NetworkManagerSystem.h, src/nm-device.c:
|
||||
Allow backends to flag a device (in whatever distro-dependent way
|
||||
they so desire) as disabled. NM will ignore any such device.
|
||||
* src/backends/NetworkManagerDebian.c,
|
||||
src/backends/NetworkManagerRedHat.c,
|
||||
src/backends/NetworkManagerSlackware.c: Add stub function
|
||||
nm_system_device_get_disabled() that always returns FALSE (enabled).
|
||||
* src/backends/NetworkManagerSuSE.c: Add system_disabled field to the
|
||||
SUSE-specific configuration structure. Fill it in from the
|
||||
NM_CONTROLLED variable in the system networking scripts. If this var
|
||||
exists and is "no", we ignore the device.
|
||||
|
||||
2006-01-17 Robert Love <rml@novell.com>
|
||||
|
||||
* configure.in: Remove 'no' language. Replaced by 'nb', which is
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ NMDevice * nm_create_device_and_add_to_list (NMData *data, const char *udi, cons
|
|||
g_object_unref (G_OBJECT (dev));
|
||||
dev = NULL;
|
||||
}
|
||||
} else nm_warning ("could not allocate device data." );
|
||||
}
|
||||
|
||||
return (dev);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ NMIP4Config * nm_system_device_new_ip4_system_config (NMDevice *dev);
|
|||
|
||||
gboolean nm_system_device_get_use_dhcp (NMDevice *dev);
|
||||
|
||||
gboolean nm_system_device_get_disabled (NMDevice *dev);
|
||||
|
||||
gboolean nm_system_device_set_from_ip4_config (NMDevice *dev);
|
||||
gboolean nm_system_vpn_device_set_from_ip4_config (NMNamedManager *named, NMDevice *active_device, const char *iface, NMIP4Config *config, char **routes, int num_routes);
|
||||
gboolean nm_system_vpn_device_unset_from_ip4_config (NMNamedManager *named, NMDevice *active_device, const char *iface, NMIP4Config *config);
|
||||
|
|
|
|||
|
|
@ -625,6 +625,19 @@ gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_system_device_get_disabled
|
||||
*
|
||||
* Return whether the distro-specific system config tells us to use
|
||||
* dhcp for this device.
|
||||
*
|
||||
*/
|
||||
gboolean nm_system_device_get_disabled (NMDevice *dev)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
|
||||
{
|
||||
DebSystemConfigData *sys_data;
|
||||
|
|
|
|||
|
|
@ -637,6 +637,19 @@ gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_system_device_get_disabled
|
||||
*
|
||||
* Return whether the distro-specific system config tells us to use
|
||||
* dhcp for this device.
|
||||
*
|
||||
*/
|
||||
gboolean nm_system_device_get_disabled (NMDevice *dev)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
|
||||
{
|
||||
RHSystemConfigData *sys_data;
|
||||
|
|
|
|||
|
|
@ -370,6 +370,20 @@ gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_system_device_get_disabled
|
||||
*
|
||||
* Return whether the distro-specific system config tells us to use
|
||||
* dhcp for this device.
|
||||
*
|
||||
*/
|
||||
gboolean nm_system_device_get_disabled (NMDevice *dev)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_system_activate_nis
|
||||
*
|
||||
|
|
|
|||
|
|
@ -341,6 +341,7 @@ typedef struct SuSESystemConfigData
|
|||
{
|
||||
NMIP4Config * config;
|
||||
gboolean use_dhcp;
|
||||
gboolean system_disabled;
|
||||
} SuSESystemConfigData;
|
||||
|
||||
/*
|
||||
|
|
@ -497,22 +498,33 @@ found:
|
|||
free (buf);
|
||||
}
|
||||
|
||||
if ((buf = svGetValue (file, "NM_CONTROLLED")))
|
||||
{
|
||||
nm_debug ("NM_CONTROLLED=%s", buf);
|
||||
if (!strcasecmp (buf, "no"))
|
||||
{
|
||||
nm_info ("System configuration disables device %s", nm_device_get_iface (dev));
|
||||
sys_data->system_disabled = TRUE;
|
||||
}
|
||||
free (buf);
|
||||
}
|
||||
|
||||
sys_data->config = nm_ip4_config_new ();
|
||||
|
||||
if (!(sys_data->use_dhcp))
|
||||
if (!sys_data->use_dhcp || sys_data->system_disabled)
|
||||
{
|
||||
buf = svGetValue (file, "IPADDR");
|
||||
if (buf)
|
||||
{
|
||||
struct in_addr ip;
|
||||
int ret;
|
||||
struct in_addr ip;
|
||||
int ret;
|
||||
|
||||
ret = inet_aton (buf, &ip);
|
||||
if (ret)
|
||||
nm_ip4_config_set_address (sys_data->config, ip.s_addr);
|
||||
else
|
||||
error = TRUE;
|
||||
free (buf);
|
||||
ret = inet_aton (buf, &ip);
|
||||
if (ret)
|
||||
nm_ip4_config_set_address (sys_data->config, ip.s_addr);
|
||||
else
|
||||
error = TRUE;
|
||||
free (buf);
|
||||
}
|
||||
else
|
||||
error = TRUE;
|
||||
|
|
@ -654,12 +666,32 @@ gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
|||
{
|
||||
SuSESystemConfigData *sys_data;
|
||||
|
||||
g_return_val_if_fail (dev != NULL, TRUE);
|
||||
g_return_val_if_fail (dev != NULL, FALSE);
|
||||
|
||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
||||
return sys_data->use_dhcp;
|
||||
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_system_device_get_disabled
|
||||
*
|
||||
* Return whether the distribution has flagged this device as disabled.
|
||||
*
|
||||
*/
|
||||
gboolean nm_system_device_get_disabled (NMDevice *dev)
|
||||
{
|
||||
SuSESystemConfigData *sys_data;
|
||||
|
||||
g_return_val_if_fail (dev != NULL, FALSE);
|
||||
|
||||
|
||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
||||
return sys_data->system_disabled;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ nm_device_new (const char *iface,
|
|||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
|
||||
g_assert (dev);
|
||||
dev->priv->iface = g_strdup (iface);
|
||||
dev->priv->udi = g_strdup (udi);
|
||||
|
|
@ -180,7 +180,7 @@ nm_device_new (const char *iface,
|
|||
if (!(dev->priv->capabilities & NM_DEVICE_CAP_NM_SUPPORTED))
|
||||
{
|
||||
g_object_unref (G_OBJECT (dev));
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Device thread's main loop */
|
||||
|
|
@ -202,6 +202,13 @@ nm_device_new (const char *iface,
|
|||
dev->priv->system_config_data = nm_system_device_get_system_config (dev);
|
||||
dev->priv->use_dhcp = nm_system_device_get_use_dhcp (dev);
|
||||
|
||||
/* Allow distributions to flag devices as disabled */
|
||||
if (nm_system_device_get_disabled (dev))
|
||||
{
|
||||
g_object_unref (G_OBJECT (dev));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nm_print_device_capabilities (dev);
|
||||
|
||||
/* Call type-specific initialization */
|
||||
|
|
@ -1994,5 +2001,3 @@ nm_device_get_type (void)
|
|||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue