diff options
| author | Robert Pluim | 2019-01-31 14:20:32 +0100 |
|---|---|---|
| committer | Robert Pluim | 2019-02-04 10:06:04 +0100 |
| commit | 49f6243027d910032f014be15b2c4ac2175c25f8 (patch) | |
| tree | f54edbb0c9d82bcb006bead0d30c8498f1bbd54f /src/process.c | |
| parent | 4633b0ef3ff7fc8ac013e4236edf782fb3cadfb4 (diff) | |
| download | emacs-49f6243027d910032f014be15b2c4ac2175c25f8.tar.gz emacs-49f6243027d910032f014be15b2c4ac2175c25f8.zip | |
Use IPv6 localhost when family is 'ipv6
This fixes Bug#34193
* src/process.c (Fmake_network_process): Explicitly use ::1 when
using IPv6 with 'local. Update docstring.
* test/lisp/net/network-stream-tests.el
(make-ipv6-tcp-server-with-unspecified-port):
(make-ipv6-tcp-server-with-specified-port): Test creating ipv6
local server.
(make-server): Add optional family argument, default ipv4
(echo-server-with-local-ipv4): Test connecting to 'local ipv4
(echo-server-with-local-ipv6): Test connecting to 'local ipv6
* doc/lispref/processes.texi (Network Processes): Describe
behavior when using 'local.
* etc/NEWS: Document new 'make-network-process' behavior when
connecting to 'local with ipv6.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/process.c b/src/process.c index 728c14a7624..9502ef461e8 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -3733,6 +3733,8 @@ also nil, meaning that this process is not associated with any buffer. | |||
| 3733 | address. The symbol `local' specifies the local host. If specified | 3733 | address. The symbol `local' specifies the local host. If specified |
| 3734 | for a server process, it must be a valid name or address for the local | 3734 | for a server process, it must be a valid name or address for the local |
| 3735 | host, and only clients connecting to that address will be accepted. | 3735 | host, and only clients connecting to that address will be accepted. |
| 3736 | `local' will use IPv4 by default, use a FAMILY of 'ipv6 to override | ||
| 3737 | this. | ||
| 3736 | 3738 | ||
| 3737 | :service SERVICE -- SERVICE is name of the service desired, or an | 3739 | :service SERVICE -- SERVICE is name of the service desired, or an |
| 3738 | integer specifying a port number to connect to. If SERVICE is t, | 3740 | integer specifying a port number to connect to. If SERVICE is t, |
| @@ -3983,14 +3985,24 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3983 | #ifdef HAVE_LOCAL_SOCKETS | 3985 | #ifdef HAVE_LOCAL_SOCKETS |
| 3984 | if (family != AF_LOCAL) | 3986 | if (family != AF_LOCAL) |
| 3985 | #endif | 3987 | #endif |
| 3986 | host = build_string ("127.0.0.1"); | 3988 | { |
| 3989 | if (family == AF_INET6) | ||
| 3990 | host = build_string ("::1"); | ||
| 3991 | else | ||
| 3992 | host = build_string ("127.0.0.1"); | ||
| 3993 | } | ||
| 3987 | } | 3994 | } |
| 3988 | else | 3995 | else |
| 3989 | { | 3996 | { |
| 3990 | if (EQ (host, Qlocal)) | 3997 | if (EQ (host, Qlocal)) |
| 3998 | { | ||
| 3991 | /* Depending on setup, "localhost" may map to different IPv4 and/or | 3999 | /* Depending on setup, "localhost" may map to different IPv4 and/or |
| 3992 | IPv6 addresses, so it's better to be explicit (Bug#6781). */ | 4000 | IPv6 addresses, so it's better to be explicit (Bug#6781). */ |
| 3993 | host = build_string ("127.0.0.1"); | 4001 | if (family == AF_INET6) |
| 4002 | host = build_string ("::1"); | ||
| 4003 | else | ||
| 4004 | host = build_string ("127.0.0.1"); | ||
| 4005 | } | ||
| 3994 | CHECK_STRING (host); | 4006 | CHECK_STRING (host); |
| 3995 | } | 4007 | } |
| 3996 | 4008 | ||