Handle kline_spoof_ip in check_one_kline
This commit is contained in:
parent
67e05d5b67
commit
40e76ac76c
1 changed files with 9 additions and 4 deletions
|
@ -602,13 +602,15 @@ check_one_kline(struct ConfItem *kline)
|
||||||
/* match one kline */
|
/* match one kline */
|
||||||
switch (masktype) {
|
switch (masktype) {
|
||||||
case HM_IPV4:
|
case HM_IPV4:
|
||||||
if (client_p->localClient->ip.ss_family == AF_INET6 &&
|
case HM_IPV6:
|
||||||
|
if (IsConfDoSpoofIp(client_p->localClient->att_conf) &&
|
||||||
|
IsConfKlineSpoof(client_p->localClient->att_conf))
|
||||||
|
continue;
|
||||||
|
if (client_p->localClient->ip.ss_family == AF_INET6 && sockaddr.ss_family == AF_INET &&
|
||||||
rb_ipv4_from_ipv6((struct sockaddr_in6 *)&client_p->localClient->ip, &ip4)
|
rb_ipv4_from_ipv6((struct sockaddr_in6 *)&client_p->localClient->ip, &ip4)
|
||||||
&& comp_with_mask_sock((struct sockaddr *)&ip4, (struct sockaddr *)&sockaddr, bits))
|
&& comp_with_mask_sock((struct sockaddr *)&ip4, (struct sockaddr *)&sockaddr, bits))
|
||||||
matched = 1;
|
matched = 1;
|
||||||
/* fallthrough */
|
else if (client_p->localClient->ip.ss_family == sockaddr.ss_family &&
|
||||||
case HM_IPV6:
|
|
||||||
if (client_p->localClient->ip.ss_family == sockaddr.ss_family &&
|
|
||||||
comp_with_mask_sock((struct sockaddr *)&client_p->localClient->ip,
|
comp_with_mask_sock((struct sockaddr *)&client_p->localClient->ip,
|
||||||
(struct sockaddr *)&sockaddr, bits))
|
(struct sockaddr *)&sockaddr, bits))
|
||||||
matched = 1;
|
matched = 1;
|
||||||
|
@ -616,6 +618,9 @@ check_one_kline(struct ConfItem *kline)
|
||||||
case HM_HOST:
|
case HM_HOST:
|
||||||
if (match(kline->host, client_p->orighost))
|
if (match(kline->host, client_p->orighost))
|
||||||
matched = 1;
|
matched = 1;
|
||||||
|
if (IsConfDoSpoofIp(client_p->localClient->att_conf) &&
|
||||||
|
IsConfKlineSpoof(client_p->localClient->att_conf))
|
||||||
|
continue;
|
||||||
if (match(kline->host, client_p->sockhost))
|
if (match(kline->host, client_p->sockhost))
|
||||||
matched = 1;
|
matched = 1;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue