mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 05:28:07 +02:00
2008-10-02 Dan Williams <dcbw@redhat.com>
* src/ppp-manager/nm-ppp-manager.c src/ppp-manager/nm-ppp-manager.h - (impl_ppp_manager_need_secrets): tries secrets twice before asking the settings daemon for completely new ones - (create_pppd_cmd_line): new parameter 'ppp_name' used to set the local PPP peer name; allow PPP debuging by launching NM with the environment variable NM_PPP_DEBUG defined - (nm_ppp_manager_start): new parameter 'ppp_name' passed to create_pppd_cmd_line() * src/nm-serial-device.c src/nm-serial-device.h - New 'get_ppp_name' function for subclasses to implement to return the local PPP peer name - (real_act_stage2_config): call 'get_ppp_name' function of subclasses and pass that name to the PPP manager * src/nm-device-ethernet.c - (pppoe_stage2_config): pass the PPPoE username to the PPP manager as the local peer name * src/nm-cdma-device.c - (real_get_ppp_name): implement using the CDMA username git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4141 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
80fdf64b0b
commit
175d6db3ef
7 changed files with 87 additions and 9 deletions
26
ChangeLog
26
ChangeLog
|
|
@ -1,3 +1,29 @@
|
||||||
|
2008-10-02 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* src/ppp-manager/nm-ppp-manager.c
|
||||||
|
src/ppp-manager/nm-ppp-manager.h
|
||||||
|
- (impl_ppp_manager_need_secrets): tries secrets twice before asking
|
||||||
|
the settings daemon for completely new ones
|
||||||
|
- (create_pppd_cmd_line): new parameter 'ppp_name' used to set the
|
||||||
|
local PPP peer name; allow PPP debuging by launching NM with
|
||||||
|
the environment variable NM_PPP_DEBUG defined
|
||||||
|
- (nm_ppp_manager_start): new parameter 'ppp_name' passed to
|
||||||
|
create_pppd_cmd_line()
|
||||||
|
|
||||||
|
* src/nm-serial-device.c
|
||||||
|
src/nm-serial-device.h
|
||||||
|
- New 'get_ppp_name' function for subclasses to implement to return the
|
||||||
|
local PPP peer name
|
||||||
|
- (real_act_stage2_config): call 'get_ppp_name' function of subclasses
|
||||||
|
and pass that name to the PPP manager
|
||||||
|
|
||||||
|
* src/nm-device-ethernet.c
|
||||||
|
- (pppoe_stage2_config): pass the PPPoE username to the PPP manager as
|
||||||
|
the local peer name
|
||||||
|
|
||||||
|
* src/nm-cdma-device.c
|
||||||
|
- (real_get_ppp_name): implement using the CDMA username
|
||||||
|
|
||||||
2008-10-02 Dan Williams <dcbw@redhat.com>
|
2008-10-02 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
Patch from Alexander Sack <asac ubuntu com>
|
Patch from Alexander Sack <asac ubuntu com>
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,21 @@ real_connection_secrets_updated (NMDevice *dev,
|
||||||
nm_device_activate_schedule_stage1_device_prepare (dev);
|
nm_device_activate_schedule_stage1_device_prepare (dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
real_get_ppp_name (NMSerialDevice *device, NMActRequest *req)
|
||||||
|
{
|
||||||
|
NMConnection *connection;
|
||||||
|
NMSettingCdma *s_cdma;
|
||||||
|
|
||||||
|
connection = nm_act_request_get_connection (req);
|
||||||
|
g_assert (connection);
|
||||||
|
|
||||||
|
s_cdma = (NMSettingCdma *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA);
|
||||||
|
g_assert (s_cdma);
|
||||||
|
|
||||||
|
return s_cdma->username;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Monitor device handling */
|
/* Monitor device handling */
|
||||||
|
|
||||||
|
|
@ -521,6 +536,7 @@ nm_cdma_device_class_init (NMCdmaDeviceClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
||||||
|
NMSerialDeviceClass *serial_class = NM_SERIAL_DEVICE_CLASS (klass);
|
||||||
|
|
||||||
g_type_class_add_private (object_class, sizeof (NMCdmaDevicePrivate));
|
g_type_class_add_private (object_class, sizeof (NMCdmaDevicePrivate));
|
||||||
|
|
||||||
|
|
@ -534,6 +550,8 @@ nm_cdma_device_class_init (NMCdmaDeviceClass *klass)
|
||||||
device_class->act_stage1_prepare = real_act_stage1_prepare;
|
device_class->act_stage1_prepare = real_act_stage1_prepare;
|
||||||
device_class->connection_secrets_updated = real_connection_secrets_updated;
|
device_class->connection_secrets_updated = real_connection_secrets_updated;
|
||||||
|
|
||||||
|
serial_class->get_ppp_name = real_get_ppp_name;
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_MONITOR_IFACE,
|
(object_class, PROP_MONITOR_IFACE,
|
||||||
|
|
|
||||||
|
|
@ -1235,6 +1235,8 @@ static NMActStageReturn
|
||||||
pppoe_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
|
pppoe_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
|
||||||
{
|
{
|
||||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||||
|
NMConnection *connection;
|
||||||
|
NMSettingPPPOE *s_pppoe;
|
||||||
NMActRequest *req;
|
NMActRequest *req;
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||||
|
|
@ -1242,8 +1244,14 @@ pppoe_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
|
||||||
req = nm_device_get_act_request (NM_DEVICE (self));
|
req = nm_device_get_act_request (NM_DEVICE (self));
|
||||||
g_assert (req);
|
g_assert (req);
|
||||||
|
|
||||||
|
connection = nm_act_request_get_connection (req);
|
||||||
|
g_assert (req);
|
||||||
|
|
||||||
|
s_pppoe = (NMSettingPPPOE *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE);
|
||||||
|
g_assert (s_pppoe);
|
||||||
|
|
||||||
priv->ppp_manager = nm_ppp_manager_new (nm_device_get_iface (NM_DEVICE (self)));
|
priv->ppp_manager = nm_ppp_manager_new (nm_device_get_iface (NM_DEVICE (self)));
|
||||||
if (nm_ppp_manager_start (priv->ppp_manager, req, &err)) {
|
if (nm_ppp_manager_start (priv->ppp_manager, req, s_pppoe->username, &err)) {
|
||||||
g_signal_connect (priv->ppp_manager, "state-changed",
|
g_signal_connect (priv->ppp_manager, "state-changed",
|
||||||
G_CALLBACK (ppp_state_changed),
|
G_CALLBACK (ppp_state_changed),
|
||||||
self);
|
self);
|
||||||
|
|
|
||||||
|
|
@ -1013,15 +1013,20 @@ static NMActStageReturn
|
||||||
real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||||
{
|
{
|
||||||
NMSerialDevicePrivate *priv = NM_SERIAL_DEVICE_GET_PRIVATE (device);
|
NMSerialDevicePrivate *priv = NM_SERIAL_DEVICE_GET_PRIVATE (device);
|
||||||
|
NMSerialDeviceClass *serial_class = NM_SERIAL_DEVICE_GET_CLASS (device);
|
||||||
NMActRequest *req;
|
NMActRequest *req;
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
NMActStageReturn ret;
|
NMActStageReturn ret;
|
||||||
|
const char *ppp_name = NULL;
|
||||||
|
|
||||||
req = nm_device_get_act_request (device);
|
req = nm_device_get_act_request (device);
|
||||||
g_assert (req);
|
g_assert (req);
|
||||||
|
|
||||||
|
if (serial_class->get_ppp_name)
|
||||||
|
ppp_name = serial_class->get_ppp_name (NM_SERIAL_DEVICE (device), req);
|
||||||
|
|
||||||
priv->ppp_manager = nm_ppp_manager_new (nm_device_get_iface (device));
|
priv->ppp_manager = nm_ppp_manager_new (nm_device_get_iface (device));
|
||||||
if (nm_ppp_manager_start (priv->ppp_manager, req, &err)) {
|
if (nm_ppp_manager_start (priv->ppp_manager, req, ppp_name, &err)) {
|
||||||
g_signal_connect (priv->ppp_manager, "state-changed",
|
g_signal_connect (priv->ppp_manager, "state-changed",
|
||||||
G_CALLBACK (ppp_state_changed),
|
G_CALLBACK (ppp_state_changed),
|
||||||
device);
|
device);
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NMDeviceClass parent;
|
NMDeviceClass parent;
|
||||||
|
|
||||||
|
const char * (*get_ppp_name) (NMSerialDevice *device, NMActRequest *req);
|
||||||
|
|
||||||
/* Signals */
|
/* Signals */
|
||||||
void (*ppp_stats) (NMSerialDevice *device, guint32 in_bytes, guint32 out_bytes);
|
void (*ppp_stats) (NMSerialDevice *device, guint32 in_bytes, guint32 out_bytes);
|
||||||
} NMSerialDeviceClass;
|
} NMSerialDeviceClass;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
@ -408,9 +409,13 @@ impl_ppp_manager_need_secrets (NMPPPManager *manager,
|
||||||
}
|
}
|
||||||
|
|
||||||
tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (connection), PPP_MANAGER_SECRET_TRIES));
|
tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (connection), PPP_MANAGER_SECRET_TRIES));
|
||||||
|
/* Only ask for completely new secrets after retrying them once; some PPP
|
||||||
|
* servers (T-Mobile USA) appear to ask a few times when they actually don't
|
||||||
|
* even care what you pass back.
|
||||||
|
*/
|
||||||
nm_act_request_request_connection_secrets (priv->act_req,
|
nm_act_request_request_connection_secrets (priv->act_req,
|
||||||
setting_name,
|
setting_name,
|
||||||
tries ? TRUE : FALSE,
|
tries > 1 ? TRUE : FALSE,
|
||||||
SECRETS_CALLER_PPP,
|
SECRETS_CALLER_PPP,
|
||||||
hint1,
|
hint1,
|
||||||
hint2);
|
hint2);
|
||||||
|
|
@ -698,11 +703,13 @@ static NMCmdLine *
|
||||||
create_pppd_cmd_line (NMPPPManager *self,
|
create_pppd_cmd_line (NMPPPManager *self,
|
||||||
NMSettingPPP *setting,
|
NMSettingPPP *setting,
|
||||||
NMSettingPPPOE *pppoe,
|
NMSettingPPPOE *pppoe,
|
||||||
|
const char *ppp_name,
|
||||||
GError **err)
|
GError **err)
|
||||||
{
|
{
|
||||||
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self);
|
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self);
|
||||||
const char *ppp_binary;
|
const char *ppp_binary;
|
||||||
NMCmdLine *cmd;
|
NMCmdLine *cmd;
|
||||||
|
const char *ppp_debug;
|
||||||
|
|
||||||
ppp_binary = nm_find_pppd ();
|
ppp_binary = nm_find_pppd ();
|
||||||
if (!ppp_binary) {
|
if (!ppp_binary) {
|
||||||
|
|
@ -718,6 +725,15 @@ create_pppd_cmd_line (NMPPPManager *self,
|
||||||
nm_cmd_line_add_string (cmd, "nodetach");
|
nm_cmd_line_add_string (cmd, "nodetach");
|
||||||
nm_cmd_line_add_string (cmd, "lock");
|
nm_cmd_line_add_string (cmd, "lock");
|
||||||
|
|
||||||
|
ppp_debug = getenv ("NM_PPP_DEBUG");
|
||||||
|
if (ppp_debug)
|
||||||
|
nm_cmd_line_add_string (cmd, "debug");
|
||||||
|
|
||||||
|
if (ppp_name) {
|
||||||
|
nm_cmd_line_add_string (cmd, "user");
|
||||||
|
nm_cmd_line_add_string (cmd, ppp_name);
|
||||||
|
}
|
||||||
|
|
||||||
if (pppoe) {
|
if (pppoe) {
|
||||||
char *dev_str;
|
char *dev_str;
|
||||||
|
|
||||||
|
|
@ -732,9 +748,6 @@ create_pppd_cmd_line (NMPPPManager *self,
|
||||||
nm_cmd_line_add_string (cmd, "rp_pppoe_service");
|
nm_cmd_line_add_string (cmd, "rp_pppoe_service");
|
||||||
nm_cmd_line_add_string (cmd, pppoe->service);
|
nm_cmd_line_add_string (cmd, pppoe->service);
|
||||||
}
|
}
|
||||||
|
|
||||||
nm_cmd_line_add_string (cmd, "user");
|
|
||||||
nm_cmd_line_add_string (cmd, pppoe->username);
|
|
||||||
} else {
|
} else {
|
||||||
nm_cmd_line_add_string (cmd, priv->parent_iface);
|
nm_cmd_line_add_string (cmd, priv->parent_iface);
|
||||||
/* Don't send some random address as the local address */
|
/* Don't send some random address as the local address */
|
||||||
|
|
@ -843,7 +856,10 @@ pppoe_fill_defaults (NMSettingPPP *setting)
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nm_ppp_manager_start (NMPPPManager *manager, NMActRequest *req, GError **err)
|
nm_ppp_manager_start (NMPPPManager *manager,
|
||||||
|
NMActRequest *req,
|
||||||
|
const char *ppp_name,
|
||||||
|
GError **err)
|
||||||
{
|
{
|
||||||
NMPPPManagerPrivate *priv;
|
NMPPPManagerPrivate *priv;
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
|
|
@ -863,7 +879,7 @@ nm_ppp_manager_start (NMPPPManager *manager, NMActRequest *req, GError **err)
|
||||||
if (pppoe_setting)
|
if (pppoe_setting)
|
||||||
pppoe_fill_defaults (ppp_setting);
|
pppoe_fill_defaults (ppp_setting);
|
||||||
|
|
||||||
ppp_cmd = create_pppd_cmd_line (manager, ppp_setting, pppoe_setting, err);
|
ppp_cmd = create_pppd_cmd_line (manager, ppp_setting, pppoe_setting, ppp_name, err);
|
||||||
if (!ppp_cmd)
|
if (!ppp_cmd)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,10 @@ GType nm_ppp_manager_get_type (void);
|
||||||
|
|
||||||
NMPPPManager *nm_ppp_manager_new (const char *iface);
|
NMPPPManager *nm_ppp_manager_new (const char *iface);
|
||||||
|
|
||||||
gboolean nm_ppp_manager_start (NMPPPManager *manager, NMActRequest *req, GError **err);
|
gboolean nm_ppp_manager_start (NMPPPManager *manager,
|
||||||
|
NMActRequest *req,
|
||||||
|
const char *ppp_name,
|
||||||
|
GError **err);
|
||||||
|
|
||||||
void nm_ppp_manager_update_secrets (NMPPPManager *manager,
|
void nm_ppp_manager_update_secrets (NMPPPManager *manager,
|
||||||
const char *device,
|
const char *device,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue