Closed GoogleCodeExporter closed 9 years ago
here are the full versions of the files changed in the diff.
Original comment by mechiel@ueber.net
on 19 Jul 2009 at 8:56
Attachments:
i've improved the patch, made it work on freebsd & netbsd too (which means it
probably also works on macosx, but i don't have access to such a machine). i
moved
the ipv6 support to a separate ipif-posix6.c, and updated the current
ipif-posix.c to
the changed interface from ip.h & devip.c. that means the ipv4-only ipif-posix
behaviour can be had by just specifying that in the emu config file.
it seems that windows xp does not have the right dual stack socket
functionality that
allows a simple ipv6 implementation. that only comes with vista and higher.
i've
modified the Nt ipif.c to work with the changed interface too. that compiles &
works, at least on windows xp sp3 with a relatively recent microsoft c++
compiler
(free download).
if i can arrange an (sdram) memory upgrade for my machine, i'll see if i can add
windows >= vista ipv6 code too, on a windows 7 release candidate machine.
other ports (Hp, Unixware, Irix) seem to use ipif-posix.c and perhaps also
freebsd's
ipif.c. i cannot test those, but they can always use the unchanged
ipif-posix.c code.
anyway, no patch attached yet. i'll do a bit more testing tomorrow.
Original comment by mechiel@ueber.net
on 20 Jul 2009 at 11:42
update attached. the .tgz has all new versions for the files (against latest
hg at
this time, rev 333). the diff makes rev 333 updated to ipv6.
files involved:
modified:
emu/FreeBSD/emu
emu/Linux/emu
emu/Linux/emu-g
emu/MacOSX/emu
emu/NetBSD/emu
emu/OpenBSD/emu
emu/Unixware/emu
emu/Nt/emu
emu/Nt/mkfile
emu/port/devip.c
emu/port/ip.h
emu/Nt/ipif.c
emu/port/ipif-posix.c
new:
emu/Nt/ipif6.c
emu/port/ipif6-posix.c
removed:
emu/FreeBSD/ipif.c
emu/MacOSX/ipif.c
emu/NetBSD/ipif.c
emu/OpenBSD/ipif.c
emu/Unixware/ipif.c
description:
the interface used by devip.c (ip.h & ipaux.c) is updated to always
pass around ipv6 addresses (so with ipv4 addresses mapped in them).
existing ipif*.c's are updated to this interface. new ipv6-enabled
implementations ipif6*.c of course use this interface too.
- left SO_REUSEADDR in so_bind() disabled because it was disabled
on Nt/ipif.c
- perhaps emu/Linux/emu-wrt should have ipv6 too.
- so_setsockopt and so_mustbind are not used, and so are not tested.
- Unixware, Irix, Hp & OpenBSD use port/ipif-posix.c, their own
copies are removed.
- Linux, FreeBSD, MacOSX and NetBSD have their ipif.c copy removed too.
they now use port/ipif6-posix.c. MacOSX should probably use this
too.
- Nt gets its own ipif6.c, it's a cross between its (updated) ipif.c
and ipif6-posix.c. i tested on windows 7, it should work on
windows >= vista. it does not work on windows xp (that's why
ipif.c is updated). i updated the mkfile to link against the new
windows socket library. windows xp can link against this too,
the ipv6 socket creation will fail at runtime though. i update
Nt's emu config file, but this means builds won't work on windows
xp. one solution would be to split Nt into two versions for
windows (at least both can be build on a single new windows system,
i think).
- all ipif*.c files have been modified so that diffs between them are small (eg
Nt &
port's ipif for v4, Nt & port's ipif for v6, and between the v4 & v6 versions).
- i haven't put thought into behaviour of multicast yet. i have no idea on how
that
works. it seems to be just part of the address space.
- the various stacks have slightly different behaviour for binding to
addresses: ::
(the v6 any address) listens on v4 too of course, but on eg freebsd ::
explicitly
binds ipv4 0.0.0.0 too, and that cannot be overridden by a later bind. i think
that
is possible on linux & windows. all systems do seem to allow binds to explicit
addresses, taking them away from the any address listening socket. i don't
think
this difference in implementation is very relevant for us.
the following has been tested:
- linux,freebsd,netbsd with port/ipif6-posix.c & port/ipif-posix.c
- windows 7 with Nt/ipif.c & Nt/ipif6.c
- windows xp with sp3 with Nt/ipif.c
- openbsd with port/ipif-posix.c
i have probably updated the code for tiny bits while forgetting to run the tests
again... still, a lot has been tested.
the biggest thing to solve is the windows xp vs vista problem. needing two
executables isn't too nice. otherwise perhaps ipv4-only is the reasonable
default
for now...
Original comment by mechiel@ueber.net
on 22 Jul 2009 at 12:33
Attachments:
although emu seems to work just fine on windows 7, there seems to be a problem
when
you specify bad command-line options (i ran emu -c^U. emu -ca or similarly
invalid
causes it too):
Usage: emu [options...] [file.dis [args...]]
-gXxY
-c[0-9]
-d file.dis
-s
-v
-p<poolname>=maxsize
-f<fontpath>
-r<rootpath>
-7
-B
-C<channel string>
-S
alloc:D2B: 1451d18 not in pools
panic: alloc:D2B 1451d18 (from 435fcf/527a74)
alloc:D2B: 14507c8 not in pools
panic: alloc:D2B 14507c8 (from 435fcf/5207c1)
i thought an atexit handler might be causing the problem, but replacing
exits("usage") in port/main.c with _exit(1) does not make a difference. i
don't know
how to turn the pc's into file+lines on windows...
windows xp does not seem to have this problem. windows 7 with Nt/ipif6.c
prints two
panic's, windows 7 with Nt/ipif.c prints one panic.
it seems windows is somehow (mistakenly?) calling alloc at exit. perhaps we're
overriding a windows symbol? with Nt/ipif.c
Original comment by mechiel@ueber.net
on 22 Jul 2009 at 11:39
apparently i broke the port/ipif-posix.c so_connect(), for ipv4. not sure why i
didn't catch this... the following patch (attached as ipv6-f-fixv4connect.diff)
corrects it. if i find more regressions, i'll make a new version of the patch.
diff -r 638cc0f2b1f0 emu/Nt/ipif.c
--- a/emu/Nt/ipif.c Wed Jul 22 01:45:38 2009 +0200
+++ b/emu/Nt/ipif.c Mon Jul 27 16:08:05 2009 +0200
@@ -196,7 +196,7 @@
sin = (struct sockaddr_in*)&sa;
sin->sin_family = AF_INET;
hnputs(&sin->sin_port, rport);
- ipw6(raddr, sin->sin_addr.s_addr);
+ memmove(&sin->sin_addr.s_addr, raddr+IPv4off, IPv4addrlen);
osenter();
r = connect(fd, &sa, sizeof(sa));
diff -r 638cc0f2b1f0 emu/port/ipif-posix.c
--- a/emu/port/ipif-posix.c Wed Jul 22 01:45:38 2009 +0200
+++ b/emu/port/ipif-posix.c Mon Jul 27 16:08:05 2009 +0200
@@ -172,7 +172,7 @@
sin = (struct sockaddr_in*)&sa;
sin->sin_family = AF_INET;
hnputs(&sin->sin_port, rport);
- ipw6(raddr, sin->sin_addr.s_addr);
+ memmove(&sin->sin_addr.s_addr, raddr+IPv4off, IPv4addrlen);
osenter();
r = connect(fd, &sa, sizeof(sa));
Original comment by mechiel@ueber.net
on 27 Jul 2009 at 2:45
forgot to attach...
Original comment by mechiel@ueber.net
on 27 Jul 2009 at 2:46
Attachments:
Merging into current source
Original comment by Charles....@gmail.com
on 27 Nov 2010 at 3:38
20101127-1632
committed changeset 467:085fb7fa2b4c
pushing to https://Charles.Forsyth:***@inferno-os.googlecode.com/hg
searching for changes
1 changesets found
Original comment by Charles....@gmail.com
on 27 Nov 2010 at 4:33
Original issue reported on code.google.com by
mechiel@ueber.net
on 19 Jul 2009 at 8:49Attachments: