]> git.proxmox.com Git - qemu.git/commitdiff
Make ARP replies at least 64 bytes long
authorHervé Poussineau <hpoussin@reactos.org>
Wed, 15 Sep 2010 20:33:26 +0000 (22:33 +0200)
committerEdgar E. Iglesias <edgar.iglesias@gmail.com>
Fri, 17 Sep 2010 10:46:27 +0000 (12:46 +0200)
IEEE 802.3 standard requires Ethernet frames to be at least 64 bytes long.
If it is not the case, they will be considered as runt frames, and may be ignored by netcard and/or OS

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
slirp/slirp.c

index 82fd9b424ff93d7b823b56d62b9b8bc03e6344c2..332d83b64d054750a0f25114a5b81cbed4095d60 100644 (file)
@@ -599,7 +599,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
 {
     struct ethhdr *eh = (struct ethhdr *)pkt;
     struct arphdr *ah = (struct arphdr *)(pkt + ETH_HLEN);
-    uint8_t arp_reply[ETH_HLEN + sizeof(struct arphdr)];
+    uint8_t arp_reply[max(ETH_HLEN + sizeof(struct arphdr), 64)];
     struct ethhdr *reh = (struct ethhdr *)arp_reply;
     struct arphdr *rah = (struct arphdr *)(arp_reply + ETH_HLEN);
     int ar_op;
@@ -619,6 +619,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
             }
             return;
         arp_ok:
+            memset(arp_reply, 0, sizeof(arp_reply));
             /* XXX: make an ARP request to have the client address */
             memcpy(slirp->client_ethaddr, eh->h_source, ETH_ALEN);