diff options
author | Max <msuraev@sysmocom.de> | 2022-08-09 00:09:42 +0700 |
---|---|---|
committer | msuraev <msuraev@sysmocom.de> | 2022-08-09 08:58:49 +0000 |
commit | a4063efa7deb6632c228037c47effca22ad0f781 (patch) | |
tree | fac2fc853e7e0121467d5859c0d50dc50782e06a /include/osmocom | |
parent | ec87a9494d1ef8441625de5265ec12300bed0ad0 (diff) |
Add function to guess AF_UNSPEC address
Sometimes we receive generic "struct sockaddr" with unspecified (AF_UNSPEC)
address family. It's handy to try to guess
the proper address (there're just 2 variants ATM in most practical applications).
Use the added function to relax input checks in osmo_sockaddr_str_from_in*()
Related: OS#5581
Change-Id: I1c90c56ce832f53b65e0d18d3cea94621c02a69a
Diffstat (limited to 'include/osmocom')
-rw-r--r-- | include/osmocom/core/sockaddr_str.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/osmocom/core/sockaddr_str.h b/include/osmocom/core/sockaddr_str.h index f474fa03..a46ad595 100644 --- a/include/osmocom/core/sockaddr_str.h +++ b/include/osmocom/core/sockaddr_str.h @@ -41,6 +41,7 @@ struct sockaddr_in6; */ int osmo_ip_str_type(const char *ip); +unsigned osmo_sockaddr_guess_unspec(const struct sockaddr *src); struct osmo_sockaddr_str { /*! AF_INET for IPv4 address, or AF_INET6 for IPv6 address. */ |