--- gvpe/src/sockinfo.C 2005/03/01 06:27:20 1.13 +++ gvpe/src/sockinfo.C 2007/12/04 15:01:12 1.22 @@ -1,8 +1,10 @@ /* sockinfo.C -- socket address management - Copyright (C) 2003 Marc Lehmann + Copyright (C) 2003 Marc Lehmann - This program is free software; you can redistribute it and/or modify + This file is part of GVPE. + + GVPE is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. @@ -13,8 +15,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + along with gvpe; if not, write to the Free Software + Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.h" @@ -26,6 +28,9 @@ #include "sockinfo.h" #include "slog.h" +#include +#include + // all ipv4-based protocols #define PROTv4 (PROT_UDPv4 | PROT_TCPv4 | PROT_ICMPv4 | PROT_IPv4 | PROT_DNSv4) @@ -61,13 +66,17 @@ void sockinfo::set (const conf_node *conf, u8 prot_) { - set (prot_ == PROT_DNSv4 ? ::conf.dns_forw_host - : conf->hostname, - prot_ == PROT_UDPv4 ? conf->udp_port - : prot_ == PROT_TCPv4 ? conf->tcp_port - : prot_ == PROT_DNSv4 ? conf->dns_port - : 0, - prot_); + if (prot_ == PROT_DNSv4) + { + host = htonl (conf->id); port = 0; prot = prot_; + } + else + set (conf->hostname, + prot_ == PROT_UDPv4 ? conf->udp_port + : prot_ == PROT_TCPv4 ? conf->tcp_port + : prot_ == PROT_DNSv4 ? conf->dns_port + : 0, + prot_); } const sockaddr * @@ -167,15 +176,6 @@ port = htons (conf->tcp_port); return true; } - - if (conf - && prot_ & PROT_DNSv4 - && conf->protocols & PROT_DNSv4 - && conf->dns_port) - { - set (::conf.dns_forw_host, ::conf.dns_forw_port, prot_); - return true; - } } return false;