Hi! As a follow-up, I'm currenrly testing the attached patch. It basically works, but a PMAX configuration running NetBSD won't be responsive on the console during network I/O. However, I think that's not due to this patch, but because limitatiins in the emulation. Will look into this, but this (hackish) patch is at least in the ticket. (I've also sent it to gxemul's author.)
MfG, JBG --
diff --git a/src/net/net_tap.c b/src/net/net_tap.c index 188276e..d920695 100644 --- a/src/net/net_tap.c +++ b/src/net/net_tap.c @@ -48,6 +48,11 @@ #include "misc.h" #include "net.h" +#ifdef __linux__ +# include <linux/if.h> +# include <linux/if_tun.h> +#endif + /* * net_tap_rx_for_nic(): * @@ -166,7 +171,11 @@ bool net_tap_init(struct net *net, const char *tapdev) int fd; int one = 1; +#ifdef __linux__ + fd = open("/dev/net/tun", O_RDWR); +#else fd = open(tapdev, O_RDWR); +#endif if (fd < 0) { debugmsg(SUBSYS_NET, "tap", VERBOSITY_ERROR, "unable to open tap device '%s': %s", @@ -174,6 +183,22 @@ bool net_tap_init(struct net *net, const char *tapdev) return false; } +#ifdef __linux__ + struct ifreq ifr; + + memset(&ifr, 0, sizeof(ifr)); + ifr.ifr_flags = IFF_TAP | IFF_NO_PI; + strncpy(ifr.ifr_name, tapdev, IFNAMSIZ); + + if (ioctl(fd, TUNSETIFF, &ifr) < 0) { + debugmsg(SUBSYS_NET, "tap", VERBOSITY_ERROR, + "unable to attach to " + "tap device '%s': %s", tapdev, strerror(errno)); + close(fd); + return false; + } +#endif + if (ioctl(fd, FIONBIO, &one) < 0) { debugmsg(SUBSYS_NET, "tap", VERBOSITY_ERROR, "unable to set non-blocking mode on "
signature.asc
Description: PGP signature