Fix vty PDP lookups by IMSI
The PDP context is searched on the hash which is generated
on context creation from the IMSI in gtp format. - A hash
created from "human-readable" IMSI does not match.
Check user input for length then convert the IMSI to gtp format
before continuing.
Change-Id: Icd2e2bc6068c06fbf5d5fe905ebcda8954f33f04
diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c
index cb92a8a..91ffe4e 100644
--- a/ggsn/ggsn_vty.c
+++ b/ggsn/ggsn_vty.c
@@ -894,7 +894,12 @@
return CMD_WARNING;
}
- imsi = strtoull(argv[1], NULL, 10);
+ if (strlen(argv[1]) < 6 || strlen(argv[1]) > 15) {
+ vty_out(vty, "%% Invalid IMSI '%s'%s", argv[1], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ imsi = imsi_str2gtp(argv[1]);
if (argc > 2) {
nsapi = atoi(argv[2]);