Commit Graph

46 Commits

Author SHA1 Message Date
Pau Espin ce966904c6 .gitignore: Add contrib/osmo-uecups.spec
Change-Id: I3feec5550a413b2ee9166b97d41e3feec409a320
2023-09-12 17:34:11 +02:00
Pau Espin 3ea62fc617 Bump version: 0.2.1.6-03fd-dirty → 0.2.2
Change-Id: Iccf4e533a98adcd1429f29f718f2556e64181c1d
2023-09-12 17:27:39 +02:00
Harald Welte 03fd41335a gtp_tunnel: Avoid double-unlock in error path of gtp_tunnel_alloc
Fixes: CID#307509: Double unlock (LOCK)
Change-Id: Ie6e4c08d2c235fbe90516c3dfe2c82963fd70a6f
2023-07-18 15:01:14 +02:00
Harald Welte e36dbcbc03 daemon_vty: avoid null-dereference in argc < 0 case
in show_gtp_cmd, we have two different checks (argc > 0) vs (argc)
which means in theory argc could be negative and the second clause
would be executed without the first having set up related data such as
'ai'.

Fixes: CID#307521: Explicit null dereferenced (FORWARD_NULL)
Change-Id: I4149b0b191a34168ba6649338d3cdf6c6af6cfe7
2023-07-18 14:35:41 +02:00
Harald Welte 3f2361ee33 gtp_daemon: Fix error paths in gtp_daemon_alloc()
Fixes: CID#307527: Unchecked return value (CHECKED_RETURN)
Change-Id: I690b24671567aac4dca24389309ebaa3e76e272c
2023-07-18 14:33:22 +02:00
Oliver Smith f207d1cdad debian: set compat level to 10
Related: OS#5958
Change-Id: Ib3d33f323b0c3004911ec026612934c12c1162aa
2023-04-25 16:48:33 +02:00
arehbein 08cc9dd634 Transition to use of 'telnet_init_default'
Related: OS#5809
Change-Id: Icc57c68337d55c6594c1c36e9bf41624d11dab0a
2023-02-25 17:48:58 +01:00
Harald Welte f7a00a5528 README.md: Add some basic information in absence of documentation
Change-Id: I4a2955c148f3bf011b96924b7d036e7f118e1e02
2023-02-10 11:28:51 +00:00
Pau Espin 6fca3d101f Bump version: 0.2.0.3-7ab8-dirty → 0.2.1
Change-Id: Id3914e2de4f72de606b08ebfc55b7eaa53da1cbc
2023-02-07 17:45:20 +01:00
Harald Welte 7ab83ee170 fix copy+paste mistake in README.md
Change-Id: Ib5bb2529099f742bfa9a2dce5b73ca1493b2a0ba
2023-02-07 14:45:45 +01:00
Harald Welte e051427187 add spec.in file for RPM building
Change-Id: I7942b715a367f71b3fe74805f43dc45701983de8
2022-11-06 12:32:18 +01:00
Max c4c7dd68bd Add git-review config
Change-Id: I7b822474d554e822fb13d9953e4c6959097a6293
2022-09-09 22:36:41 +07:00
Pau Espin 277669d9fc Bump version: 0.1.4.13-1590-dirty → 0.2.0
Change-Id: I7205197806eda26a19a6e09838fce096280baa28
2022-06-29 12:24:31 +02:00
Pau Espin 15908cdeb4 .gitignore: Add configure~
Change-Id: Icc381f72af041ba442b7e8fb90f0da055838da07
2022-06-29 12:23:47 +02:00
Harald Welte 55e1e71559 README.md: Fix copy+paste mistke
Change-Id: Ifb1de87f5985bf0c097fa126135520ba0161d0bf
2022-06-18 13:57:29 +02:00
Harald Welte 5d5509fd4c update git URLs (git -> https; gitea)
Change-Id: I3c43819d70d91d42218bcbf9bf6aaf5d802174ad
2022-06-18 13:57:25 +02:00
Pau Espin 7b2a729848 tun_device: Avoid deadlocks logging while thread is cancelled
We cannot garantee that LOGP will not end up calling a syscall which can
be a cancellation point. Since the syscall will be probably called while
having the logging mutex locked, an eventuall cancellation of the thread
would leave the logging mutex locked forever, hence making all other
threads deadlock as soon as they try to write anything to the log.

Change-Id: I72a0b536c8f39857960f132a5b84cdf5b8519732
2022-04-13 18:04:26 +02:00
Pau Espin f9f5b301dd Move several objects outside of main.c
This makes it far more easy to understand the data model and find stuff
in code.

