sgsnemu: Initial support IPv4v6 PDP context type

Change-Id: If6eb2f1a5d0fb71da80e289112a67dd2faa30b4b
This commit is contained in:
Pau Espin Pedrol
2025-07-16 19:06:01 +02:00
parent 3aa81c594d
commit 5baef59ad8
3 changed files with 9 additions and 3 deletions

View File

@@ -80,7 +80,7 @@ const char *gengetopt_args_info_help[] = {
" --pingcount=INT Number of ping req to send (default=`0')", " --pingcount=INT Number of ping req to send (default=`0')",
" --pingquiet Do not print ping packet info (default=off)", " --pingquiet Do not print ping packet info (default=off)",
" --no-tx-gpdu-seq Don't transmit G-PDU sequence nums\n (default=off)", " --no-tx-gpdu-seq Don't transmit G-PDU sequence nums\n (default=off)",
" -t, --pdp-type=(v4|v6) PDP Type (default=`v4')", " -t, --pdp-type=(v4|v6|v4v6) PDP Type (default=`v4')",
0 0
}; };

View File

@@ -68,4 +68,4 @@ modeoption "pingcount" - "Number of ping req to send" int default="0" d
modeoption "pingquiet" - "Do not print ping packet info" flag dependon="pinghost" off mode="pinghost" modeoption "pingquiet" - "Do not print ping packet info" flag dependon="pinghost" off mode="pinghost"
option "no-tx-gpdu-seq" - "Don't transmit G-PDU sequence nums" flag off option "no-tx-gpdu-seq" - "Don't transmit G-PDU sequence nums" flag off
option "pdp-type" t "PDP Type" string default="v4" no typestr="(v4|v6)" option "pdp-type" t "PDP Type" string default="v4" no typestr="(v4|v6|v4v6)"

View File

@@ -925,6 +925,8 @@ static int process_options(int argc, char **argv)
options.pdp_type = PDP_EUA_TYPE_v6; options.pdp_type = PDP_EUA_TYPE_v6;
else if (!strcmp(args_info.pdp_type_arg, "v4")) else if (!strcmp(args_info.pdp_type_arg, "v4"))
options.pdp_type = PDP_EUA_TYPE_v4; options.pdp_type = PDP_EUA_TYPE_v4;
else if (!strcmp(args_info.pdp_type_arg, "v4v6"))
options.pdp_type = PDP_EUA_TYPE_v4v6;
else { else {
SYS_ERR(DSGSN, LOGL_ERROR, 0, "Unsupported/unknown PDP Type '%s'\n", SYS_ERR(DSGSN, LOGL_ERROR, 0, "Unsupported/unknown PDP Type '%s'\n",
args_info.pdp_type_arg); args_info.pdp_type_arg);
@@ -944,6 +946,9 @@ static int process_options(int argc, char **argv)
case PDP_EUA_TYPE_v6: case PDP_EUA_TYPE_v6:
hints.ai_family = AF_INET6; hints.ai_family = AF_INET6;
break; break;
case PDP_EUA_TYPE_v4v6:
hints.ai_family = AF_UNSPEC;
break;
default: default:
SYS_ERR(DSGSN, LOGL_ERROR, 0, "lookup(AF_UNSPEC) %d", options.pdp_type); SYS_ERR(DSGSN, LOGL_ERROR, 0, "lookup(AF_UNSPEC) %d", options.pdp_type);
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
@@ -1664,7 +1669,8 @@ static int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause)
} }
} }
if (options.createif && options.pdp_type == PDP_EUA_TYPE_v6) { if (options.createif && (options.pdp_type == PDP_EUA_TYPE_v6 ||
options.pdp_type == PDP_EUA_TYPE_v4v6)) {
struct in6_addr *saddr6; struct in6_addr *saddr6;
struct msgb *msg; struct msgb *msg;
if (in46a_is_v6(&addr[0])) { if (in46a_is_v6(&addr[0])) {