From: Willy Tarreau Date: Fri, 26 Oct 2012 17:47:23 +0000 (+0200) Subject: MINOR: tools: add a clear_addr() function to unset an address X-Git-Tag: v1.5-dev13~99 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=422a0a51611f0892507ddfa1d826394a5d04561d;p=thirdparty%2Fhaproxy.git MINOR: tools: add a clear_addr() function to unset an address This will be used to unset a from address. --- diff --git a/include/common/standard.h b/include/common/standard.h index e795df7171..ff87cd132e 100644 --- a/include/common/standard.h +++ b/include/common/standard.h @@ -572,6 +572,12 @@ static inline unsigned int __full_hash(unsigned int a) return a * 3221225473U; } +/* sets the address family to AF_UNSPEC so that is_addr() does not match */ +static inline void clear_addr(struct sockaddr_storage *addr) +{ + addr->ss_family = AF_UNSPEC; +} + /* returns non-zero if addr has a valid and non-null IPv4 or IPv6 address, * otherwise zero. */