Change-Id: I4613361dc40518edd94f2d4128ba412337690736
2022-04-12 12:49:55 +02:00
Pau Espin afa22c6fef Add optarg support
Change-Id: I88c95c27d20f1da8dc2ce967197b58c876b42c59
2022-04-12 12:48:48 +02:00
Pau Espin a459b5c756 Fix use-after-free by tun thread after tun obj destroyed
The main thread calls pthread_cancel before freeing the tun object.
However, pthread_cancel doesn't kill the thread synchronously (man
pthread_cancel). Hence, the tun thread may still be running for a while
after the tun object is/has been(ing) freed.
Let's avoid this by making sure the thread is stopped before
freeing the object.
To accomplish it, we must wait for the thread to be cancelled. A cleanup
routie is added which will signal the "tun_released" message to the main
thread through an osmo_itq, which will then free the object (since
talloc context is managed by the main thread).

Related: SYS#5523
Change-Id: Idf005359afb41d3413b09281a9ff937d5eafcc7c
2022-04-12 10:54:04 +02:00
Pau Espin 687eafab1b main.c: Improve logging
Change-Id: I6d9a355fef78906cee1ddf65ebb00a738b43c596
2022-04-11 19:36:50 +02:00
Pau Espin 42fccbe5b5 main: Remove duplicate call to child_terminated()
The same pid will be handled below tyhrough waitpid. This can be seen
when running PGW_Tests:
"""
20220411134309656 DUECUPS main.c:343 SIGCHLD receive from pid 24; status=0
20220411134309656 DUECUPS main.c:95 r=172.18.18.202:9999<->l=172.18.18.20:4268: JSON Tx '{"program_term_ind": {"exit_code": 0, "pid": 24}}'
20220411134309656 DUECUPS main.c:343 SIGCHLD receive from pid 24; status=0
"""

Change-Id: I348b91097fe9bf78b2c7e33d4f3eaf316618068e
2022-04-11 15:48:32 +02:00
Pau Espin 95ad8c9919 main.c: Fix typo in comment
Change-Id: I6fb65b0468ebab8c35bb918f1d04d62b641edf69
2022-04-11 15:47:36 +02:00
Vadim Yanitskiy 115a176b99 daemon: log more details when netdev_add_defaultroute() fails
Change-Id: I4ac09ec528e6e9169cca813995ba0db583b212a0
Related: SYS#5602
2022-01-31 02:36:41 +06:00
Vadim Yanitskiy 8280924569 daemon: enable multithread logging in main()
It may happen that multiple threads trying to log at the same time,
and the msgb containing a logging message gets corrupted in
libosmocore's _file_wq_write_cb():

  msgb(0x7f5ca2a38150): msgb too small to pull 240 (len 120)
  Aborted (core dumped)

'''
  rc = write(ofd->fd, msgb_data(msg), msgb_length(msg));
  if (rc < 0)
      return rc;
  if (rc != msgb_length(msg)) { // 240 != 120
      /* pull the number of bytes we have already written */
      msgb_pull(msg, rc); // <-- we abort() here
      /* ask write_queue to re-insert the msgb at the head of the queue */
      return -EAGAIN;
  }
'''

The return value of write() cannot be greater than the given length.
Most likely, the msgb gets corrupted during the write() system call.

Enabling multithread logging in libosmocore solves the problem.

Change-Id: Ib14d0e36e8cd72465bfe55d19b68dbe3423f7f05
Related: SYS#5602
Fixes: OS#5424
2022-01-28 20:49:24 +06:00
Pau Espin 5cbb80f797 debian/control: Drop dependency on autoconf-archive
Dependency not needed since 0ac9688fc7.

