diff options
author | Hervé Poussineau <hpoussin@reactos.org> | 2010-09-15 22:33:26 +0200 |
---|---|---|
committer | Edgar E. Iglesias <edgar.iglesias@gmail.com> | 2010-09-17 12:46:27 +0200 |
commit | dbf3c4b4baceb91eb64d09f787cbe92d65188813 (patch) | |
tree | 36f624643daab0b6e18af88fa919e0c32e35d742 | |
parent | 0d491754d00a70c6af675312b9de8e382240a8bb (diff) |
Make ARP replies at least 64 bytes long
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>
-rw-r--r-- | slirp/slirp.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/slirp/slirp.c b/slirp/slirp.c index 82fd9b424f..332d83b64d 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -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); |