aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-06-02 23:17:33 +0200
committerHarald Welte <laforge@gnumonks.org>2010-06-02 23:17:33 +0200
commit61ca7ce0069739f9da3b58967988a745a7b65bc5 (patch)
tree243172722eb41e1d58cabe3857fedf307be0cadc
parent5cc2bc37a7d5822c70e3a4654c22330ed789cc0c (diff)
[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.
-rw-r--r--openbsc/src/gprs/sgsn_libgtp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c
index f42ea8c7a..37ffd8985 100644
--- a/openbsc/src/gprs/sgsn_libgtp.c
+++ b/openbsc/src/gprs/sgsn_libgtp.c
@@ -163,14 +163,14 @@ struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn,
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;