aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2019-11-21 22:34:09 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-11-21 22:34:09 +0000
commit0d337b5382f3521216c3dfd30fcde4f5bcdffd02 (patch)
tree17dbd08ecbeb6f0b416704564a008f3aed022ec2
parentd171af3732a0610a25334b06b77fa547bd677918 (diff)
parentdb65c3cb3e18b15b49a47662f6fc656d16d93ad1 (diff)
downloadslirp-0d337b5382f3521216c3dfd30fcde4f5bcdffd02.zip
slirp-0d337b5382f3521216c3dfd30fcde4f5bcdffd02.tar.gz
slirp-0d337b5382f3521216c3dfd30fcde4f5bcdffd02.tar.bz2
Merge branch 'arp_0' into 'master'
arp: Allow 0.0.0.0 destination address Closes #9 See merge request slirp/libslirp!16
-rw-r--r--src/arp_table.c2
-rw-r--r--src/slirp.c5
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;