MEDIUM: protocol: use a custom AF_MAX to help protocol parser
It's possible to have several protocols per family which is a problem
with the current way the protocols are stored.
This allows to register a new protocol in HAProxy which is not a
protocol in the strict socket definition. It will be used to register a
SOCK_STREAM protocol using socketpair().
diff --git a/include/proto/protocol.h b/include/proto/protocol.h
index 13a3c0a..857f9e6 100644
--- a/include/proto/protocol.h
+++ b/include/proto/protocol.h
@@ -25,7 +25,7 @@
#include <sys/socket.h>
#include <types/protocol.h>
-extern struct protocol *__protocol_by_family[AF_MAX];
+extern struct protocol *__protocol_by_family[AF_CUST_MAX];
/* Registers the protocol <proto> */
void protocol_register(struct protocol *proto);
@@ -56,7 +56,7 @@
/* returns the protocol associated to family <family> or NULL if not found */
static inline struct protocol *protocol_by_family(int family)
{
- if (family >= 0 && family < AF_MAX)
+ if (family >= 0 && family < AF_CUST_MAX)
return __protocol_by_family[family];
return NULL;
}