[GPRS] SGSN: use correct length+data for GSN_ADDRESS
We have to copy the sin_addr.s_addr, rather than the entire sin_addr. The
latter results in the destination interpreting it as an IPv6 address, as
the only differentiator between IPv4 and IPv6 is the size of the payload
of this IE.
diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c
index f42ea8c..37ffd89 100644
--- a/openbsc/src/gprs/sgsn_libgtp.c
+++ b/openbsc/src/gprs/sgsn_libgtp.c
@@ -163,14 +163,14 @@
pdp->qos_req.l);
/* SGSN address for control plane */
- pdp->gsnlc.l = sizeof(sgsn->cfg.gtp_listenaddr);
- memcpy(pdp->gsnlc.v, &sgsn->cfg.gtp_listenaddr,
- sizeof(sgsn->cfg.gtp_listenaddr));
+ pdp->gsnlc.l = sizeof(sgsn->cfg.gtp_listenaddr.sin_addr);
+ memcpy(pdp->gsnlc.v, &sgsn->cfg.gtp_listenaddr.sin_addr,
+ sizeof(sgsn->cfg.gtp_listenaddr.sin_addr));
/* SGSN address for user plane */
- pdp->gsnlu.l = sizeof(sgsn->cfg.gtp_listenaddr);
- memcpy(pdp->gsnlu.v, &sgsn->cfg.gtp_listenaddr,
- sizeof(sgsn->cfg.gtp_listenaddr));
+ pdp->gsnlu.l = sizeof(sgsn->cfg.gtp_listenaddr.sin_addr);
+ memcpy(pdp->gsnlu.v, &sgsn->cfg.gtp_listenaddr.sin_addr,
+ sizeof(sgsn->cfg.gtp_listenaddr.sin_addr));
/* change pdp state to 'requested' */
pctx->state = PDP_STATE_CR_REQ;