libdns: Let kernel to decide the local port.
authorNIIBE Yutaka <gniibe@fsij.org>
Tue, 19 Jun 2018 23:59:05 +0000 (08:59 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Wed, 20 Jun 2018 00:14:02 +0000 (09:14 +0900)
commit72a35ffee022f1bf180d02250c5be6a4edb599e7
tree3a21127f7fd3e3dea5a395aa7134d801773de968
parent87d0ecf8a1b80139a6cab2a79f1ca6e287207999
libdns: Let kernel to decide the local port.

* dirmngr/dns.c (LEAVE_SELECTION_OF_PORT_TO_KERNEL): New.
(dns_socket): Don't select ephemeral port in user space.

--

Cherry picked from master commit:
    861f1da0731bf29dcb9221c4f22c76b40ec15a78

There is no good reason to bind local port aggressively.  It might be
some reason to do so, then, a user can specify it in /etc/resolv.conf
by the second argument of "interface" directive.

At least, it causes a problem on Windows.  Binding a specified port in
user space can trigger the Firewall dialog on Windows.  Since it can
be considered valid question, it is better not to bind with an
ephemeral port which is selected in user space, by default.

GnuPG-bug-id: 3610
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
dirmngr/dns.c