plan9port/src/lib9
David du Colombier 3409bc9ae1 lib9/dial: add support for IPv6
The function p9dialparse() returns the host as a sockaddr_storage
structure instead of a u32int, to be able to handle both IPv4
and IPv6 addresses. Because the sockaddr_storage structure also
handle port numbers and Unix path names, there is no longer
need to set them in the calling functions. However, these values
are still returned for convenience.

The sockaddr_in and sockaddr_un structures have been replaced
by sockaddr_storage to handle Unix, IPv4 and IPv6 sockets.

Names and addresses are resolved using either gethostbyname()
or getaddrinfo() functions.

The getaddrinfo() function is documented in RFC2553 and standardized
since POSIX.1-2001. It supports both IPv4 and IPv6 addresses.
The gethostbyname() function is deprecated since POSIX.1-2008.
However, some libc implementations don't handle getaddrinfo()
properly, thus we preferred to try gethostbyname() first.

I've tried to preserve most of the old code logic to prevent
from surprising or unwanted behavior.

R=rsc
http://codereview.appspot.com/6255068
2012-06-02 21:50:59 +02:00
..
fmt convert to 4-byte UTF-8 and 32-bit Rune 2009-09-11 17:03:06 -04:00
utf convert to 4-byte UTF-8 and 32-bit Rune 2009-09-11 17:03:06 -04:00
_exits.c add exitcode 2006-02-12 19:40:55 +00:00
_p9dialparse.c lib9/dial: add support for IPv6 2012-06-02 21:50:59 +02:00
_p9dir.c lib9: add <sys/dkio.h> for OpenBSD 2010-07-11 10:08:41 -07:00
_p9translate.c Today's changes. 2004-03-25 23:03:57 +00:00
announce.c lib9/dial: add support for IPv6 2012-06-02 21:50:59 +02:00
argv0.c Various tweaks to make things run on Mac OS. 2003-10-01 02:50:57 +00:00
atexit.c add exitcode 2006-02-12 19:40:55 +00:00
atnotify.c Various additions and fixes. 2003-11-23 18:12:54 +00:00
atoi.c Change _p9strsig to return nil if tmp==nil. 2004-04-02 22:57:49 +00:00
atol.c Change _p9strsig to return nil if tmp==nil. 2004-04-02 22:57:49 +00:00
atoll.c Change _p9strsig to return nil if tmp==nil. 2004-04-02 22:57:49 +00:00
await.c apple 2005-07-13 21:34:11 +00:00
cistrcmp.c Various additions and fixes. 2003-11-23 18:12:54 +00:00
cistrncmp.c Various additions and fixes. 2003-11-23 18:12:54 +00:00
cistrstr.c Various additions and fixes. 2003-11-23 18:12:54 +00:00
cleanname.c Single-threaded plumber that can run "start" rules. 2003-10-14 02:35:00 +00:00
convD2M.c delete 9P2000.u 2010-12-07 13:34:11 -05:00
convM2D.c delete 9P2000.u 2010-12-07 13:34:11 -05:00
convM2S.c delete 9P2000.u 2010-12-07 13:34:11 -05:00
convS2M.c delete 9P2000.u 2010-12-07 13:34:11 -05:00
create.c better error message 2005-03-18 19:03:45 +00:00
crypt.c add crypt 2005-02-08 21:02:40 +00:00
ctime.c build: OS X 64-bit build 2011-08-02 14:28:04 -04:00
debugmalloc.c Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
dial.c lib9/dial: add support for IPv6 2012-06-02 21:50:59 +02:00
dirfstat.c expose unix mode bits 2005-02-08 20:17:02 +00:00
dirfwstat.c lib9: can change length in dirfwstat, dirwstat; mode in dirwstat (David Swasey) 2008-12-06 16:05:41 -08:00
dirmodefmt.c better symlink 2005-02-21 14:25:12 +00:00
dirread.c lib9: fix dirread/stat mismatch on Snow Leopard 2009-09-13 17:30:12 -04:00
dirstat.c expose unix mode bits 2005-02-08 20:17:02 +00:00
dirwstat.c lib9/dirwstat: missing prototype for chmod 2008-12-07 09:20:08 -08:00
dup.c Various additions and fixes. 2003-11-23 18:12:54 +00:00
encodefmt.c Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
errstr.c Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
exec.c Various additions and fixes. 2003-11-23 18:12:54 +00:00
execl.c in with the new 2005-01-04 22:30:15 +00:00
exitcode.c add exitcode 2006-02-12 19:05:12 +00:00
fcallfmt.c 9P2000.u fixes (Lucho Ionkov) 2005-11-21 20:42:52 +00:00
fmtlock2.c lock using Lock instead of QLock. 2004-12-27 05:18:22 +00:00
fork.c Continue the pthreads torture. 2004-09-21 01:11:28 +00:00
get9root.c cache answer 2005-01-04 22:19:07 +00:00
getcallerpc-386.c Initial revision 2003-09-30 17:47:41 +00:00
getcallerpc-arm.c arm 2005-11-07 02:47:39 +00:00
getcallerpc-power.c various forgotten files 2004-09-20 15:08:57 +00:00
getcallerpc-sun4u.s Various additions and fixes. 2003-11-23 18:12:54 +00:00
getcallerpc-x86_64.c add x86 64 2005-01-18 05:57:56 +00:00
getenv.c Small tweaks 2004-03-21 04:33:13 +00:00
getfields.c Initial revision 2003-09-30 17:47:41 +00:00
getnetconn.c correct size 2006-02-18 13:57:06 +00:00
getns.c lib9: allow no $DISPLAY on OS X in getns 2008-06-30 19:41:24 -04:00
getuser.c Today's changes. 2004-03-25 23:03:57 +00:00
getwd.c Various additions and fixes. 2003-11-23 18:12:54 +00:00
jmp.c Various additions and fixes. 2003-11-23 18:12:54 +00:00
LICENSE more licensing 2009-08-14 22:49:38 -07:00
lnrand.c Add some missing files. 2004-03-21 14:05:38 +00:00
lock.c Rewrite to remove dependence on rendezvous and its bizarre 2004-09-17 00:38:29 +00:00
lrand.c Rename lrand to p9lrand, too. 2004-12-29 02:44:01 +00:00
main.c Get rid of 9proc. 2004-09-23 03:06:04 +00:00
malloc.c cannot trust system libraries to lock properly. sigh. 2005-07-14 00:06:43 +00:00
malloctag.c Initial revision 2003-09-30 17:47:41 +00:00
mallocz.c Today's changes. 2004-03-25 23:03:57 +00:00
mkfile lib9: rewrite date routines to use /usr/share/zoneinfo directly 2008-07-09 08:27:22 -04:00
nan.c Fighting the good fight. 2004-02-29 22:10:26 +00:00
needsrcquote.c Various additions and fixes. 2003-11-23 18:12:54 +00:00
needstack.c just a stub. 2004-04-21 22:44:51 +00:00
netcrypt.c hard code list of plan 9 services in case they are not in /etc/services 2005-02-11 16:58:23 +00:00
netmkaddr.c lib9: make netmkaddr handle unix! addresses better 2008-06-11 06:35:51 -07:00
notify.c lib9: turn certain signals off by default 2008-07-12 07:35:20 -07:00
nrand.c Initial revision 2003-09-30 17:47:41 +00:00
nulldir.c lib9: null d->ext during nulldir 2008-10-26 17:03:17 -04:00
open.c better error message 2005-03-18 19:03:45 +00:00
opentemp.c lib9: add mode parameter to opentemp 2008-07-10 11:10:10 -04:00
pin.c pin 2006-06-26 05:47:59 +00:00
pipe.c Small tweaks 2004-03-21 04:33:13 +00:00
portdate plan 9 changes 2004-12-26 23:17:03 +00:00
post9p.c post9p: try mount9p before 9pfuse 2008-06-19 19:13:47 -04:00
postnote.c Build correctly on FreeBSD. 2003-11-24 00:47:50 +00:00
priv.c No more malloc or lock inside signal handlers. 2004-04-21 04:48:25 +00:00
qlock.c sunos fixes 2005-01-07 07:47:37 +00:00
quote.c no wide character constants; sigh 2005-05-07 22:42:06 +00:00
rand.c Avoid conflicts with stdlib. 2004-12-29 01:30:19 +00:00
read9pmsg.c File system stuff. 2003-12-06 18:08:52 +00:00
readcons.c hard code list of plan 9 services in case they are not in /etc/services 2005-02-11 16:58:23 +00:00
readn.c Initial revision 2003-09-30 17:47:41 +00:00
rfork.c lib9: restore SIGCHLD handler in rfork 2011-05-01 15:38:18 -04:00
searchpath.c Add searchpath(). 2005-01-23 22:33:59 +00:00
seek.c Various additions and fixes. 2003-11-23 18:12:54 +00:00
sendfd.c more type-punned pointers 2010-03-10 14:59:03 -08:00
sleep.c fix sleep for OpenBSD 4.0 (Tim Wiess) 2006-11-02 17:31:30 +00:00
strdup.c add strdup for debugging. 2004-06-09 14:15:47 +00:00
strecpy.c Initial revision 2003-09-30 17:47:41 +00:00
sysfatal.c make things work on SunOS 2004-04-20 02:03:38 +00:00
syslog.c hard code list of plan 9 services in case they are not in /etc/services 2005-02-11 16:58:23 +00:00
sysname.c cache answer 2005-01-04 22:19:25 +00:00
test.c Initial revision 2003-09-30 17:47:41 +00:00
testfltfmt.c more tests 2006-05-22 14:56:13 +00:00
testfmt.c more tests 2006-05-22 14:56:13 +00:00
testfork.c Initial revision 2003-09-30 17:47:41 +00:00
testprint.c more tests 2006-05-22 14:56:13 +00:00
time.c Today's changes. 2004-03-25 23:03:57 +00:00
tm2sec.c lib9: rewrite date routines to use /usr/share/zoneinfo directly 2008-07-09 08:27:22 -04:00
tokenize.c Initial revision 2003-09-30 17:47:41 +00:00
truerand.c fix type-punned pointer warnings from gcc 2010-03-10 14:50:33 -08:00
u16.c Initial revision 2003-09-30 17:47:41 +00:00
u32.c Initial revision 2003-09-30 17:47:41 +00:00
u64.c Initial revision 2003-09-30 17:47:41 +00:00
udp.c Various additions and fixes. 2003-11-23 18:12:54 +00:00
unsharp.c More files. 2004-03-25 23:08:53 +00:00
wait.c add awaitfor and waitfor 2004-12-27 19:11:21 +00:00
waitpid.c Various additions and fixes. 2003-11-23 18:12:54 +00:00
write.c lib9: add write function that withstands interrupts 2008-07-04 12:38:26 -04:00
zoneinfo.c lib9: rewrite date routines to use /usr/share/zoneinfo directly 2008-07-09 08:27:22 -04:00
zoneinfo.h lib9: rewrite date routines to use /usr/share/zoneinfo directly 2008-07-09 08:27:22 -04:00