lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

January 2023

  • 1 participants
  • 2205 discussions
Change in osmo-sgsn[master]: Move sgsn_pdp_ctx to its own file pdpctx.{c,h}
by Jenkins Builder 05 Jan '23

05 Jan '23
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30891 ) Change subject: Move sgsn_pdp_ctx to its own file pdpctx.{c,h} ...................................................................... Patch Set 1: (2 comments) File include/osmocom/sgsn/pdpctx.h: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-2485): https://gerrit.osmocom.org/c/osmo-sgsn/+/30891/comment/fd8e604c_fb1d17f4 PS1, Line 60: char *apn_subscribed; please, no space before tabs Robot Comment from checkpatch (run ID jenkins-gerrit-lint-2485): https://gerrit.osmocom.org/c/osmo-sgsn/+/30891/comment/40c4f48b_5581fbed PS1, Line 61: //char *apn_used; please, no space before tabs -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30891 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: Iad4da06efee7d8514ff48423bdaebc0f26413cc1 Gerrit-Change-Number: 30891 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Thu, 05 Jan 2023 19:14:58 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Change in osmo-sgsn[master]: Move sgsn_pdp_ctx to its own file pdpctx.{c,h}
by pespin 05 Jan '23

05 Jan '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30891 ) Change subject: Move sgsn_pdp_ctx to its own file pdpctx.{c,h} ...................................................................... Move sgsn_pdp_ctx to its own file pdpctx.{c,h} This further shrinks the mess in gprs_sgsn.h, and allows to easily see layer violations (like pdpctx.c requiring llc.h) Change-Id: Iad4da06efee7d8514ff48423bdaebc0f26413cc1 --- M include/osmocom/sgsn/Makefile.am M include/osmocom/sgsn/gprs_sgsn.h A include/osmocom/sgsn/pdpctx.h M include/osmocom/sgsn/sgsn.h M src/sgsn/Makefile.am M src/sgsn/gprs_gmm.c M src/sgsn/gprs_mm_state_iu_fsm.c M src/sgsn/gprs_ranap.c M src/sgsn/gprs_sgsn.c M src/sgsn/gprs_sm.c M src/sgsn/gtp_ggsn.c A src/sgsn/pdpctx.c M src/sgsn/sgsn_cdr.c M src/sgsn/sgsn_ctrl.c M src/sgsn/sgsn_libgtp.c M src/sgsn/sgsn_vty.c M tests/sgsn/Makefile.am 17 files changed, 272 insertions(+), 193 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/91/30891/1 diff --git a/include/osmocom/sgsn/Makefile.am b/include/osmocom/sgsn/Makefile.am index 4d43c6d..a3bc218 100644 --- a/include/osmocom/sgsn/Makefile.am +++ b/include/osmocom/sgsn/Makefile.am @@ -26,6 +26,7 @@ gtphub.h \ gtp_ggsn.h \ gtp_mme.h \ + pdpctx.h \ sgsn.h \ sgsn_rim.h \ signal.h \ diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h index 8aaabfd..3fdf45d 100644 --- a/include/osmocom/sgsn/gprs_sgsn.h +++ b/include/osmocom/sgsn/gprs_sgsn.h @@ -23,6 +23,7 @@ struct ctrl_handle; struct gprs_subscr; struct sgsn_ggsn_ctx; +struct sgsn_pdp_ctx; enum gsm48_gsm_cause; @@ -40,13 +41,6 @@ GMM_CTR_RA_UPDATE, }; -enum gprs_pdp_ctx { - PDP_CTR_PKTS_UDATA_IN, - PDP_CTR_PKTS_UDATA_OUT, - PDP_CTR_BYTES_UDATA_IN, - PDP_CTR_BYTES_UDATA_OUT, -}; - enum gprs_t3350_mode { GMM_T3350_MODE_NONE, GMM_T3350_MODE_ATT, @@ -291,64 +285,6 @@ enum gsm48_gsm_cause *gsm_cause, char *apn_str); -enum pdp_ctx_state { - PDP_STATE_NONE, - PDP_STATE_CR_REQ, - PDP_STATE_CR_CONF, - - /* 04.08 / Figure 6.2 / 6.1.2.2 */ - PDP_STATE_INACT_PEND, - PDP_STATE_INACTIVE = PDP_STATE_NONE, -}; - -enum pdp_type { - PDP_TYPE_NONE, - PDP_TYPE_ETSI_PPP, - PDP_TYPE_IANA_IPv4, - PDP_TYPE_IANA_IPv6, -}; - -struct sgsn_pdp_ctx { - struct llist_head list; /* list_head for mmctx->pdp_list */ - struct llist_head g_list; /* list_head for global list */ - struct sgsn_mm_ctx *mm; /* back pointer to MM CTX */ - int destroy_ggsn; /* destroy it on destruction */ - struct sgsn_ggsn_ctx *ggsn; /* which GGSN serves this PDP */ - struct llist_head ggsn_list; /* list_head for ggsn->pdp_list */ - struct rate_ctr_group *ctrg; - - //unsigned int id; - struct pdp_t *lib; /* pointer to libgtp PDP ctx */ - enum pdp_ctx_state state; - enum pdp_type type; - uint32_t address; - char *apn_subscribed; - //char *apn_used; - uint16_t nsapi; /* SNDCP */ - uint16_t sapi; /* LLC */ - uint8_t ti; /* transaction identifier */ - int vplmn_allowed; - uint32_t qos_profile_subscr; - //uint32_t qos_profile_req; - //uint32_t qos_profile_neg; - uint8_t radio_prio; - //uint32_t charging_id; - - struct osmo_timer_list timer; - unsigned int T; /* Txxxx number */ - unsigned int num_T_exp; /* number of consecutive T expirations */ - - struct osmo_timer_list cdr_timer; /* CDR record wird timer */ - struct timespec cdr_start; /* The start of the CDR */ - uint64_t cdr_bytes_in; - uint64_t cdr_bytes_out; - uint32_t cdr_charging_id; -}; - -#define LOGPDPCTXP(level, pdp, fmt, args...) \ - LOGP(DGPRS, level, "PDP(%s/%u) " \ - fmt, (pdp)->mm ? (pdp)->mm->imsi : "---", (pdp)->ti, ## args) - /* look up PDP context by MM context and NSAPI */ struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_nsapi(const struct sgsn_mm_ctx *mm, uint8_t nsapi); @@ -356,19 +292,10 @@ struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_tid(const struct sgsn_mm_ctx *mm, uint8_t tid); -struct sgsn_pdp_ctx *sgsn_pdp_ctx_alloc(struct sgsn_mm_ctx *mm, - struct sgsn_ggsn_ctx *ggsn, - uint8_t nsapi); -void sgsn_pdp_ctx_terminate(struct sgsn_pdp_ctx *pdp); -void sgsn_pdp_ctx_free(struct sgsn_pdp_ctx *pdp); - extern struct llist_head sgsn_mm_ctxts; -extern struct llist_head sgsn_pdp_ctxts; uint32_t sgsn_alloc_ptmsi(void); -char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len, bool return_ipv6); - /* * ctrl interface related work */ diff --git a/include/osmocom/sgsn/pdpctx.h b/include/osmocom/sgsn/pdpctx.h new file mode 100644 index 0000000..f537679 --- /dev/null +++ b/include/osmocom/sgsn/pdpctx.h @@ -0,0 +1,96 @@ +#pragma once + +#include <stdint.h> +#include <netinet/in.h> +#include <inttypes.h> + +#include <osmocom/core/timer.h> +#include <osmocom/core/rate_ctr.h> + +#include <osmocom/gsm/gsm48.h> + +#include <osmocom/crypt/gprs_cipher.h> +#include <osmocom/gsm/protocol/gsm_23_003.h> +#include <osmocom/crypt/auth.h> + +#include <osmocom/sgsn/apn.h> +#include <osmocom/sgsn/gprs_subscriber.h> + +struct sgsn_mm_ctx; +struct sgsn_ggsn_ctx; + +enum gprs_pdp_ctx { + PDP_CTR_PKTS_UDATA_IN, + PDP_CTR_PKTS_UDATA_OUT, + PDP_CTR_BYTES_UDATA_IN, + PDP_CTR_BYTES_UDATA_OUT, +}; + +enum pdp_ctx_state { + PDP_STATE_NONE, + PDP_STATE_CR_REQ, + PDP_STATE_CR_CONF, + + /* 04.08 / Figure 6.2 / 6.1.2.2 */ + PDP_STATE_INACT_PEND, + PDP_STATE_INACTIVE = PDP_STATE_NONE, +}; + +enum pdp_type { + PDP_TYPE_NONE, + PDP_TYPE_ETSI_PPP, + PDP_TYPE_IANA_IPv4, + PDP_TYPE_IANA_IPv6, +}; + +struct sgsn_pdp_ctx { + struct llist_head list; /* list_head for mmctx->pdp_list */ + struct llist_head g_list; /* list_head for global list */ + struct sgsn_mm_ctx *mm; /* back pointer to MM CTX */ + int destroy_ggsn; /* destroy it on destruction */ + struct sgsn_ggsn_ctx *ggsn; /* which GGSN serves this PDP */ + struct llist_head ggsn_list; /* list_head for ggsn->pdp_list */ + struct rate_ctr_group *ctrg; + + //unsigned int id; + struct pdp_t *lib; /* pointer to libgtp PDP ctx */ + enum pdp_ctx_state state; + enum pdp_type type; + uint32_t address; + char *apn_subscribed; + //char *apn_used; + uint16_t nsapi; /* SNDCP */ + uint16_t sapi; /* LLC */ + uint8_t ti; /* transaction identifier */ + int vplmn_allowed; + uint32_t qos_profile_subscr; + //uint32_t qos_profile_req; + //uint32_t qos_profile_neg; + uint8_t radio_prio; + //uint32_t charging_id; + + struct osmo_timer_list timer; + unsigned int T; /* Txxxx number */ + unsigned int num_T_exp; /* number of consecutive T expirations */ + + struct osmo_timer_list cdr_timer; /* CDR record wird timer */ + struct timespec cdr_start; /* The start of the CDR */ + uint64_t cdr_bytes_in; + uint64_t cdr_bytes_out; + uint32_t cdr_charging_id; +}; + +#define LOGPDPCTXP(level, pdp, fmt, args...) \ + LOGP(DGPRS, level, "PDP(%s/%u) " \ + fmt, (pdp)->mm ? (pdp)->mm->imsi : "---", (pdp)->ti, ## args) + +struct sgsn_pdp_ctx *sgsn_pdp_ctx_alloc(struct sgsn_mm_ctx *mm, + struct sgsn_ggsn_ctx *ggsn, + uint8_t nsapi); +void sgsn_pdp_ctx_terminate(struct sgsn_pdp_ctx *pdp); +void sgsn_pdp_ctx_free(struct sgsn_pdp_ctx *pdp); + +extern struct llist_head sgsn_pdp_ctxts; + +char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len, bool return_ipv6); + diff --git a/include/osmocom/sgsn/sgsn.h b/include/osmocom/sgsn/sgsn.h index 0bc88a9..4326846 100644 --- a/include/osmocom/sgsn/sgsn.h +++ b/include/osmocom/sgsn/sgsn.h @@ -159,6 +159,7 @@ }; extern struct sgsn_instance *sgsn; +extern void *tall_sgsn_ctx; /* sgsn_vty.c */ diff --git a/src/sgsn/Makefile.am b/src/sgsn/Makefile.am index ba752ad..75f9608 100644 --- a/src/sgsn/Makefile.am +++ b/src/sgsn/Makefile.am @@ -62,6 +62,7 @@ sgsn_libgtp.c \ gprs_llc.c \ gprs_llc_vty.c \ + pdpctx.c \ sgsn_ctrl.c \ sgsn_auth.c \ gprs_subscriber.c \ diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c index b385ff1..3b805ee 100644 --- a/src/sgsn/gprs_gmm.c +++ b/src/sgsn/gprs_gmm.c @@ -62,6 +62,7 @@ #include <osmocom/sgsn/gprs_ranap.h> #include <osmocom/sgsn/gprs_sm.h> #include <osmocom/sgsn/gtp.h> +#include <osmocom/sgsn/pdpctx.h> #include <pdp.h> diff --git a/src/sgsn/gprs_mm_state_iu_fsm.c b/src/sgsn/gprs_mm_state_iu_fsm.c index d0e9ffc..597507c 100644 --- a/src/sgsn/gprs_mm_state_iu_fsm.c +++ b/src/sgsn/gprs_mm_state_iu_fsm.c @@ -30,6 +30,7 @@ #include <osmocom/sgsn/sgsn.h> #include <osmocom/sgsn/gprs_ranap.h> #include <osmocom/sgsn/gtp.h> +#include <osmocom/sgsn/pdpctx.h> #define X(s) (1 << (s)) diff --git a/src/sgsn/gprs_ranap.c b/src/sgsn/gprs_ranap.c index af1a61c..245de4b 100644 --- a/src/sgsn/gprs_ranap.c +++ b/src/sgsn/gprs_ranap.c @@ -39,6 +39,7 @@ #include <osmocom/sgsn/gprs_mm_state_iu_fsm.h> #include <osmocom/sgsn/gtp_ggsn.h> #include <osmocom/sgsn/gtp.h> +#include <osmocom/sgsn/pdpctx.h> /* Send RAB activation requests for all PDP contexts */ void activate_pdp_rabs(struct sgsn_mm_ctx *ctx) diff --git a/src/sgsn/gprs_sgsn.c b/src/sgsn/gprs_sgsn.c index 42d1ece..20cf82f 100644 --- a/src/sgsn/gprs_sgsn.c +++ b/src/sgsn/gprs_sgsn.c @@ -52,6 +52,7 @@ #include <osmocom/sgsn/gprs_sndcp.h> #include <osmocom/sgsn/gtp_ggsn.h> #include <osmocom/sgsn/gtp.h> +#include <osmocom/sgsn/pdpctx.h> #include <pdp.h> @@ -66,7 +67,6 @@ extern struct osmo_tdef sgsn_T_defs[]; LLIST_HEAD(sgsn_mm_ctxts); -LLIST_HEAD(sgsn_pdp_ctxts); const struct value_string sgsn_ran_type_names[] = { { MM_CTX_T_GERAN_Gb, "GPRS/EDGE via Gb" }, @@ -99,21 +99,6 @@ .class_id = OSMO_STATS_CLASS_SUBSCRIBER, }; -static const struct rate_ctr_desc pdpctx_ctr_description[] = { - { "udata:packets:in", "User Data Messages ( In)" }, - { "udata:packets:out", "User Data Messages (Out)" }, - { "udata:bytes:in", "User Data Bytes ( In)" }, - { "udata:bytes:out", "User Data Bytes (Out)" }, -}; - -static const struct rate_ctr_group_desc pdpctx_ctrg_desc = { - .group_name_prefix = "sgsn:pdpctx", - .group_description = "SGSN PDP Context Statistics", - .num_ctr = ARRAY_SIZE(pdpctx_ctr_description), - .ctr_desc = pdpctx_ctr_description, - .class_id = OSMO_STATS_CLASS_SUBSCRIBER, -}; - static const struct rate_ctr_desc sgsn_ctr_description[] = { { "llc:dl_bytes", "Count sent LLC bytes before giving it to the bssgp layer" }, { "llc:ul_bytes", "Count successful received LLC bytes (encrypt & fcs correct)" }, @@ -431,109 +416,6 @@ return NULL; } -/* you don't want to use this directly, call sgsn_create_pdp_ctx() */ -struct sgsn_pdp_ctx *sgsn_pdp_ctx_alloc(struct sgsn_mm_ctx *mm, - struct sgsn_ggsn_ctx *ggsn, - uint8_t nsapi) -{ - struct sgsn_pdp_ctx *pdp; - - pdp = sgsn_pdp_ctx_by_nsapi(mm, nsapi); - if (pdp) - return NULL; - - pdp = talloc_zero(tall_sgsn_ctx, struct sgsn_pdp_ctx); - if (!pdp) - return NULL; - - pdp->mm = mm; - pdp->ggsn = ggsn; - pdp->nsapi = nsapi; - pdp->ctrg = rate_ctr_group_alloc(pdp, &pdpctx_ctrg_desc, nsapi); - if (!pdp->ctrg) { - LOGPDPCTXP(LOGL_ERROR, pdp, "Error allocation counter group\n"); - talloc_free(pdp); - return NULL; - } - llist_add(&pdp->list, &mm->pdp_list); - sgsn_ggsn_ctx_add_pdp(pdp->ggsn, pdp); - llist_add(&pdp->g_list, &sgsn_pdp_ctxts); - - return pdp; -} - -/* - * This function will not trigger any GSM DEACT PDP ACK messages, so you - * probably want to call sgsn_delete_pdp_ctx() instead if the connection - * isn't detached already. - */ -void sgsn_pdp_ctx_terminate(struct sgsn_pdp_ctx *pdp) -{ - struct sgsn_signal_data sig_data; - - OSMO_ASSERT(pdp->mm != NULL); - - /* There might still be pending callbacks in libgtp. So the parts of - * this object relevant to GTP need to remain intact in this case. */ - - LOGPDPCTXP(LOGL_INFO, pdp, "Forcing release of PDP context\n"); - - if (pdp->mm->ran_type == MM_CTX_T_GERAN_Gb) { - /* Force the deactivation of the SNDCP layer */ - if (pdp->mm->gb.llme) - sndcp_sm_deactivate_ind(&pdp->mm->gb.llme->lle[pdp->sapi], pdp->nsapi); - } - - memset(&sig_data, 0, sizeof(sig_data)); - sig_data.pdp = pdp; - osmo_signal_dispatch(SS_SGSN, S_SGSN_PDP_TERMINATE, &sig_data); - - /* Detach from MM context */ - pdp_ctx_detach_mm_ctx(pdp); - if (pdp->ggsn) - sgsn_delete_pdp_ctx(pdp); -} - -/* - * Don't call this function directly unless you know what you are doing. - * In normal conditions use sgsn_delete_pdp_ctx and in unspecified or - * implementation dependent abnormal ones sgsn_pdp_ctx_terminate. - */ -void sgsn_pdp_ctx_free(struct sgsn_pdp_ctx *pdp) -{ - struct sgsn_signal_data sig_data; - - memset(&sig_data, 0, sizeof(sig_data)); - sig_data.pdp = pdp; - osmo_signal_dispatch(SS_SGSN, S_SGSN_PDP_FREE, &sig_data); - - if (osmo_timer_pending(&pdp->timer)) { - LOGPDPCTXP(LOGL_ERROR, pdp, "Freeing PDP ctx with timer %u pending\n", pdp->T); - osmo_timer_del(&pdp->timer); - } - - rate_ctr_group_free(pdp->ctrg); - if (pdp->mm) - llist_del(&pdp->list); - if (pdp->ggsn) - sgsn_ggsn_ctx_remove_pdp(pdp->ggsn, pdp); - llist_del(&pdp->g_list); - - /* _if_ we still have a library handle, at least set it to NULL - * to avoid any dereferences of the now-deleted PDP context from - * sgsn_libgtp:cb_data_ind() */ - if (pdp->lib) { - struct pdp_t *lib = pdp->lib; - LOGPDPCTXP(LOGL_NOTICE, pdp, "freeing PDP context that still " - "has a libgtp handle attached to it, this shouldn't " - "happen!\n"); - osmo_generate_backtrace(); - lib->priv = NULL; - } - - talloc_free(pdp); -} - uint32_t sgsn_alloc_ptmsi(void) { struct sgsn_mm_ctx *mm; diff --git a/src/sgsn/gprs_sm.c b/src/sgsn/gprs_sm.c index 157e279..c53fe53 100644 --- a/src/sgsn/gprs_sm.c +++ b/src/sgsn/gprs_sm.c @@ -43,6 +43,7 @@ #include <osmocom/sgsn/gprs_sndcp.h> #include <osmocom/sgsn/gprs_ranap.h> #include <osmocom/sgsn/gtp.h> +#include <osmocom/sgsn/pdpctx.h> extern void *tall_sgsn_ctx; diff --git a/src/sgsn/gtp_ggsn.c b/src/sgsn/gtp_ggsn.c index 9c63d71..add0306 100644 --- a/src/sgsn/gtp_ggsn.c +++ b/src/sgsn/gtp_ggsn.c @@ -34,6 +34,7 @@ #include <osmocom/sgsn/debug.h> #include <osmocom/sgsn/gprs_gmm_fsm.h> #include <osmocom/sgsn/gprs_sm.h> +#include <osmocom/sgsn/pdpctx.h> extern void *tall_sgsn_ctx; diff --git a/src/sgsn/pdpctx.c b/src/sgsn/pdpctx.c new file mode 100644 index 0000000..52b1c0f --- /dev/null +++ b/src/sgsn/pdpctx.c @@ -0,0 +1,160 @@ +/* PDP context functionality */ + +/* (C) 2009 by Harald Welte <laforge(a)gnumonks.org> + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <stdint.h> + +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/talloc.h> +#include <osmocom/core/timer.h> +#include <osmocom/core/rate_ctr.h> +#include <osmocom/core/stats.h> + +#include <osmocom/sgsn/pdpctx.h> +#include <osmocom/sgsn/gprs_sgsn.h> +#include <osmocom/sgsn/sgsn.h> +#include <osmocom/sgsn/debug.h> +#include <osmocom/sgsn/signal.h> +#include <osmocom/sgsn/gtp_ggsn.h> +#include <osmocom/sgsn/gprs_llc_xid.h> +#include <osmocom/sgsn/gprs_sndcp.h> +#include <osmocom/sgsn/gprs_llc.h> +#include <osmocom/sgsn/gprs_sm.h> +#include <osmocom/sgsn/gtp.h> + +LLIST_HEAD(sgsn_pdp_ctxts); + +static const struct rate_ctr_desc pdpctx_ctr_description[] = { + { "udata:packets:in", "User Data Messages ( In)" }, + { "udata:packets:out", "User Data Messages (Out)" }, + { "udata:bytes:in", "User Data Bytes ( In)" }, + { "udata:bytes:out", "User Data Bytes (Out)" }, +}; + +static const struct rate_ctr_group_desc pdpctx_ctrg_desc = { + .group_name_prefix = "sgsn:pdpctx", + .group_description = "SGSN PDP Context Statistics", + .num_ctr = ARRAY_SIZE(pdpctx_ctr_description), + .ctr_desc = pdpctx_ctr_description, + .class_id = OSMO_STATS_CLASS_SUBSCRIBER, +}; + +/* you don't want to use this directly, call sgsn_create_pdp_ctx() */ +struct sgsn_pdp_ctx *sgsn_pdp_ctx_alloc(struct sgsn_mm_ctx *mm, + struct sgsn_ggsn_ctx *ggsn, + uint8_t nsapi) +{ + struct sgsn_pdp_ctx *pdp; + + pdp = sgsn_pdp_ctx_by_nsapi(mm, nsapi); + if (pdp) + return NULL; + + pdp = talloc_zero(tall_sgsn_ctx, struct sgsn_pdp_ctx); + if (!pdp) + return NULL; + + pdp->mm = mm; + pdp->ggsn = ggsn; + pdp->nsapi = nsapi; + pdp->ctrg = rate_ctr_group_alloc(pdp, &pdpctx_ctrg_desc, nsapi); + if (!pdp->ctrg) { + LOGPDPCTXP(LOGL_ERROR, pdp, "Error allocation counter group\n"); + talloc_free(pdp); + return NULL; + } + llist_add(&pdp->list, &mm->pdp_list); + sgsn_ggsn_ctx_add_pdp(pdp->ggsn, pdp); + llist_add(&pdp->g_list, &sgsn_pdp_ctxts); + + return pdp; +} + +/* + * This function will not trigger any GSM DEACT PDP ACK messages, so you + * probably want to call sgsn_delete_pdp_ctx() instead if the connection + * isn't detached already. + */ +void sgsn_pdp_ctx_terminate(struct sgsn_pdp_ctx *pdp) +{ + struct sgsn_signal_data sig_data; + + OSMO_ASSERT(pdp->mm != NULL); + + /* There might still be pending callbacks in libgtp. So the parts of + * this object relevant to GTP need to remain intact in this case. */ + + LOGPDPCTXP(LOGL_INFO, pdp, "Forcing release of PDP context\n"); + + if (pdp->mm->ran_type == MM_CTX_T_GERAN_Gb) { + /* Force the deactivation of the SNDCP layer */ + if (pdp->mm->gb.llme) + sndcp_sm_deactivate_ind(&pdp->mm->gb.llme->lle[pdp->sapi], pdp->nsapi); + } + + memset(&sig_data, 0, sizeof(sig_data)); + sig_data.pdp = pdp; + osmo_signal_dispatch(SS_SGSN, S_SGSN_PDP_TERMINATE, &sig_data); + + /* Detach from MM context */ + pdp_ctx_detach_mm_ctx(pdp); + if (pdp->ggsn) + sgsn_delete_pdp_ctx(pdp); +} + +/* + * Don't call this function directly unless you know what you are doing. + * In normal conditions use sgsn_delete_pdp_ctx and in unspecified or + * implementation dependent abnormal ones sgsn_pdp_ctx_terminate. + */ +void sgsn_pdp_ctx_free(struct sgsn_pdp_ctx *pdp) +{ + struct sgsn_signal_data sig_data; + + memset(&sig_data, 0, sizeof(sig_data)); + sig_data.pdp = pdp; + osmo_signal_dispatch(SS_SGSN, S_SGSN_PDP_FREE, &sig_data); + + if (osmo_timer_pending(&pdp->timer)) { + LOGPDPCTXP(LOGL_ERROR, pdp, "Freeing PDP ctx with timer %u pending\n", pdp->T); + osmo_timer_del(&pdp->timer); + } + + rate_ctr_group_free(pdp->ctrg); + if (pdp->mm) + llist_del(&pdp->list); + if (pdp->ggsn) + sgsn_ggsn_ctx_remove_pdp(pdp->ggsn, pdp); + llist_del(&pdp->g_list); + + /* _if_ we still have a library handle, at least set it to NULL + * to avoid any dereferences of the now-deleted PDP context from + * sgsn_libgtp:cb_data_ind() */ + if (pdp->lib) { + struct pdp_t *lib = pdp->lib; + LOGPDPCTXP(LOGL_NOTICE, pdp, "freeing PDP context that still " + "has a libgtp handle attached to it, this shouldn't " + "happen!\n"); + osmo_generate_backtrace(); + lib->priv = NULL; + } + + talloc_free(pdp); +} diff --git a/src/sgsn/sgsn_cdr.c b/src/sgsn/sgsn_cdr.c index ac0a6fd..1f7ce5e 100644 --- a/src/sgsn/sgsn_cdr.c +++ b/src/sgsn/sgsn_cdr.c @@ -28,6 +28,7 @@ #include <osmocom/sgsn/vty.h> #include <osmocom/sgsn/gtp_ggsn.h> +#include <osmocom/sgsn/pdpctx.h> #include <gtp.h> #include <pdp.h> diff --git a/src/sgsn/sgsn_ctrl.c b/src/sgsn/sgsn_ctrl.c index 278857f..2ba06ba 100644 --- a/src/sgsn/sgsn_ctrl.c +++ b/src/sgsn/sgsn_ctrl.c @@ -22,9 +22,11 @@ #include <osmocom/ctrl/control_if.h> #include <osmocom/ctrl/control_cmd.h> #include <osmocom/sgsn/gprs_sgsn.h> +#include <osmocom/sgsn/pdpctx.h> #include <osmocom/sgsn/sgsn.h> #include <osmocom/sgsn/debug.h> + #include <pdp.h> static int get_subscriber_list(struct ctrl_cmd *cmd, void *d) diff --git a/src/sgsn/sgsn_libgtp.c b/src/sgsn/sgsn_libgtp.c index f848e57..c6eff34 100644 --- a/src/sgsn/sgsn_libgtp.c +++ b/src/sgsn/sgsn_libgtp.c @@ -59,6 +59,7 @@ #include <osmocom/sgsn/gtp_mme.h> #include <osmocom/sgsn/sgsn_rim.h> #include <osmocom/sgsn/gprs_bssgp.h> +#include <osmocom/sgsn/pdpctx.h> #include <gtp.h> #include <pdp.h> diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c index b6d03cf..3079dfc 100644 --- a/src/sgsn/sgsn_vty.c +++ b/src/sgsn/sgsn_vty.c @@ -42,6 +42,7 @@ #include <osmocom/sgsn/gtp_ggsn.h> #include <osmocom/sgsn/gtp_mme.h> #include <osmocom/sgsn/vty.h> +#include <osmocom/sgsn/pdpctx.h> #include <osmocom/gsupclient/gsup_client.h> #include <osmocom/vty/tdef_vty.h> diff --git a/tests/sgsn/Makefile.am b/tests/sgsn/Makefile.am index 853d8f1..8df1395 100644 --- a/tests/sgsn/Makefile.am +++ b/tests/sgsn/Makefile.am @@ -60,6 +60,7 @@ $(top_builddir)/src/sgsn/gprs_sgsn.o \ $(top_builddir)/src/sgsn/gtp_ggsn.o \ $(top_builddir)/src/sgsn/gtp_mme.o \ + $(top_builddir)/src/sgsn/pdpctx.o \ $(top_builddir)/src/sgsn/sgsn_cdr.o \ $(top_builddir)/src/sgsn/sgsn_ctrl.o \ $(top_builddir)/src/sgsn/sgsn_vty.o \ -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30891 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: Iad4da06efee7d8514ff48423bdaebc0f26413cc1 Gerrit-Change-Number: 30891 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-sgsn[master]: gtp_{ggsn,mme}: Allocate contexts under struct sgsn_instance
by pespin 05 Jan '23

05 Jan '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30890 ) Change subject: gtp_{ggsn,mme}: Allocate contexts under struct sgsn_instance ...................................................................... gtp_{ggsn,mme}: Allocate contexts under struct sgsn_instance This way apns are managed by the lifcycle of the main global struct sgsn_instance automatically. Change-Id: Ie65d59632a368c6957c33dca64e856ace792b2c6 --- M src/sgsn/gtp_ggsn.c M src/sgsn/gtp_mme.c 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/90/30890/1 diff --git a/src/sgsn/gtp_ggsn.c b/src/sgsn/gtp_ggsn.c index be07d13..9c63d71 100644 --- a/src/sgsn/gtp_ggsn.c +++ b/src/sgsn/gtp_ggsn.c @@ -63,7 +63,7 @@ { struct sgsn_ggsn_ctx *ggc; - ggc = talloc_zero(tall_sgsn_ctx, struct sgsn_ggsn_ctx); + ggc = talloc_zero(sgsn, struct sgsn_ggsn_ctx); if (!ggc) return NULL; diff --git a/src/sgsn/gtp_mme.c b/src/sgsn/gtp_mme.c index 4fe804d..948e8e8 100644 --- a/src/sgsn/gtp_mme.c +++ b/src/sgsn/gtp_mme.c @@ -39,7 +39,7 @@ struct sgsn_mme_ctx *sgsn_mme_ctx_alloc(struct sgsn_instance *sgsn, const char *name) { struct sgsn_mme_ctx *mme; - mme = talloc_zero(tall_sgsn_ctx, struct sgsn_mme_ctx); + mme = talloc_zero(sgsn, struct sgsn_mme_ctx); if (!mme) return NULL; -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30890 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: Ie65d59632a368c6957c33dca64e856ace792b2c6 Gerrit-Change-Number: 30890 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-sgsn[master]: Move global apn_list inside struct sgsn_instance
by pespin 05 Jan '23

05 Jan '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30889 ) Change subject: Move global apn_list inside struct sgsn_instance ...................................................................... Move global apn_list inside struct sgsn_instance This way apns are managed by the lifcycle of the main global struct sgsn_instance automatically. Change-Id: I8cc8e540cfb64d0f130e9c0aaedf7b0835f8fe16 --- M include/osmocom/sgsn/apn.h M include/osmocom/sgsn/sgsn.h M src/sgsn/apn.c M src/sgsn/gprs_sgsn.c M src/sgsn/sgsn_vty.c M tests/sgsn/sgsn_test.c 6 files changed, 12 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/89/30889/1 diff --git a/include/osmocom/sgsn/apn.h b/include/osmocom/sgsn/apn.h index adf62e2..3dc7a70 100644 --- a/include/osmocom/sgsn/apn.h +++ b/include/osmocom/sgsn/apn.h @@ -6,8 +6,6 @@ #define GSM_APN_LENGTH 102 -extern struct llist_head sgsn_apn_ctxts; - struct apn_ctx { struct llist_head list; struct sgsn_ggsn_ctx *ggsn; diff --git a/include/osmocom/sgsn/sgsn.h b/include/osmocom/sgsn/sgsn.h index 7e78eee..0bc88a9 100644 --- a/include/osmocom/sgsn/sgsn.h +++ b/include/osmocom/sgsn/sgsn.h @@ -151,6 +151,7 @@ struct rate_ctr_group *rate_ctrs; + struct llist_head apn_list; /* list of struct sgsn_apn_ctx */ struct llist_head ggsn_list; /* list of struct sgsn_ggsn_ctx */ struct llist_head mme_list; /* list of struct sgsn_mme_ctx */ diff --git a/src/sgsn/apn.c b/src/sgsn/apn.c index d6d5372..8ed523e 100644 --- a/src/sgsn/apn.c +++ b/src/sgsn/apn.c @@ -25,22 +25,21 @@ #include <talloc.h> #include <osmocom/sgsn/apn.h> +#include <osmocom/sgsn/sgsn.h> extern void *tall_sgsn_ctx; -LLIST_HEAD(sgsn_apn_ctxts); - static struct apn_ctx *sgsn_apn_ctx_alloc(const char *ap_name, const char *imsi_prefix) { struct apn_ctx *actx; - actx = talloc_zero(tall_sgsn_ctx, struct apn_ctx); + actx = talloc_zero(sgsn, struct apn_ctx); if (!actx) return NULL; actx->name = talloc_strdup(actx, ap_name); actx->imsi_prefix = talloc_strdup(actx, imsi_prefix); - llist_add_tail(&actx->list, &sgsn_apn_ctxts); + llist_add_tail(&actx->list, &sgsn->apn_list); return actx; } @@ -59,7 +58,7 @@ size_t name_prio = 0; size_t name_req_len = strlen(name); - llist_for_each_entry(actx, &sgsn_apn_ctxts, list) { + llist_for_each_entry(actx, &sgsn->apn_list, list) { size_t name_ref_len, imsi_ref_len; const char *name_ref_start, *name_match_start; @@ -106,7 +105,7 @@ { struct apn_ctx *actx; - llist_for_each_entry(actx, &sgsn_apn_ctxts, list) { + llist_for_each_entry(actx, &sgsn->apn_list, list) { if (strcasecmp(name, actx->name) == 0 && strcasecmp(imsi_prefix, actx->imsi_prefix) == 0) return actx; diff --git a/src/sgsn/gprs_sgsn.c b/src/sgsn/gprs_sgsn.c index c157625..42d1ece 100644 --- a/src/sgsn/gprs_sgsn.c +++ b/src/sgsn/gprs_sgsn.c @@ -658,7 +658,7 @@ insert_extra(tp, mmctx->subscr->sgsn_data, pdp); continue; } - if (!llist_empty(&sgsn_apn_ctxts)) { + if (!llist_empty(&sgsn->apn_list)) { apn_ctx = sgsn_apn_ctx_match(req_apn_str, mmctx->imsi); /* Not configured */ if (apn_ctx == NULL) @@ -711,7 +711,7 @@ if (apn_ctx != NULL) { ggsn = apn_ctx->ggsn; - } else if (llist_empty(&sgsn_apn_ctxts)) { + } else if (llist_empty(&sgsn->apn_list)) { /* No configuration -> use GGSN 0 */ ggsn = sgsn_ggsn_ctx_by_id(0); } else if (allow_any_apn && @@ -821,6 +821,7 @@ inst->rate_ctrs = rate_ctr_group_alloc(inst, &sgsn_ctrg_desc, 0); OSMO_ASSERT(inst->rate_ctrs); + INIT_LLIST_HEAD(&inst->apn_list); INIT_LLIST_HEAD(&inst->ggsn_list); INIT_LLIST_HEAD(&inst->mme_list); diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c index b678f07..b6d03cf 100644 --- a/src/sgsn/sgsn_vty.c +++ b/src/sgsn/sgsn_vty.c @@ -311,9 +311,9 @@ llist_for_each_entry(acl, &g_cfg->imsi_acl, list) vty_out(vty, " imsi-acl add %s%s", acl->imsi, VTY_NEWLINE); - if (llist_empty(&sgsn_apn_ctxts)) + if (llist_empty(&sgsn->apn_list)) vty_out(vty, " ! apn * ggsn 0%s", VTY_NEWLINE); - llist_for_each_entry(actx, &sgsn_apn_ctxts, list) { + llist_for_each_entry(actx, &sgsn->apn_list, list) { if (strlen(actx->imsi_prefix) > 0) vty_out(vty, " apn %s imsi-prefix %s ggsn %u%s", actx->name, actx->imsi_prefix, actx->ggsn->id, diff --git a/tests/sgsn/sgsn_test.c b/tests/sgsn/sgsn_test.c index e7f820f..5d46162 100644 --- a/tests/sgsn/sgsn_test.c +++ b/tests/sgsn/sgsn_test.c @@ -1346,6 +1346,7 @@ struct apn_ctx *actx, *actxs[9]; printf("Testing APN matching\n"); + sgsn = sgsn_instance_alloc(tall_sgsn_ctx); actxs[0] = sgsn_apn_ctx_find_alloc("*.test", ""); actxs[1] = sgsn_apn_ctx_find_alloc("*.def.test", ""); -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30889 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I8cc8e540cfb64d0f130e9c0aaedf7b0835f8fe16 Gerrit-Change-Number: 30889 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-sgsn[master]: Move gtp related functions to gtp.h
by Jenkins Builder 05 Jan '23

05 Jan '23
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30888 ) Change subject: Move gtp related functions to gtp.h ...................................................................... Patch Set 1: (1 comment) File include/osmocom/sgsn/gtp.h: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-2481): https://gerrit.osmocom.org/c/osmo-sgsn/+/30888/comment/68be5d48_c86b6b2f PS1, Line 30: int send_act_pdp_cont_acc(struct sgsn_pdp_ctx *pctx); adding a line without newline at end of file -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30888 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I7f5cf2895b05e03435769548b61051e6284ccb3c Gerrit-Change-Number: 30888 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Thu, 05 Jan 2023 18:20:47 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Change in osmo-sgsn[master]: Move gtp related functions to gtp.h
by pespin 05 Jan '23