Change-Id: I7eeb38260add26f350882410869ec9867506c7d7
2022-01-11 18:28:27 +01:00
Pau Espin 3c73b66a1f Bump version: 0.1.3.2-0ac9 → 0.1.4
Change-Id: I411002b62f47c57db76811535eefa08c53163754
2021-11-17 17:41:19 +01:00
Oliver Smith 0ac9688fc7 configure: don't turn some warnings into errors
Do not turn some compiler warnings into errors by default. This part was
copied from openbsc.git 34f012 ("Turn some compiler warnings into
errors"), where it was added before --enable-werror was available.

We build with --enable-werror during development and in CI. If the code
is built with a different compiler that throws additional warnings, it
should not stop the build.

Related: OS#5289
Change-Id: Idb04e85d1e241f8b53cf338d9e79da198028565d
2021-11-04 11:14:52 +01:00
Harald Welte 8362efef7c daemon: Add VTY command to configure local bind IP of UECUPS socket
Change-Id: Iabe37ce5c77fddcc146fca3b81660822071d1925
2020-04-26 22:44:28 +02:00
Harald Welte ad8fce866d Bump version: 0.1.2-8e2a → 0.1.3
Change-Id: I8b915dbb0fdc55d37818ca1db944945d123f7256
2020-04-25 10:27:15 +02:00
Harald Welte f9bb1777c7 dameon: Handle multiple coalesced SIGCHLD
It turns out signalfd is much less useful than one would assume:
https://ldpreload.com/blog/signalfd-is-useless

Change-Id: I16bc5b7de72843c2ae18b982bfd967a7105313e4
2020-04-21 22:46:34 +02:00
Harald Welte 8e2ad14487 debian/control: Add dependency to libsctp-dev
[  337s] main.c:33:10: fatal error: netinet/sctp.h: No such file or directory
[  337s]  #include <netinet/sctp.h>
[  337s]           ^~~~~~~~~~~~~~~~

Change-Id: Iaec1c688ac136bd146dbc9527804c238245cac47
2020-04-20 16:59:56 +02:00
Harald Welte 2eb161dad4 debian: add dependency to autoconf-archive
configure: 8901: error: Please install autoconf-archive; re-run 'autoreconf -fi' for it to take effect.
Change-Id: I7a7c4680678cc68b0b81f71af7687386a09afdb5
2020-04-20 16:41:40 +02:00
Harald Welte 75a7a5c010 debian packaging
Change-Id: Ib86883b99a4650e984146b0d036d0c14dbec3d14
2020-04-20 13:21:12 +02:00
Harald Welte 681f119da5 migrate to autotools
Change-Id: Icb1a0a2e39f291ceac5c868d76445799d0ce31f1
2020-04-20 13:21:12 +02:00
Harald Welte f23abd74cf work around bogus compiler warnings
Change-Id: I9170e4de857c1f3e003a480b12dd16fe796ec763
2020-04-20 13:21:12 +02:00
Harald Welte f2be0995f5 daemon: Work around old libnl3 failing to include linux/netlink.h
In file included from /usr/include/libnl3/netlink/socket.h:16:0,
                 from netdev.c:19:
/usr/include/libnl3/netlink/handlers.h:51:15: warning: ‘struct nlmsgerr’
declared inside parameter list will not be visible outside of this
definition or declaration
        struct nlmsgerr *nlerr, void *arg);

Change-Id: Ia2d1b0d5ccf427895feb80298d9b5c3aef1c6c9d
2020-04-20 13:21:12 +02:00
Harald Welte 27dc4c4772 daemon: rename default config file to osmo-uecups-daemon.cfg
Change-Id: Icd1e5f2d62fa46029cfe55878a84166ef76a4e91
2020-04-20 13:21:12 +02:00
Harald Welte a932e4e1ec daemon: set msgb talloc context
Change-Id: Id16952e7c65a1691bbfed8bbfc4f597ae13b10a0
2020-04-20 13:21:12 +02:00
Harald Welte 933dec7d68 Add support for SIGUSR1 talloc report + SIGHUP logfile re-open
Change-Id: I8bfce39443fd29b6acab9a88c9fa5da54c46e824
2020-04-18 21:43:24 +02:00
Harald Welte 0174469247 Add support for UeCUPS_ResetAllState
This allows the controlling entity (testsuite) to reset all
state in the daemon.

Change-Id: I18c952b3874324a9efafb26b5f2c64f8396ff36a
2020-04-18 21:15:34 +02:00
Harald Welte 24557a76b7 add "start_program" support
This allows the controlling instance (ttcn3 test case) to start
a process (shell command) within the namespace of a given tunnel
/ tun device.

The controlling instance is informed of the success/failure
of starting the process, as well as the exit code at time of
termination.

Change-Id: I94db625de9f5968e53bf67ce2f941673d9a15fbc
Depends: libosmocore.git If1431f930f72a8d6c1d102426874a11b7a2debd9
Depends: libosmocore.git If8d89dd1f6989e1cd9b9367fad954d65f91ada30
2020-04-18 21:15:29 +02:00
Harald Welte 432a130e39 move VTY and SCTP UECUPS sockets to port 4268
This is the port number listed on http://osmocom.org/projects/cellular-infrastructure/wiki/Port_Numbers

Change-Id: Ifd8a9418184147e1bb3d74192167207c981453de
2020-04-17 15:08:06 +02:00
Harald Welte 7dadaa921f jenkins.sh: Fix PKG_CONFIG_DIR
Change-Id: Ie2391ca00e588ddc9b7920dbf28ac69ddd7173e0
2020-04-17 15:08:06 +02:00
Harald Welte f9e9a7022e add jenkins.sh
Change-Id: I5de3a4ee209ae78346aaa4ce5734b5ef213e5c07
2020-04-15 22:07:48 +02:00
Harald Welte f7365595ac initial check-in of the UECUPS daemon and the related TTCN3 code
Change-Id: I5acf7059722b58e6f57dbf31e18abcc385533970
2020-04-15 22:01:52 +02:00