Bug 127784 - Provide option to listen on ipv6 socket if ipv6 available and fallback to ipv4 if not.
Summary: Provide option to listen on ipv6 socket if ipv6 available and fallback to ipv...
Status: RESOLVED FIXED
Alias: None
Product: SUSE Linux 10.1
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: unspecified
Hardware: Other All
: P5 - None : Enhancement (vote)
Target Milestone: ---
Assignee: Michal Marek
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-12 13:18 UTC by Marian Jancar
Modified: 2005-11-03 08:52 UTC (History)
0 users

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
patch allowing 'flags = IPv4 IPv6' (1.51 KB, patch)
2005-10-31 12:40 UTC, Michal Marek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marian Jancar 2005-10-12 13:18:17 UTC
There is IPv6 flag for xinet that makes it listen on ipv6 socket, but it fails
to start the service when only ipv4 is available. Please provide an option to
listen on ipv6 if avilable and fallback to ipv4 if not (just like ssh does by
default).
Comment 1 Michal Marek 2005-10-18 12:41:37 UTC
Do you mean something like

flags = IPv6orIPv4

meaning

bind() to :::port;
if that fails
  bind() to 0.0.0.0:port;

OR

flags = IPv6 IPv4

meaning

bind() to :::port;
bind() to 0.0.0.0:port;

? (Will talk to you when you're back from vacation)
Comment 2 Marian Jancar 2005-10-18 13:44:29 UTC
The second seems better. bind() to ::: is enough, ipv6 sockets can accept ipv4 connections (thats the point of this enhancement). Currently when both the IPv6 IPv4 flags are set, xinetd warns and listens on ipv4 only, it would be best to change this to try bind to ::: and if that fails bind to 0.0.0.0.
Comment 3 Michal Marek 2005-10-31 12:40:16 UTC
Created attachment 56001 [details]
patch allowing 'flags = IPv4 IPv6'
Comment 4 Michal Marek 2005-10-31 12:51:30 UTC
Does the above patch do what you want? Specify 

    flags = IPv6 IPv4 # order doesn't matter

and xinetd will first try to create an IPv6 socket and fallback to an
IPv4 socket. BTW you can achieve the same by creating two services:

    service foo {
        id     = foo-4
        flags  = IPv4
        ...
    }
    service foo {
        id     = foo-6
        flags  = IPv6
        v6only = yes
        ...
    }

So this patch might not be needed.
Comment 5 Marian Jancar 2005-11-01 08:23:07 UTC
Right, this would work too. But the one socket solution is neat, it would be nice if it were accepted upstream, so we wouldn't have to use the two sockets or maintain the patch.
Comment 6 Michal Marek 2005-11-01 08:47:21 UTC
OK, so I'm setting this to FIXEd and will talk to upstream.
Comment 7 Michal Marek 2005-11-03 08:52:33 UTC
Seems like it will be accepted by upstream:


On Tue, Nov 01, 2005 at 11:50:00AM +0100, Michal Marek wrote:
> 
> Do you think this patch could make it info official xinetd?

My initial reaction was negative, but after more thought and
bouncing the idea off others, I think it's probably fine.

Rob