GNU bug report logs - #34617
27.0.50; Can't bind a server process to all interfaces?

Previous Next

Package: emacs;

Reported by: Lars Ingebrigtsen <larsi <at> gnus.org>

Date: Fri, 22 Feb 2019 13:46:01 UTC

Severity: normal

Tags: fixed

Found in version 27.0.50

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34617 in the body.
You can then email your comments to 34617 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#34617; Package emacs. (Fri, 22 Feb 2019 13:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lars Ingebrigtsen <larsi <at> gnus.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 22 Feb 2019 13:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; Can't bind a server process to all interfaces?
Date: Fri, 22 Feb 2019 14:43:48 +0100
I'm looking to bind a server process to all interfaces on the machine.
If I say:

		(make-network-process
		 :name name
		 :family 'ipv4
		 :service port
		 :host (system-name)
		 :server t))

then the process won't be listening to the localhost address, and if I
say :host nil, it'll only be listening to the localhost address.

Am I missing something, or does Emacs just not have a way to listen to
INADDR_ANY?

The code in make-network-process seems to imply that (and could probably
do with a slight rewrite):

  /* :host HOST -- hostname, ip address, or 'local for localhost.  */
  host = Fplist_get (contact, QChost);
  if (NILP (host))
    {
      /* The "connection" function gets it bind info from the address we're
	 given, so use this dummy address if nothing is specified. */
#ifdef HAVE_LOCAL_SOCKETS
      if (family != AF_LOCAL)
#endif
        {
        if (family == AF_INET6)
          host = build_string ("::1");
        else
          host = build_string ("127.0.0.1");
        }
    }
  else
    {
      if (EQ (host, Qlocal))
        {
	/* Depending on setup, "localhost" may map to different IPv4 and/or
	   IPv6 addresses, so it's better to be explicit (Bug#6781).  */
        if (family == AF_INET6)
          host = build_string ("::1");
        else
          host = build_string ("127.0.0.1");
        }
      CHECK_STRING (host);
    }



In GNU Emacs 27.0.50 (build 62, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2019-02-11 built on stories
Repository revision: 2860f6cec56b02120b0b62cb3733c00a9e5359db
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description: Debian GNU/Linux 9 (stretch)


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34617; Package emacs. (Fri, 22 Feb 2019 13:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 34617 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 34617 <at> debbugs.gnu.org
Subject: Re: bug#34617: 27.0.50; Can't bind a server process to all interfaces?
Date: Fri, 22 Feb 2019 14:51:53 +0100
Somebody on irc told me that

  :host "0.0.0.0"

will give me the INADDR_ANY thing I want...  So perhaps that should just
be added to the doc string?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34617; Package emacs. (Fri, 22 Feb 2019 14:01:02 GMT) Full text and rfc822 format available.

Message #11 received at 34617 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 34617 <at> debbugs.gnu.org
Subject: Re: bug#34617: 27.0.50; Can't bind a server process to all interfaces?
Date: Fri, 22 Feb 2019 15:00:17 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I'm looking to bind a server process to all interfaces on the machine.
> If I say:
>
> 		(make-network-process
> 		 :name name
> 		 :family 'ipv4
> 		 :service port
> 		 :host (system-name)
> 		 :server t))
>
> then the process won't be listening to the localhost address, and if I
> say :host nil, it'll only be listening to the localhost address.
>
> Am I missing something, or does Emacs just not have a way to listen to
> INADDR_ANY?
>

Does :host "0.0.0.0" not work? Seems ok to me:

(setq proc (make-network-process
                 :name "foo"
                 :family 'ipv4
                 :service 6666
                 :host "0.0.0.0"
                 :server t))
                         
M-x list-processes

foo             --      listen  --                        --           Main         (network server on 0.0.0.0)
foo <127.0.0... --      open    foo <127.0.0.1:63650>     --           Main         (network connection to 127.0.0.1)
foo <172.26.... --      open    foo <172.26.128.66:63605> --           Main         (network connection to 172.26.128.66)
foo <172.26.... --      open    foo <172.26.148.3:63628>  --           Main         (network connection to 172.26.148.3)



Robert




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34617; Package emacs. (Fri, 22 Feb 2019 14:06:02 GMT) Full text and rfc822 format available.

Message #14 received at 34617 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 34617 <at> debbugs.gnu.org
Subject: Re: bug#34617: 27.0.50; Can't bind a server process to all interfaces?
Date: Fri, 22 Feb 2019 15:05:41 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Somebody on irc told me that
>
>   :host "0.0.0.0"
>
> will give me the INADDR_ANY thing I want...  So perhaps that should just
> be added to the doc string?

And the same somebody pointed out that then you can't listen to ipv6 and
ipv4 at the same time.  Probably?

So perhaps there should be a

  :host 'any

thing to just listen to a port on all available interfaces...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34617; Package emacs. (Fri, 22 Feb 2019 14:26:02 GMT) Full text and rfc822 format available.

Message #17 received at 34617 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 34617 <at> debbugs.gnu.org
Subject: Re: bug#34617: 27.0.50; Can't bind a server process to all interfaces?
Date: Fri, 22 Feb 2019 15:25:22 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
>> Somebody on irc told me that
>>
>>   :host "0.0.0.0"
>>
>> will give me the INADDR_ANY thing I want...  So perhaps that should just
>> be added to the doc string?
>
> And the same somebody pointed out that then you can't listen to ipv6 and
> ipv4 at the same time.  Probably?
>

You can, by listening to "::" but it depends on the underlying stack
whether it works or not. It works for me :-)

