… | |
… | |
20 | */ |
20 | */ |
21 | |
21 | |
22 | #include "config.h" |
22 | #include "config.h" |
23 | |
23 | |
24 | #include <netdb.h> |
24 | #include <netdb.h> |
25 | |
|
|
26 | #include "gettext.h" |
|
|
27 | |
25 | |
28 | #include "sockinfo.h" |
26 | #include "sockinfo.h" |
29 | #include "slog.h" |
27 | #include "slog.h" |
30 | |
28 | |
31 | // all ipv4-based protocols |
29 | // all ipv4-based protocols |
… | |
… | |
63 | void |
61 | void |
64 | sockinfo::set (const conf_node *conf, u8 prot_) |
62 | sockinfo::set (const conf_node *conf, u8 prot_) |
65 | { |
63 | { |
66 | if (prot_ == PROT_DNSv4) |
64 | if (prot_ == PROT_DNSv4) |
67 | { |
65 | { |
68 | host = 0x01010101; port = htons (conf->id); prot = prot_; |
66 | host = htonl (conf->id); port = 0; prot = prot_; |
69 | } |
67 | } |
70 | else |
68 | else |
71 | set (conf->hostname, |
69 | set (conf->hostname, |
72 | prot_ == PROT_UDPv4 ? conf->udp_port |
70 | prot_ == PROT_UDPv4 ? conf->udp_port |
73 | : prot_ == PROT_TCPv4 ? conf->tcp_port |
71 | : prot_ == PROT_TCPv4 ? conf->tcp_port |
… | |
… | |
171 | { |
169 | { |
172 | prot = prot_; |
170 | prot = prot_; |
173 | port = htons (conf->tcp_port); |
171 | port = htons (conf->tcp_port); |
174 | return true; |
172 | return true; |
175 | } |
173 | } |
176 | |
|
|
177 | #if ENABLE_DNS |
|
|
178 | if (conf |
|
|
179 | && prot_ & PROT_DNSv4 |
|
|
180 | && conf->protocols & PROT_DNSv4 |
|
|
181 | && conf->dns_port) |
|
|
182 | { |
|
|
183 | set (::conf.dns_forw_host, ::conf.dns_forw_port, prot_); |
|
|
184 | return true; |
|
|
185 | } |
|
|
186 | #endif |
|
|
187 | } |
174 | } |
188 | |
175 | |
189 | return false; |
176 | return false; |
190 | } |
177 | } |
191 | |
178 | |