This patch accomplishes two things for umb(4) connections. One, some SIM
cards have a plus at the beginning of the phone number while others do
not. In my case, an AT&T Wireless SIM card in the US has the plus where
a T-Mobile SIM card in Germany does not. The output of ifconfig(8)
originally added a plus regardless which caused two plus signs to appear
for me as below. With this patch, ifconfig(8) now adds the plus if it
is not there and does not add the plus if it is already programmed into
the SIM card.
umb0: flags=8951<UP,POINTOPOINT,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1430
index 5 priority 0 llprio 3
roaming disabled registration home network
state #7 cell-class LTE rssi -79dBm speed 47.7Mps up 286Mps down
SIM initialized PIN valid (3 attempts left)
subscriber-id 31041088 ICC-id 8901410427 provider AT&T
device EM7455 IMEI 014582000 firmware SWI9X30C_02.08.
phone# ++1213555123 APN broadband
dns 172.26.38.1
groups: egress
status: active
inet 10.45.181.18 --> 10.45.181.17 netmask 0xfffffffc
The second part of the patch also fixes the last digit of the phone
number and mulitple digits of the subscriber-id, ICC-id, and IMEI being
cut off. Both fixes were discussed with Gerhard Roth. I sent him an
original patch but it only partially solved the issues and after
discussion with him, he came up with the patch below which solves and
fully accounts for the issues and possible scenarios. With this patch
the output looks like this.
umb0: flags=8851<UP,POINTOPOINT,RUNNING,SIMPLEX,MULTICAST> mtu 1430
index 5 priority 0 llprio 3
roaming disabled registration home network
state #7 cell-class LTE rssi -103dBm speed 47.7Mps up 286Mps down
SIM initialized PIN valid (3 attempts left)
subscriber-id 310410812345678 ICC-id 89014104278812345678 provider AT&T
device EM7455 IMEI 014582012345678 firmware SWI9X30C_02.08.02.00
phone# +12135551234 APN broadband
dns 172.26.38.1
status: active
inet 10.84.107.51 --> 10.84.107.52 netmask 0xfffffff8
Bryan
Index: sbin/ifconfig/ifconfig.c
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.332
diff -u -p -r1.332 ifconfig.c
--- sbin/ifconfig/ifconfig.c 8 Nov 2016 14:37:20 -0000 1.332
+++ sbin/ifconfig/ifconfig.c 9 Nov 2016 16:34:26 -0000
@@ -5153,7 +5153,7 @@ umb_status(void)
printf("\t");
n = 0;
if (pn[0])
- printf("%sphone# +%s", n++ ? " " : "", pn);
+ printf("%sphone# +%s", n++ ? " " : "", pn[0] == '+' ?
&pn[1] : pn);
if (apn[0])
printf("%sAPN %s", n++ ? " " : "", apn);
printf("\n");
@@ -5323,7 +5323,7 @@ done:
}
*out++ = isascii(c) ? (char)c : '?';
in++;
- inlen -= sizeof (*in);
+ inlen--;
}
}