diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-08-03 00:00:23 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-08-03 01:35:55 +0200 |
commit | 109c14c2fab9554a8ec90f1df13f03f6f824d251 (patch) | |
tree | b0e7a78e9f1d9d318a43a05fa29c6444351dc1b2 /lib/ippool.c | |
parent | 88a37ce7021cab973c3ef09549b1b915ca766d99 (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 'lib/ippool.c')
-rw-r--r-- | lib/ippool.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/ippool.c b/lib/ippool.c index 9a3d0b3..305aae2 100644 --- a/lib/ippool.c +++ b/lib/ippool.c @@ -403,7 +403,7 @@ int ippool_newip(struct ippool_t *this, struct ippoolm_t **member, if (!this->allowstat) { SYS_ERR(DIP, LOGL_ERROR, 0, "Static IP address not allowed"); - return -1; + return -GTPCAUSE_NOT_SUPPORTED; } if (!in46a_within_mask(addr, &this->stataddr, this->stataddrprefixlen)) { SYS_ERR(DIP, LOGL_ERROR, 0, "Static out of range"); @@ -413,7 +413,7 @@ int ippool_newip(struct ippool_t *this, struct ippoolm_t **member, if (!this->allowdyn) { SYS_ERR(DIP, LOGL_ERROR, 0, "Dynamic IP address not allowed"); - return -1; + return -GTPCAUSE_NOT_SUPPORTED; } } @@ -439,7 +439,7 @@ int ippool_newip(struct ippool_t *this, struct ippoolm_t **member, if (!this->firstdyn) { SYS_ERR(DIP, LOGL_ERROR, 0, "No more IP addresses available"); - return -1; + return -GTPCAUSE_ADDR_OCCUPIED; } else p2 = this->firstdyn; } @@ -448,12 +448,12 @@ int ippool_newip(struct ippool_t *this, struct ippoolm_t **member, if (p2->inuse) { SYS_ERR(DIP, LOGL_ERROR, 0, "IP address allready in use"); - return -1; /* Allready in use / Should not happen */ + return -GTPCAUSE_SYS_FAIL; /* Allready in use / Should not happen */ } if (p2->addr.len != addr->len) { SYS_ERR(DIP, LOGL_ERROR, 0, "MS requested unsupported PDP context type"); - return -1; + return -GTPCAUSE_UNKNOWN_PDP; } /* Remove from linked list of free dynamic addresses */ @@ -482,13 +482,13 @@ int ippool_newip(struct ippool_t *this, struct ippoolm_t **member, if (!this->firststat) { SYS_ERR(DIP, LOGL_ERROR, 0, "No more IP addresses available"); - return -1; /* No more available */ + return -GTPCAUSE_ADDR_OCCUPIED; /* No more available */ } else p2 = this->firststat; if (p2->addr.len != addr->len) { SYS_ERR(DIP, LOGL_ERROR, 0, "MS requested unsupported PDP context type"); - return -1; + return -GTPCAUSE_UNKNOWN_PDP; } /* Remove from linked list of free static addresses */ @@ -513,7 +513,7 @@ int ippool_newip(struct ippool_t *this, struct ippoolm_t **member, SYS_ERR(DIP, LOGL_ERROR, 0, "Could not allocate IP address"); - return -1; /* Should never get here. TODO: Bad code */ + return -GTPCAUSE_SYS_FAIL; /* Should never get here. TODO: Bad code */ } int ippool_freeip(struct ippool_t *this, struct ippoolm_t *member) |