[nsd-users] Address already in use if using same -a and ip-address

Jeremy C. Reed jreed at isc.org
Wed Sep 16 17:14:59 CEST 2009


nsd -a 127.0.0.1 -c nsd.conf -P nsd.pid -p 15353 -u jreed
And nsd.conf had:
	ip-address: 127.0.0.1
	port: 15353

Sep 15 13:57:18 bind10-testing1 nsd[25334]: can't bind udp socket: Address already in use

socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
fcntl(3, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
bind(3, {sa_family=AF_INET, sin_port=htons(15353), sin_addr=inet_addr("127.0.0.1
")}, 16) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
fcntl(4, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
bind(4, {sa_family=AF_INET, sin_port=htons(15353), sin_addr=inet_addr("127.0.0.1
")}, 16) = -1 EADDRINUSE (Address already in use)
open("/etc/localtime", O_RDONLY)        = 5

If on command line and also in config file, it attempts to bind to it 
twice.

If that is expected, it is not intuitive. I'd assume that the command-line 
arguments override the configuration file. My workaround was to comment 
out the ip-address: in my configuration or don't use the -a option.

This is inconsistent. (If I am reading code correctly...) here are two 
examples:

- nodes array is all set to nothing.
- nodes is set for each -a argument, nsd.ifs is increment for each
- then options are read and nodes is set for each ip-address

(I'd suggest that if -a is used then don't use from config.)

- udp_port set to nothing
- udp_port is set to -p argument
- if udp_port was not set to -p argument, then set to port from 
  conf options
- if no conf options for port, then set to default 53

>From looking at code, I see some command line options to override the 
nsd.conf options. Please be clear in man pages which ones do this.

And maybe be useful to warn about it also, like:

log_msg(LOG_WARNING, "Not using foo from configuration. Using command-line argument instead to override.");


More information about the nsd-users mailing list