aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmsc/smpp_smsc.c
AgeCommit message (Collapse)AuthorFilesLines
2022-08-05Introduce libsmpputilMax1-1050/+0
As part of preparation for libosmo-netif migration let's move common SMPP code into separate build-time library and use it for both smpp_mirror and OsmoMSC renaming the files if necessary. While at it we also fix id/password legth limits in smpp_mirror and drop unused fields from ESME struct. Related: OS#5568 Change-Id: I61910651bc7c188dc2fb67d96189a66a47e7e8fb
2022-08-01ESME: use osmo_sock_get_name() for loggingMax1-3/+0
This allows us to drop single-use parameters from osmo_esme to facilitate further code changes. Related: OS#5568 Change-Id: I34bd4c145b0f6287a323e2350808feb59f1d3187
2022-08-01SMPP: clarify (re)start logicMax1-2/+2
Having smpp_smsc_stop() called from within smpp_smsc_start() instead of explicitly inside smpp_smsc_restart() is confusing and could lead to hard-to-trace bugs. Let's get this fixed first before going further. Related: OS#5568 Change-Id: I353f5b82c9f5308d93e926538d4ef7e24d0b0339
2022-05-16smpp: don't enqueue write messages if ESME is disconnectedHarald Welte1-1/+8
If the ESME has been disconnected (dead socket) but still is in memory (other users hold a use count), we shouldn't enqueue messages to the write queue. This prevents messages like DSMPP write_queue.c:112 wqueue(0x7f8bc392f6e0) is full. Rejecting msgb Change-Id: I10a270f1d555782be272f4d78da43190618a9950 Closes: OS#3278
2022-05-16smpp: Fix use-after-free bug when ESME disconnects but has write pendingHarald Welte1-1/+1
When the SMPP code free's an ESME it also free's the related write_queue and the osmo_fd contained therein. So if this happens while we are in esme_link_read_cb(), we must return -EBADF to make osmo_wqueue_bfd_cb() of libosmocore avoid further accessing related memory. Change-Id: I441d3b05c2f2556c530783a7f66c73adf6d845a1 Closes: OS#5565
2021-10-30smpp_smsc: use osmo_talloc_replace_string() in smpp_smsc_conf()Vadim Yanitskiy1-7/+1
Change-Id: Ie3dc0d9673a0410a5908cba77fc352d581bac6f6 Fixes: CID#240711
2020-10-19Use osmo_fd_setup() whenever applicableHarald Welte1-3/+1
Change-Id: Ib570e2ada619b72001d76d2cae159d78f09d6fb6
2020-05-09Use OSMO_FD_* instead of deprecated BSC_FD_*Pau Espin Pedrol1-1/+1
New define is available since libosmocore 1.1.0, and we already require 1.3.0, so no need to update dependenices. Let's change it to avoid people re-using old BSC_FD_* symbols when copy-pasting somewhere else. Change-Id: Ifc89fffac0443d94f3e49555684975b293ef90fb
2020-01-11Use GSM411_RP_* and not GSM48_CC_*Keith Whyte1-2/+3
d34ed5768cccab57e879bd32f38872d290c9ae89 introduced comparison of GSM411_RP_CAUSE_MO_NUM_UNASSIGNED with GSM48_CC_CAUSE_UNASSIGNED_NR For consistency lets use the GSM411_RP constants in SMS related code. Change-Id: Ie54966560f66d2dcde905feb2eb19ef90406acd1
2019-04-10smpp_smsc: Call destroy_tlv() when using build_tlv()Harald Welte1-2/+7
The libsmpp34 build_tlv() function is allocating dynamic memory which we need to release again by calling destroy_tlv(). Change-Id: Iacc74c9948fb10fa79c0dd7b0cb72d4adbefdeed Closes: OS#3912
2019-01-17Make alert notifications vty configurable per ESMEKeith1-0/+1
Adds (no) alert-notifications as a per-esme vty command, in order to allow some ESMEs to be excluded from alerts. The default is still to send alert notifications to all esme, so no changes are required to the config file to maintain identical operation after this patch. Change-Id: I57f4d268ca6fe6a233f2caaffce62e4aade01274
2018-04-17smpp_smsc_conf: Fix heap-use-after-freepespin/fix-smsc-use-after-freePau Espin Pedrol1-1/+6
Fixes following error catched by enabling address sanitizer: ==20792==ERROR: AddressSanitizer: heap-use-after-free on address 0x60b000122610 at pc 0x7f9c9c3fe063 bp 0x7ffd2e68f600 sp 0x7ffd2e68edb0 READ of size 11 at 0x60b000122610 thread T0 #0 0x7f9c9c3fe062 (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x3c062) #1 0x7f9c9beb8ee4 in talloc_strdup (/usr/lib/x86_64-linux-gnu/libtalloc.so.2+0x6ee4) #2 0x56096a7cf75b in smpp_smsc_conf src/libmsc/smpp_smsc.c:983 #3 0x56096a7cf9df in smpp_smsc_start src/libmsc/smpp_smsc.c:1015 #4 0x56096a7d4935 in smpp_openbsc_start src/libmsc/smpp_openbsc.c:785 #5 0x56096a755ad0 in main src/osmo-msc/msc_main.c:598 #6 0x7f9c9927b2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) #7 0x56096a756979 in _start (/home/jenkins/workspace/osmo-gsm-tester_run-prod/trial-805/inst/osmo-msc/bin/osmo-msc+0xf0979) Related: OS#3181 Change-Id: Iaf0d251c8d2912266a087ada4d20905146e08592
2018-04-14smpp: Unset esme->acl on socket closeHarald Welte1-0/+6
We set acl->esme during _process_bind(), but we don't clear it in case the TCP connection for the ESME is dead. This leads to a stale acl->esme pointer, which we will attempt to dereference the next time a SMS is delivered to a route pointing to this acl, where it will be a heap use-after-free. This was discovered using AddressSanitizer and MSC_Tests.ttcn Closes: OS#3168 Change-Id: I1f140d7f9c7d89f200ddbcd81a8df66de69fb3e4
2018-02-09cosmetic: Use msgb_hexdump*() rather than manual osmo_hexdump() on msgHarald Welte1-1/+1
This requires libosmocore Change-Id I98e85397fb541ee0fd711f2e1852f63f3bb87359 Change-Id: Ieeb97a9f1eba2fdef84294b8c8c7ac0984ae5c70
2018-01-07smpp_smsc.c: don't talloc_strdup NULL pointersthe 34c3 gsm team1-1/+1
Change-Id: Ie6a83a20464a959cf51f999d6f900fa4516ced1b
2017-12-20smpp_smsc: fix truncated string copy into bind_r.system_idNeels Hofmeyr1-2/+1
The target buffer in libsmpp is 16 bytes long, and snprintf() may omit the terminating zero. There seems to be no handling for unterminated strings, so osmo_strlcpy() is the safer (and presumably more optimal) choice. Change-Id: I5845666201f945ea9f83da62f2dd4bec52eb74cf
2017-09-06rename include/openbsc to include/osmocom/mscNeels Hofmeyr1-2/+2
Change-Id: I1f96a1285bbd1b4607614856bca935d5c26e2da9
2017-08-27smpp: fix return causeBenoit Bolsee1-6/+10
Return cause 38 when default SMPP route is unavailable. This is better than cause 1. Change-Id: If3241d50a78fa611981e55fef6ae4c72b0a2a167
2017-08-27smpp_smsc.c: Log on sending deliver_sm messagePau Espin Pedrol1-0/+3
Change-Id: Ie16294df6d5bc0065f8d2b49320ead61f535f271
2017-07-12move openbsc/* to repos rootNeels Hofmeyr1-0/+1030
This is the first step in creating this repository from the legacy openbsc.git. Like all other Osmocom repositories, keep the autoconf and automake files in the repository root. openbsc.git has been the sole exception, which ends now. Change-Id: I9c6f2a448d9cb1cc088cf1cf6918b69d7e69b4e7