diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-10-13 20:24:18 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-10-13 20:43:23 +0200 |
commit | db65c3cb3e18b15b49a47662f6fc656d16d93ad1 (patch) | |
tree | 04983ac467bd81dfcafcd62344edc1a39c521d02 /src | |
parent | ad36c04a3ef961a2dbb6dc78dd5322318a7f10b6 (diff) | |
download | slirp-db65c3cb3e18b15b49a47662f6fc656d16d93ad1.zip slirp-db65c3cb3e18b15b49a47662f6fc656d16d93ad1.tar.gz slirp-db65c3cb3e18b15b49a47662f6fc656d16d93ad1.tar.bz2 |
arp: Allow 0.0.0.0 destination address
That can show up with DHCP packets.
Fixes #9
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/arp_table.c | 2 | ||||
-rw-r--r-- | src/slirp.c | 5 |
2 files changed, 1 insertions, 6 deletions
diff --git a/src/arp_table.c b/src/arp_table.c index 022a52e..054fbf5 100644 --- a/src/arp_table.c +++ b/src/arp_table.c @@ -71,7 +71,7 @@ bool arp_table_search(Slirp *slirp, uint32_t ip_addr, DEBUG_ARG("ip = %s", inet_ntoa((struct in_addr){ .s_addr = ip_addr })); /* If broadcast address */ - if (ip_addr == 0xffffffff || ip_addr == broadcast_addr) { + if (ip_addr == 0 || ip_addr == 0xffffffff || ip_addr == broadcast_addr) { /* return Ethernet broadcast address */ memset(out_ethaddr, 0xff, ETH_ALEN); return 1; diff --git a/src/slirp.c b/src/slirp.c index 911a7a6..22ca7d3 100644 --- a/src/slirp.c +++ b/src/slirp.c @@ -845,11 +845,6 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, struct ethhdr *eh, { const struct ip *iph = (const struct ip *)ifm->m_data; - if (iph->ip_dst.s_addr == 0) { - /* 0.0.0.0 can not be a destination address, something went wrong, - * avoid making it worse */ - return 1; - } if (!arp_table_search(slirp, iph->ip_dst.s_addr, ethaddr)) { uint8_t arp_req[ETH_HLEN + sizeof(struct slirp_arphdr)]; struct ethhdr *reh = (struct ethhdr *)arp_req; |