MINOR: protocol: remove the redundant ->sock_domain field
This field used to be needed before commit 2b5e0d8b6 ("MEDIUM: proto_udp:
replace last AF_CUST_UDP* with AF_INET*") as it was used as a protocol
entry selector. Since this commit it's always equal to the socket family's
value so it's entirely redundant. Let's remove it now to simplify the
protocol definition a little bit.
diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c
index fe74ff4..2f691f7 100644
--- a/src/proto_sockpair.c
+++ b/src/proto_sockpair.c
@@ -67,7 +67,6 @@
.name = "sockpair",
.fam = &proto_fam_sockpair,
.ctrl_type = SOCK_STREAM,
- .sock_domain = AF_CUST_SOCKPAIR,
.sock_type = SOCK_STREAM,
.sock_prot = 0,
.add = default_add_listener,
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 30a0045..eecb299 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -55,7 +55,6 @@
.name = "tcpv4",
.fam = &proto_fam_inet4,
.ctrl_type = SOCK_STREAM,
- .sock_domain = AF_INET,
.sock_type = SOCK_STREAM,
.sock_prot = IPPROTO_TCP,
.add = default_add_listener,
@@ -85,7 +84,6 @@
.name = "tcpv6",
.fam = &proto_fam_inet6,
.ctrl_type = SOCK_STREAM,
- .sock_domain = AF_INET6,
.sock_type = SOCK_STREAM,
.sock_prot = IPPROTO_TCP,
.add = default_add_listener,
diff --git a/src/proto_udp.c b/src/proto_udp.c
index 5ac7b15..12e25af 100644
--- a/src/proto_udp.c
+++ b/src/proto_udp.c
@@ -51,7 +51,6 @@
.name = "udp4",
.fam = &proto_fam_inet4,
.ctrl_type = SOCK_DGRAM,
- .sock_domain = AF_INET,
.sock_type = SOCK_DGRAM,
.sock_prot = IPPROTO_UDP,
.add = default_add_listener,
@@ -77,7 +76,6 @@
.name = "udp6",
.fam = &proto_fam_inet6,
.ctrl_type = SOCK_DGRAM,
- .sock_domain = AF_INET6,
.sock_type = SOCK_DGRAM,
.sock_prot = IPPROTO_UDP,
.add = default_add_listener,
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index 9c19374..52e90ae 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -51,7 +51,6 @@
.name = "unix_stream",
.fam = &proto_fam_unix,
.ctrl_type = SOCK_STREAM,
- .sock_domain = PF_UNIX,
.sock_type = SOCK_STREAM,
.sock_prot = 0,
.add = default_add_listener,
diff --git a/src/protocol.c b/src/protocol.c
index 8ea36cb..cb9f6e7 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -37,8 +37,8 @@
{
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
LIST_ADDQ(&protocols, &proto->list);
- if (proto->sock_domain >= 0 && proto->sock_domain < AF_CUST_MAX)
- __protocol_by_family[proto->sock_domain]
+ if (proto->fam->sock_domain >= 0 && proto->fam->sock_domain < AF_CUST_MAX)
+ __protocol_by_family[proto->fam->sock_domain]
[proto->sock_type == SOCK_DGRAM]
[proto->ctrl_type == SOCK_DGRAM] = proto;
HA_SPIN_UNLOCK(PROTO_LOCK, &proto_lock);