From 61ca7ce0069739f9da3b58967988a745a7b65bc5 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 2 Jun 2010 23:17:33 +0200 Subject: [PATCH] [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. --- openbsc/src/gprs/sgsn_libgtp.c | 12 ++++++------ 1 file 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;