fixeria submitted this change.
gsup: encode_pdp_info(): fix wrong pdp_address index
The `PDP_TYPE_N_IETF_IPv4v6` case encodes two addresses: IPv4 from
`pdp_address[0]` and IPv6 from `pdp_address[1]`. The IPv4 part is
encoded correctly, but the IPv6 part checks the wrong index.
The decoder decode_pdp_address() correctly puts the IPv4 address in
`pdp_address[0]` and the IPv6 address in `pdp_address[1]`. Because
`pdp_address[0].sa_family` is `AF_INET` (not `AF_INET6`), the second
condition is always false in a proper dual-stack context, so the IPv6
part is silently dropped from every outgoing dual-stack GSUP message.
Change-Id: Ibc4a438ee7b06346839e78dc14d9d5b11b1c5bbd
---
M src/gsm/gsup.c
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index 4f0a1b5..1e4ee6a 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -689,7 +689,7 @@
pdp_addr.ietf.v4v6.v4 = pdp_info->pdp_address[0].u.sin.sin_addr.s_addr;
pdp_addr_len += sizeof(pdp_addr.ietf.v4v6.v4);
}
- if (pdp_info->pdp_address[0].u.sa.sa_family == AF_INET6) {
+ if (pdp_info->pdp_address[1].u.sa.sa_family == AF_INET6) {
memcpy(pdp_addr.ietf.v4v6.v6,
&pdp_info->pdp_address[1].u.sin6.sin6_addr,
sizeof(pdp_addr.ietf.v4v6.v6));
To view, visit change 42403. To unsubscribe, or for help writing mail filters, visit settings.