> So perhaps there should be a
>
>   :host 'any
>
> thing to just listen to a port on all available interfaces...

Sure, as long as we make it error out if :family is specified, unless
you want

:family 'ipv6
:host 'any

to mean 'listen only on IPv6' interfaces and similarly for 'ipv4.

Robert




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34617; Package emacs. (Fri, 22 Feb 2019 14:29:02 GMT) Full text and rfc822 format available.

Message #20 received at 34617 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 34617 <at> debbugs.gnu.org
Subject: Re: bug#34617: 27.0.50; Can't bind a server process to all interfaces?
Date: Fri, 22 Feb 2019 15:28:50 +0100
Robert Pluim <rpluim <at> gmail.com> writes:

> You can, by listening to "::" but it depends on the underlying stack
> whether it works or not. It works for me :-)

That's a syntax I was definitely not aware of.  :-)  Is that new?

>> So perhaps there should be a
>>
>>   :host 'any
>>
>> thing to just listen to a port on all available interfaces...
>
> Sure, as long as we make it error out if :family is specified, unless
> you want
>
> :family 'ipv6
> :host 'any
>
> to mean 'listen only on IPv6' interfaces and similarly for 'ipv4.

Yeah, I think that would be logical?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34617; Package emacs. (Fri, 22 Feb 2019 15:41:02 GMT) Full text and rfc822 format available.

Message #23 received at 34617 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 34617 <at> debbugs.gnu.org
Subject: Re: bug#34617: 27.0.50; Can't bind a server process to all interfaces?
Date: Fri, 22 Feb 2019 16:39:56 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Robert Pluim <rpluim <at> gmail.com> writes:
>
>> You can, by listening to "::" but it depends on the underlying stack
>> whether it works or not. It works for me :-)
>
> That's a syntax I was definitely not aware of.  :-)  Is that new?
>

Itʼs the IPv6 equivalent of INADDR_ANY, itʼs been around basically
forever.

>>> So perhaps there should be a
>>>
>>>   :host 'any
>>>
>>> thing to just listen to a port on all available interfaces...
>>
>> Sure, as long as we make it error out if :family is specified, unless
>> you want
>>
>> :family 'ipv6
>> :host 'any
>>
>> to mean 'listen only on IPv6' interfaces and similarly for 'ipv4.
>
> Yeah, I think that would be logical?

I guess so, although

:family 'ipv6
:host "::"

currently results in listening on v4 as well for me here, so some work
would be required to implement it.

(why this sudden desire to listen to everything in Emacs? Are you
re-implementing gmane in elisp? ;-) )

Robert




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34617; Package emacs. (Sat, 21 Sep 2019 08:01:02 GMT) Full text and rfc822 format available.

Message #26 received at 34617 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 34617 <at> debbugs.gnu.org
Subject: Re: bug#34617: 27.0.50; Can't bind a server process to all interfaces?
Date: Sat, 21 Sep 2019 10:00:04 +0200
Robert Pluim <rpluim <at> gmail.com> writes:

> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
>> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>>
>>> Somebody on irc told me that
>>>
>>>   :host "0.0.0.0"
>>>
>>> will give me the INADDR_ANY thing I want...  So perhaps that should just
>>> be added to the doc string?
>>
>> And the same somebody pointed out that then you can't listen to ipv6 and
>> ipv4 at the same time.  Probably?
>
> You can, by listening to "::" but it depends on the underlying stack
> whether it works or not. It works for me :-)

I've now just mentioned this in the doc string.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 21 Sep 2019 08:01:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 34617 <at> debbugs.gnu.org and Lars Ingebrigtsen <larsi <at> gnus.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 21 Sep 2019 08:01:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 19 Oct 2019 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 184 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.