diff options
author | Nickolai Zeldovich <nickolai@csail.mit.edu> | 2012-11-12 17:59:49 +0100 |
---|---|---|
committer | Jan Kiszka <jan.kiszka@siemens.com> | 2012-11-15 10:27:14 +0100 |
commit | 76738578355e5e5be7cfa6217c33551fb7b38d3d (patch) | |
tree | 0075b144b30df582871b1ca781d0b3998871acbb | |
parent | c5e61098874d965d286b7f5b9e1944fc1c8b2a69 (diff) | |
download | slirp-76738578355e5e5be7cfa6217c33551fb7b38d3d.zip slirp-76738578355e5e5be7cfa6217c33551fb7b38d3d.tar.gz slirp-76738578355e5e5be7cfa6217c33551fb7b38d3d.tar.bz2 |
slirp: Don't crash on packets from 0.0.0.0/8.
LWIP can generate packets with a source of 0.0.0.0, which triggers an
assertion failure in arp_table_add(). Instead of crashing, simply return
to avoid adding an invalid ARP table entry.
Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
-rw-r--r-- | arp_table.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arp_table.c b/arp_table.c index 5fa8de6..188c2af 100644 --- a/arp_table.c +++ b/arp_table.c @@ -37,7 +37,9 @@ void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALEN]) ethaddr[1], ethaddr[2], ethaddr[3], ethaddr[4], ethaddr[5])); /* Check 0.0.0.0/8 invalid source-only addresses */ - assert((ip_addr & htonl(~(0xf << 28))) != 0); + if ((ip_addr & htonl(~(0xf << 28))) == 0) { + return; + } if (ip_addr == 0xffffffff || ip_addr == broadcast_addr) { /* Do not register broadcast addresses */ |