19                              const uint16_t port) {
 
   21    int sock = socket(AF_INET, SOCK_DGRAM, 0);
 
   24                  " address " << addr << 
", port " << port
 
   25                  << 
", reason: " << strerror(errno));
 
   28    if (fcntl(sock, F_SETFD, FD_CLOEXEC) < 0) {
 
   31                  << 
" on fallback socket for address " << addr
 
   33                  << 
", reason: " << strerror(errno));
 
   36    struct sockaddr_in addr4;
 
   37    memset(&addr4, 0, 
sizeof(addr4));
 
   38    addr4.sin_family = AF_INET;
 
   39    addr4.sin_addr.s_addr = htonl(addr.
toUint32());
 
   40    addr4.sin_port = htons(port);
 
   42    if (bind(sock, 
reinterpret_cast<struct sockaddr*
>(&addr4),
 
   46        char* errmsg = strerror(errno);
 
   50                  " address " << addr << 
", port " << port
 
   51                  << 
", reason: " << errmsg
 
   52                  << 
" - is another DHCP server running?");
 
   57    if (fcntl(sock, F_SETFL, O_NONBLOCK) != 0) {
 
   60        char* errmsg = strerror(errno);
 
   63                  " fallback socket, bound to " << addr << 
", port " 
   64                  << port << 
", reason: " << errmsg);