Commit Graph

28 Commits

Author SHA1 Message Date
Max d388dead51 SCCP: Log more data on CR size error
Related: OS#5579
Change-Id: I4d7fc44fde5b900907ec5ebec0450040a764802a
2022-08-18 21:15:19 +07:00
Max 4f9c66dc0f SCCP: enforce optional data length limits
Limit length of optional Data parameter to 130 bytes to conform with ITU-T Rec Q.713 §4.2..§4.5 while receiving SCCP messages.

Related: OS#5579
Change-Id: Icc3bd0a71b29cf61a259c5d97e7dd85beb4397bd
2022-08-17 11:36:04 +07:00
Oliver Smith 043275129c treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: Ia450b630e0b60b38835f599c93985bbe97c50d2f
2021-12-14 12:54:05 +00:00
Neels Hofmeyr 3b64bed092 big endian: add missing endian.h in sccp.c
sccp.c uses #ifdef OSMO_IS_LITTLE_ENDIAN, but fails to include endian.h, i.e.
it would build little endian also on big endian systems.

Found by libosmocore/contrib/struct_endianness.py.

Change-Id: I5906d94e0e0a74674c3a14cf2ec81c681e696474
2020-05-19 22:37:41 +02:00
Holger Hans Peter Freyther 174d33681a udts/xudts: Attempt to implement unitdata service parsing
Use the new offset based parsing to extract GT and data from the
UDTS/XUDTS message as well. Test vectors are missing right now.

Change-Id: Id0a3a291d8bad3f8c9621e6c97d4ea0b8bbe6035
2019-05-02 00:12:16 +01:00
Holger Hans Peter Freyther 1646d9b827 xudt: Implement address and data extraction
The cellmgr-ng unfortunately looks at the data being sent and can't
handle the presence of XUDT at all. Add the structure definition
and refactor extraction code to work on offsets. Add a unit test.

Change-Id: I45a7447cc1be432fff34849e0e35abc0410cf153
2019-05-01 23:52:31 +01:00
Harald Welte 2c880ba6f4 sccp.c: Fix gcc-8.2 -Werror=maybe-uninitialized
This fixes the following compiler warning when using -Werror on gcc-8.2:

sccp.c: In function ‘sccp_system_incoming_ctx’:
sccp.c:1039:10: error: ‘result.destination_local_reference’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
       && memcmp(&conn->source_local_reference,
          result.destination_local_reference,
          sizeof(conn->source_local_reference)) == 0
sccp.c:1030:27: note: ‘result.destination_local_reference’ was declared here
  struct sccp_parse_result result;
                           ^~~~~~

Change-Id: Ied41f7c8ddaa5f616dd6556079a54d8d70274490
2019-01-20 15:11:07 +01:00
Neels Hofmeyr 6a973bab9c build: move include/{mtp,sccp} to include/osmocom/
Anywhere else in the Osmocom code base, we arrange headers in
include/osmocom/foo/ and pass -I ${root_srcdir}/include/.
This way including an osmocom header always has the format
  #include <osmocom/foo/bar.h>
whether we are including from the local source tree or from $prefix.

For some reason not clear to me, the mtp and sccp folders, even though they are
being installed to $prefix/include/osmocom/, were kept *next* to the osmocom/
dir, instead of inside it. Fix that weird situation.

The motivation is that I wanted to use a definition from sccp_types.h in a
public-API header. That is impossible if it requires
  #include <sccp/sccp_types.h>
in a local build, but
  #include <osmocom/sccp/sccp_types.h>
for any other source tree using libosmo-sccp. After this patch, both are
identical and including works without quirks. (The other patch that needed this
has changed in the meantime on and no longer needs this, but this still makes
sense for future hacking.)

