ircd: use GET_SS_FAMILY() in a bunch of places
This commit is contained in:
parent
1d90b085d3
commit
e867208deb
6 changed files with 14 additions and 14 deletions
|
@ -581,7 +581,7 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef RB_IPV6
|
#ifdef RB_IPV6
|
||||||
if(who->localClient->ip.ss_family == AF_INET6 &&
|
if(GET_SS_FAMILY(&who->localClient->ip) == AF_INET6 &&
|
||||||
ipv4_from_ipv6((const struct sockaddr_in6 *)&who->localClient->ip, &ip4))
|
ipv4_from_ipv6((const struct sockaddr_in6 *)&who->localClient->ip, &ip4))
|
||||||
{
|
{
|
||||||
sprintf(src_ip4host, "%s!%s@", who->name, who->username);
|
sprintf(src_ip4host, "%s!%s@", who->name, who->username);
|
||||||
|
|
|
@ -542,7 +542,7 @@ check_dlines(void)
|
||||||
if(IsMe(client_p))
|
if(IsMe(client_p))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip,client_p->localClient->ip.ss_family)) != NULL)
|
if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip, GET_SS_FAMILY(&client_p->localClient->ip))) != NULL)
|
||||||
{
|
{
|
||||||
if(aconf->status & CONF_EXEMPTDLINE)
|
if(aconf->status & CONF_EXEMPTDLINE)
|
||||||
continue;
|
continue;
|
||||||
|
@ -561,7 +561,7 @@ check_dlines(void)
|
||||||
{
|
{
|
||||||
client_p = ptr->data;
|
client_p = ptr->data;
|
||||||
|
|
||||||
if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip,client_p->localClient->ip.ss_family)) != NULL)
|
if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip, GET_SS_FAMILY(&client_p->localClient->ip))) != NULL)
|
||||||
{
|
{
|
||||||
if(aconf->status & CONF_EXEMPTDLINE)
|
if(aconf->status & CONF_EXEMPTDLINE)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -106,7 +106,7 @@ static uint16_t
|
||||||
get_listener_port(const struct Listener *listener)
|
get_listener_port(const struct Listener *listener)
|
||||||
{
|
{
|
||||||
#ifdef RB_IPV6
|
#ifdef RB_IPV6
|
||||||
if(listener->addr.ss_family == AF_INET6)
|
if(GET_SS_FAMILY(&listener->addr) == AF_INET6)
|
||||||
return ntohs(((const struct sockaddr_in6 *)&listener->addr)->sin6_port);
|
return ntohs(((const struct sockaddr_in6 *)&listener->addr)->sin6_port);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -180,7 +180,7 @@ inetport(struct Listener *listener)
|
||||||
F = rb_socket(GET_SS_FAMILY(&listener->addr), SOCK_STREAM, 0, "Listener socket");
|
F = rb_socket(GET_SS_FAMILY(&listener->addr), SOCK_STREAM, 0, "Listener socket");
|
||||||
|
|
||||||
#ifdef RB_IPV6
|
#ifdef RB_IPV6
|
||||||
if(listener->addr.ss_family == AF_INET6)
|
if(GET_SS_FAMILY(&listener->addr) == AF_INET6)
|
||||||
{
|
{
|
||||||
struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)&listener->addr;
|
struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)&listener->addr;
|
||||||
if(!IN6_ARE_ADDR_EQUAL(&in6->sin6_addr, &in6addr_any))
|
if(!IN6_ARE_ADDR_EQUAL(&in6->sin6_addr, &in6addr_any))
|
||||||
|
@ -279,7 +279,7 @@ find_listener(struct rb_sockaddr_storage *addr)
|
||||||
|
|
||||||
for (listener = ListenerPollList; listener; listener = listener->next)
|
for (listener = ListenerPollList; listener; listener = listener->next)
|
||||||
{
|
{
|
||||||
if(addr->ss_family != listener->addr.ss_family)
|
if(GET_SS_FAMILY(addr) != GET_SS_FAMILY(&listener->addr))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch(addr->ss_family)
|
switch(addr->ss_family)
|
||||||
|
@ -342,7 +342,7 @@ add_listener(int port, const char *vhost_ip, int family, int ssl, int defer_acce
|
||||||
if(port == 0)
|
if(port == 0)
|
||||||
return;
|
return;
|
||||||
memset(&vaddr, 0, sizeof(vaddr));
|
memset(&vaddr, 0, sizeof(vaddr));
|
||||||
vaddr.ss_family = family;
|
SET_SS_FAMILY(&vaddr, family);
|
||||||
|
|
||||||
if(vhost_ip != NULL)
|
if(vhost_ip != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -269,7 +269,7 @@ start_auth_query(struct AuthRequest *auth)
|
||||||
if(IsAnyDead(auth->client))
|
if(IsAnyDead(auth->client))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
family = auth->client->localClient->ip.ss_family;
|
family = GET_SS_FAMILY(&auth->client->localClient->ip);
|
||||||
if((F = rb_socket(family, SOCK_STREAM, 0, "ident")) == NULL)
|
if((F = rb_socket(family, SOCK_STREAM, 0, "ident")) == NULL)
|
||||||
{
|
{
|
||||||
ilog_error("creating auth stream socket");
|
ilog_error("creating auth stream socket");
|
||||||
|
@ -302,7 +302,7 @@ start_auth_query(struct AuthRequest *auth)
|
||||||
|
|
||||||
/* XXX mangle_mapped_sockaddr((struct sockaddr *)&localaddr); */
|
/* XXX mangle_mapped_sockaddr((struct sockaddr *)&localaddr); */
|
||||||
#ifdef RB_IPV6
|
#ifdef RB_IPV6
|
||||||
if(localaddr.ss_family == AF_INET6)
|
if(GET_SS_FAMILY(&localaddr) == AF_INET6)
|
||||||
{
|
{
|
||||||
auth->lport = ntohs(((struct sockaddr_in6 *)&localaddr)->sin6_port);
|
auth->lport = ntohs(((struct sockaddr_in6 *)&localaddr)->sin6_port);
|
||||||
((struct sockaddr_in6 *)&localaddr)->sin6_port = 0;
|
((struct sockaddr_in6 *)&localaddr)->sin6_port = 0;
|
||||||
|
@ -316,7 +316,7 @@ start_auth_query(struct AuthRequest *auth)
|
||||||
|
|
||||||
destaddr = auth->client->localClient->ip;
|
destaddr = auth->client->localClient->ip;
|
||||||
#ifdef RB_IPV6
|
#ifdef RB_IPV6
|
||||||
if(localaddr.ss_family == AF_INET6)
|
if(GET_SS_FAMILY(&localaddr) == AF_INET6)
|
||||||
{
|
{
|
||||||
auth->rport = ntohs(((struct sockaddr_in6 *)&destaddr)->sin6_port);
|
auth->rport = ntohs(((struct sockaddr_in6 *)&destaddr)->sin6_port);
|
||||||
((struct sockaddr_in6 *)&destaddr)->sin6_port = htons(113);
|
((struct sockaddr_in6 *)&destaddr)->sin6_port = htons(113);
|
||||||
|
|
|
@ -261,7 +261,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern
|
||||||
{
|
{
|
||||||
int port = -1;
|
int port = -1;
|
||||||
#ifdef RB_IPV6
|
#ifdef RB_IPV6
|
||||||
if(source_p->localClient->ip.ss_family == AF_INET6)
|
if(GET_SS_FAMILY(&source_p->localClient->ip) == AF_INET6)
|
||||||
port = ntohs(((struct sockaddr_in6 *)&source_p->localClient->listener->addr)->sin6_port);
|
port = ntohs(((struct sockaddr_in6 *)&source_p->localClient->listener->addr)->sin6_port);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -394,7 +394,7 @@ find_address_conf_by_client(struct Client *client_p, const char *username)
|
||||||
aconf = find_address_conf(client_p->host, client_p->sockhost,
|
aconf = find_address_conf(client_p->host, client_p->sockhost,
|
||||||
client_p->username, client_p->username,
|
client_p->username, client_p->username,
|
||||||
(struct sockaddr *) &client_p->localClient->ip,
|
(struct sockaddr *) &client_p->localClient->ip,
|
||||||
client_p->localClient->ip.ss_family,
|
GET_SS_FAMILY(&client_p->localClient->ip),
|
||||||
client_p->localClient->auth_user);
|
client_p->localClient->auth_user);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -404,7 +404,7 @@ find_address_conf_by_client(struct Client *client_p, const char *username)
|
||||||
aconf = find_address_conf(client_p->host, client_p->sockhost,
|
aconf = find_address_conf(client_p->host, client_p->sockhost,
|
||||||
non_ident, client_p->username,
|
non_ident, client_p->username,
|
||||||
(struct sockaddr *) &client_p->localClient->ip,
|
(struct sockaddr *) &client_p->localClient->ip,
|
||||||
client_p->localClient->ip.ss_family,
|
GET_SS_FAMILY(&client_p->localClient->ip),
|
||||||
client_p->localClient->auth_user);
|
client_p->localClient->auth_user);
|
||||||
}
|
}
|
||||||
return aconf;
|
return aconf;
|
||||||
|
|
|
@ -305,7 +305,7 @@ find_oper_conf(const char *username, const char *host, const char *locip, const
|
||||||
|
|
||||||
if(parse_netmask(addr, &ip, &bits) != HM_HOST)
|
if(parse_netmask(addr, &ip, &bits) != HM_HOST)
|
||||||
{
|
{
|
||||||
if(ip.ss_family == cip.ss_family &&
|
if(GET_SS_FAMILY(&ip) == GET_SS_FAMILY(&cip) &&
|
||||||
comp_with_mask_sock((struct sockaddr *)&ip, (struct sockaddr *)&cip, bits))
|
comp_with_mask_sock((struct sockaddr *)&ip, (struct sockaddr *)&cip, bits))
|
||||||
return oper_p;
|
return oper_p;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue