aboutsummaryrefslogtreecommitdiffstats
path: root/tests/sockaddr_str
AgeCommit message (Collapse)AuthorFilesLines
2024-01-26tests/sockaddr_str: rc_name(): also handle -EAFNOSUPPORTVadim Yanitskiy2-39/+41
Change-Id: I489378705e19c6b09f2fa894ddea4b8a0dc0c7e4
2024-01-26tests/sockaddr_str: fix dead code, print some errno valuesVadim Yanitskiy2-87/+82
This fixes a -Wunused-function warning thrown by clang. Change-Id: I45e9044f80e1f634c811e729f4314ec9bcf6a9ad
2022-11-03Support building with -Werror=strict-prototypes / -Werror=old-style-definitionHarald Welte1-2/+2
Unfortunately "-std=c99" is not sufficient to make gcc ignore code that uses constructs of earlier C standards, which were abandoned in C99. See https://lwn.net/ml/fedora-devel/Y1kvF35WozzGBpc8@redhat.com/ for some related discussion. Change-Id: I84fd99442d0cc400fa562fa33623c142649230e2
2022-08-17Revert "Add osmo_sockaddr_strs_to_str()"neels2-63/+2
This reverts commit e145e28a91eeca65d34d7b82caa2190fa89492b4. Reason for revert: The function osmo_sockaddr_strs_to_str() should not be part of the osmo_sockaddr_str API. The implementation of this should live in the function multiaddr_snprintf() added in patch Icef53fe4b6e51563d97a1bc48001d67679b3b6e9 and should not use dynamic allocation. Change-Id: I263dfd68313b896c5b474025fbca13c22ce41cdc
2022-08-14Add osmo_sockaddr_strs_to_str()Max2-2/+63
This will come in handy for working with multihomes sockets like SCTP. Related: OS#5581 Change-Id: Ic0d7c08f669994e37a2314555ecac85d28c42c89
2021-12-14treewide: remove FSF addressOliver Smith1-4/+0
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: I5050285e75cf120407a1d883e99b3c4bcae8ffd7
2019-11-24osmo_sockaddr_str: deprecate osmo_sockaddr_str_*_32n()Neels Hofmeyr2-32/+32
Follow up for patch I3cf150cc0cc06dd36039fbde091bc71b01697322 osmo_sockaddr_str_{from,to}_32n actually use host byte order. Deprecate these and introduce a more accurately named version ending in h. Change-Id: Ic7fc279bf3c741811cfc002538e28e8f8560e338
2019-11-23osmo_sockaddr_str: API doc: fix 32bit addr mixup of host/network byte orderNeels Hofmeyr2-48/+50
Of course both v4 and v6 addresses are kept in network byte order when represented in bytes, but when writing, I somehow must have assumed that inet_pton() returns host byte order. Fix that mixup in the API docs: osmo_sockaddr_str_from_32() and osmo_sockaddr_str_to_32() actually use network byte order. osmo_sockaddr_str_from_32n() and osmo_sockaddr_str_to_32n() actually use host byte order, though reflecting 'n' in their name. sockaddr_str_test: use hexdump instead of %x to show the osmo_sockaddr_str_to_32*() conversions so that the error becomes obvious. (Printing %x reverses the bytes again and made it look correct.) Change-Id: I3cf150cc0cc06dd36039fbde091bc71b01697322
2019-11-21add osmo_sockaddr_str_cmp()Neels Hofmeyr2-0/+601
Currently planned user: for Distributed GSM in osmo-hlr: setting per-MSC service addresses in VTY: replace/remove existing entries. osmo_sockaddr_str_cmp() is useful to catch identical resulting IP addresses, regardless of differing strings (e.g. '0::' and '::' are equal but differ in strings). Change-Id: I0dbc1cf707098dcda75f8e07c1b936951f9f9501
2019-11-11fix OSMO_SOCKADDR_STR_FMT for IPv6Neels Hofmeyr1-11/+11
The format prints IP:port separated by a colon, which of course is confusing when the IPv6 address itself contains mostly colons. The new format adds square braces. cafe:face::1:42 -> [cafe:face::1]:42 The IPv4 format remains unchanged: 1.2.3.4:42 Change-Id: I161f8427729ae31be0eac719b7a4a9290715e37f
2019-11-11test: add OSMO_SOCKADDR_STR_FMT to sockaddr_str_test.cNeels Hofmeyr2-0/+24
This shows the weird format choice for showing IPv6 addresses' port, fixed in subsequent patch. Change-Id: I8e5ebfbbc3a2b88aed820e8f845d9f6ededb29de
2019-11-01add osmo_sockaddr_str_is_nonzero()Neels Hofmeyr2-0/+57
Often, an IP address of 0.0.0.0 is considered an unset value (for clients requiring a server address; not for listening on "any"). osmo_sockaddr_str_is_set() does return false when the port is 0, but there is no simple way to tell whether the IP address is actually set to a server address. Add osmo_sockaddr_str_is_nonzero() to return false if: - the port is zero, or - the IP address is zero (0.0.0.0 or ::0), or - the IP address cannot be parsed. A practical use example: osmo-msc so far accepts an RTP IP address of 0.0.0.0 as valid. I noticed when trying to trigger error handling from a ttcn3 test. osmo-msc can use this function to reject invalid addresses from MGCP messages. Related: I53ddb19a70fda3deb906464e1b89c12d9b4c7cbd (osmo-msc) Change-Id: I73cbcab90cffcdc9a5f8d5281c57c1f87b2c3550
2019-04-08add osmo_sockaddr_str APINeels Hofmeyr2-0/+527
For handling RTP IP addresses and ports, osmo-mgw, osmo-bsc and osmo-msc so far have their own separate shims and code duplication around inet_ntoa(), htons(), sockaddr conversions etc. Unify and standardize with this common API. In the MGW endpoint FSM that was introduced in osmo-bsc and which I would like to re-use for osmo-msc (upcoming patch moving that to osmo-mgw), it has turned out that using char* IP address and uint16_t port number types are a convenient common denominator for logging, MGCP message composition and GSM48. Ongoing osmo-msc work also uses this for MNCC. This is of course potentially useful for any other IP+port combinations besides RTP stream handling. Needless to say that most current implementations will probably stay with their current own conversion code for a long time; for current osmo-{bsc,msc,mgw} work (MGW endpoint FSM) though, I would like to move to this API here. Change-Id: Id617265337f09dfb6ddfe111ef5e578cd3dc9f63