Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

What should be default for Net::Server - IPv4, IPv6 or IPv*

by Rhandom (Curate)
on Jun 01, 2012 at 01:21 UTC ( #973650=perlquestion: print w/ replies, xml ) Need Help??
Rhandom has asked for the wisdom of the Perl Monks concerning the following question:

Net::Server is finally getting releases again after a lot of backlogged work. Among other new features, it now has fully configurable IPv6 support. If you pass it an IPv4 address, you'll get an IPv4 socket. If you pass it an IPv6 address, you'll get an IPv6 socket. At the moment, if you pass a hostname the server defaults to IPv4 - but you can configure it to do just IPv6 by passing ipv => 6 (or ipv => "IPv6"), or you can have it look for any available interfaces on either IPv4 or IPv6 by passing ipv => "*", and if you wanted to force both you could pass ipv => "46" (or ipv => "IPv4 IPv6". A similar issue exists for the "*" host (0.0.0.0 under IPv4 and :: under IPv6).

So at the moment, the default for the ipv parameter is 4. Should it be? Or should the default be "*".

Using IPv6 as the default is certainly nice if that is what you want. However, it does bring along some problems. It is additional chaining and resources; If you do find interfaces for both then you need to create multiple sockets (well :: on linux listens for both IPv6 and IPv4 by default - so only one socket is needed there); there is a bit of legacy security issue involved in that servers running off of hostnames, that previously weren't listening to IPv6 sockets, now would automatically begin listening; additionally existing allow_deny rules may not handle the new peeraddr formats coming in; and finally, any legacy socket specific code might break (hopefully there isn't too much of this).

One more item, the unofficial 0.99.6.1 package essentially had ipv => "*" as the default for 9 months, so that is certainly something in favor of "*".

So what do the monks think the default should be? It is likely that "*" is the way to go along with careful documentation saying to add ipv => 4 to your configurations if you don't want to begin binding IPv6 after your upgrade.

Thanks for any input.

<strikethrough> Update: So, based on comments, I am deciding to leave the default as is (IPv4) - however, to try and make things easier, the value can now be set via the hostname ("localhost/IPv*"), via the proto ("tcp/IPv*") or via setting $ENV{'IPV'} to '*'.

I do still agree that from angles, not defaulting to "*" is partially broken. However, I think safety for existing people is likely better at this point. And it should be remembered that many configuration systems of other software require you to use the IP address.

Update2: After all of the debate, and after my last comment, we still went with a change. Version 2.005 switched the default to IPv*.

my @a=qw(random brilliant braindead); print $a[rand(@a)];

Comment on What should be default for Net::Server - IPv4, IPv6 or IPv*
Re: What should be default for Net::Server - IPv4, IPv6 or IPv*
by Anonymous Monk on Jun 01, 2012 at 02:27 UTC

    Having seen many test suites use the default, I think the default should be localhost :) 127.0.0.1

Re: What should be default for Net::Server - IPv4, IPv6 or IPv*
by mbethke (Hermit) on Jun 01, 2012 at 03:04 UTC
    I'd opt for compatibility for now and keep the default at v4. Those who want IPv6 will have some workaround in place and will be happy to hear they can simplify their code now, and those who don't want to change their legacy applications when they get some automated upgrade needn't worry about suddenly accepting connections they may not be fully prepared to accept due to some assumptions about v4 peer addresses and similar legacy problems. In a year or two when v6 is more widespread it should be time to change the default.
      This is just another good reason to use a default value of "*" IMHO. Changing the default somewhere down the road just because one's subjective opinion on what's become more widespread would guarantee breakage in scripts depending on Net::Server in one way or another.

      -- Time flies when you don't know what you're doing
        You mean, "rather break them now than later"? Because I don't see how changing the default later would guarantee breakage with any higher probability than now. Perceptions of what is "widespread enough" are of course necessarily subjective, just like perceptions of what should be given more weight, compatibility or "moving forward".
      The only problem with compatibility - is compatibility with which version.

      IPv4 as default is compatible with all official versions including 0.99.

      IPv* as default is compatible with the unofficial (but head for 9 months) version 0.99.6.1

      my @a=qw(random brilliant braindead); print $a[rand(@a)];
        but IP* would work for anyone who has ipv4 already set... i.e., it doesn't break anything. It just adds ipv6 to the mix. I basically ran across this because our company is making massive moves to make sure everything easily supports ipv4, ipv4/ipv6, and ipv6 modes of operation.

        Compatibility with what most people use. People who use unofficial HEADs should know what they are doing and particularly be aware that defaults may change from one version to the other---obviously they've had this experience at least once. Those who just run "aptitude upgrade" or equivalents to be fed the latest stable version are less likely to pay attention to these things and just expect their applications to behave the same. You could just warn() people who haven't explicitly set a protocol family about impending changes in the default for a while and then switch it.

Re: What should be default for Net::Server - IPv4, IPv6 or IPv*
by Anonymous Monk on Jun 01, 2012 at 19:16 UTC
    The problem I have with the current behavior for Net::Server 2.001, is that if you specify "localhost" on a system with only IPv6 support, and where /etc/hosts only has ::1 as a interface for localhost, it will incorrectly only listen to IPv4 localhost (127.0.0.1). Since nothing on the box has any knowledge of IPv4 localhost, nothing can connect to the server. You have to explicitly use ::1 or set ipv to * for it to correctly listen on the ipv6 localhost interface. This seems utterly broken.
Reaped: Re: What should be default for Net::Server - IPv4, IPv6 or IPv*
by NodeReaper (Curate) on Jun 02, 2012 at 03:14 UTC
Reaped: Re: What should be default for Net::Server - IPv4, IPv6 or IPv*
by NodeReaper (Curate) on Jun 02, 2012 at 12:58 UTC
Reaped: Re: What should be default for Net::Server - IPv4, IPv6 or IPv*
by NodeReaper (Curate) on Jun 03, 2012 at 12:30 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://973650]
Front-paged by NetWallah
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2014-11-27 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (188 votes), past polls