Skip to contentSkip to conversation

gprs: added two authentication methods: NONE and ANY

PATCH In review Giacinto Cifelli 2 participants 7 messages Sep 20, 2018 – Sep 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 gprs: added two authentication methods: NONE and ANY

OFONO_GPRS_AUTH_METHOD_NONE disables the authentication OFONO_GPRS_AUTH_METHOD_ANY tries first CHAP then PAP, but only applies to supporting drivers and modules

---
 include/gprs-context.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/gprs-context.h +3 -1
index 20ca9ef..7e1dfcc 100644
@@ -55,7 +55,9 @@ enum ofono_gprs_context_type {
 };
 
 enum ofono_gprs_auth_method {
-	OFONO_GPRS_AUTH_METHOD_CHAP = 0,
+	OFONO_GPRS_AUTH_METHOD_ANY = 0,
+	OFONO_GPRS_AUTH_METHOD_NONE,
+	OFONO_GPRS_AUTH_METHOD_CHAP,
 	OFONO_GPRS_AUTH_METHOD_PAP,
 };
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/4 added default values handling for gprs authentication in atmodem and mbimmodem

this is needed so that with the additional methods NONE and ANY the compilation is not broken

---
 drivers/atmodem/gprs-context.c   | 2 ++
 drivers/mbimmodem/gprs-context.c | 2 ++
 2 files changed, 4 insertions(+)
drivers/atmodem/gprs-context.c +2 -0
index 79ac4c8..0585850 100644
@@ -304,6 +304,8 @@ static void at_gprs_activate_primary(struct ofono_gprs_context *gc,
 				snprintf(buf + len, sizeof(buf) - len - 3,
 						",\"PAP:%s\"", ctx->apn);
 				break;
+			default:
+				break;
 			}
 			break;
 		default:
drivers/mbimmodem/gprs-context.c +2 -0
index 79793c9..ce33b92 100644
@@ -75,6 +75,8 @@ static uint32_t auth_method_to_auth_protocol(enum ofono_gprs_auth_method method)
 		return 2; /* MBIMAuthProtocolChap */
 	case OFONO_GPRS_AUTH_METHOD_PAP:
 		return 1; /* MBIMAuthProtocolPap */
+	default:
+		return 0;
 	}
 
 	return 0;
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH 2/4] added default values handling for gprs authentication in atmodem and mbimmodem

Hi Denis,

could you take this? It applies even only for the NONE auth_method, because it just adds default to the switch/cases.
I am resubmitting the other 3.

BR,
Giacinto

Quoted 41 lines · Giacinto Cifelli

this is needed so that with the additional methods NONE and ANY the compilation is not broken

---
 drivers/atmodem/gprs-context.c   | 2 ++
 drivers/mbimmodem/gprs-context.c | 2 ++
 2 files changed, 4 insertions(+)
drivers/atmodem/gprs-context.c +2 -0
index 79ac4c8..0585850 100644
@@ -304,6 +304,8 @@ static void at_gprs_activate_primary(struct
 ofono_gprs_context *gc,
                                snprintf(buf + len, sizeof(buf) - len - 3,
                                                ",\"PAP:%s\"", ctx->apn);
                                break;
+                       default:
+                               break;
                        }
                        break;

default:

drivers/mbimmodem/gprs-context.c +2 -0
index 79793c9..ce33b92 100644
@@ -75,6 +75,8 @@ static uint32_t auth_method_to_auth_protocol(enum
 ofono_gprs_auth_method method)
                return 2; /* MBIMAuthProtocolChap */
        case OFONO_GPRS_AUTH_METHOD_PAP:
                return 1; /* MBIMAuthProtocolPap */
+       default:
+               return 0;
        }
 
        return 0;

--
1.9.1

#3 lore raw

PATCH 3/4 plugins/file-provisioning.c: take into account auth_methods NONE and ANY

In reply to Giacinto Cifelli

added the support for the NONE and ANY authentication methods

