Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Wanted: IPv6

Closed / Accepted1782896fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 16 years ago
Descriptionplain2007-08-27 20:53:50
I work on some government-related code and we have a mandate to convert to IPv6 this next coming year. I was wondering if IPv6 could make it into 8.6 ???
dkf Ticket [1782896fff]: 1 change [History diff]2007-08-28 15:19:10
silpheedplain2007-08-31 00:03:21
Logged In: YES 
user_id=963204
Originator: YES

Of course if it made it as a patch into 8.5, that would be very nice. And to clarify, the mandate is from OMB for government networks and apps to IPv6 compliant by sometime next year. (Can't remember the specific date.)
dkfplain2007-08-31 20:14:05
Logged In: YES 
user_id=79902
Originator: NO

IPv6 client sockets look to be fairly straight-forward on Unix (all changes localized to tclUnixChan.c) but I'm less sure about server sockets. How practical is it to have a single socket listening for connects on both IPv4 and IPv6 sockets? (Thankfully, they both share the same port-space, so at least *that* won't get in our way!)
dkfplain2007-08-31 20:34:48
Logged In: YES 
user_id=79902
Originator: NO

Additional notes:
 Use inet_ntop() instead of inet_ntoa()
 Use inet_pton() instead of inet_aton()
 Use getaddrinfo() instead of gethostbyname() and gethostbyaddr()
dsolariplain2008-09-24 04:08:58
Needed IPv6:

The client side is being requested by many of our customers since they are converting/converted to IP6.
As an ISV using tcl we need to support it or convert to a different language.

So why not release the client support in 8.6 even if the server support will not be ready or agreed to...?
Using tcl socket calls as a client would meet our requirements for now from customers.
ferrieuxplain2008-09-24 05:19:52
In the meantime to this implementation, what about [open |netcat6 r+] ?
ceroplain2009-06-09 02:09:55
Is there anyting new about IPv6 implementation to core tcl? I've seen a patch #713194 for that!
dkfplain2009-06-09 04:32:49
This was discussed in depth between myself and Reinhard Max at EuroTcl last week. We believe that it is possible to do it without significant changes *provided* people are content to let the OS pick which base protocol to use to communicate with the remote server; that can be done with no change to the scripted API (other than modifications to code that assumes that addresses are never in v6 format, of course...)

We don't know if this is acceptable as an interim measure. (More control is desirable, but we couldn't get that sorted out in a reasonable timescale for 8.6)
dkfplain2010-03-20 23:15:45
c.f. rmax-ipv6-branch in CVS; assigning to person in charge of that
egavilanplain2010-03-20 23:33:07
The rmax-ipv6-branch doesn't build on NetBSD. For the error message see http://paste.tclers.tk/2019
dkfplain2010-03-20 23:36:50
{Copying in from that URL}

[snip]
/home/emiliano/src/tcl/unix/tclUnixSock.c: In function 'CreateSocketAddress':
/home/emiliano/src/tcl/unix/tclUnixSock.c:1036: error: 'AI_ADDRCONFIG' undeclared (first use in this function)
/home/emiliano/src/tcl/unix/tclUnixSock.c:1036: error: (Each undeclared identifier is reported only once
/home/emiliano/src/tcl/unix/tclUnixSock.c:1036: error: for each function it appears in.)
*** Error code 1
 
Stop.
make: stopped in /home/emiliano/src/tcl/unix
egavilanplain2010-03-21 01:09:38
It seems AI_ADDRCONFIG is an specific glibc optimization; with the obvious #ifdef the build completes. Whowever, there are failing socket test:

==== socket-2.2 tcp connection with client port specified FAILED
==== Contents of test case:
 
    # $x == "ready" at this point
    global port
    set sock [socket -myport $port 127.0.0.1 $listen]
    puts $sock hello
    flush $sock
    lappend x [gets $f]
    close $sock
    return $x
 
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't open socket: invalid argument
    while executing
"socket -myport $port 127.0.0.1 $listen"
    ("uplevel" body line 4)
    invoked from within
"uplevel 1 $script"
---- errorCode: POSIX EINVAL {invalid argument}
---- Test cleanup failed:
error writing "stdout": broken pipe
    while executing
"puts "[gets $file] $port""
    (procedure "accept" line 3)
    invoked from within
"accept sock5 127.0.0.1 63767"
---- errorInfo(cleanup): error writing "stdout": broken pipe
    while executing
"puts "[gets $file] $port""
    (procedure "accept" line 3)
    invoked from within
"accept sock5 127.0.0.1 63767"
    while executing
"close $f"
    ("uplevel" body line 3)
    invoked from within
"uplevel 1 $cleanup"
---- errorCode(cleanup): NONE
==== socket-2.2 FAILED
  
==== socket-11.2 client specifies its port FAILED
==== Contents of test case:
 
    set s [socket -myport $port $remoteServerIP 2835]
    set r [gets $s]
    expr {$r==$port ? "ok" : "broken: $r != $port"}
 
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't open socket: invalid argument
    while executing
"socket -myport $port $remoteServerIP 2835"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $script"
---- errorCode: POSIX EINVAL {invalid argument}
---- Test cleanup failed:
can not find channel named "sock6"
---- errorInfo(cleanup): can not find channel named "sock6"
    while executing
"close $s"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $cleanup"
---- errorCode(cleanup): TCL LOOKUP CHANNEL sock6
==== socket-11.2 FAILED
jenglishplain2010-03-21 06:53:54
AI_ADDRCONFIG was added in RFC 3493, published Feb 2003; it may still be a while before everyone is caught up.   Many systems still support (only) the RFC 2553 API; best to stick with the common subset between those two RFCs.
dkfplain2010-03-21 23:31:16
Failing that, that's the sort of thing that autoconf can help solve.
rmaxplain2010-03-23 21:28:25
Given that AI_ADDRCONFIG is a preprocessor macro and optional, using it conditionally doesn't even need support from autoconf. The latest version of the rmax-ipv6-branch uses:

#ifdef AI_ADDRCONFIG
    hints.ai_flags |= AI_ADDRCONFIG;
#endif
dkfplain2010-10-28 15:22:34
allow_comments - 1

Though more work needs to be done (in particular some control over address family selection), this feature is now at least present to a sufficient level to satisfy this FRQ. Closing.
Log in (anonymous is fine) to add a comment.