mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
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. -- 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>
This commit is contained in:
parent
08147f8bbd
commit
861f1da073
@ -7121,6 +7121,8 @@ static int dns_socket(struct sockaddr *local, int type, int *error_) {
|
|||||||
if (type != SOCK_DGRAM)
|
if (type != SOCK_DGRAM)
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
|
#define LEAVE_SELECTION_OF_PORT_TO_KERNEL
|
||||||
|
#if !defined(LEAVE_SELECTION_OF_PORT_TO_KERNEL)
|
||||||
/*
|
/*
|
||||||
* FreeBSD, Linux, OpenBSD, OS X, and Solaris use random ports by
|
* FreeBSD, Linux, OpenBSD, OS X, and Solaris use random ports by
|
||||||
* default. Though the ephemeral range is quite small on OS X
|
* default. Though the ephemeral range is quite small on OS X
|
||||||
@ -7146,6 +7148,7 @@ static int dns_socket(struct sockaddr *local, int type, int *error_) {
|
|||||||
|
|
||||||
/* NB: continue to next bind statement */
|
/* NB: continue to next bind statement */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (0 == bind(fd, local, dns_sa_len(local)))
|
if (0 == bind(fd, local, dns_sa_len(local)))
|
||||||
return fd;
|
return fd;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user