| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Catched by AddressSanitizer in osmo-bts-trx while running tests in
osmo-gsm-tester:
==31738==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 5744 byte(s) in 1 object(s) allocated from:
#0 0x7ff7ec789ed0 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1ed0)
#1 0x7ff7e952697c (/lib/x86_64-linux-gnu/libc.so.6+0x10297c)
#2 0x7ff7e95274df in getifaddrs (/lib/x86_64-linux-gnu/libc.so.6+0x1034df)
#3 0x7ff7eadcdc8f in osmo_sockaddr_is_local libosmocore/src/socket.c:537
Change-Id: I778d3c1f162abce0595e62670c29c5134bccd28d
|
|
|
|
|
|
| |
See explanations in previous commit.
Change-Id: I4889e777d8627fdfb52c97ab3ab353b6ed34aab2
|
|
|
|
|
|
| |
See explanations in previous commits.
Change-Id: Ib2f7577b9f498ae9d388ed1f79f6ca0ec6f09664
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After investigating osmo-msc showing this log message and looking at the
code, it's a bit difficult to find out what's going on in the code:
socket.c:224 unable to bind socket: (null):0: Protocol not supported
The root cause was not yet found, but probably SCTP is not enabled in
the kernel of the host running it.
The cod eis most probably failing during socket() and not due to bind
error as the log says, so let's print an error if socket() fails.
Then, if setsockopt fails, we want to still keep trying in case an extra
addr was offered by addrinfo_helper. It is definetly wrong to continue
if setsockopt fails, because then we are skipping the bind(), which is a
fundamental part of what osmo_sock_init2 does.
Then, let's print the bind error when it really happens, and re-write
the extra log at the end if we reach the point at which no suitable addr
is found.
Change-Id: I1854422ad92dadf33ed4d849e15c0380c3bf1626
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function inet_ntoa() stores its result in a static buffer and
returns the pointer. When inet_ntoa() is called subsequently it
overwrite the content of its static buffer with the new result.
Since we osmo_sock_local_ip() is a library function we should use
the more safe variant inet_ntop() in order to prevent unintentionally
overwriting data that the caller might still need. Such an error
would be hard to find.
- Use the more safe inet_ntop() inestead of inet_ntoa()
Change-Id: I9852b57736432032542bd96b6fdd4a2f08fc1f64
|
|
|
|
|
|
|
|
|
| |
The socket that is opend to probe the correct local ip-address is
not closed when the test is done.
- Close socket when it is not needed anymore
Change-Id: I7f3562a344b58f6298d2068314be1626a96e1b1d
|
|
|
|
|
|
|
|
| |
Let's fix some erroneous/accidential references to wrong license,
update copyright information where applicable and introduce a
SPDX-License-Identifier to all files.
Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
|
|
|
|
|
|
|
|
|
|
| |
In some cases it is required to know the ip-address of the interface
through that a given remote IP-Address can be reached.
Add function osmo_sock_local_ip() to determine the local ip-address
for a given remote ip-address
Change-Id: I2988cc52b196fc8476703d1287e24cb4a48491c2
|
|
|
|
|
|
|
|
|
| |
If osmo_sock_init2() was used with CONNECT flag but without BIND
flag, an invalid check for "did we create a socket yet" caused
the socket to never be created, and subsequently the entire function
to return an error.
Change-Id: I0206dbb9c5b8f74d7fb088576941b092acd2ca22
|
|
|
|
|
|
|
| |
Using this option at socket creation, the caller can request disabling
the IP_MULTICAST_ALL socket option.
Change-Id: I5ab5de45c0b64ceb3636ea98245a23defa24ffd4
|
|
|
|
|
|
|
|
|
|
|
| |
This introduces a new flag OSMO_SOCK_F_NO_MCAST_LOOP, which can be used
to disable the looping back of multicast packets transmitted throug this
socket to other local sockets on the machine.
As this looping-back is active by default, a single option to deviate
from the default is deemed sufficient.
Change-Id: I24a5b1ebc3f84d2d5d4734e54df50efaea26490b
|
|
|
|
|
|
|
|
|
| |
We had three places at the end of socket initialization functions
calling listen(). Let's unify that and fix some bugs:
* close + return error in case of bad listen() result
* don't call listen() on AF_UNIX SOCK_DGRAM sockets
Change-Id: I7e8dbe3c0486bb3b9810b0add1331e93fc106d82
|
|
|
|
| |
Change-Id: Id703e7a7a1e065181a4c76c088b8dcc1b7fe15a2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In a string like
127.0.0.1:2905<->127.0.0.1:60661
it is hard to tell which is the local part. I'd have expected it on the left,
but it is actually on the right.
To avoid doubt and bypass bikesheds on which side should be what, clearly mark
the two sides as remote and local.
(r=127.0.0.1:2905<->l=127.0.0.1:60661)
Change-Id: I43dcc6a1906429bd0955fd7fe2eb5b8495b592d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Considering the various styles and implications found in the sources, edit
scores of files to follow the same API doc guidelines around the doxygen
grouping and the \file tag.
Many files now show a short description in the generated API doc that was so
far only available as C comment.
The guidelines and reasoning behind it is documented at
https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation
In some instances, remove file comments and add to the corresponding group
instead, to be shared among several files (e.g. bitvec).
Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
|
|
|
|
|
|
|
|
|
|
| |
Especially for short descriptions, it is annoying to have to type \brief for
every single API doc.
Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes
the first sentence of an API doc as the brief description.
Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
|
|
|
|
|
|
|
|
|
| |
It's a pity that even with this patch we still are fare away from having
the whole API documented. However, at least we have a more solid
foundation. Updates not only extend the documentation, but also make
sure it is rendered properly in the doxygen HTML.
Change-Id: I1344bd1a6869fb00de7c1899a8db93bba9bafce3
|
|
|
|
|
|
| |
Will be used by osmo-bts-trx
Change-Id: I3c655a4af64fb80497a5aaa811cce8005dba9cd9
|
|
|
|
|
|
|
|
|
| |
The old osmo_sock_init() function allows only either a bind (for a
server socket), or a connect (for a client socket), but not both
together. So there's no way to have a client socket that is bound to a
specific local IP and/or port, which is needed for some use cases.
Change-Id: Idab124bcca47872f55311a82d6818aed590965e6
|
|
|
|
|
|
|
| |
socket.c still uses fprintf to output error messages. This commit
replaces the fprintf with proper LOGP messages.
Change-Id: Ia2993415d5f5c33ccd719af239ff59252d11b764
|
|
|
|
|
|
|
| |
Using this function, one can obtain a human-readable string identifying
the host and port names of the socket.
Change-Id: Ib5de5c7b9effe1b0a363e4473a7be7fa38ca6ef3
|
|
|
|
|
|
|
| |
We forgot to call freeaddrinfo() in an error path.
Change-Id: Iccbd3beef4c4a70dc443131b909c45e650d8c6a2
Fixes: Coverity CID 135217
|
|
|
|
|
|
|
| |
error messages'
Related: CID#143566
Change-Id: I75c542089749a0875d3d1913151fe838d7722ff2
|
|
|
|
|
|
|
|
|
|
|
| |
For programs like osmo-hnbgw with numerous sockets, the message that some
unspecified connection was refused is not very helpful. Also output the host
and port where an error occured.
Instead of perror, use fprintf(stderr, ..., strerror()) to be able to include a
format string and print host and port as passed to osmo_sock_init().
Change-Id: I8d0343f51310699b78fcb83fd76fd93764acf3dc
|
|
|
|
|
| |
This adds and improves doxygen API descriptions all over libosmocore,
reducing the 'white spots' that don't have any documentation.
|
|
|
|
| |
Signed-off-by: Max <max.suraev@fairwaves.co>
|
|
|
|
|
|
| |
Some source code files didn't have the usual copyright and licence
statement at their top. I'm adding them baesed on information in the
commitlog.
|
|
|
|
|
|
| |
Added some function for adding the unix domain socket support.
Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
|
|
|
|
|
| |
Doxygen generates quite a lot of warnings on libosmocore. Some of them
are obvious typos - this patch aims to fix such low-hanging fruit.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
getaddrinfo returns EAI_SERVICE (-8) if that combination is used.
More information available in here:
http://sourceware.org/bugzilla/show_bug.cgi?id=15015
Reported by Holger Hans Peter Freyther.
While at it, this patch also removes hints.ai_flags = 0 as memset
to zero already happened just a bit before that.
|
|
|
|
| |
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
|
|
|
|
|
| |
in e476442cf0e84c65565ace545f5b73602b5f0ffc we changed from sockle_t
to unsigned int, but only in the header, not in the implementation!
|
|
|
|
|
|
|
|
|
|
|
| |
alloca.h is not available on FreeBSD, use the default autoconf
function to check for it, there is a complete list[1] of what to
do for using alloca but let us see how far we get with this test.
Include netinet/in.h for the IPv4 and IPv6 socket address. Check
for dlopen in libraries and use this instead of linking -dl.
[1] http://www.gnu.org/s/hello/manual/autoconf/Particular-Functions.html
|
| |
|
|
|
|
|
|
|
|
| |
This extends the socket infrastructure in libosmocore to allow
to create non-blocking sockets.
Basically, it replaces the connect0_bind1 parameter by one
flags parameter.
|
|
|
|
| |
This will tell getaddrinfo() that we want a INADDR_ANY style socket
|
| |
|
|
|
|
| |
Apparently getifaddrs() returns ifa's without an ifa_addr set.
|
|
|
|
|
|
| |
osmo_sock_init_ofd() is a wrapper around osmo_sock_init() which will
take care of initializing and registering a 'struct osmo_fd' for the
newly-created socket.
|
| |
|
| |
|
|
* use write_queue where applicable
* provide functions that work on raw FD and those with osmo_fd
* add support for multiple gsmtap instances (no global variables)
|