diff options
author | thorpej <thorpej@pkgsrc.org> | 2002-11-06 08:37:46 +0000 |
---|---|---|
committer | thorpej <thorpej@pkgsrc.org> | 2002-11-06 08:37:46 +0000 |
commit | 3f48a0c8f543a1e06c703368f810ecf9df0dafe6 (patch) | |
tree | 0f52c431253add892c1d39f02c1e44c2c098e7ab /emulators/simh/patches | |
parent | 916b2538deb00fefcc13064fd411012fbc976d13 (diff) | |
download | pkgsrc-3f48a0c8f543a1e06c703368f810ecf9df0dafe6.tar.gz |
Update the DELQA module to beta5. Changes:
22-Oct-02 DTH Added all_multicast and promiscuous support
21-Oct-02 DTH Added write buffer max size check (code by Jason Thorpe)
Corrected copyright again
Implemented NXM testing and recovery
22-Oct-02 DTH Added all_multicast and promiscuous support
Fixed not attached behavior
21-Oct-02 DTH Added NetBSD code from Jason Thorpe
Patched buffer size to make sure entire packet is read in
Made 'ethX' check characters passed as well as length
Corrected copyright again
Bump revision to nb2.
Diffstat (limited to 'emulators/simh/patches')
-rw-r--r-- | emulators/simh/patches/patch-ab | 137 | ||||
-rw-r--r-- | emulators/simh/patches/patch-ac | 17 |
2 files changed, 0 insertions, 154 deletions
diff --git a/emulators/simh/patches/patch-ab b/emulators/simh/patches/patch-ab deleted file mode 100644 index 3b72d453cd1..00000000000 --- a/emulators/simh/patches/patch-ab +++ /dev/null @@ -1,137 +0,0 @@ -$NetBSD: patch-ab,v 1.1 2002/10/19 21:38:10 thorpej Exp $ - ---- sim_ether.c.orig Sat Oct 19 14:26:01 2002 -+++ sim_ether.c Sat Oct 19 14:26:10 2002 -@@ -70,6 +70,7 @@ - msg, dst, src, *proto, packet->len); - } - -+#ifndef __NetBSD__ - char* eth_getname(int number, char* name) - { - #define ETH_SUPPORTED_DEVICES 10 -@@ -80,6 +81,7 @@ - strcpy(name, list[number].name); - return name; - } -+#endif /* ! __NetBSD__ */ - - void eth_zero(ETH_DEV* dev) - { -@@ -89,7 +91,7 @@ - - /* First, all the non-implemented versions */ - --#if !defined (WIN32) && !defined(linux) -+#if !defined (WIN32) && !defined(linux) && !defined(__NetBSD__) - t_stat eth_open (ETH_DEV* dev, char* name) - {return SCPE_NOFNC;} - t_stat eth_close (ETH_DEV* dev) -@@ -110,9 +112,13 @@ - #ifdef WIN32 - #include <packet32.h> - #endif /*WIN32*/ --#ifdef linux -+#ifdef __NetBSD__ -+#include <sys/ioctl.h> -+#include <net/bpf.h> -+#endif /* __NetBSD__ */ -+#if defined(linux) || defined(__NetBSD__) - #include <fcntl.h> --#endif /*linux*/ -+#endif /*linux || __NetBSD__*/ - - t_stat eth_open(ETH_DEV* dev, char* name) - { -@@ -124,22 +130,34 @@ - /* initialize device */ - eth_zero(dev); - -+#ifndef __NetBSD__ - /* translate name of type "ethX" */ - if ((strlen(name) == 4) && isdigit(name[3])) { - num = atoi(&name[3]); - savname = eth_getname(num, temp); - } -+#endif /* ! __NetBSD__ */ - - /* attempt to connect device */ -- dev->handle = (void*) pcap_open_live(savname, BUFSIZ, ETH_PROMISC, /*ETH_TIMEOUT*/-1, errbuf); -+ dev->handle = (void*) pcap_open_live(savname, ETH_MAX_PACKET, ETH_PROMISC, /*ETH_TIMEOUT*/-1, errbuf); - -- if (!dev->handle) return SCPE_OPENERR; /* can't open device */ -+ if (!dev->handle) { -+ printf("pcap_open_live: %s\n", errbuf); -+ return SCPE_OPENERR; /* can't open device */ -+ } - - /* save name of device */ - dev->name = malloc(strlen(savname)+1); - strcpy(dev->name, savname); - --#ifdef linux -+#ifdef __NetBSD__ -+ /* tell the kernel that the header is fully-formed when it gets it. this -+ is required in order to fake the src address. */ -+ i = 1; -+ ioctl(pcap_fileno(dev->handle), BIOCSHDRCMPLT, &i); -+#endif /* __NetBSD__ */ -+ -+#if defined(linux) || defined(__NetBSD__) - /* set file non-blocking */ - fcntl(pcap_fileno(dev->handle), F_SETFL, fcntl(pcap_fileno(dev->handle), F_GETFL, 0) | O_NONBLOCK); - #endif /*linux*/ -@@ -373,4 +391,53 @@ - - #endif /*linux*/ - -+#ifdef __NetBSD__ -+ -+#include <sys/types.h> -+#include <sys/socket.h> -+#include <net/if_dl.h> -+#include <net/if_types.h> -+#include <ifaddrs.h> -+#include <string.h> -+ -+int pcap_sendpacket(pcap_t* handle, u_char* msg, int len) -+{ -+ return (write(pcap_fileno(handle), msg, len) == len)?0:-1; -+} -+ -+int PacketGetAdapterNames(char* buffer, int* size) -+{ -+ const struct sockaddr_dl *sdl; -+ struct ifaddrs *ifap, *ifa; -+ char *p; -+ int ptr = 0; -+ -+ if (getifaddrs(&ifap) != 0) { -+ *size = 0; -+ return (0); -+ } -+ -+ p = NULL; -+ for (ifa = ifap; ifa; ifa = ifa->ifa_next) { -+ if (ifa->ifa_addr->sa_family != AF_LINK) -+ continue; -+ if (p && strcmp(p, ifa->ifa_name) == 0) -+ continue; -+ sdl = (const struct sockaddr_dl *) ifa->ifa_addr; -+ if (sdl->sdl_type != IFT_ETHER) -+ continue; -+ -+ strcpy(buffer+ptr, ifa->ifa_name); -+ ptr += strlen(ifa->ifa_name)+1; -+ } -+ -+ freeifaddrs(ifap); -+ -+ buffer[ptr++] = '\0'; -+ buffer[ptr++] = '\0'; -+ *size = ptr; -+ -+ return (ptr); -+} - -+#endif /* __NetBSD__ */ diff --git a/emulators/simh/patches/patch-ac b/emulators/simh/patches/patch-ac deleted file mode 100644 index 13f5904c89e..00000000000 --- a/emulators/simh/patches/patch-ac +++ /dev/null @@ -1,17 +0,0 @@ -$NetBSD: patch-ac,v 1.1 2002/10/19 21:38:10 thorpej Exp $ - -*** PDP11/pdp11_xq.c.orig Sat Oct 19 14:29:44 2002 ---- PDP11/pdp11_xq.c Sat Oct 19 14:30:00 2002 -*************** -*** 766,771 **** ---- 766,775 ---- - if (xq.xbdl_buf[1] & XQ_DSC_H) b_length -= 1; - if (xq.xbdl_buf[1] & XQ_DSC_L) b_length -= 1; - -+ /* protect ourselves from a broken device driver... */ -+ if ((xq.write_buffer.len + b_length) > sizeof(xq.write_buffer.msg)) -+ b_length = sizeof(xq.write_buffer.msg) - xq.write_buffer.len; -+ - /* add to transmit buffer */ - Map_ReadB(address, b_length, &xq.write_buffer.msg[xq.write_buffer.len], NOMAP); - xq.write_buffer.len += b_length; |