diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-08-03 00:00:23 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-08-09 22:09:34 +0200 |
commit | d1bf1e11ba72a5e46c0d85b845110bd56d8d6e20 (patch) | |
tree | 5422c87b814ace5c3f2f8fc2bb228a3d6943a764 /ggsn | |
parent | a0d281db1cd2f122fb8f0adfd9e4a82e60efbd2f (diff) |
ggsn: Send proper errors in create_context_ind()
When we receive PDP context requests for unknown PDP types or if
we run out of dynamic addresses, we need to inform the SGSN that
PDP context creation failed.
Change-Id: Ibf199c1726130d27c8f80230b30ee51101c93b06
Diffstat (limited to 'ggsn')
-rw-r--r-- | ggsn/ggsn.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c index 8e7d1e3..0629f9e 100644 --- a/ggsn/ggsn.c +++ b/ggsn/ggsn.c @@ -178,6 +178,7 @@ int create_context_ind(struct pdp_t *pdp) { struct in46_addr addr; struct ippoolm_t *member; + int rc; DEBUGP(DGGSN, "Received create PDP context request\n"); @@ -192,11 +193,16 @@ int create_context_ind(struct pdp_t *pdp) pdp->qos_neg.l = pdp->qos_req.l; if (in46a_from_eua(&pdp->eua, &addr)) { - addr.v4.s_addr = 0; /* Request dynamic */ + SYS_ERR(DGGSN, LOGL_ERROR, 0, "Cannot decode EUA from MS/SGSN: %s", + osmo_hexdump(pdp->eua.v, pdp->eua.l)); + gtp_create_context_resp(gsn, pdp, GTPCAUSE_UNKNOWN_PDP); + return 0; } - if (ippool_newip(ippool, &member, &addr, 0)) { - gtp_create_context_resp(gsn, pdp, GTPCAUSE_NO_RESOURCES); + rc = ippool_newip(ippool, &member, &addr, 0); + if (rc < 0) { + SYS_ERR(DGGSN, LOGL_ERROR, 0, "Cannot allocate IP address in pool\n"); + gtp_create_context_resp(gsn, pdp, -rc); return 0; /* Allready in use, or no more available */ } @@ -208,6 +214,8 @@ int create_context_ind(struct pdp_t *pdp) if (gtp_kernel_tunnel_add(pdp) < 0) { SYS_ERR(DGGSN, LOGL_ERROR, 0, "Cannot add tunnel to kernel: %s\n", strerror(errno)); + gtp_create_context_resp(gsn, pdp, GTPCAUSE_SYS_FAIL); + return 0; } if (!send_trap(gsn, pdp, member, "imsi-ass-ip")) { /* TRAP with IP assignment */ |