05 Jan '23
pespin has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30888 ) Change subject: Move gtp related functions to gtp.h ...................................................................... Move gtp related functions to gtp.h The functions are implemented in sgsn_libgtp.c and hence belong to header file gtp.h Change-Id: I7f5cf2895b05e03435769548b61051e6284ccb3c --- M include/osmocom/sgsn/gtp.h M include/osmocom/sgsn/sgsn.h M src/sgsn/gprs_gmm.c M src/sgsn/gprs_mm_state_iu_fsm.c M src/sgsn/gprs_ranap.c M src/sgsn/gprs_sgsn.c M src/sgsn/gprs_sm.c M src/sgsn/gtp_ggsn.c M src/sgsn/sgsn_rim.c 9 files changed, 29 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/88/30888/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30888 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I7f5cf2895b05e03435769548b61051e6284ccb3c Gerrit-Change-Number: 30888 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in osmo-sgsn[master]: Move gtp related functions to gtp.h
by pespin 05 Jan '23

05 Jan '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30888 ) Change subject: Move gtp related functions to gtp.h ...................................................................... Move gtp related functions to gtp.h The functions are implemented in sgsn_libgtp.c and hence belong to header file gtp.h Change-Id: I7f5cf2895b05e03435769548b61051e6284ccb3c --- M include/osmocom/sgsn/gtp.h M include/osmocom/sgsn/sgsn.h M src/sgsn/gprs_gmm.c M src/sgsn/gprs_mm_state_iu_fsm.c M src/sgsn/gprs_ranap.c M src/sgsn/gprs_sgsn.c M src/sgsn/gprs_sm.c M src/sgsn/gtp_ggsn.c M src/sgsn/sgsn_rim.c 9 files changed, 29 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/88/30888/1 diff --git a/include/osmocom/sgsn/gtp.h b/include/osmocom/sgsn/gtp.h index e835b53..d679ccc 100644 --- a/include/osmocom/sgsn/gtp.h +++ b/include/osmocom/sgsn/gtp.h @@ -1,8 +1,30 @@ #pragma once +#include <stddef.h> +#include <stdint.h> + +#include <osmocom/gsm/tlv.h> +#include <osmocom/gprs/gprs_bssgp_rim.h> + +struct gprs_ra_id; struct sgsn_instance; +struct sgsn_ggsn_ctx; +struct sgsn_pdp_ctx; +struct sgsn_mm_ctx; +struct sgsn_mme_ctx; int sgsn_gtp_init(struct sgsn_instance *sgi); +int sgsn_mme_ran_info_req(struct sgsn_mme_ctx *mme, const struct bssgp_ran_information_pdu *pdu); + +void sgsn_ggsn_echo_req(struct sgsn_ggsn_ctx *ggc); +struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn, + struct sgsn_mm_ctx *mmctx, + uint16_t nsapi, + struct tlv_parsed *tp); + int sgsn_gtp_data_req(struct gprs_ra_id *ra_id, int32_t tlli, uint8_t nsapi, struct msgb *msg, uint32_t npdu_len, uint8_t *npdu); +int sgsn_delete_pdp_ctx(struct sgsn_pdp_ctx *pctx); +void sgsn_pdp_upd_gtp_u(struct sgsn_pdp_ctx *pdp, void *addr, size_t alen); +int send_act_pdp_cont_acc(struct sgsn_pdp_ctx *pctx); \ No newline at end of file diff --git a/include/osmocom/sgsn/sgsn.h b/include/osmocom/sgsn/sgsn.h index bbeaed4..7e78eee 100644 --- a/include/osmocom/sgsn/sgsn.h +++ b/include/osmocom/sgsn/sgsn.h @@ -168,18 +168,6 @@ /* sgsn.c */ struct sgsn_instance *sgsn_instance_alloc(void *talloc_ctx); int sgsn_inst_init(struct sgsn_instance *sgsn); - -/* sgsn_libgtp.c */ -struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn, - struct sgsn_mm_ctx *mmctx, - uint16_t nsapi, - struct tlv_parsed *tp); -int sgsn_delete_pdp_ctx(struct sgsn_pdp_ctx *pctx); -void sgsn_pdp_upd_gtp_u(struct sgsn_pdp_ctx *pdp, void *addr, size_t alen); -void sgsn_ggsn_echo_req(struct sgsn_ggsn_ctx *ggc); -int send_act_pdp_cont_acc(struct sgsn_pdp_ctx *pctx); -int sgsn_mme_ran_info_req(struct sgsn_mme_ctx *mme, const struct bssgp_ran_information_pdu *pdu); - /* * CDR related functionality */ diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c index 6aa479b..b385ff1 100644 --- a/src/sgsn/gprs_gmm.c +++ b/src/sgsn/gprs_gmm.c @@ -61,6 +61,7 @@ #include <osmocom/sgsn/gprs_sndcp.h> #include <osmocom/sgsn/gprs_ranap.h> #include <osmocom/sgsn/gprs_sm.h> +#include <osmocom/sgsn/gtp.h> #include <pdp.h> diff --git a/src/sgsn/gprs_mm_state_iu_fsm.c b/src/sgsn/gprs_mm_state_iu_fsm.c index b1604f8..d0e9ffc 100644 --- a/src/sgsn/gprs_mm_state_iu_fsm.c +++ b/src/sgsn/gprs_mm_state_iu_fsm.c @@ -29,6 +29,7 @@ #include <osmocom/sgsn/debug.h> #include <osmocom/sgsn/sgsn.h> #include <osmocom/sgsn/gprs_ranap.h> +#include <osmocom/sgsn/gtp.h> #define X(s) (1 << (s)) diff --git a/src/sgsn/gprs_ranap.c b/src/sgsn/gprs_ranap.c index 72d744d..af1a61c 100644 --- a/src/sgsn/gprs_ranap.c +++ b/src/sgsn/gprs_ranap.c @@ -38,6 +38,7 @@ #include <osmocom/sgsn/gprs_gmm_attach.h> #include <osmocom/sgsn/gprs_mm_state_iu_fsm.h> #include <osmocom/sgsn/gtp_ggsn.h> +#include <osmocom/sgsn/gtp.h> /* Send RAB activation requests for all PDP contexts */ void activate_pdp_rabs(struct sgsn_mm_ctx *ctx) diff --git a/src/sgsn/gprs_sgsn.c b/src/sgsn/gprs_sgsn.c index 9ce632c..c157625 100644 --- a/src/sgsn/gprs_sgsn.c +++ b/src/sgsn/gprs_sgsn.c @@ -51,6 +51,7 @@ #include <osmocom/sgsn/gprs_llc.h> #include <osmocom/sgsn/gprs_sndcp.h> #include <osmocom/sgsn/gtp_ggsn.h> +#include <osmocom/sgsn/gtp.h> #include <pdp.h> diff --git a/src/sgsn/gprs_sm.c b/src/sgsn/gprs_sm.c index 182528d..157e279 100644 --- a/src/sgsn/gprs_sm.c +++ b/src/sgsn/gprs_sm.c @@ -42,6 +42,7 @@ #include <osmocom/sgsn/gprs_llc.h> #include <osmocom/sgsn/gprs_sndcp.h> #include <osmocom/sgsn/gprs_ranap.h> +#include <osmocom/sgsn/gtp.h> extern void *tall_sgsn_ctx; diff --git a/src/sgsn/gtp_ggsn.c b/src/sgsn/gtp_ggsn.c index f8e09e8..be07d13 100644 --- a/src/sgsn/gtp_ggsn.c +++ b/src/sgsn/gtp_ggsn.c @@ -29,6 +29,7 @@ #include <osmocom/core/stats.h> #include <osmocom/sgsn/gtp_ggsn.h> +#include <osmocom/sgsn/gtp.h> #include <osmocom/sgsn/sgsn.h> #include <osmocom/sgsn/debug.h> #include <osmocom/sgsn/gprs_gmm_fsm.h> diff --git a/src/sgsn/sgsn_rim.c b/src/sgsn/sgsn_rim.c index f28ba60..57f6ea7 100644 --- a/src/sgsn/sgsn_rim.c +++ b/src/sgsn/sgsn_rim.c @@ -12,6 +12,7 @@ #include <osmocom/gprs/gprs_bssgp_rim.h> #include <osmocom/sgsn/sgsn_rim.h> #include <osmocom/sgsn/gtp_mme.h> +#include <osmocom/sgsn/gtp.h> #include <osmocom/sgsn/debug.h> #include <osmocom/sgsn/sgsn.h> -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30888 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I7f5cf2895b05e03435769548b61051e6284ccb3c Gerrit-Change-Number: 30888 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-sgsn[master]: sndcp: Standarize unitdata function naming
by pespin 05 Jan '23

