summaryrefslogtreecommitdiff
path: root/src/ppp-manager
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2008-10-02 17:10:00 +0000
committerDan Williams <dcbw@redhat.com>2008-10-02 17:10:00 +0000
commit175d6db3ef272d5badee4a293a23be3c293b4174 (patch)
treec33c6ea970682ccd68e50e60260ba4d45daeb3aa /src/ppp-manager
parent80fdf64b0be3f7e660ba4602c3b1a488c4e00281 (diff)
downloadNetworkManager-175d6db3ef272d5badee4a293a23be3c293b4174.tar.gz
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
Diffstat (limited to 'src/ppp-manager')
-rw-r--r--src/ppp-manager/nm-ppp-manager.c28
-rw-r--r--src/ppp-manager/nm-ppp-manager.h5
2 files changed, 26 insertions, 7 deletions
diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c
index 3ab51564bf..abf9a0bf6a 100644
--- a/src/ppp-manager/nm-ppp-manager.c
+++ b/src/ppp-manager/nm-ppp-manager.c
@@ -6,6 +6,7 @@
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
+#include <stdlib.h>
#include <errno.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));
+ /* 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,
setting_name,
- tries ? TRUE : FALSE,
+ tries > 1 ? TRUE : FALSE,
SECRETS_CALLER_PPP,
hint1,
hint2);
@@ -698,11 +703,13 @@ static NMCmdLine *
create_pppd_cmd_line (NMPPPManager *self,
NMSettingPPP *setting,
NMSettingPPPOE *pppoe,
+ const char *ppp_name,
GError **err)
{
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self);
const char *ppp_binary;
NMCmdLine *cmd;
+ const char *ppp_debug;
ppp_binary = nm_find_pppd ();
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, "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) {
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, pppoe->service);
}
-
- nm_cmd_line_add_string (cmd, "user");
- nm_cmd_line_add_string (cmd, pppoe->username);
} else {
nm_cmd_line_add_string (cmd, priv->parent_iface);
/* Don't send some random address as the local address */
@@ -843,7 +856,10 @@ pppoe_fill_defaults (NMSettingPPP *setting)
}
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;
NMConnection *connection;
@@ -863,7 +879,7 @@ nm_ppp_manager_start (NMPPPManager *manager, NMActRequest *req, GError **err)
if (pppoe_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)
return FALSE;
diff --git a/src/ppp-manager/nm-ppp-manager.h b/src/ppp-manager/nm-ppp-manager.h
index 4e0e576e40..ec18f16e7a 100644
--- a/src/ppp-manager/nm-ppp-manager.h
+++ b/src/ppp-manager/nm-ppp-manager.h
@@ -38,7 +38,10 @@ GType nm_ppp_manager_get_type (void);
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,
const char *device,