- Fix for lookup of parent-child disagreement domains, where the
parent-side glue works but it does not provide proper NS, A or AAAA
for itself, fixing domains such as motorcaravanners.eu.
+ - Feature: you can specify a port number in the interface: line, so
+ you can bind the same interface multiple times at different ports.
7 December 2009: Wouter
- Bug#287: Fix segfault when unbound-control remove nonexistent local
.B port: \fI<port number>
The port number, default 53, on which the server responds to queries.
.TP
-.B interface: \fI<ip address>
+.B interface: \fI<ip address[@port]>
Interface to use to connect to the network. This interface is listened to
for queries from clients, and answers to clients are given from it.
Can be given multiple times to work on several interfaces. If none are
given the default is to listen to localhost.
The interfaces are not changed on a reload (kill \-HUP) but only on restart.
+A port number can be specified with @port (without spaces between
+interface and port number), if not specified the default port (from
+\fBport\fR) is used.
.TP
.B interface\-automatic: \fI<yes or no>
Detect source interface on UDP queries and copy them to replies. This
return s;
}
+/** make socket and first see if ifname contains port override info */
+static int
+make_sock_port(int stype, const char* ifname, const char* port,
+ struct addrinfo *hints, int v6only, int* noip6, size_t rcv)
+{
+ char* s = strchr(ifname, '@');
+ if(s) {
+ /* override port with ifspec@port */
+ char p[16];
+ char newif[128];
+ if((size_t)(s-ifname) >= sizeof(newif)) {
+ log_err("ifname too long: %s", ifname);
+ *noip6 = 0;
+ return -1;
+ }
+ if(strlen(s+1) >= sizeof(p)) {
+ log_err("portnumber too long: %s", ifname);
+ *noip6 = 0;
+ return -1;
+ }
+ strncpy(newif, ifname, sizeof(newif));
+ newif[s-ifname] = 0;
+ strncpy(p, s+1, sizeof(p));
+ p[strlen(s+1)]=0;
+ return make_sock(stype, newif, p, hints, v6only, noip6, rcv);
+ }
+ return make_sock(stype, ifname, port, hints, v6only, noip6, rcv);
+}
+
/**
* Add port to open ports list.
* @param list: list head. changed.
if(!do_udp && !do_tcp)
return 0;
if(do_auto) {
- if((s = make_sock(SOCK_DGRAM, ifname, port, hints, 1,
+ if((s = make_sock_port(SOCK_DGRAM, ifname, port, hints, 1,
&noip6, rcv)) == -1) {
if(noip6) {
log_warn("IPv6 protocol not available");
}
} else if(do_udp) {
/* regular udp socket */
- if((s = make_sock(SOCK_DGRAM, ifname, port, hints, 1,
+ if((s = make_sock_port(SOCK_DGRAM, ifname, port, hints, 1,
&noip6, rcv)) == -1) {
if(noip6) {
log_warn("IPv6 protocol not available");
}
}
if(do_tcp) {
- if((s = make_sock(SOCK_STREAM, ifname, port, hints, 1,
+ if((s = make_sock_port(SOCK_STREAM, ifname, port, hints, 1,
&noip6, 0)) == -1) {
if(noip6) {
/*log_warn("IPv6 protocol not available");*/