]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tools: Add net_addr structure describing a network addess
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 25 Feb 2021 17:50:02 +0000 (18:50 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 26 Feb 2021 12:32:17 +0000 (13:32 +0100)
The net_addr structure describes a IPv4 or IPv6 address. Its ip and mask are
represented. Among other things, this structure will be used to add support
of IPv6 for "except" parameter of "forwardfor" and "originalto" options.

include/haproxy/tools-t.h

index 34f79bea8a6b9f73d870702c76044b3531c6b5aa..488b90d863dac598619f75300ae8dbf9a36a2b7a 100644 (file)
@@ -142,4 +142,18 @@ struct name_desc {
        const char *desc;
 };
 
+struct net_addr {
+       int family; /* AF_INET or AF_INET6 if defined, AF_UNSET if undefined */
+       union {
+               struct {
+                       struct in_addr ip;
+                       struct in_addr mask;
+               } v4;
+               struct {
+                       struct in6_addr ip;
+                       struct in6_addr mask;
+               } v6;
+       } addr;
+};
+
 #endif /* _HAPROXY_TOOLS_T_H */