mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-06 23:20:34 +01:00
gsm: pass the PPP auth preferences for STATIC and DHCP device use
When using the either DHCP or STATIC IpMethods the modem manager
or device itself negotiates the PPP session so we need to pass
the authentication preferences through to MM.
Notes:
1/ Using a bitfield now that happens to match the Ericsson
in the lower orders so that it's far more tidy.
2/ Devices that wish to utilise this should observe the
following:
If the bitfield doesn't exist in the dict, then MM uses the
modem default, if it does, MM tries to fulfill the request. If the
modem can only accept one value (Qualcomm-type devices accept only
None, PAP or CHAP with AT$QCPDPP) then MM picks the appropriate one
from the dict if only one of PAP or CHAP was given, otherwise we
default to PAP.
(dcbw: make enum a bitfield instead of the bit position)
This commit is contained in:
parent
4abb300c96
commit
34aef8aaaa
1 changed files with 35 additions and 0 deletions
|
|
@ -62,6 +62,18 @@ typedef enum {
|
|||
MM_MODEM_GSM_ALLOWED_MODE_LAST = MM_MODEM_GSM_ALLOWED_MODE_3G_ONLY
|
||||
} MMModemGsmAllowedMode;
|
||||
|
||||
typedef enum {
|
||||
MM_MODEM_GSM_ALLOWED_AUTH_UNKNOWN = 0x0000,
|
||||
/* bits 0..4 order match Ericsson device bitmap */
|
||||
MM_MODEM_GSM_ALLOWED_AUTH_NONE = 0x0001,
|
||||
MM_MODEM_GSM_ALLOWED_AUTH_PAP = 0x0002,
|
||||
MM_MODEM_GSM_ALLOWED_AUTH_CHAP = 0x0004,
|
||||
MM_MODEM_GSM_ALLOWED_AUTH_MSCHAP = 0x0008,
|
||||
MM_MODEM_GSM_ALLOWED_AUTH_MSCHAPV2 = 0x0010,
|
||||
MM_MODEM_GSM_ALLOWED_AUTH_EAP = 0x0020,
|
||||
|
||||
MM_MODEM_GSM_ALLOWED_AUTH_LAST = MM_MODEM_GSM_ALLOWED_AUTH_EAP
|
||||
} MMModemGsmAllowedAuth;
|
||||
|
||||
G_DEFINE_TYPE (NMModemGsm, nm_modem_gsm, NM_TYPE_MODEM)
|
||||
|
||||
|
|
@ -326,6 +338,7 @@ static GHashTable *
|
|||
create_connect_properties (NMConnection *connection)
|
||||
{
|
||||
NMSettingGsm *setting;
|
||||
NMSettingPPP *s_ppp;
|
||||
GHashTable *properties;
|
||||
const char *str;
|
||||
|
||||
|
|
@ -384,6 +397,28 @@ create_connect_properties (NMConnection *connection)
|
|||
if (nm_setting_gsm_get_home_only (setting))
|
||||
value_hash_add_bool (properties, "home_only", TRUE);
|
||||
|
||||
/* For IpMethod == STATIC or DHCP */
|
||||
s_ppp = nm_connection_get_setting_ppp (connection);
|
||||
if (s_ppp) {
|
||||
guint32 auth = MM_MODEM_GSM_ALLOWED_AUTH_UNKNOWN;
|
||||
|
||||
if (nm_setting_ppp_get_noauth (s_ppp))
|
||||
auth |= MM_MODEM_GSM_ALLOWED_AUTH_NONE;
|
||||
if (!nm_setting_ppp_get_refuse_pap (s_ppp))
|
||||
auth |= MM_MODEM_GSM_ALLOWED_AUTH_PAP;
|
||||
if (!nm_setting_ppp_get_refuse_chap (s_ppp))
|
||||
auth |= MM_MODEM_GSM_ALLOWED_AUTH_CHAP;
|
||||
if (!nm_setting_ppp_get_refuse_mschap (s_ppp))
|
||||
auth |= MM_MODEM_GSM_ALLOWED_AUTH_MSCHAP;
|
||||
if (!nm_setting_ppp_get_refuse_mschapv2 (s_ppp))
|
||||
auth |= MM_MODEM_GSM_ALLOWED_AUTH_MSCHAPV2;
|
||||
if (!nm_setting_ppp_get_refuse_eap (s_ppp))
|
||||
auth |= MM_MODEM_GSM_ALLOWED_AUTH_EAP;
|
||||
|
||||
if (auth != MM_MODEM_GSM_ALLOWED_AUTH_UNKNOWN)
|
||||
value_hash_add_uint (properties, "allowed_auth", auth);
|
||||
}
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue