mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-12-12 13:11:11 +01:00
MINOR: tools: split is_addr() and is_inet_addr()
The is_addr() function indicates if an address is set and is an IPv4 or IPv6 address. Let's rename it is_inet_addr() and make is_addr() also accept AF_UNIX addresses.
This commit is contained in:
parent
640556c692
commit
18ca2d48bf
@ -627,7 +627,7 @@ static inline void clear_addr(struct sockaddr_storage *addr)
|
|||||||
/* returns non-zero if addr has a valid and non-null IPv4 or IPv6 address,
|
/* returns non-zero if addr has a valid and non-null IPv4 or IPv6 address,
|
||||||
* otherwise zero.
|
* otherwise zero.
|
||||||
*/
|
*/
|
||||||
static inline int is_addr(struct sockaddr_storage *addr)
|
static inline int is_inet_addr(const struct sockaddr_storage *addr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -642,6 +642,17 @@ static inline int is_addr(struct sockaddr_storage *addr)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* returns non-zero if addr has a valid and non-null IPv4 or IPv6 address,
|
||||||
|
* or is a unix address, otherwise returns zero.
|
||||||
|
*/
|
||||||
|
static inline int is_addr(const struct sockaddr_storage *addr)
|
||||||
|
{
|
||||||
|
if (addr->ss_family == AF_UNIX)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return is_inet_addr(addr);
|
||||||
|
}
|
||||||
|
|
||||||
/* returns port in network byte order */
|
/* returns port in network byte order */
|
||||||
static inline int get_net_port(struct sockaddr_storage *addr)
|
static inline int get_net_port(struct sockaddr_storage *addr)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user