This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/24585 ) Change subject: gprs_ns2_sns: move gss->remote specific check out of add_ip4_elem/add_ip6_elem ...................................................................... gprs_ns2_sns: move gss->remote specific check out of add_ip4_elem/add_ip6_elem Allow to use the add_ip4_elem also with local elemens. Related: OS#5036 Change-Id: Ib48dfd7567467e60c5af2348924ece5cc6124206 --- M src/gb/gprs_ns2_sns.c 1 file changed, 8 insertions(+), 8 deletions(-) Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c index 20076ed..c50b2b9 100644 --- a/src/gb/gprs_ns2_sns.c +++ b/src/gb/gprs_ns2_sns.c @@ -454,15 +454,11 @@ { unsigned int i; - if (gss->remote.num_ip4 >= gss->num_max_ip4_remote) - return -NS_CAUSE_INVAL_NR_NS_VC; - /* check for duplicates */ for (i = 0; i < elems->num_ip4; i++) { if (memcmp(&elems->ip4[i], ip4, sizeof(*ip4))) continue; - /* TODO: log message duplicate */ - return -NS_CAUSE_PROTO_ERR_UNSPEC; + return -1; } elems->ip4 = talloc_realloc(gss, elems->ip4, struct gprs_ns_ie_ip4_elem, @@ -511,8 +507,6 @@ static int add_ip6_elem(struct ns2_sns_state *gss, struct ns2_sns_elems *elems, const struct gprs_ns_ie_ip6_elem *ip6) { - if (elems->num_ip6 >= gss->num_max_ip6_remote) - return -NS_CAUSE_INVAL_NR_NS_VC; elems->ip6 = talloc_realloc(gss, elems->ip6, struct gprs_ns_ie_ip6_elem, elems->num_ip6+1); @@ -671,9 +665,15 @@ * an SNS-ACK PDU with a cause code set to "Invalid number of IP4 Endpoints". */ switch (gss->ip) { case IPv4: + if (gss->remote.num_ip4 >= gss->num_max_ip4_remote) + return -NS_CAUSE_INVAL_NR_NS_VC; + /* TODO: log message duplicate */ rc = add_ip4_elem(gss, &gss->remote, ip4); break; case IPv6: + if (gss->remote.num_ip6 >= gss->num_max_ip6_remote) + return -NS_CAUSE_INVAL_NR_NS_VC; + /* TODO: log message duplicate */ rc = add_ip6_elem(gss, &gss->remote, ip6); break; default: @@ -682,7 +682,7 @@ } if (rc) - return rc; + return -NS_CAUSE_PROTO_ERR_UNSPEC; /* Upon receiving an SNS-ADD PDU containing an already configured IP endpoint the * NSE shall send an SNS-ACK PDU with the cause code "Protocol error - -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/24585 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ib48dfd7567467e60c5af2348924ece5cc6124206 Gerrit-Change-Number: 24585 Gerrit-PatchSet: 2 Gerrit-Owner: lynxis lazus <lynxis at fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210607/6ce7091d/attachment.htm>