mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-18 17:34:45 +00:00
DEBUG: protocol: yell loudly during registration of invalid sock_domain
The test on the sock_domain is a bit useless because the protocols are registered at boot time, and the test silently fails and returns no error. Use a BUG_ON() instead to make sure to catch such bugs in the code if any.
This commit is contained in:
parent
52b28d2f30
commit
bdcee7fbc9
@ -35,12 +35,15 @@ __decl_spinlock(proto_lock);
|
||||
/* Registers the protocol <proto> */
|
||||
void protocol_register(struct protocol *proto)
|
||||
{
|
||||
int sock_domain = proto->fam->sock_domain;
|
||||
|
||||
BUG_ON(sock_domain < 0 || sock_domain >= AF_CUST_MAX);
|
||||
|
||||
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
||||
LIST_APPEND(&protocols, &proto->list);
|
||||
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;
|
||||
__protocol_by_family[sock_domain]
|
||||
[proto->sock_type == SOCK_DGRAM]
|
||||
[proto->ctrl_type == SOCK_DGRAM] = proto;
|
||||
HA_SPIN_UNLOCK(PROTO_LOCK, &proto_lock);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user