From a4063efa7deb6632c228037c47effca22ad0f781 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 9 Aug 2022 00:09:42 +0700 Subject: 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 --- include/osmocom/core/sockaddr_str.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') 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. */ -- cgit v1.2.3