Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 330859

Summary: sys-apps/xinetd-2.3.14: specifying "flags = IPv4 IPv6" does not allow one service listen on IPv4 and IPv6
Product: Gentoo Linux Reporter: Maxime de Roucy <maxime.deroucy>
Component: [OLD] ServerAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED INVALID    
Severity: normal CC: jer
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info
/etc/xinetd.conf

Description Maxime de Roucy 2010-08-02 15:56:16 UTC
If I well understand the xinetd documentation a basic service should listen on IPv4 and IPv6 and it's possible to restrict that with "flags = IPv6" or "flags = IPv4".

But currently xinetd doesn't listen on IPv4 and IPv6 by default (just v4) and it's impossible to set "flags = IPv4 IPv6" so it's impossible to listen on both v4 and v6...

Reproducible: Always




both perl and tcpd use-flags are set.
Comment 1 Maxime de Roucy 2010-08-02 15:58:51 UTC
Created attachment 241101 [details]
emerge --info
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2010-08-02 16:08:12 UTC
(By default xinetd is set up not to listen to anything, i.e. to disable all available services until you've configured them.)


xinetd.conf(5):
       flags            Any combination of the following flags may be used:


Why do you think it is impossible to set that? Does it not run when you do set it?
Comment 3 Maxime de Roucy 2010-08-02 16:54:56 UTC
for (In reply to comment #2)
> (By default xinetd is set up not to listen to anything, i.e. to disable all
> available services until you've configured them.)

Yes, I tried to setup a sane-port service with :

service sane-port
{
  socket_type = stream
  server = /usr/sbin/saned
  protocol = tcp
  user = saned
  group = scanner
  wait = no
  disable = yes
}

then reload xinetd -> xinetd listen on ipv4 but not on ipv6
# netstat -lnptu | grep "xinetd*"
tcp   0   0 0.0.0.0:6566   0.0.0.0:*   LISTEN   3352/xinetd

> xinetd.conf(5):
>        flags            Any combination of the following flags may be used:

I tried with "flags = IPv4 IPv6"

xinetd[3352]: Service sane-port specified as both IPv4 and IPv6 - DISABLING
xinetd[3352]: service sane-port deactivated

And with "flags = IPv6" (just to try) ... there is no v4 anymore.
# netstat -lnptu |grep "xinetd*"
tcp6   0   0 :::6566   :::*   LISTEN   3352/xinetd
Comment 4 Maxime de Roucy 2010-08-02 17:26:50 UTC
Created attachment 241129 [details]
/etc/xinetd.conf
Comment 5 Dmitri Pogosian 2010-08-02 20:34:07 UTC
(In reply to comment #3)
> for (In reply to comment #2)
> > (By default xinetd is set up not to listen to anything, i.e. to disable all
> > available services until you've configured them.)
> 
> Yes, I tried to setup a sane-port service with :
> 
> service sane-port
> {
>   socket_type = stream
>   server = /usr/sbin/saned
>   protocol = tcp
>   user = saned
>   group = scanner
>   wait = no
>   disable = yes
> }
> 
> then reload xinetd -> xinetd listen on ipv4 but not on ipv6
> # netstat -lnptu | grep "xinetd*"
> tcp   0   0 0.0.0.0:6566   0.0.0.0:*   LISTEN   3352/xinetd
> 
> > xinetd.conf(5):
> >        flags            Any combination of the following flags may be used:
> 
> I tried with "flags = IPv4 IPv6"
> 
> xinetd[3352]: Service sane-port specified as both IPv4 and IPv6 - DISABLING
> xinetd[3352]: service sane-port deactivated
> 
> And with "flags = IPv6" (just to try) ... there is no v4 anymore.
> # netstat -lnptu |grep "xinetd*"
> tcp6   0   0 :::6566   :::*   LISTEN   3352/xinetd
> 

xinetd.d is shipped will all services having

disable=yes

flag, which means they are disabled.
You have copied this flag into your sane config, and, voila, it is disabled as well.   Put 'disabled=no'

Comment 6 Dmitri Pogosian 2010-08-02 20:35:43 UTC
> You have copied this flag into your sane config, and, voila, it is disabled as
> well.   Put 'disabled=no'
> 

Sorry, mistyped,  'disable=no' without 'd'

Comment 7 Maxime de Roucy 2010-08-02 20:50:25 UTC
> You have copied this flag into your sane config, and, voila, it is disabled as
> well.   Put 'disabled=no'

Sorry I didn't check the service config I gave on this bug report. I fact on my server I have "disable=no" :
(this is my real sane-port service config : )

service sane-port
{
        socket_type = stream
        server = /usr/sbin/saned
        protocol = tcp
        user = saned
        group = scanner
        wait = no
        disable = no
}

I was reading bug 321473 (which give a sane-port config for xinetd) while filling this bug report and just copy its sane-port service example... instead of ssh my server to look my real file.

My fault ... sorry.

So the problem is still here...
Comment 8 Maxime de Roucy 2010-08-02 20:59:18 UTC
Just to clarify :

xinetd works well on IPv4 (my sane-port config work on v4) (but no IPv6 listening).

It works exactly the same with "flags = IPv4" (no IPv6 listening as well ... normal).

It work on IPv6 with "flags = IPv6" but that's disable v4 listening.

It doesn't work with "flags = IPv4 IPv6".

So -> impossible to listen on IPv6 and IPv4 at the same time...

I think that without IPv4 nor IPv6 flags xinetd should listen on both.

PS : sorry for my bad english
Comment 9 SpanKY gentoo-dev 2010-08-02 21:34:04 UTC
i imagine if you created two service entries, one set to IPv4 and one set to IPv6, things would work as you want

i dont think the xinetd architecture allows for multiple ports/sockets per service entry.  and this is probably a design decision rather than a "bug".

you probably see the same behavior if you attempted to specify multiple socket types simultaneously to try and do TCP/IP and UDP/IP with one entry:
  socket_type = stream dgram

i'd have to double check the source code, but my gut reaction is that there is no bug here ...
Comment 10 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-08-02 21:45:53 UTC
Please do note that unless I'm mistaken *:tcp6 in netstat does not mean _ipv6 only_ but rather ipv6-and-mapped-ipv4. Indeed you have to explicitly request for ipv6-only sockets, so I wouldn't be surprised if that was the case.
Comment 11 Maxime de Roucy 2010-08-02 22:21:24 UTC
(In reply to comment #9)
> i imagine if you created two service entries, one set to IPv4 and one set to
> IPv6, things would work as you want
> 
> i dont think the xinetd architecture allows for multiple ports/sockets per
> service entry.  and this is probably a design decision rather than a "bug".
> 
> you probably see the same behavior if you attempted to specify multiple socket
> types simultaneously to try and do TCP/IP and UDP/IP with one entry:
>   socket_type = stream dgram
> 
> i'd have to double check the source code, but my gut reaction is that there is
> no bug here ...
> 

I tried with 2 config for sane-port at the same time ... doesn't work

I browse the web to find an explanation :
http://old.nabble.com/xinetd-and-IPv6-td9719864.html
http://www.washington.edu/imap/documentation/IPv6.txt.html

"The man page for xinetd says the IPv6 flag means xinetd will listen ONLY
on IPv6.  However the actual behaviour (for Fedora Linux) is to listen on
both IPv4 and IPv6."

say that it's possible to have a service listening v4 and v6 address ... but the method is quite strange...

Instead of creating 2 socket it create one ipv6 socket that also handle v4 request... that's why I didn't see a v4 socket with netstat :
tcp6   0   0 :::6566   :::*   LISTEN   14692/xinetd

So the solution is to set "flags = IPv6" , sysctl net.ipv6.bindv6only=0 and it should work on v4.

I am not at home right now so I can't test but I will as soon as I can.

In fact if it works : it will not be really a bug...
Comment 12 Maxime de Roucy 2010-08-03 03:44:01 UTC
it works...

"flags = IPv4" -> equal to default ... listen IPv4
"flags = IPv6" -> listen on IPv4 and v6 through one tcp6 socket.

So that's not a bug, that's the correct behavior of xinetd...
(I think the documentation isn't very clear on that)

Sorry for that...