From: Tito L. <tit...@gm...> - 2016-10-26 20:38:40
|
Hi, getaddrinfo() in GNU C library assumes ai_flags with a value of (AI_V4MAPPED | AI_ADDRCONFIG) if the argument `hints' is NULL [POSIX specifies different defaults, see NOTES in `man getaddrinfo'] AI_ADDRCONFIG means: "Use configuration of this host to choose returned address type.." I have accidentally noticed that problem by running a dhcpcd client daemon sh> dhcpcd eth0 but without a physical connection to talk with a DHCP server. Then I have tried to start a local Swank server but the required port number is ignored, because addrinfo-family after getaddrinfo() is always AF_INET6 in this case and SWANK/SBCL::RESOLVE-HOSTNAME considers the first HOST-ENT returned from GET-HOST-BY-NAME (for IPv4 addresses): ;; slime/swank/sbcl.lisp (defun resolve-hostname (name) (car (sb-bsd-sockets:host-ent-addresses (sb-bsd-sockets:get-host-by-name name)))) so the result is NIL and the specified port number is ignored during socket-bind. A solution is to alloc a struct addrinfo for the argument `hints' of getaddrinfo(), set ai_family to AF_UNSPEC and the other slots (flags, socktype and protocol should be enough) to zero. I have attached a git-diff because I don't have a good log message at moment. |