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/.
lynxis lazus gerrit-no-reply at lists.osmocom.orglynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/22197 ) Change subject: gprs_ns2: check if persistent nsei or nsvc exists when creating dynamic NSE ...................................................................... gprs_ns2: check if persistent nsei or nsvc exists when creating dynamic NSE When receiving a NS Reset over an unknown NSVC the NS code would create a dynamic NSE. If the NSEI or NSVCI is already configured to a persistant NSE/NSVC the packet should be ignored. Related: SYS#5208 Change-Id: I855911e7d364f2e5b08ea05857747aa63fcf1cd3 --- M src/gb/gprs_ns2.c 1 file changed, 34 insertions(+), 4 deletions(-) Approvals: daniel: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c index 3ca87a4..7f43cf0 100644 --- a/src/gb/gprs_ns2.c +++ b/src/gb/gprs_ns2.c @@ -861,18 +861,49 @@ return GPRS_NS2_CS_REJECTED; } - /* find or create NSE */ nsei = tlvp_val16be(&tp, NS_IE_NSEI); + nsvci = tlvp_val16be(&tp, NS_IE_VCI); + + /* find or create NSE */ nse = gprs_ns2_nse_by_nsei(bind->nsi, nsei); if (!nse) { - if (!bind->nsi->create_nse) { + /* only create nse for udp & ipaccess */ + if (bind->ll != GPRS_NS2_LL_UDP || dialect != NS2_DIALECT_IPACCESS) return GPRS_NS2_CS_SKIPPED; - } + + if (!bind->nsi->create_nse || !bind->accept_ipaccess) + return GPRS_NS2_CS_SKIPPED; nse = gprs_ns2_create_nse(bind->nsi, nsei, bind->ll, dialect); if (!nse) { + LOGP(DLNS, LOGL_ERROR, "Failed to create NSE(%05u)\n", nsei); return GPRS_NS2_CS_ERROR; } + } else { + /* nsei already known */ + if (nse->ll != bind->ll) { + LOGP(DLNS, LOGL_ERROR, "Received NS-RESET NS-VCI(%05u) with wrong linklayer(%s) for already known NSE(%05u/%s)\n", + nsei, gprs_ns2_lltype_str(bind->ll), nse->nsei, gprs_ns2_lltype_str(nse->ll)); + return GPRS_NS2_CS_SKIPPED; + } + } + + nsvc = gprs_ns2_nsvc_by_nsvci(bind->nsi, nsvci); + if (nsvc) { + if (nsvc->persistent) { + LOGP(DLNS, LOGL_ERROR, "Received NS-RESET for a persistent NSE(%05u) NS-VCI(%05u) over wrong connection.\n", + nsei, nsvci); + return GPRS_NS2_CS_SKIPPED; + } + /* destroy old dynamic nsvc */ + gprs_ns2_free_nsvc(nsvc); + } + + /* do nse persistent check late to be more precise on the error message */ + if (nse->persistent) { + LOGP(DLNS, LOGL_ERROR, "Received NS-RESET for a persistent NSE(%05u) but the unknown NS-VCI(%05u)\n", + nsei, nsvci); + return GPRS_NS2_CS_SKIPPED; } vc_mode = gprs_ns2_dialect_to_vc_mode(dialect); @@ -880,7 +911,6 @@ if (!nsvc) return GPRS_NS2_CS_SKIPPED; - nsvci = tlvp_val16be(&tp, NS_IE_VCI); nsvc->nsvci = nsvci; nsvc->nsvci_is_valid = true; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/22197 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I855911e7d364f2e5b08ea05857747aa63fcf1cd3 Gerrit-Change-Number: 22197 Gerrit-PatchSet: 3 Gerrit-Owner: lynxis lazus <lynxis at fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210117/232001dc/attachment.htm>