Commit Graph

46 Commits

Author SHA1 Message Date
Vadim Yanitskiy 86af1b96dd sctp_server: do not let sctp_proxy:shutdown() crash the server
Change-Id: Iaeedbc66cab21ec7274f864c8daf86c87f21e633
2024-07-11 03:53:21 +07:00
Vadim Yanitskiy c31fc04442 sctp_proxy: handle_pdu/2: print stacktrace on exception
Change-Id: I7fef18d4462af4b629318922e59cb5aa161fed93
2024-07-11 03:53:19 +07:00
Vadim Yanitskiy 9128f1ecca sctp_proxy: fix typo in field name: s/mmr_port/mme_port/g
Change-Id: I0c3d5a979aaa494cb0b2bd3da9118d9fedf7027f
2024-07-11 03:51:38 +07:00
Vadim Yanitskiy 893b4c2016 sctp_proxy: add type hints for public API
Change-Id: I307e51f1130f08c219c6817629b856764ef7df59
2024-07-11 03:51:38 +07:00
Vadim Yanitskiy d6cbebcb4c sctp_client: add type hints
Change-Id: I89f237706dfbd6004e7644b3b68446fab7f31c7c
2024-07-11 03:51:38 +07:00
Vadim Yanitskiy 83e54d064f rebar.{config,lock}: add pfcplib to deps[]
Change-Id: I4cf3b3b09b19ebabbaad082c616c31ffc1327fd7
2024-07-03 06:29:29 +07:00
Vadim Yanitskiy 59d09be6ff Makefile: allow overriding the config file
Change-Id: If077e9c0e06d7b081b5254bcded77ee65bcd8e5d
2024-07-03 06:29:29 +07:00
Vadim Yanitskiy b9a1916b9f config/sys.config: print prefix before msg, if present
It's sometimes desirable to add some context to logging messages,
like the FSM name and identifier, for instance.  With this patch,
this can be easily achieved by passing an arbitrary prefix string
to a logging function/macro:

  %% EXAMPLE: adding metadata to a specific log macro
  ?LOG_INFO("The planet is fine...", #{prefix = "EARTH"}).

or by setting it for all logging of a process:

  %% EXAMPLE: adding context for the whole process
  logger:set_process_metadata(#{prefix => "E-RAB FSM"}).

Change-Id: Ib88801b8d38976b98a02ed06e1638e0e9056bafb
2024-07-03 06:29:29 +07:00
Vadim Yanitskiy c2b1c4ce80 contrib/ also run Dialyzer
Dialyzer is a static code analyzer for Erlang, see:

Change-Id: Id9fe11e9eb36d7ed468288094095a6d38b2d1d49
2024-06-27 22:06:48 +07:00
Vadim Yanitskiy 2817f9c6be sctp_proxy: reduce 'connecting' state timeout: 2000s -> 2s
2000 seconds is waay too much.

Change-Id: I79b04c0bc087d598b3e322fd697508ac840402d5
2024-06-21 04:58:19 +07:00
Vadim Yanitskiy 2f5c946e8c sctp_proxy: fix no-op 'connecting' state timeout
We need to perform a loop state transition if we want the timer
to be scheduled for 'connecting'.  Otherwise the timeout is no-op.

Change-Id: I45d874f3f73d5b9a8aa62c8a36e94e51497d6754
2024-06-21 04:58:19 +07:00
Vadim Yanitskiy ab9ea5d1e8 fix Copyright year in *.erl files: 2021 -> 2024
Change-Id: I610ced7d15a8a1652813c02978e2d7569c077337
2024-06-20 02:52:22 +07:00
Vadim Yanitskiy 3e1f2d249c add logger_color_formatter
This patch fixes 'FORMATTER CRASH' in the logging when running escript.

Change-Id: I6f10b22af406ef640bc2eaa2dddca34b009f7e6a
Fixes: c5d3c625 "Rework logging config, colorize output"
2024-06-14 04:04:04 +07:00
Vadim Yanitskiy 563302430d logging: convert error_logger:error_report/1 to ?LOG_ERROR
In Erlang/OTP 21.0, a new API for logging was added.  The old error_logger
module can still be used by legacy code, but log events are redirected to
the new Logger API.  New code should use the Logger API directly.

Change-Id: Id6c61fb5ca730209ef625fc5f63d627574e60fbe
2024-06-13 01:14:38 +07:00
Vadim Yanitskiy b8087e9275 logging: cosmetic: print mfa at the end of each line
Change-Id: Ib5b8aabd1d7285d22a4cee2beece77691c61f753
2024-06-13 01:14:38 +07:00
Vadim Yanitskiy 109f898e2b logging: use ?LOG macros instead of calling logger:level()
The difference between using these macros and the exported functions
is that macros add location (originator) information to the metadata,
and perform lazy evaluation by wrapping the logger call in a case
statement, so it is only evaluated if the log level of the event
passes the primary log level check.

Change-Id: I3b6e4296f736f9c87d2706ef5fb75146fd9f1239
2024-06-13 01:13:57 +07:00
Vadim Yanitskiy 1e238f9f44 sctp_server: fix state in catch-all handle_call()
Sending an unexpected call breaks the server, because the third member
of a returned tuple (not_implemented) becomes the new state.  It was
actually meant to be part of the Reply - fix this.

  {reply, Reply :: term(), NewState :: term()}

Change-Id: I1cc683e549c3bb61e3e4c45bb3d244202d61be53
2024-06-13 01:07:34 +07:00
Vadim Yanitskiy 52d8e4d28c sctp_proxy: add a safe wrapper for s1ap_proxy:handle_pdu/1
We want to keep the SCTP connection alive even if we hit a bug in
s1ap_proxy:handle_pdu/1.  Otherwise, all the PDN contexts of all
the subscribers served by the respective eNB will be killed.

Change-Id: Ie6a7c9ff40789695e37be11344f5ea97fbcb8cfa
2024-06-07 03:48:55 +07:00
Vadim Yanitskiy fa3ceb94c4 s1ap_proxy: add TODOs for PDUs also containing TLA
Change-Id: I1d420481cf78c75c2b7a7a3df5ffb1af1ba9aaa0
2024-06-06 10:41:09 +02:00
Vadim Yanitskiy 1545214379 s1ap_proxy: implement patching of INITIAL CONTEXT SETUP REQ/RSP
Change-Id: Ia0d8f8d81756bcce5f518caee8887cf5822aaa08
2024-06-06 10:41:09 +02:00
Vadim Yanitskiy 609f0cf230 s1ap_proxy: implement patching of E-RAB MODIFICATION IND
Change-Id: I054b874b39d4e39a51c00385d1553da065131047
2024-06-06 10:41:09 +02:00
Vadim Yanitskiy 635766e7fa test/s1ap_proxy_test: minor/cosmetic improvements
Change-Id: I91650bef356b4010d16de9c708381ef8de14fe85
2024-06-06 10:41:09 +02:00
Oliver Smith 067925bee7 gitreview: update project path
Change-Id: I551c2c7ea367b9ca20dcf72035c6094dc469dca9
2024-06-06 10:37:22 +02:00
Vadim Yanitskiy e72b5927bc Add COPYING and license headers to *.erl files
Change-Id: I8b38d05299211da187ca74812b228b4f30708193
2024-06-06 01:44:51 +07:00
Vadim Yanitskiy 713e7b9844 sctp_{server,proxy}: cosmetic: improve logging
Change-Id: I6287a5ec775e3aba18e16470388888c43104e963
2024-06-06 01:44:51 +07:00
Oliver Smith bac943bb79 README: use shorter 'make' commands
Change-Id: If650c04c676f98d5f936f478a0e44a6e1713c3d2
2024-06-06 01:44:51 +07:00
Oliver Smith 9f5d31f0df gitreview: new file
Change-Id: Ia3fc980e6ee942518d6ffd263a9e6a4496716b6f
2024-06-06 01:44:51 +07:00
Oliver Smith d44a857d8c Makefile,contrib/jenkins: import from osmo-epdg
Add Makefile and contrib/ from osmo-epdg. Add "rebar3 asn
compile" to the "build" target, as mentioned in

Change-Id: Id8d6652c9007f4d565e2e0ca318e3a7b2113ea67
Tweaked-By: Vadim Yanitskiy <>
2024-06-06 01:44:51 +07:00
Vadim Yanitskiy 1adc5fb196 initial version
Change-Id: Ifed0146b1bf609756e967e7c6b9ed159d29dfbf0
2024-06-05 15:03:31 +02:00
Vadim Yanitskiy 379c551f96 rebar.config: add escript and relx parameters
Change-Id: I204aba4a0fdd678d2e6f5ab588c8c42ef3e44678
2024-06-05 15:03:27 +02:00
Vadim Yanitskiy 8920c6e2b9 rebar.config: cosmetic: reformat, add vim modeline
Change-Id: If93630d6e0a89512beeb27723bf7a56deb49e9c5
2024-06-05 15:03:25 +02:00
Vadim Yanitskiy 0514ad32d5 osmo_s1gw: add main/1 for rebar's escriptize target
Change-Id: Icb20a3c32fe4236522ccbc83d322b248a074580c
2024-06-05 15:03:23 +02:00
Vadim Yanitskiy 1fb84b0912 s1ap_proxy: properly patch transportLayerAddress
Change-Id: Iffcf6842147bcbc665689196c5ded6dfa1a066fa
2024-06-05 15:03:21 +02:00
Vadim Yanitskiy 433ce8778b sctp_client: support explicitly setting local address
Change-Id: I96c0cecb855d11066cbb1f7e43f70fb532e473f3
2024-06-05 15:03:18 +02:00
Vadim Yanitskiy f690146764 config/sys.config: add default environment params
Change-Id: Ie5ec9f62d77407152e18ea3c20cf401151fa6aea
2024-06-05 15:03:16 +02:00
Vadim Yanitskiy c6fa4b69c0 s1ap_proxy: implement patching of E-RAB SETUP REQ/RSP
Change-Id: I88cb261d93b56a4e0ca06ad1d676d1ac16d115bb
2024-06-05 15:03:13 +02:00
Vadim Yanitskiy c5339cdf9d sctp_server: fix terminate/2: match any Reason
Change-Id: I57f1604ef3febee6c330521a044271988110cf2a
2024-06-05 15:03:11 +02:00
Vadim Yanitskiy fefbf4b7f1 sctp_server: add public API to shutdown the server
Change-Id: I706dc7d79feb9d3c6d527fc767e5c5574004a95b
2024-06-05 15:03:08 +02:00
Vadim Yanitskiy c5d3c6252e Rework logging config, colorize output
Change-Id: Icb24c9ab0f7f236424c08f6461d058d9a6e8a40b
2024-06-05 15:03:05 +02:00
Vadim Yanitskiy 9a2c066e95 Add a global supervisor and env parameters
Change-Id: I2da6bccf728bdbe615aaf853b33077ceb4481176
2024-06-05 15:03:03 +02:00
Vadim Yanitskiy 600581eec3 Move S1AP constants into a header file
Change-Id: I8f06d11f984fe47b7ee0a3ed43532861cbae1dd0
2024-06-05 15:03:00 +02:00
Vadim Yanitskiy ca2c0037ad sctp_server: allow passing bind address as string
Change-Id: I1557e4dd8c918ed70e93ff23dcf0e77c9c9e34a3
2024-06-05 15:02:57 +02:00
Vadim Yanitskiy ee884ca01e Decode S1AP PDUs and log them while forwarding
Change-Id: Iac1db3dbbf9b72fbd301b4c4133df3cb8c85cf89
2024-06-05 15:02:55 +02:00
Vadim Yanitskiy 2418df63f4 .gitignore: ignore generated S1AP code
Change-Id: I89df49e1290f32d2fabbc4ffd9a5767bf0fdac00
2024-06-05 15:02:52 +02:00
Vadim Yanitskiy 8b8d8b5051 Check-in S1AP ASN.1 definitions (3GPP TS 36.413 v17.6.0)
Change-Id: Ifda18e71abea29f9bf5dac901f1aae70dab8ff75
2024-06-05 15:02:49 +02:00
Vadim Yanitskiy d3982ba111 Initial SCTP proxy (server/client) implementation
Change-Id: Ia317f58f7dcbec42930165fdcd42d0ddd23e289c
2024-06-05 15:02:43 +02:00