The installed result does not change, since both mtp/*.h and sccp/*.h have
always been installed to $prefix/include/osmocom/{mtp,sccp}/. This merely
changes their position in the source tree.

The most curious situation before this is that any patch #including
<osmocom/sccp/sccp_types.h> might not get a notice that the header didn't
exist, but might instead include an older system-installed file.

Change-Id: I1209a4ecf9f692a8030b5c93cd281fc9dd58d105
2018-10-21 12:35:11 +00:00
Harald Welte b393b3f4cc Add SPDX-License-Identifier + missing copyright statements
Change-Id: I113232bbeaa7a835871df7f9b883ba573d8a2534
2017-11-13 01:25:47 +09:00
Neels Hofmeyr 8fab8413bf NULL safety: sccp_create_sccp_addr: copy only non-NULL sock->gti
presumably, sock->gti_len is always zero when sock->gti is NULL, but ensure
with a check and make coverity scan happy.

Change-Id: I6cf195a3fbda1d9eacbbaec9a0e7f5b4c154f428
Fixes: coverity CID#57683
2016-12-11 21:24:59 +01:00
Ruben Undheim 5a1abeb02a Fix for big-endian architectures 2016-02-12 21:18:27 +01:00
Harald Welte ec86dcdc2f sccp.c: Fix compiler warnings about size_t / %u 2015-12-22 23:24:27 +01:00
Holger Hans Peter Freyther a9c411ec8c sccp: Allow to specify the context of the incoming message
At the time a SCCP CREF is sent there is no context anymore
and the user of the API might not know where to return the
message to. Allow to specify the incoming context and use it
on the way out.

There are no more callers of _send_msg which passes a NULL
connection and a NULL context.
2015-06-15 09:40:43 +02:00
Holger Hans Peter Freyther b01178898f sccp: Create sccp_create_cr and use it in the connection creation
The data is optional in the in the CR msg so we have to check if the
msgb is NULL or not.
2013-04-10 16:17:14 +02:00
Holger Hans Peter Freyther 0b0dda7e4b misc: Use a unsigned result for the sizeof sizes
Avoid comparing unsigned/signed values with the msgb. In practice
our messages are way lower than this would would matter though.
2013-04-10 16:17:13 +02:00
Holger Hans Peter Freyther 84406e2779 sccp: Make sccp_write take an additional local context
For connection less data there is no way to pass a per context
data for outgoing data, add one.
2011-06-04 16:55:50 +02:00
Harald Welte d35a3079df namespace: use osmo_static_assert() instead of static_assert() 2011-05-08 09:43:49 +02:00
Harald Welte 2d97000f98 Update include paths with libosmocore 0.2.0 2011-03-23 18:30:22 +01:00
Holger Hans Peter Freyther 039c7adcd5 sccp: Add a test case for GTI creation, set the SSN indicator bit
Make sure that creating an address that should be routed based on
the GTI can be created properly.
2010-11-26 18:17:28 +01:00
Holger Hans Peter Freyther 6ecf8104c0 sccp: Use the length of the address to update the offsets
Instead of guessing the length of an address, use the result
of the sccp_create_addr method.
2010-11-16 20:56:08 +01:00
Holger Hans Peter Freyther 13cd1199b9 sccp: Rewrite the sccp_test_addr to set the size correctly
Fix the code to set the number of consumed bytes correctly
and return the number of bytes consumed for for the address.

Add a simple but expandable test case to test the SCCP address
2010-11-16 20:56:08 +01:00
Holger Hans Peter Freyther ec5409ca4f sccp: Make the sccp_create_addr function public
Prefix it with sccp_ and remove the static. This way we
can test this from the unit tests.
2010-11-16 20:56:08 +01:00
Holger Hans Peter Freyther 27cdccf74a sccp: Pass the sccp_connection down to the send method if it exists
This allows to identify the sccp connection and send the SCCP
payload down to a different stream depending on the connection. It
will be used by the bsc_msc_ip to keep multiple MSC connections
open.
2010-08-25 12:01:12 +08:00
Holger Hans Peter Freyther 3e021b827f sccp.c: Make the create work with data + len to not have a msgb 2010-08-02 23:01:02 +08:00
Holger Hans Peter Freyther b5a2f8d589 sccp: We have the gti_ind inside the address already. 2010-08-02 22:00:28 +08:00
Holger Hans Peter Freyther d2a7174414 sccp: Allow to create a _udt message with the given parameter. 2010-08-01 20:52:01 +08:00
Holger Hans Peter Freyther 8c1402ea99 sccp: Use the function to put the sccp address.. fixes GTI for connect 2010-08-01 20:47:39 +08:00
Holger Hans Peter Freyther 68b7e8bd60 sccp: Rename the SCCP file and delete the sccp/ directory.. 2010-08-01 05:30:55 +08:00