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>
This commit is contained in:
Nickolai Zeldovich 2012-11-12 17:59:49 +01:00 committed by Jan Kiszka
parent ce34cf72fe
commit 1a89b60885

View file

@ -38,7 +38,9 @@ void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALEN])
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 */