sgsnemu: Allow specification of PDP (EUA) Type IPv4 or IPv6
This just adds the capability to sgsnemu to request a certain PDP
EUA type. It doesn't mean it actually handles anything beyond the
existing IPv4 yet.
Change-Id: I157f9157a7ff2ea56c37a4a902d4706de4c7d35d
diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index 4cc2021..c181603 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -118,6 +118,7 @@
struct ul16_t msisdn;
int norecovery_given;
int tx_gpdu_seq;
+ uint8_t pdp_type;
} options;
/* Definitions to use for PING. Most of the ping code was derived from */
@@ -926,6 +927,12 @@
else
options.tx_gpdu_seq = 1;
+ /* PDP Type */
+ if (!strcmp(args_info.pdp_type_arg, "v6"))
+ options.pdp_type = PDP_EUA_TYPE_v6;
+ else
+ options.pdp_type = PDP_EUA_TYPE_v4;
+
return 0;
}
@@ -1580,7 +1587,10 @@
msisdn_add(&options.msisdn, &pdp->msisdn, n);
}
- ipv42eua(&pdp->eua, NULL); /* Request dynamic IP address */
+ /* Request dynamic IP address */
+ pdp->eua.v[0] = PDP_EUA_ORG_IETF;
+ pdp->eua.v[1] = options.pdp_type;
+ pdp->eua.l = 2;
if (options.pco.l > sizeof(pdp->pco_req.v)) {
SYS_ERR(DSGSN, LOGL_ERROR, 0,