commit 0636901274652abd7d83edfb56c02a9060b4ce4e
parent cdd88278d084289826390601deb88fbbf1577927
Author: Alexander Burger <abu@software-lab.de>
Date: Thu, 20 Oct 2011 13:45:41 +0200
IPv6 support
Diffstat:
20 files changed, 456 insertions(+), 357 deletions(-)
diff --git a/CHANGES b/CHANGES
@@ -1,4 +1,5 @@
* XXdec11 picoLisp-3.0.9
+ IPv6 support
'*Prompt' global variable
'local' symbols function
'open' optional 'flg' argument
diff --git a/doc/refC.html b/doc/refC.html
@@ -535,16 +535,21 @@ and <code><a href="refW.html#when">when</a></code>.
-> 2
</code></pre>
-<dt><a name="connect"><code>(connect 'any 'cnt) -> cnt | NIL</code></a>
+<dt><a name="connect"><code>(connect 'any1 'any2) -> cnt | NIL</code></a>
<dd>Tries to establish a TCP/IP connection to a server listening at host
-<code>any</code>, port <code>cnt</code>. <code>any</code> may be either a
-hostname or a standard internet address in numbers-and-dots notation. Returns a
-socket descriptor <code>cnt</code>, or <code>NIL</code> if the connection cannot
-be established. See also <code><a href="refL.html#listen">listen</a></code>.
+<code>any1</code>, port <code>any2</code>. <code>any1</code> may be either a
+hostname or a standard internet address in numbers-and-dots/colons notation
+(IPv4/IPv6). <code>any2</code> may be either a port number or a service name.
+Returns a socket descriptor <code>cnt</code>, or <code>NIL</code> if the
+connection cannot be established. See also <code><a
+href="refL.html#listen">listen</a></code> and <code><a
+href="refU.html#udp">udp</a></code>.
<pre><code>
: (connect "localhost" 4444)
-> 3
+: (connect "some.host.org" "http")
+-> 4
</code></pre>
<dt><a name="cons"><code>(cons 'any ['any ..]) -> lst</code></a>
diff --git a/doc/refU.html b/doc/refU.html
@@ -93,13 +93,14 @@ href="refU.html#unbug">unbug</a></code>.
-> T
</code></pre>
-<dt><a name="udp"><code>(udp 'any1 'cnt 'any2) -> any</code></a>
+<dt><a name="udp"><code>(udp 'any1 'any2 'any3) -> any</code></a>
<dt><code>(udp 'cnt) -> any</code>
<dd>Simple unidirectional sending/receiving of UDP packets. In the first form,
-<code>any2</code> is sent to a UDP server listening at host <code>any1</code>,
-port <code>cnt</code>. In the second form, one item is received from a UDP
+<code>any3</code> is sent to a UDP server listening at host <code>any1</code>,
+port <code>any2</code>. In the second form, one item is received from a UDP
socket <code>cnt</code>, established with <code><a
href="refP.html#port">port</a></code>. See also <code><a
+href="refL.html#listen">listen</a></code> and <code><a
href="refC.html#connect">connect</a></code>.
<pre><code>
diff --git a/ersatz/picolisp.jar b/ersatz/picolisp.jar
Binary files differ.
diff --git a/lib/tags b/lib/tags
@@ -24,7 +24,7 @@ $ (2953 . "@src64/flow.l")
>= (2297 . "@src64/subr.l")
>> (2627 . "@src64/big.l")
abs (2731 . "@src64/big.l")
-accept (139 . "@src64/net.l")
+accept (145 . "@src64/net.l")
adr (594 . "@src64/main.l")
alarm (471 . "@src64/main.l")
all (780 . "@src64/sym.l")
@@ -95,7 +95,7 @@ commit (1495 . "@src64/db.l")
con (725 . "@src64/subr.l")
conc (781 . "@src64/subr.l")
cond (1911 . "@src64/flow.l")
-connect (201 . "@src64/net.l")
+connect (224 . "@src64/net.l")
cons (747 . "@src64/subr.l")
copy (1225 . "@src64/subr.l")
ctl (4254 . "@src64/io.l")
@@ -157,7 +157,7 @@ hash (2976 . "@src64/big.l")
head (1820 . "@src64/subr.l")
heap (526 . "@src64/main.l")
hear (3228 . "@src64/io.l")
-host (184 . "@src64/net.l")
+host (190 . "@src64/net.l")
id (1025 . "@src64/db.l")
idx (2151 . "@src64/sym.l")
if (1797 . "@src64/flow.l")
@@ -185,7 +185,7 @@ lines (3852 . "@src64/io.l")
link (1172 . "@src64/subr.l")
lisp (1982 . "@src64/main.l")
list (887 . "@src64/subr.l")
-listen (151 . "@src64/net.l")
+listen (157 . "@src64/net.l")
lit (150 . "@src64/flow.l")
load (4171 . "@src64/io.l")
lock (1182 . "@src64/db.l")
@@ -329,7 +329,7 @@ touch (1164 . "@src64/sym.l")
trim (1759 . "@src64/subr.l")
try (1171 . "@src64/flow.l")
type (911 . "@src64/flow.l")
-udp (268 . "@src64/net.l")
+udp (301 . "@src64/net.l")
unify (3935 . "@src64/subr.l")
unless (1893 . "@src64/flow.l")
until (2077 . "@src64/flow.l")
diff --git a/src/httpGate.c b/src/httpGate.c
@@ -1,4 +1,4 @@
-/* 26jul11abu
+/* 20oct11abu
* (c) Software Lab. Alexander Burger
*/
@@ -10,14 +10,11 @@
#include <ctype.h>
#include <string.h>
#include <signal.h>
-#include <netdb.h>
#include <time.h>
#include <sys/time.h>
#include <sys/stat.h>
-#include <sys/socket.h>
+#include <netdb.h>
#include <arpa/inet.h>
-#include <netinet/tcp.h>
-#include <netinet/in.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
@@ -111,23 +108,22 @@ static void sslWrite(SSL *ssl, void *p, int cnt) {
exit(1);
}
-static int gateSocket(void) {
- int sd;
+static int gatePort(unsigned short port) {
+ int sd, n;
+ struct sockaddr_in6 addr;
- if ((sd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
+ if ((sd = socket(AF_INET6, SOCK_STREAM, 0)) < 0)
+ exit(1);
+ n = 0;
+ if (setsockopt(sd, IPPROTO_IPV6, IPV6_V6ONLY, &n, sizeof(n)) < 0)
exit(1);
- return sd;
-}
-
-static int gatePort(int port) {
- int n, sd;
- struct sockaddr_in addr;
-
memset(&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = htonl(INADDR_ANY);
- addr.sin_port = htons((unsigned short)port);
- n = 1, setsockopt(sd = gateSocket(), SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n));
+ addr.sin6_family = AF_INET6;
+ addr.sin6_addr = in6addr_any;
+ n = 1;
+ if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n)) < 0)
+ exit(1);
+ addr.sin6_port = htons(port);
if (bind(sd, (struct sockaddr*)&addr, sizeof(addr)) < 0)
exit(1);
if (listen(sd,5) < 0)
@@ -137,13 +133,14 @@ static int gatePort(int port) {
static int gateConnect(unsigned short port) {
int sd;
- struct sockaddr_in addr;
+ struct sockaddr_in6 addr;
+ if ((sd = socket(AF_INET6, SOCK_STREAM, 0)) < 0)
+ exit(1);
memset(&addr, 0, sizeof(addr));
- addr.sin_addr.s_addr = inet_addr("127.0.0.1");
- sd = gateSocket();
- addr.sin_family = AF_INET;
- addr.sin_port = htons(port);
+ addr.sin6_family = AF_INET6;
+ addr.sin6_addr = in6addr_loopback;
+ addr.sin6_port = htons(port);
return connect(sd, (struct sockaddr*)&addr, sizeof(addr)) < 0? -1 : sd;
}
@@ -161,7 +158,8 @@ static void doSigUsr1(int n __attribute__((unused))) {
int main(int ac, char *av[]) {
int cnt = ac>4? ac-3 : 1, ports[cnt], n, sd, cli, srv;
- struct sockaddr_in addr;
+ struct sockaddr_in6 addr;
+ char s[INET6_ADDRSTRLEN];
char *gate;
SSL_CTX *ctx;
SSL *ssl;
@@ -276,7 +274,8 @@ int main(int ac, char *av[]) {
wrBytes(srv, q, p - q);
if (pre(p-10, "HTTP/1."))
Http1 = *(p-3) - '0';
- wrBytes(srv, buf2, sprintf(buf2, gate, inet_ntoa(addr.sin_addr)));
+ inet_ntop(AF_INET6, &addr.sin6_addr, s, INET6_ADDRSTRLEN);
+ wrBytes(srv, buf2, sprintf(buf2, gate, s));
wrBytes(srv, p, buf + n - p);
signal(SIGALRM, doSigAlarm);
diff --git a/src/net.c b/src/net.c
@@ -1,14 +1,11 @@
-/* 08oct09abu
+/* 20oct11abu
* (c) Software Lab. Alexander Burger
*/
#include "pico.h"
#include <netdb.h>
-#include <sys/socket.h>
#include <arpa/inet.h>
-#include <netinet/tcp.h>
-#include <netinet/in.h>
static void ipErr(any ex, char *s) {
err(ex, NULL, "IP %s error: %s", s, strerror(errno));
@@ -17,25 +14,28 @@ static void ipErr(any ex, char *s) {
// (port ['T] 'cnt|(cnt . cnt) ['var]) -> cnt
any doPort(any ex) {
any x, y;
- int type, n, sd;
+ int type, sd, n;
unsigned short port;
- struct sockaddr_in addr;
+ struct sockaddr_in6 addr;
x = cdr(ex);
type = SOCK_STREAM;
if ((y = EVAL(car(x))) == T)
type = SOCK_DGRAM, x = cdr(x), y = EVAL(car(x));
- if ((sd = socket(AF_INET, type, 0)) < 0)
+ if ((sd = socket(AF_INET6, type, 0)) < 0)
ipErr(ex, "socket");
closeOnExec(ex, sd);
+ n = 0;
+ if (setsockopt(sd, IPPROTO_IPV6, IPV6_V6ONLY, &n, sizeof(n)) < 0)
+ ipErr(ex, "IPV6_V6ONLY");
memset(&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = htonl(INADDR_ANY);
+ addr.sin6_family = AF_INET6;
+ addr.sin6_addr = in6addr_any;
if (isNum(y)) {
if ((port = (unsigned short)xCnt(ex,y)) != 0) {
n = 1;
if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n)) < 0)
- ipErr(ex, "setsockopt");
+ ipErr(ex, "SO_REUSEADDR");
}
}
else if (isCell(y))
@@ -43,7 +43,7 @@ any doPort(any ex) {
else
argError(ex,y);
for (;;) {
- addr.sin_port = htons(port);
+ addr.sin6_port = htons(port);
if (bind(sd, (struct sockaddr*)&addr, sizeof(addr)) >= 0)
break;
if (!isCell(y) || ++port > xCnt(ex,cdr(y)))
@@ -57,21 +57,23 @@ any doPort(any ex) {
close(sd), ipErr(ex, "getsockname");
NeedVar(ex,y);
CheckVar(ex,y);
- val(y) = boxCnt(ntohs(addr.sin_port));
+ val(y) = boxCnt(ntohs(addr.sin6_port));
}
return boxCnt(sd);
}
static any tcpAccept(int sd) {
int i, f, sd2;
- struct sockaddr_in addr;
+ char s[INET6_ADDRSTRLEN];
+ struct sockaddr_in6 addr;
f = nonblocking(sd);
i = 200; do {
socklen_t len = sizeof(addr);
if ((sd2 = accept(sd, (struct sockaddr*)&addr, &len)) >= 0) {
fcntl(sd, F_SETFL, f);
- val(Adr) = mkStr(inet_ntoa(addr.sin_addr));
+ inet_ntop(AF_INET6, &addr.sin6_addr, s, INET6_ADDRSTRLEN);
+ val(Adr) = mkStr(s);
initInFile(sd2,NULL), initOutFile(sd2);
return boxCnt(sd2);
}
@@ -105,55 +107,60 @@ any doListen(any ex) {
// (host 'any) -> sym
any doHost(any x) {
- struct in_addr in;
- struct hostent *p;
-
x = evSym(cdr(x));
{
+ struct addrinfo *lst, *p;
+ char host[NI_MAXHOST];
char nm[bufSize(x)];
bufString(x, nm);
- if (inet_aton(nm, &in) && (p = gethostbyaddr((char*)&in, sizeof(in), AF_INET)))
- return mkStr(p->h_name);
- return Nil;
+ if (getaddrinfo(nm, NULL, NULL, &lst))
+ return Nil;
+ x = Nil;
+ for (p = lst; p; p = p->ai_next) {
+ if (getnameinfo(p->ai_addr, p->ai_addrlen, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD) == 0 && host[0]) {
+ x = mkStr(host);
+ break;
+ }
+ }
+ freeaddrinfo(lst);
+ return x;
}
}
-static bool server(any host, unsigned short port, struct sockaddr_in *addr) {
- struct hostent *p;
- char nm[bufSize(host)];
-
- memset(addr, 0, sizeof(struct sockaddr_in));
- addr->sin_port = htons(port);
- addr->sin_family = AF_INET;
- bufString(host, nm);
- if (!inet_aton(nm, &addr->sin_addr)) {
- if (!(p = gethostbyname(nm)) || p->h_length == 0)
- return NO;
- addr->sin_addr.s_addr = ((struct in_addr*)p->h_addr_list[0])->s_addr;
- }
- return YES;
+static struct addrinfo *server(int type, any node, any service) {
+ struct addrinfo hints, *lst;
+ char nd[bufSize(node)], sv[bufSize(service)];
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = type;
+ bufString(node, nd), bufString(service, sv);
+ return getaddrinfo(nd, sv, &hints, &lst)? NULL : lst;
}
-// (connect 'any 'cnt) -> cnt | NIL
+// (connect 'any1 'any2) -> cnt | NIL
any doConnect(any ex) {
- int sd, port;
+ struct addrinfo *lst, *p;
+ any port;
+ int sd;
cell c1;
- struct sockaddr_in addr;
Push(c1, evSym(cdr(ex)));
- port = evCnt(ex, cddr(ex));
- if (!server(Pop(c1), (unsigned short)port, &addr))
- return Nil;
- if ((sd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
- ipErr(ex, "socket");
- closeOnExec(ex, sd);
- if (connect(sd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
- close(sd);
- return Nil;
+ port = evSym(cddr(ex));
+ for (p = lst = server(SOCK_STREAM, Pop(c1), port); p; p = p->ai_next) {
+ if ((sd = socket(p->ai_family, p->ai_socktype, 0)) >= 0) {
+ if (connect(sd, p->ai_addr, p->ai_addrlen) == 0) {
+ closeOnExec(ex, sd);
+ initInFile(sd,NULL), initOutFile(sd);
+ freeaddrinfo(lst);
+ return boxCnt(sd);
+ }
+ close(sd);
+ }
}
- initInFile(sd,NULL), initOutFile(sd);
- return boxCnt(sd);
+ freeaddrinfo(lst);
+ return Nil;
}
/*** UDP send/receive ***/
@@ -172,13 +179,13 @@ static int getUdp(void) {
return *UdpPtr++;
}
-// (udp 'any1 'cnt 'any2) -> any
+// (udp 'any1 'any2 'any3) -> any
// (udp 'cnt) -> any
any doUdp(any ex) {
- any x;
- int sd;
+ any x, y;
cell c1;
- struct sockaddr_in addr;
+ struct addrinfo *lst, *p;
+ int sd;
byte buf[UDPMAX];
x = cdr(ex), data(c1) = EVAL(car(x));
@@ -189,16 +196,21 @@ any doUdp(any ex) {
return binRead(ExtN) ?: Nil;
}
Save(c1);
- if (!server(xSym(data(c1)), (unsigned short)evCnt(ex,x), &addr))
- x = Nil;
- else {
+ data(c1) = xSym(data(c1));
+ y = evSym(x);
+ drop(c1);
+ if (lst = server(SOCK_DGRAM, data(c1), y)) {
x = cdr(x), x = EVAL(car(x));
putBin = putUdp, UdpPtr = UdpBuf = buf, binPrint(ExtN, x);
- if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- ipErr(ex, "socket");
- sendto(sd, buf, UdpPtr-buf, 0, (struct sockaddr*)&addr, sizeof(struct sockaddr_in));
- close(sd);
+ for (p = lst; p; p = p->ai_next) {
+ if ((sd = socket(p->ai_family, p->ai_socktype, 0)) >= 0) {
+ sendto(sd, buf, UdpPtr-buf, 0, p->ai_addr, p->ai_addrlen);
+ close(sd);
+ freeaddrinfo(lst);
+ return x;
+ }
+ }
+ freeaddrinfo(lst);
}
- drop(c1);
- return x;
+ return Nil;
}
diff --git a/src/ssl.c b/src/ssl.c
@@ -1,4 +1,4 @@
-/* 20jul09abu
+/* 20oct11abu
* (c) Software Lab. Alexander Burger
*/
@@ -10,12 +10,9 @@
#include <errno.h>
#include <string.h>
#include <signal.h>
-#include <netdb.h>
#include <sys/stat.h>
-#include <sys/socket.h>
+#include <netdb.h>
#include <arpa/inet.h>
-#include <netinet/tcp.h>
-#include <netinet/in.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
@@ -48,33 +45,29 @@ static void sslChk(int n) {
}
}
-static int sslConnect(SSL *ssl, char *host, int port) {
- struct sockaddr_in addr;
- struct hostent *p;
+static int sslConnect(SSL *ssl, char *node, char *service) {
+ struct addrinfo hints, *lst, *p;
int sd;
- memset(&addr, 0, sizeof(addr));
- if ((long)(addr.sin_addr.s_addr = inet_addr(host)) == -1) {
- if (!(p = gethostbyname(host)) || p->h_length == 0)
- return -1;
- addr.sin_addr.s_addr = ((struct in_addr*)p->h_addr_list[0])->s_addr;
- }
-
- if ((sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- errmsg("No socket");
- return -1;
- }
- addr.sin_family = AF_INET;
- addr.sin_port = htons((unsigned short)port);
- if (connect(sd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
- close(sd);
- return -1;
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ if (getaddrinfo(node, service, &hints, &lst) == 0) {
+ for (p = lst; p; p = p->ai_next) {
+ if ((sd = socket(p->ai_family, p->ai_socktype, 0)) >= 0) {
+ if (connect(sd, p->ai_addr, p->ai_addrlen) == 0) {
+ freeaddrinfo(lst);
+ SSL_set_fd(ssl, sd);
+ if (SSL_connect(ssl) >= 0)
+ return sd;
+ close(sd);
+ return -1;
+ }
+ close(sd);
+ }
+ }
+ freeaddrinfo(lst);
}
-
- SSL_set_fd(ssl,sd);
- if (SSL_connect(ssl) >= 0)
- return sd;
- close(sd);
return -1;
}
@@ -150,7 +143,7 @@ int main(int ac, char *av[]) {
ssl = SSL_new(ctx);
if (ac <= 6) {
- if (sslConnect(ssl, av[1], atoi(av[2])) < 0) {
+ if (sslConnect(ssl, av[1], av[2]) < 0) {
errmsg("Can't connect");
return 1;
}
@@ -201,7 +194,7 @@ int main(int ac, char *av[]) {
errmsg("Can't truncate");
close(fd);
for (;;) {
- if ((sd = sslConnect(ssl, av[1], atoi(av[2]))) >= 0) {
+ if ((sd = sslConnect(ssl, av[1], av[2])) >= 0) {
if (SSL_write(ssl, get, getLen) == getLen &&
(!*av[4] || sslFile(ssl,av[4])) && // key
(bin || SSL_write(ssl, len, lenLen) == lenLen) && // length
@@ -223,7 +216,7 @@ int main(int ac, char *av[]) {
if (p->d_name[0] != '.') {
snprintf(nm, sizeof(nm), "%s%s", Dir, p->d_name);
if ((n = readlink(nm, buf, sizeof(buf))) > 0 &&
- (sd = sslConnect(ssl, av[1], atoi(av[2]))) >= 0 ) {
+ (sd = sslConnect(ssl, av[1], av[2])) >= 0 ) {
if (SSL_write(ssl, get, getLen) == getLen &&
(!*av[4] || sslFile(ssl,av[4])) && // key
(bin || SSL_write(ssl, buf, n) == n) && // path
diff --git a/src/vers.h b/src/vers.h
@@ -1 +1 @@
-static byte Version[4] = {3,0,8,4};
+static byte Version[4] = {3,0,8,5};
diff --git a/src/z3dClient.c b/src/z3dClient.c
@@ -1,4 +1,4 @@
-/* 12nov09abu
+/* 20oct11abu
* (c) Software Lab. Alexander Burger
*/
@@ -10,8 +10,6 @@
#include <errno.h>
#include <netdb.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
#include <arpa/inet.h>
#include <X11/Xlib.h>
@@ -364,10 +362,30 @@ static void zLine(long pix, long v, long h, long h2,
}
}
+int z3dConnect(char *node, char *service) {
+ struct addrinfo hints, *lst, *p;
+ int sd;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ if (getaddrinfo(node, service, &hints, &lst) == 0) {
+ for (p = lst; p; p = p->ai_next) {
+ if ((sd = socket(p->ai_family, p->ai_socktype, 0)) >= 0) {
+ if (connect(sd, p->ai_addr, p->ai_addrlen) == 0) {
+ freeaddrinfo(lst);
+ return sd;
+ }
+ close(sd);
+ }
+ }
+ freeaddrinfo(lst);
+ }
+ return -1;
+}
+
/*** Main entry point ***/
int main(int ac, char *av[]) {
- struct sockaddr_in addr;
- struct hostent *hp;
XPixmapFormatValues *pmFormat;
long hor, sky, gnd, pix, v;
int n, i, x0, y0, z0, x1, y1, z1, x2, y2, z2;
@@ -380,18 +398,8 @@ int main(int ac, char *av[]) {
giveup("Use: <host> <port>");
/* Open Connection */
- memset(&addr, 0, sizeof(addr));
- if ((long)(addr.sin_addr.s_addr = inet_addr(av[1])) == -1) {
- if (!(hp = gethostbyname(av[1])) || hp->h_length == 0)
- giveup("Can't get host");
- addr.sin_addr.s_addr = ((struct in_addr*)hp->h_addr_list[0])->s_addr;
- }
- if ((Socket = socket(AF_INET, SOCK_STREAM, 0)) < 0)
- giveup("Can't create socket");
- addr.sin_family = AF_INET;
- addr.sin_port = htons(atol(av[2]));
- if (connect(Socket, (struct sockaddr*)&addr, sizeof(addr)) < 0)
- giveup("Can't connect");
+ if ((Socket = z3dConnect(av[1], av[2])) < 0)
+ giveup("Can't connect to server");
/* Open Display */
if ((Disp = XOpenDisplay(NULL)) == NULL)
diff --git a/src64/err.l b/src64/err.l
@@ -1,4 +1,4 @@
-# 12oct11abu
+# 19oct11abu
# (c) Software Lab. Alexander Burger
# Debug print routine
@@ -659,9 +659,14 @@
ld Y IpGetsocknameErr
jmp errnoEXY
-(code 'ipSetsockoptErrX)
+(code 'ipV6onlyErrX)
ld E 0
- ld Y IpSetsockoptErr
+ ld Y IpV6onlyErr
+ jmp errnoEXY
+
+(code 'ipReuseaddrErrX)
+ ld E 0
+ ld Y IpReuseaddrErr
jmp errnoEXY
(code 'ipBindErrX)
diff --git a/src64/glob.l b/src64/glob.l
@@ -1,4 +1,4 @@
-# 11oct11abu
+# 20oct11abu
# (c) Software Lab. Alexander Burger
(data 'Data)
@@ -134,12 +134,12 @@
initSym Nil "NIL" Nil
word Nil # CDR when NIL is accessed as an empty list
word 0 # Padding
-
+: Pico
word Nil # Short internal names
word Nil # Long internal names
# Protected symbols
- initSym pico "pico" .-24
+ initSym pico "pico" Pico
initSym OS "*OS" TgOS
initSym DB "*DB" Db1
initFun Meth "meth" doMeth
@@ -613,7 +613,7 @@
: OrgTermio skip TERMIOS # Original termio structure
: Flock skip FLOCK # File lock structure
: Tms skip TMS # 'times' structure
-: Addr skip SOCKADDR_IN # Internet socket address
+: Addr skip SOCKADDR_IN6 # Internet socket address
: TBuf byte (+ INTERN 4) # 'T' in PLIO format
byte (char "T")
@@ -1231,7 +1231,8 @@
: TellErr asciz "Tell PIPE_BUF"
: IpSocketErr asciz "IP socket error: %s"
: IpGetsocknameErr asciz "IP getsockname error: %s"
-: IpSetsockoptErr asciz "IP setsockopt error: %s"
+: IpV6onlyErr asciz "IP IPV6_V6ONLY error: %s"
+: IpReuseaddrErr asciz "IP SO_REUSEADDR error: %s"
: IpBindErr asciz "IP bind error: %s"
: IpListenErr asciz "IP listen error: %s"
: UdpOvflErr asciz "UDP overflow"
diff --git a/src64/lib/asm.l b/src64/lib/asm.l
@@ -1,4 +1,4 @@
-# 23sep11abu
+# 19oct11abu
# (c) Software Lab. Alexander Burger
# *LittleEndian *AlignedCode *Registers optimize
@@ -232,11 +232,14 @@
(T X) ) )
((asoq (car X) *Registers)
(cons (car X) (operand (cadr X))) )
- ((memq (car X) '(+ - * */ / % >> & | pack short char hex oct))
+ ((memq (car X) '(+ - * */ / % >> & | %% pack short char hex oct))
(apply (car X) (mapcar operand (cdr X))) )
(T (cons (car X) (operand (cadr X)))) ) )
# Constants
+(de %% (N)
+ (>> -3 (>> 3 (+ N 7))) )
+
(de short (N)
(| 2 (>> -4 N)) )
diff --git a/src64/main.l b/src64/main.l
@@ -1,4 +1,4 @@
-# 20sep11abu
+# 20oct11abu
# (c) Software Lab. Alexander Burger
(code 'Code)
@@ -92,7 +92,7 @@
lea Z (E VI) # Skip padding and 'pico' cell
do
ld X (E TAIL) # Get name
- ld Y "pico-24" # From initial symbol namespace
+ ld Y Pico # From initial symbol namespace
call internEXY_FE # Store to internals
ld E Z
cnt (Z TAIL) # Short name?
@@ -116,10 +116,10 @@
cc tcgetattr(0 OrgTermio) # Save terminal I/O
not B
ld (Tio) B # and flag
- sub S SIGSET_T # Create signal mask structure
+ sub S (%% SIGSET_T) # Create signal mask structure
cc sigfillset(S) # Set all signals to unblocked
cc sigprocmask(SIG_UNBLOCK S 0)
- add S SIGSET_T # Drop mask structure
+ add S (%% SIGSET_T) # Drop mask structure
ld E sig # Install standard signal handler
ld C SIGHUP
call iSignalCE # for SIGHUP
@@ -190,12 +190,12 @@
# Install interrupting signal
(code 'iSignalCE)
- sub S (* 2 SIGACTION) # 'sigaction' and 'oldact'
+ sub S (%% (* 2 SIGACTION)) # 'sigaction' and 'oldact'
ld (S SA_HANDLER) E # Function pointer
cc sigemptyset(&(S SA_MASK))
ld (S SA_FLAGS) 0
cc sigaction(C S &(S SIGACTION)) # Install handler
- add S (* 2 SIGACTION)
+ add S (%% (* 2 SIGACTION))
ret
# Allocate memory
@@ -400,11 +400,11 @@
begin # Ignore signal number
ld C OrgTermio # Set original terminal I/O
call tcSetC
- sub S SIGSET_T # Create mask structure
+ sub S (%% SIGSET_T) # Create mask structure
cc sigemptyset(S) # Init to empty signal set
cc sigaddset(S SIGTSTP) # Add stop signal
cc sigprocmask(SIG_UNBLOCK S 0) # Remove blocked signals
- add S SIGSET_T # Drop mask structure
+ add S (%% SIGSET_T) # Drop mask structure
cc signal(SIGTSTP SIG_DFL)
cc raise(SIGTSTP)
cc signal(SIGTSTP sigTermStop)
@@ -2752,7 +2752,7 @@
call evSymE_E # Evaluate to a symbol
call pathStringE_SZ # Write to stack buffer
ld E S # path name pointer
- sub S STAT # 'stat' structure
+ sub S (%% STAT) # 'stat' structure
cc stat(E S) # Get status
ld E Nil # Preload return value
nul4 # 'stat' OK?
diff --git a/src64/net.l b/src64/net.l
@@ -1,4 +1,4 @@
-# 24aug11abu
+# 20oct11abu
# (c) Software Lab. Alexander Burger
# (port ['T] 'cnt|(cnt . cnt) ['var]) -> cnt
@@ -18,26 +18,31 @@
ld E (Y)
eval
end
- cc socket(AF_INET Z 0) # Create socket
+ cc socket(AF_INET6 Z 0) # Create socket
nul4 # OK?
js ipSocketErrX # No
ld C A # Keep socket in C
call closeOnExecAX
+ ld A 0 # Socket option "off"
+ st4 (Buf) # Store into 'optval'
+ cc setsockopt(C IPPROTO_IPV6 IPV6_V6ONLY Buf 4) # "Not only IPv6" option
+ nul4 # OK?
+ js ipV6onlyErrX # No
ld B 0 # Clear socket structure
- mset (Addr) SOCKADDR_IN
- ld A AF_INET
- st2 (Addr SIN_FAMILY)
- cc htonl(INADDR_ANY)
- st4 (Addr SIN_ADDR.S_ADDR)
+ mset (Addr) SOCKADDR_IN6
+ ld A AF_INET6
+ st2 (Addr SIN6_FAMILY)
+ ld B 0 # Clear sin6_addr
+ mset (Addr SIN6_ADDR) 16 # "::" (16 null-bytes)
cnt E # Single port-argument?
if nz # Yes
shr E 4 # Port zero?
if nz # No
- ld A 1 # Socket option value
+ ld A 1 # Socket option "on"
st4 (Buf) # Store into 'optval'
cc setsockopt(C SOL_SOCKET SO_REUSEADDR Buf 4) # "Reuse socket" option
nul4 # OK?
- js ipSetsockoptErrX # No
+ js ipReuseaddrErrX # No
end
push 0 # <S> No range limit
else
@@ -51,8 +56,8 @@
end
do
cc htons(E) # Convert port to network order
- st2 (Addr SIN_PORT) # Store as port
- cc bind(C Addr SOCKADDR_IN) # Try to bind socket
+ st2 (Addr SIN6_PORT) # Store as port
+ cc bind(C Addr SOCKADDR_IN6) # Try to bind socket
nul4 # OK?
while s # No
inc E # Next port in range
@@ -78,7 +83,7 @@
eval
cmp E Nil # Any?
if ne # Yes
- ld A SOCKADDR_IN # Structure size
+ ld A SOCKADDR_IN6 # Structure size
st4 (Buf) # Store into 'namelen'
cc getsockname(Z Addr Buf) # Get socket name
nul4 # OK?
@@ -87,7 +92,7 @@
jmp ipGetsocknameErrX
end
call needVarEX # Need variable
- ld2 (Addr SIN_PORT) # Get port
+ ld2 (Addr SIN6_PORT) # Get port
cc ntohs(A) # Convert to host byte order
shl A 4 # Make short number
or A CNT
@@ -104,21 +109,22 @@
(code 'tcpAcceptA_FE)
ld E A # Save socket in E
call nonblockingA_A # Set socket to non-blocking
- push A # Save old socket status flags
- ld A SOCKADDR_IN # Structure size
- st4 (Buf) # Store into 'addrlen'
+ push A # <S> Old socket status flags
ld C 200 # Maximally 20 seconds
do
+ ld A SOCKADDR_IN6 # Structure size
+ st4 (Buf) # Store into 'addrlen'
cc accept(E Addr Buf) # Accept connection
nul4 # OK?
if ns # Yes
xchg A (S) # Save new socket, retrieve flags
cc fcntl(E F_SETFL A) # Restore socket status flags
- ld4 (Addr SIN_ADDR.S_ADDR) # Get address
- cc inet_ntoa(A) # Convert to IPv4 dotted-decimal string
- ld E A
+ sub S (%% INET6_ADDRSTRLEN) # Allocate name buffer
+ cc inet_ntop(AF_INET6 &(Addr SIN6_ADDR) S INET6_ADDRSTRLEN)
+ ld E S
call mkStrE_E # Make transient symbol
ld (Adr) E # Store in '*Adr'
+ add S (%% INET6_ADDRSTRLEN) # Drop buffer
ld A (S) # Get socket
call initInFileA_A # Init input file
ld A (S)
@@ -185,19 +191,36 @@
push Z
ld E ((E CDR)) # Eval IP address
call evSymE_E
+ sub S I # 'lst' buffer
call bufStringE_SZ # Write to stack buffer
- cc inet_aton(S Buf) # Convert to binary form
+ cc getaddrinfo(S 0 0 Z) # Get address info
ld S Z # Drop buffer
+ pop Z # Get 'lst' into Z
+ ld E Nil # Preset return value
+ nul4 # Address valid?
+ if z # Yes
+ sub S (%% NI_MAXHOST) # <S> Hostname buffer
+ ld C Z # Get 'lst'
+ do
+ null C # Any?
+ while nz # Yes
+ ld4 (C AI_ADDRLEN)
+ cc getnameinfo((C AI_ADDR) A S NI_MAXHOST 0 0 NI_NAMEREQD)
+ nul4 # OK?
+ if z # Yes
+ ld E S
+ call mkStrE_E # Make transient symbol
+ break T
+ end
+ ld C (C AI_NEXT) # Try next
+ loop
+ add S (%% NI_MAXHOST) # Drop buffer
+ cc freeaddrinfo(Z)
+ end
pop Z
- nul4 # Valid?
- jz retNil # No
- cc gethostbyaddr(Buf IN_ADDR AF_INET) # Get hostent
- null A # Any?
- jz retNil # No
- ld E (A H_NAME)
- jmp mkStrE_E # Make transient symbol
+ ret
-# (connect 'any 'cnt) -> cnt | NIL
+# (connect 'any1 'any2) -> cnt | NIL
(code 'doConnect 2)
push X
push Y
@@ -206,64 +229,74 @@
ld Y (E CDR) # Y on args
call evSymY_E # Eval host
ld Y (Y CDR) # Next arg
- call serverEY_F # Found server?
- jz 80 # No: Return NIL
- cc socket(AF_INET SOCK_STREAM 0) # Create socket
- nul4 # OK?
- js ipSocketErrX # No
- ld Y A # Keep socket in Y
- call closeOnExecAX
- cc connect(Y Addr SOCKADDR_IN) # Try to connect
- nul4 # OK?
- if ns # Yes
- ld A Y # Get socket
- call initInFileA_A # Init input file
- ld A Y
- call initOutFileA_A # and output file
- ld E Y # Return socket
- shl E 4 # Make short number
- or E CNT
- else
- cc close(Y) # Close socket
-80 ld E Nil # Return NIL
+ ld C SOCK_STREAM
+ call serverCEY_FE # Found server?
+ if z # Yes
+ ld Z E # Keep list in Z
+ do
+ null E # Any?
+ while nz # Yes
+ ld4 (E AI_SOCKTYPE) # Create socket
+ ld C A
+ ld4 (E AI_FAMILY)
+ cc socket(A C 0)
+ nul4 # OK?
+ if ns # Yes
+ ld Y A # Keep socket in Y
+ ld4 (E AI_ADDRLEN)
+ cc connect(Y (E AI_ADDR) A) # Try to connect
+ nul4 # OK?
+ if z # Yes
+ ld A Y
+ call closeOnExecAX
+ ld A Y # Get socket
+ call initInFileA_A # Init input file
+ ld A Y
+ call initOutFileA_A # and output file
+ ld E Y # Return socket
+ shl E 4 # Make short number
+ or E CNT
+ jmp 80
+ end
+ cc close(Y) # Close socket
+ end
+ ld E (E AI_NEXT) # Try next
+ loop
+ ld E Nil # Return NIL
+80 cc freeaddrinfo(Z)
end
pop Z
pop Y
pop X
ret
-(code 'serverEY_F)
+(code 'serverCEY_FE)
link
push E # <L I> Host
link
- ld B 0 # Clear socket structure
- mset (Addr) SOCKADDR_IN
- call evCntXY_FE # Eval port
- cc htons(E) # Convert to network order
- st2 (Addr SIN_PORT) # Store as port
- ld A AF_INET
- st2 (Addr SIN_FAMILY)
+ sub S (%% ADDRINFO) # <S> Hints
+ ld B 0 # Clear hints
+ mset (S) ADDRINFO
+ ld A AF_UNSPEC # Accept IPv4 and IPv6
+ st4 (S AI_FAMILY) # Store into 'ai_family'
+ ld A C # Get type
+ st4 (S AI_SOCKTYPE) # Store into 'ai_socktype'
+ call evSymY_E # Eval service
+ call bufStringE_SZ # Write to stack buffer
+ push Z # Save pointer to hints
ld E (L I) # Get host
- call bufStringE_SZ # Write host to stack buffer
- cc inet_aton(S &(Addr SIN_ADDR)) # Convert numbers/dots to binary address
- nul4 # Valid?
- if z # No
- cc gethostbyname(S) # Find hostent for given hostname
- null A # Found?
- jz 90 # No
- ld E A # Keep hostent pointer in E
- ld4 (E H_LENGTH) # Length of address?
- nul4
- jz 90 # No
- ld4 (((E H_ADDR_LIST))) # Take first address
- st4 (Addr SIN_ADDR.S_ADDR)
- end
- clrz # Return 'nz'
-90 ld S Z # Drop buffer
+ call bufStringE_SZ # Write to stack buffer
+ sub S I # 'lst' buffer
+ cc getaddrinfo(&(S I) &(Z I) (Z) S) # Get address info
+ pop E # Into 'lst'
+ ld S (Z) # Clean up
+ add S (%% ADDRINFO)
+ nul4 # Address valid -> 'z'
+ ldnz E Nil
drop
ret
-# (udp 'any1 'cnt 'any2) -> any
+# (udp 'any1 'any2 'any3) -> any
# (udp 'cnt) -> any
(code 'doUdp 2)
push X
@@ -290,9 +323,11 @@
10 ld E Nil # Return NIL
end
else
- call serverEY_F # Found server?
- ldz E Nil # No
- if nz # Yes
+ call xSymE_E # Host
+ ld C SOCK_DGRAM
+ call serverCEY_FE # Found server?
+ if z # Yes
+ ld X E # Keep list in X
ld Y (Y CDR) # Next arg
ld E (Y) # Eval 'any2'
eval
@@ -302,14 +337,28 @@
ld (PutBinBZ) putUdpBZ # Set binary print function
ld (Extn) (ExtN) # Set external symbol offset
call binPrintEZ # Print item
- cc socket(AF_INET SOCK_DGRAM 0) # Create socket
- nul4 # OK?
- js ipSocketErrX # No
- ld C A # Keep socket in C
- sub Z S # Data length
- cc sendto(C S Z 0 Addr SOCKADDR_IN) # Transmit message
- cc close(C) # Close socket
- ld E Y # Get return value
+ ld E X # Get list
+ do
+ null E # Any?
+ while nz # Yes
+ ld4 (E AI_SOCKTYPE) # Create socket
+ ld C A
+ ld4 (E AI_FAMILY)
+ cc socket(A C 0)
+ nul4 # OK?
+ if ns # Yes
+ ld C A # Keep socket in C
+ sub Z S # Data length
+ ld4 (E AI_ADDRLEN)
+ cc sendto(C S Z 0 (E AI_ADDR) A) # Transmit message
+ cc close(C) # Close socket
+ ld E Y # Get return value
+ jmp 80
+ end
+ ld E (E AI_NEXT) # Try next
+ loop
+ ld E Nil # Return NIL
+80 cc freeaddrinfo(X)
end
end
add S UDPMAX # Drop buffer
diff --git a/src64/sys/ppc64.linux.defs.l b/src64/sys/ppc64.linux.defs.l
@@ -1,4 +1,4 @@
-# 27mar11abu
+# 20oct11abu
# (c) Software Lab. Alexander Burger
# errno
@@ -26,7 +26,7 @@
(equ BUFSIZ 8192)
(equ PIPE_BUF 4096)
-(equ MAXPATHLEN 0)
+(equ MAXPATHLEN 4096)
# dlfcn
(equ RTLD_LAZY 1)
@@ -67,7 +67,7 @@
(equ TMS_STIME 8)
# termios
-(equ TERMIOS (+ 60 4)) # Terminal I/O structure (+ Padding)
+(equ TERMIOS 60) # Terminal I/O structure
(equ C_IFLAG 0)
(equ C_LFLAG 12)
(equ C_CC 17)
@@ -122,24 +122,29 @@
(equ D_NAME 19)
# Sockets
-(equ HOSTENT 32)
-(equ H_NAME 0)
-(equ H_LENGTH 20)
-(equ H_ADDR_LIST 24)
-
-(equ IN_ADDR 4)
-(equ S_ADDR 0)
-
-(equ SOCKADDR_IN 16)
-(equ SIN_ADDR 4)
-(equ SIN_ADDR.S_ADDR 4)
-(equ SIN_PORT 2)
-(equ SIN_FAMILY 0)
-(equ AF_INET 2)
(equ SOCK_STREAM 1)
(equ SOCK_DGRAM 2)
-(equ INADDR_ANY 0)
+(equ AF_UNSPEC 0)
+(equ AF_INET6 10)
(equ SOL_SOCKET 1)
(equ SO_REUSEADDR 2)
+(equ IPPROTO_IPV6 41)
+(equ IPV6_V6ONLY 26)
+(equ INET6_ADDRSTRLEN 46)
+
+(equ NI_MAXHOST 1025)
+(equ NI_NAMEREQD 8)
+
+(equ SOCKADDR_IN6 28)
+(equ SIN6_FAMILY 0)
+(equ SIN6_PORT 2)
+(equ SIN6_ADDR 8)
+
+(equ ADDRINFO 48)
+(equ AI_FAMILY 4)
+(equ AI_SOCKTYPE 8)
+(equ AI_ADDRLEN 16)
+(equ AI_ADDR 24)
+(equ AI_NEXT 40)
# vi:et:ts=3:sw=3
diff --git a/src64/sys/x86-64.linux.defs.l b/src64/sys/x86-64.linux.defs.l
@@ -1,4 +1,4 @@
-# 21feb11abu
+# 19oct11abu
# (c) Software Lab. Alexander Burger
# errno
@@ -67,7 +67,7 @@
(equ TMS_STIME 8)
# termios
-(equ TERMIOS (+ 60 4)) # Terminal I/O structure (+ Padding)
+(equ TERMIOS 60) # Terminal I/O structure
(equ C_IFLAG 0)
(equ C_LFLAG 12)
(equ C_CC 17)
@@ -122,24 +122,29 @@
(equ D_NAME 19)
# Sockets
-(equ HOSTENT 32)
-(equ H_NAME 0)
-(equ H_LENGTH 20)
-(equ H_ADDR_LIST 24)
-
-(equ IN_ADDR 4)
-(equ S_ADDR 0)
-
-(equ SOCKADDR_IN 16)
-(equ SIN_ADDR 4)
-(equ SIN_ADDR.S_ADDR 4)
-(equ SIN_PORT 2)
-(equ SIN_FAMILY 0)
-(equ AF_INET 2)
(equ SOCK_STREAM 1)
(equ SOCK_DGRAM 2)
-(equ INADDR_ANY 0)
+(equ AF_UNSPEC 0)
+(equ AF_INET6 10)
(equ SOL_SOCKET 1)
(equ SO_REUSEADDR 2)
+(equ IPPROTO_IPV6 41)
+(equ IPV6_V6ONLY 26)
+(equ INET6_ADDRSTRLEN 46)
+
+(equ NI_MAXHOST 1025)
+(equ NI_NAMEREQD 8)
+
+(equ SOCKADDR_IN6 28)
+(equ SIN6_FAMILY 0)
+(equ SIN6_PORT 2)
+(equ SIN6_ADDR 8)
+
+(equ ADDRINFO 48)
+(equ AI_FAMILY 4)
+(equ AI_SOCKTYPE 8)
+(equ AI_ADDRLEN 16)
+(equ AI_ADDR 24)
+(equ AI_NEXT 40)
# vi:et:ts=3:sw=3
diff --git a/src64/sys/x86-64.sunOs.defs.l b/src64/sys/x86-64.sunOs.defs.l
@@ -24,7 +24,7 @@
(equ FD_CLOEXEC 1)
# stdio
-(equ BUFSIZ 8192)
+(equ BUFSIZ 1024)
(equ PIPE_BUF 5120)
(equ stdin "$__iob")
@@ -55,7 +55,7 @@
(equ F_SETLK 6)
(equ F_SETLKW 7)
(equ F_SETOWN 24)
-(equ O_NONBLOCK 0)
+(equ O_NONBLOCK 128)
(equ O_ASYNC 0)
# stat
@@ -72,7 +72,7 @@
(equ TMS_STIME 8)
# termios
-(equ TERMIOS 36) # Terminal I/O structure (+ Padding)
+(equ TERMIOS 36) # Terminal I/O structure
(equ C_IFLAG 0)
(equ C_LFLAG 12)
(equ C_CC 16)
@@ -127,24 +127,29 @@
(equ D_NAME 18)
# Sockets
-(equ HOSTENT 32)
-(equ H_NAME 0)
-(equ H_LENGTH 20)
-(equ H_ADDR_LIST 24)
-
-(equ IN_ADDR 4)
-(equ S_ADDR 0)
-
-(equ SOCKADDR_IN 16)
-(equ SIN_ADDR 4)
-(equ SIN_ADDR.S_ADDR 4)
-(equ SIN_PORT 2)
-(equ SIN_FAMILY 0)
-(equ AF_INET 2)
(equ SOCK_STREAM 2)
(equ SOCK_DGRAM 1)
-(equ INADDR_ANY 0)
+(equ AF_UNSPEC 0)
+(equ AF_INET6 26)
(equ SOL_SOCKET 65535)
(equ SO_REUSEADDR 4)
+(equ IPPROTO_IPV6 41)
+(equ IPV6_V6ONLY 39)
+(equ INET6_ADDRSTRLEN 46)
+
+(equ NI_MAXHOST 1025)
+(equ NI_NAMEREQD 4)
+
+(equ SOCKADDR_IN6 32)
+(equ SIN6_FAMILY 0)
+(equ SIN6_PORT 2)
+(equ SIN6_ADDR 8)
+
+(equ ADDRINFO 48)
+(equ AI_FAMILY 4)
+(equ AI_SOCKTYPE 8)
+(equ AI_ADDRLEN 16)
+(equ AI_ADDR 32)
+(equ AI_NEXT 40)
# vi:et:ts=3:sw=3
diff --git a/src64/tags b/src64/tags
@@ -6,7 +6,14 @@
-VI ./defs.l 29
-VII ./defs.l 30
-VIII ./defs.l 31
-AF_INET sys/x86-64.linux.defs.l 138
+ADDRINFO sys/x86-64.linux.defs.l 143
+AF_INET6 sys/x86-64.linux.defs.l 128
+AF_UNSPEC sys/x86-64.linux.defs.l 127
+AI_ADDR sys/x86-64.linux.defs.l 147
+AI_ADDRLEN sys/x86-64.linux.defs.l 146
+AI_FAMILY sys/x86-64.linux.defs.l 144
+AI_NEXT sys/x86-64.linux.defs.l 148
+AI_SOCKTYPE sys/x86-64.linux.defs.l 145
AV ./glob.l 7
AV0 ./glob.l 8
Addr ./glob.l 616
@@ -88,7 +95,7 @@ Dbg ./glob.l 163
Delim ./glob.l 1173
DelimEnd ./glob.l 1174
DivErr ./glob.l 1197
-DlErr ./glob.l 1239
+DlErr ./glob.l 1240
EACCES sys/x86-64.linux.defs.l 9
EAGAIN sys/x86-64.linux.defs.l 8
EBADF sys/x86-64.linux.defs.l 7
@@ -157,10 +164,6 @@ GetBinZ_FB ./glob.l 30
Get_A ./glob.l 586
Giveup ./glob.l 1157
HEAP ./defs.l 5
-HOSTENT sys/x86-64.linux.defs.l 125
-H_ADDR_LIST sys/x86-64.linux.defs.l 128
-H_LENGTH sys/x86-64.linux.defs.l 127
-H_NAME sys/x86-64.linux.defs.l 126
HashBlank ./glob.l 1164
Heaps ./glob.l 10
Hear ./glob.l 39
@@ -169,9 +172,10 @@ Hup ./glob.l 169
I ./defs.l 14
II ./defs.l 15
III ./defs.l 16
-INADDR_ANY sys/x86-64.linux.defs.l 141
+INET6_ADDRSTRLEN sys/x86-64.linux.defs.l 133
INTERN ./defs.l 48
-IN_ADDR sys/x86-64.linux.defs.l 130
+IPPROTO_IPV6 sys/x86-64.linux.defs.l 131
+IPV6_V6ONLY sys/x86-64.linux.defs.l 132
ISIG sys/x86-64.linux.defs.l 74
ISym ./glob.l 150
IV ./defs.l 17
@@ -182,11 +186,12 @@ InBye ./glob.l 1144
InFDs ./glob.l 25
InFile ./glob.l 587
InFiles ./glob.l 26
-IpBindErr ./glob.l 1235
+IpBindErr ./glob.l 1236
IpGetsocknameErr ./glob.l 1233
-IpListenErr ./glob.l 1236
-IpSetsockoptErr ./glob.l 1234
+IpListenErr ./glob.l 1237
+IpReuseaddrErr ./glob.l 1235
IpSocketErr ./glob.l 1232
+IpV6onlyErr ./glob.l 1234
Jam ./glob.l 1143
JnlErr ./glob.l 1226
L_LEN sys/x86-64.linux.defs.l 40
@@ -211,6 +216,8 @@ Month ./glob.l 1146
Msg ./glob.l 174
MsgErr ./glob.l 1202
NIX ./defs.l 43
+NI_MAXHOST sys/x86-64.linux.defs.l 135
+NI_NAMEREQD sys/x86-64.linux.defs.l 136
NSym ./glob.l 151
NUMBER ./defs.l 47
Nil ./glob.l 134
@@ -237,6 +244,7 @@ PIPE_BUF sys/x86-64.linux.defs.l 27
PPid ./glob.l 156
PRepl ./glob.l 1142
Penv ./glob.l 56
+Pico ./glob.l 137
Pid ./glob.l 157
PidSigMsg ./glob.l 1160
PipeErr ./glob.l 1206
@@ -289,15 +297,14 @@ SIGUSR2 sys/x86-64.linux.defs.l 93
SIG_DFL sys/x86-64.linux.defs.l 86
SIG_IGN sys/x86-64.linux.defs.l 87
SIG_UNBLOCK sys/x86-64.linux.defs.l 88
-SIN_ADDR sys/x86-64.linux.defs.l 134
-SIN_ADDR.S_ADDR sys/x86-64.linux.defs.l 135
-SIN_FAMILY sys/x86-64.linux.defs.l 137
-SIN_PORT sys/x86-64.linux.defs.l 136
-SOCKADDR_IN sys/x86-64.linux.defs.l 133
-SOCK_DGRAM sys/x86-64.linux.defs.l 140
-SOCK_STREAM sys/x86-64.linux.defs.l 139
-SOL_SOCKET sys/x86-64.linux.defs.l 142
-SO_REUSEADDR sys/x86-64.linux.defs.l 143
+SIN6_ADDR sys/x86-64.linux.defs.l 141
+SIN6_FAMILY sys/x86-64.linux.defs.l 139
+SIN6_PORT sys/x86-64.linux.defs.l 140
+SOCKADDR_IN6 sys/x86-64.linux.defs.l 138
+SOCK_DGRAM sys/x86-64.linux.defs.l 126
+SOCK_STREAM sys/x86-64.linux.defs.l 125
+SOL_SOCKET sys/x86-64.linux.defs.l 129
+SO_REUSEADDR sys/x86-64.linux.defs.l 130
SSym ./glob.l 152
STACK ./defs.l 7
STAT sys/x86-64.linux.defs.l 57
@@ -305,7 +312,6 @@ ST_MODE sys/x86-64.linux.defs.l 58
ST_MTIME sys/x86-64.linux.defs.l 60
ST_SIZE sys/x86-64.linux.defs.l 59
SYM ./defs.l 39
-S_ADDR sys/x86-64.linux.defs.l 131
S_IFDIR sys/x86-64.linux.defs.l 62
S_IFMT sys/x86-64.linux.defs.l 61
Scl ./glob.l 166
@@ -374,8 +380,8 @@ Tsm ./glob.l 177
TtyPid ./glob.l 24
UDPMAX ./defs.l 58
USec ./glob.l 23
-UdpOvflErr ./glob.l 1237
-UndefErr ./glob.l 1238
+UdpOvflErr ./glob.l 1238
+UndefErr ./glob.l 1239
Uni ./glob.l 175
Up ./glob.l 172
V ./defs.l 18
@@ -547,9 +553,9 @@ divDone ./big.l 1255
divErrX ./err.l 462
divUnder ./big.l 1261
divuAE_A ./big.l 1045
-dlErrX ./err.l 692
+dlErrX ./err.l 697
doAbs ./big.l 2731
-doAccept ./net.l 139
+doAccept ./net.l 145
doAdd ./big.l 2171
doAdr ./main.l 594
doAlarm ./main.l 471
@@ -627,7 +633,7 @@ doCommit ./db.l 1495
doCon ./subr.l 725
doConc ./subr.l 781
doCond ./flow.l 1911
-doConnect ./net.l 201
+doConnect ./net.l 224
doCons ./subr.l 747
doCopy ./subr.l 1225
doCtl ./io.l 4254
@@ -697,7 +703,7 @@ doHead ./subr.l 1820
doHeap ./main.l 526
doHear ./io.l 3228
doHide ./sym.l 1082
-doHost ./net.l 184
+doHost ./net.l 190
doId ./db.l 1025
doIdx ./sym.l 2151
doIf ./flow.l 1797
@@ -726,7 +732,7 @@ doLines ./io.l 3852
doLink ./subr.l 1172
doLisp ./main.l 1982
doList ./subr.l 887
-doListen ./net.l 151
+doListen ./net.l 157
doLit ./flow.l 150
doLoad ./io.l 4171
doLock ./db.l 1182
@@ -881,7 +887,7 @@ doTrace ./flow.l 2953
doTrim ./subr.l 1759
doTry ./flow.l 1171
doType ./flow.l 911
-doUdp ./net.l 268
+doUdp ./net.l 301
doUnify ./subr.l 3935
doUnless ./flow.l 1893
doUntil ./flow.l 2077
@@ -958,7 +964,7 @@ getChar_A ./io.l 1975
getEC_E ./sym.l 2664
getParse_A ./io.l 1795
getStdin_A ./io.l 1724
-getUdpZ_FB ./net.l 321
+getUdpZ_FB ./net.l 370
getnECX_E ./sym.l 2623
giveupX ./main.l 180
halfA_A ./big.l 87
@@ -977,11 +983,12 @@ initInFileCA_A ./io.l 67
initOutFileA_A ./io.l 106
initSeedE_E ./big.l 2927
internEXY_FE ./sym.l 75
-ipBindErrX ./err.l 667
+ipBindErrX ./err.l 672
ipGetsocknameErrX ./err.l 657
-ipListenErrX ./err.l 672
-ipSetsockoptErrX ./err.l 662
+ipListenErrX ./err.l 677
+ipReuseaddrErrX ./err.l 667
ipSocketErrX ./err.l 652
+ipV6onlyErrX ./err.l 662
isBlankE_F ./sym.l 696
isInternEXY_F ./sym.l 37
isLetterOrDigitA_F ./sym.l 3554
@@ -1081,7 +1088,7 @@ putSrcEC_E ./flow.l 25
putStdoutB ./io.l 4625
putStringB ./main.l 2236
putTellBZ ./io.l 996
-putUdpBZ ./net.l 328
+putUdpBZ ./net.l 377
rdAtomBY_E ./io.l 2117
rdBlockIndexAZ_Z ./db.l 377
rdBlockLinkZ_Z ./db.l 375
@@ -1106,21 +1113,21 @@ remuAE_A ./big.l 1266
renErrEX ./err.l 467
restart ./main.l 154
resumeCoroutine ./flow.l 2566
-ret ./err.l 700
-retE_E ./err.l 723
-retNil ./err.l 717
-retNull ./err.l 714
-retT ./err.l 720
-retc ./err.l 702
-retnc ./err.l 705
-retnz ./err.l 711
-retz ./err.l 708
+ret ./err.l 705
+retE_E ./err.l 728
+retNil ./err.l 722
+retNull ./err.l 719
+retT ./err.l 725
+retc ./err.l 707
+retnc ./err.l 710
+retnz ./err.l 716
+retz ./err.l 713
rewindLog ./db.l 925
runE_E ./main.l 2083
rwUnlockDbA ./db.l 269
s_isdirS_F sys/x86-64.linux.code.l 16
selectErrX ./err.l 558
-serverEY_F ./net.l 235
+serverCEY_FE ./net.l 273
setAdrAS ./db.l 36
setAdrAZ ./db.l 22
setBlkAC_Z ./db.l 366
@@ -1159,7 +1166,7 @@ symErrYX ./err.l 428
symNsErrEX ./err.l 390
symToNumXA_FE ./big.l 1681
tcSetC ./main.l 386
-tcpAcceptA_FE ./net.l 104
+tcpAcceptA_FE ./net.l 109
tellBegZ_Z ./io.l 1004
tellEndAZ ./io.l 1011
tellErr ./err.l 646
@@ -1177,12 +1184,12 @@ truncLog ./db.l 944
tryLockCE_FA ./db.l 299
twiceA_A ./big.l 47
twiceBigA_A ./big.l 57
-udpOvflErr ./err.l 677
+udpOvflErr ./err.l 682
unLockFileAC ./io.l 15
unLockJnl ./db.l 357
-undefinedCE ./err.l 684
-undefinedCX ./err.l 686
-undefinedEX ./err.l 688
+undefinedCE ./err.l 689
+undefinedCX ./err.l 691
+undefinedEX ./err.l 693
uniFillE_E ./subr.l 3883
unifyCEYZ_F ./subr.l 3361
uninternEXY ./sym.l 356
diff --git a/src64/version.l b/src64/version.l
@@ -1,6 +1,6 @@
-# 14oct11abu
+# 20oct11abu
# (c) Software Lab. Alexander Burger
-(de *Version 3 0 8 4)
+(de *Version 3 0 8 5)
# vi:et:ts=3:sw=3