1
0
mirror of https://github.com/yarrick/iodine.git synced 2024-11-22 04:56:07 +03:00

Do not validate the autodetected IPs of additional address families when using -4 (IPV4 only) and -6 (IPv6 only) flags

This commit is contained in:
Will Szumski 2016-11-23 01:00:11 +00:00
parent 8e15a73a77
commit 1ad7c05b92

View File

@ -1844,10 +1844,10 @@ tunnel(int tun_fd, struct dnsfd *dns_fds, int bind_fd, int max_idle_time)
if (FD_ISSET(tun_fd, &fds)) {
tunnel_tun(tun_fd, dns_fds);
}
if (FD_ISSET(dns_fds->v4fd, &fds)) {
if (dns_fds->v4fd >= 0 && FD_ISSET(dns_fds->v4fd, &fds)) {
tunnel_dns(tun_fd, dns_fds->v4fd, dns_fds, bind_fd);
}
if (FD_ISSET(dns_fds->v6fd, &fds)) {
if (dns_fds->v6fd >= 0 && FD_ISSET(dns_fds->v6fd, &fds)) {
tunnel_dns(tun_fd, dns_fds->v6fd, dns_fds, bind_fd);
}
if (FD_ISSET(bind_fd, &fds)) {
@ -2592,17 +2592,20 @@ main(int argc, char **argv)
fprintf(stderr, "Add more -D switches to set higher debug level.\n");
foreground = 1;
}
if (addrfamily == AF_UNSPEC || addrfamily == AF_INET) {
dns4addr_len = get_addr(listen_ip4, port, AF_INET, AI_PASSIVE | AI_NUMERICHOST, &dns4addr);
if (dns4addr_len < 0) {
warnx("Bad IPv4 address to listen on.");
usage();
}
}
if (addrfamily == AF_UNSPEC || addrfamily == AF_INET6) {
dns6addr_len = get_addr(listen_ip6, port, AF_INET6, AI_PASSIVE | AI_NUMERICHOST, &dns6addr);
if (dns6addr_len < 0) {
warnx("Bad IPv6 address to listen on.");
usage();
}
}
if(bind_enable) {
in_addr_t dns_ip = ((struct sockaddr_in *) &dns4addr)->sin_addr.s_addr;