---
 plugins/file-provision.c | 6 ++++++
 1 file changed, 6 insertions(+)
plugins/file-provision.c +6 -0
index d4846a6..f7412e6 100644
@@ -104,6 +104,12 @@ static int config_file_provision_get_settings(const char *mcc,
 		else if (g_strcmp0(value, "pap") == 0)
 			(*settings)[0].auth_method =
 						OFONO_GPRS_AUTH_METHOD_PAP;
+		else if (g_strcmp0(value, "none") == 0)
+			(*settings)[0].auth_method =
+						OFONO_GPRS_AUTH_METHOD_NONE;
+		else if (g_strcmp0(value, "any") == 0)
+			(*settings)[0].auth_method =
+						OFONO_GPRS_AUTH_METHOD_ANY;
 		else
 			DBG("Unknown auth method: %s", value);
 
Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/4 src/gprs.c: added support for NONE and ANY authentication methods

In reply to Giacinto Cifelli
---
 src/gprs.c | 7 +++++++
 1 file changed, 7 insertions(+)
src/gprs.c +7 -0
index 377eced..f17f31b 100644
@@ -261,6 +261,10 @@ static const char *gprs_auth_method_to_string(enum ofono_gprs_auth_method auth)
 		return "chap";
 	case OFONO_GPRS_AUTH_METHOD_PAP:
 		return "pap";
+	case OFONO_GPRS_AUTH_METHOD_NONE:
+		return "none";
+	default:
+		return NULL;
 	};
 
 	return NULL;
@@ -275,6 +279,9 @@ static gboolean gprs_auth_method_from_string(const char *str,
 	} else if (g_str_equal(str, "pap")) {
 		*auth = OFONO_GPRS_AUTH_METHOD_PAP;
 		return TRUE;
+	} else if (g_str_equal(str, "none")) {
+		*auth = OFONO_GPRS_AUTH_METHOD_NONE;
+		return TRUE;
 	}
 
 	return FALSE;
Signature · 1 line
1.9.1
#5 lore raw

Re: [PATCH 4/4] src/gprs.c: added support for NONE and ANY authentication methods

Hi Denis,

actually also this applies for auth_method NONE alone.

Regards,
Giacinto

Quoted 35 lines · Giacinto Cifelli
---
 src/gprs.c | 7 +++++++
 1 file changed, 7 insertions(+)
src/gprs.c +4 -0
index 377eced..f17f31b 100644
@@ -261,6 +261,10 @@ static const char *gprs_auth_method_to_string(enum
 ofono_gprs_auth_method auth)
                return "chap";
        case OFONO_GPRS_AUTH_METHOD_PAP:
                return "pap";
+       case OFONO_GPRS_AUTH_METHOD_NONE:
+               return "none";
+       default:
+               return NULL;
        };
 
        return NULL;
src/gprs.c +3 -0
@@ -275,6 +279,9 @@ static gboolean gprs_auth_method_from_string(const
 char *str,
        } else if (g_str_equal(str, "pap")) {
                *auth = OFONO_GPRS_AUTH_METHOD_PAP;
                return TRUE;
+       } else if (g_str_equal(str, "none")) {
+               *auth = OFONO_GPRS_AUTH_METHOD_NONE;
+               return TRUE;
        }
 
        return FALSE;

--
1.9.1

#6 lore raw
In reply to Giacinto Cifelli

Hi Giacinto,

Quoted 3 lines · Giacinto Cifelli

OFONO_GPRS_AUTH_METHOD_NONE disables the authentication OFONO_GPRS_AUTH_METHOD_ANY tries first CHAP then PAP, but only applies to supporting drivers and modules

No, we're not supporting METHOD_ANY for the reasons outlined already. Pretty much all of our drivers cannot handle this and settings are expected to work across devices. So if I plug modem from manufacturer A, provision a context, connect. Disconnect modem A, then connect modem from manufacturer B, things should still work seamlessly.

Quoted 4 lines
---
  include/gprs-context.h | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

Regards,
-Denis