Patchwork Fix MNC length for Swisscom SIM cards

login
register
mail settings
Submitter Andrejs Cainikovs
Date Aug. 28, 2013, 3:19 p.m.
Message ID <1377703143-4630-1-git-send-email-andrejs.cainikovs@gmail.com>
Download mbox | patch
Permalink /patch/270560/
State Accepted
Commit fcf20528a029ec382ce8bbcacd37393eae208f0b
Headers show

Comments

Andrejs Cainikovs - Aug. 28, 2013, 3:19 p.m.
From: Andrejs Cainikovs <andrejs.cainikovs@sonymobile.com>

Swisscom SIM cards does not include MNC length with in EF_AD,
and end up using incorrect MNC length based on the 3-digit
default.
Hardcode MNC length of 2 for Switzerland, in the same manner
as it is done now for Finland.

Signed-hostap: Andrejs Cainikovs <andrejs.cainikovs@sonymobile.com>
---
 src/eap_peer/eap.c |    2 ++
 1 file changed, 2 insertions(+)
Jouni Malinen - Aug. 31, 2013, 7:59 a.m.
On Wed, Aug 28, 2013 at 05:19:03PM +0200, Andrejs Cainikovs wrote:
> Swisscom SIM cards does not include MNC length with in EF_AD,
> and end up using incorrect MNC length based on the 3-digit
> default.
> Hardcode MNC length of 2 for Switzerland, in the same manner
> as it is done now for Finland.

Thanks, applied.

Patch

diff --git a/src/eap_peer/eap.c b/src/eap_peer/eap.c
index c0d7078..554e7e9 100644
--- a/src/eap_peer/eap.c
+++ b/src/eap_peer/eap.c
@@ -938,6 +938,8 @@  static int mnc_len_from_imsi(const char *imsi)
 	mcc_str[3] = '\0';
 	mcc = atoi(mcc_str);
 
+	if (mcc == 228)
+		return 2; /* Networks in Switzerland use 2-digit MNC */
 	if (mcc == 244)
 		return 2; /* Networks in Finland use 2-digit MNC */