diff --git a/include/haproxy/protocol-t.h b/include/haproxy/protocol-t.h index 494f95d03..0119cf2fb 100644 --- a/include/haproxy/protocol-t.h +++ b/include/haproxy/protocol-t.h @@ -83,7 +83,6 @@ struct protocol { char name[PROTO_NAME_LEN]; /* protocol name, zero-terminated */ struct proto_fam *fam; /* protocol family */ int ctrl_type; /* control layer type (SOCK_STREAM/SOCK_DGRAM) */ - int sock_domain; /* socket domain, as passed to socket() */ int sock_type; /* socket type, as passed to socket() */ int sock_prot; /* socket protocol, as passed to socket() */ diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c index fe74ff469..2f691f7ec 100644 --- a/src/proto_sockpair.c +++ b/src/proto_sockpair.c @@ -67,7 +67,6 @@ static struct protocol proto_sockpair = { .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 30a0045be..eecb299e6 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -55,7 +55,6 @@ static struct protocol proto_tcpv4 = { .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 @@ static struct protocol proto_tcpv6 = { .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 5ac7b1588..12e25afdf 100644 --- a/src/proto_udp.c +++ b/src/proto_udp.c @@ -51,7 +51,6 @@ static struct protocol proto_udp4 = { .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 @@ static struct protocol proto_udp6 = { .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 9c19374f7..52e90ae4a 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -51,7 +51,6 @@ static struct protocol proto_unix = { .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 8ea36cb81..cb9f6e7c1 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -37,8 +37,8 @@ void protocol_register(struct protocol *proto) { 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);