05 Jan '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30887 ) Change subject: sndcp: Standarize unitdata function naming ...................................................................... sndcp: Standarize unitdata function naming Use sndcp_<sap>_type>_<op> so that it's easier to distinguish and identify them. Change-Id: Ib8825570a8f61d0a28d631f86f5244e70d3194aa --- M include/osmocom/sgsn/gprs_sndcp.h M src/sgsn/gprs_llc.c M src/sgsn/gprs_sndcp.c M src/sgsn/sgsn_libgtp.c 4 files changed, 12 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/87/30887/1 diff --git a/include/osmocom/sgsn/gprs_sndcp.h b/include/osmocom/sgsn/gprs_sndcp.h index ba0b8f9..b4a0af8 100644 --- a/include/osmocom/sgsn/gprs_sndcp.h +++ b/include/osmocom/sgsn/gprs_sndcp.h @@ -82,16 +82,17 @@ void gprs_sndcp_sm_deactivate_ind_by_llme(const struct gprs_llc_llme *llme); /* Called by SNDCP when it has received/re-assembled a N-PDU */ -int sndcp_sn_ud_ind(struct gprs_sndcp_entity *sne, struct msgb *msg, +int sndcp_sn_unitdata_ind(struct gprs_sndcp_entity *sne, struct msgb *msg, uint32_t npdu_len, uint8_t *npdu); +int sndcp_sn_unitdata_req(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t nsapi, + void *mmcontext); /* Entry point for the SNSM-ACTIVATE.indication */ int sndcp_sm_activate_ind(struct gprs_llc_lle *lle, uint8_t nsapi); /* Entry point for the SNSM-DEACTIVATE.indication */ int sndcp_sm_deactivate_ind(const struct gprs_llc_lle *lle, uint8_t nsapi); -int sndcp_unitdata_req(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t nsapi, - void *mmcontext); -int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, + +int sndcp_ll_unitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t *hdr, uint16_t len); #endif /* INT_SNDCP_H */ diff --git a/src/sgsn/gprs_llc.c b/src/sgsn/gprs_llc.c index 612dbca..302e018 100644 --- a/src/sgsn/gprs_llc.c +++ b/src/sgsn/gprs_llc.c @@ -1030,7 +1030,7 @@ case GPRS_SAPI_SNDCP9: case GPRS_SAPI_SNDCP11: /* send LL_DATA_IND/LL_UNITDATA_IND to SNDCP */ - rc = sndcp_llunitdata_ind(msg, lle, llhp.data, llhp.data_len); + rc = sndcp_ll_unitdata_ind(msg, lle, llhp.data, llhp.data_len); break; case GPRS_SAPI_SMS: /* FIXME */ diff --git a/src/sgsn/gprs_sndcp.c b/src/sgsn/gprs_sndcp.c index 8ee752e..6707c28 100644 --- a/src/sgsn/gprs_sndcp.c +++ b/src/sgsn/gprs_sndcp.c @@ -399,7 +399,7 @@ } /* Hand off packet to SGSN (SNDCP SN-UNITDATA.ind), which will forward it to GGSN (GTP): */ - rc = sndcp_sn_ud_ind(sne, msg, npdu_len, expnd); + rc = sndcp_sn_unitdata_ind(sne, msg, npdu_len, expnd); ret_free: /* we must free the memory we allocated above; ownership is not transferred @@ -684,7 +684,7 @@ } /* Request transmission of a SN-PDU over specified LLC Entity + SAPI */ -int sndcp_unitdata_req(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t nsapi, +int sndcp_sn_unitdata_req(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t nsapi, void *mmcontext) { struct gprs_sndcp_entity *sne; @@ -794,7 +794,7 @@ } /* Section 5.1.2.17 LL-UNITDATA.ind */ -int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, +int sndcp_ll_unitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t *hdr, uint16_t len) { struct gprs_sndcp_entity *sne; @@ -878,7 +878,7 @@ } /* Hand off packet to gtp */ - rc = sndcp_sn_ud_ind(sne, msg, npdu_len, expnd); + rc = sndcp_sn_unitdata_ind(sne, msg, npdu_len, expnd); ret_free: if (any_pcomp_or_dcomp_active(sgsn)) @@ -890,7 +890,7 @@ /* 5.1.1.4 SN-UNITDATA.indication * Called by SNDCP when it has received/re-assembled a N-PDU */ -int sndcp_sn_ud_ind(struct gprs_sndcp_entity *sne, +int sndcp_sn_unitdata_ind(struct gprs_sndcp_entity *sne, struct msgb *msg, uint32_t npdu_len, uint8_t *npdu) { /* Hand it off N-PDU to the correct GTP tunnel + GGSN: */ diff --git a/src/sgsn/sgsn_libgtp.c b/src/sgsn/sgsn_libgtp.c index f76180a..f848e57 100644 --- a/src/sgsn/sgsn_libgtp.c +++ b/src/sgsn/sgsn_libgtp.c @@ -804,7 +804,7 @@ /* It is easier to have a global count */ pdp->cdr_bytes_out += len; - return sndcp_unitdata_req(msg, &mm->gb.llme->lle[pdp->sapi], + return sndcp_sn_unitdata_req(msg, &mm->gb.llme->lle[pdp->sapi], pdp->nsapi, mm); } -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30887 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: Ib8825570a8f61d0a28d631f86f5244e70d3194aa Gerrit-Change-Number: 30887 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-sgsn[master]: Move func defintions of funcs implemented in gprs_sndcp.c to gprs_snd...
by pespin 05 Jan '23

