summaryrefslogtreecommitdiff
path: root/emulators/simh/patches/patch-ab
blob: 11179bfc0b0f602e174ed0f855896d5076e0d027 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$NetBSD: patch-ab,v 1.5 2004/12/22 21:07:01 skrll Exp $

--- sim_ether.c.orig	2004-03-31 13:38:58.000000000 +0100
+++ sim_ether.c
@@ -830,6 +830,15 @@ void eth_callback(u_char* info, const st
     tmp_packet.len = header->len;
     memcpy(tmp_packet.msg, data, header->len);
 
+    /*
+     * Pad packet to minimum ethernet len, in case it comes from the local
+     * host.
+     */
+    if (header->len < 60) {
+        tmp_packet.len = 60;
+        memset(dev->read_packet->msg + header->len, 0, 60 - header->len);
+    }
+
     eth_packet_trace (dev, tmp_packet.msg, tmp_packet.len, "rcvqd");
 
     pthread_mutex_lock (&dev->lock);
@@ -840,6 +849,15 @@ void eth_callback(u_char* info, const st
     dev->read_packet->len = header->len;
     memcpy(dev->read_packet->msg, data, header->len);
 
+    /*
+     * Pad packet to minimum ethernet len, in case it comes from the local
+     * host.
+     */
+    if (header->len <60) {
+        dev->read_packet->len = 60;
+        memset(dev->read_packet->msg + header->len, 0, 60 - header->len);
+    }
+
     eth_packet_trace (dev, dev->read_packet->msg, dev->read_packet->len, "reading");
 
     /* call optional read callback function */
@@ -1080,8 +1098,10 @@ int eth_host_devices(int used, int max, 
 
 int eth_devices(int max, ETH_LIST* list)
 {
+#ifndef DONT_USE_PCAP_FINDALLDEVS
   pcap_if_t* alldevs;
   pcap_if_t* dev;
+#endif
   int i = 0;
   char errbuf[PCAP_ERRBUF_SIZE];