]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tools: add a clear_addr() function to unset an address
authorWilly Tarreau <w@1wt.eu>
Fri, 26 Oct 2012 17:47:23 +0000 (19:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 26 Oct 2012 18:04:26 +0000 (20:04 +0200)
This will be used to unset a from address.

include/common/standard.h

index e795df71715e83d95625df70a9f653a9daea7cb4..ff87cd132e3af4054ec8aeded261a3de8c17b8d0 100644 (file)
@@ -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.
  */