05 Jan '23
pespin has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30886 ) Change subject: Move func defintions of funcs implemented in gprs_sndcp.c to gprs_sndcp.h ...................................................................... Move func defintions of funcs implemented in gprs_sndcp.c to gprs_sndcp.h Move them to the correct header where they belong, so that the all the related protocol stuff is placed together. Change-Id: I9052f48a0af125bb445194f4ae94ebbe49508fda --- M include/osmocom/sgsn/gprs_sndcp.h M include/osmocom/sgsn/sgsn.h M src/sgsn/gprs_sgsn.c 3 files changed, 10 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/86/30886/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30886 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I9052f48a0af125bb445194f4ae94ebbe49508fda Gerrit-Change-Number: 30886 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in osmo-sgsn[master]: Move func defintions of funcs implemented in gprs_sndcp.c to gprs_snd...
by pespin 05 Jan '23

05 Jan '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30886 ) Change subject: Move func defintions of funcs implemented in gprs_sndcp.c to gprs_sndcp.h ...................................................................... Move func defintions of funcs implemented in gprs_sndcp.c to gprs_sndcp.h Move them to the correct header where they belong, so that the all the related protocol stuff is placed together. Change-Id: I9052f48a0af125bb445194f4ae94ebbe49508fda --- M include/osmocom/sgsn/gprs_sndcp.h M include/osmocom/sgsn/sgsn.h M src/sgsn/gprs_sgsn.c 3 files changed, 10 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/86/30886/1 diff --git a/include/osmocom/sgsn/gprs_sndcp.h b/include/osmocom/sgsn/gprs_sndcp.h index b77fff2..ba0b8f9 100644 --- a/include/osmocom/sgsn/gprs_sndcp.h +++ b/include/osmocom/sgsn/gprs_sndcp.h @@ -85,4 +85,13 @@ int sndcp_sn_ud_ind(struct gprs_sndcp_entity *sne, struct msgb *msg, uint32_t npdu_len, uint8_t *npdu); +/* Entry point for the SNSM-ACTIVATE.indication */ +int sndcp_sm_activate_ind(struct gprs_llc_lle *lle, uint8_t nsapi); +/* Entry point for the SNSM-DEACTIVATE.indication */ +int sndcp_sm_deactivate_ind(const struct gprs_llc_lle *lle, uint8_t nsapi); +int sndcp_unitdata_req(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t nsapi, + void *mmcontext); +int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, + uint8_t *hdr, uint16_t len); + #endif /* INT_SNDCP_H */ diff --git a/include/osmocom/sgsn/sgsn.h b/include/osmocom/sgsn/sgsn.h index f2bb49f..92792fc 100644 --- a/include/osmocom/sgsn/sgsn.h +++ b/include/osmocom/sgsn/sgsn.h @@ -180,17 +180,6 @@ int send_act_pdp_cont_acc(struct sgsn_pdp_ctx *pctx); int sgsn_mme_ran_info_req(struct sgsn_mme_ctx *mme, const struct bssgp_ran_information_pdu *pdu); -/* gprs_sndcp.c */ - -/* Entry point for the SNSM-ACTIVATE.indication */ -int sndcp_sm_activate_ind(struct gprs_llc_lle *lle, uint8_t nsapi); -/* Entry point for the SNSM-DEACTIVATE.indication */ -int sndcp_sm_deactivate_ind(const struct gprs_llc_lle *lle, uint8_t nsapi); -int sndcp_unitdata_req(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t nsapi, - void *mmcontext); -int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, - uint8_t *hdr, uint16_t len); - /* * CDR related functionality diff --git a/src/sgsn/gprs_sgsn.c b/src/sgsn/gprs_sgsn.c index cdfa029..9ce632c 100644 --- a/src/sgsn/gprs_sgsn.c +++ b/src/sgsn/gprs_sgsn.c @@ -49,6 +49,7 @@ #include <osmocom/sgsn/gprs_mm_state_iu_fsm.h> #include <osmocom/sgsn/gprs_gmm_fsm.h> #include <osmocom/sgsn/gprs_llc.h> +#include <osmocom/sgsn/gprs_sndcp.h> #include <osmocom/sgsn/gtp_ggsn.h> #include <pdp.h> -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30886 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I9052f48a0af125bb445194f4ae94ebbe49508fda Gerrit-Change-Number: 30886 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • ...
  • 221
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.