* [Qemu-devel] [PATCH v2] slirp: Don't crash on packets from 0.0.0.0/8.
@ 2012-11-12 16:59 Nickolai Zeldovich
2012-11-15 9:27 ` Jan Kiszka
0 siblings, 1 reply; 2+ messages in thread
From: Nickolai Zeldovich @ 2012-11-12 16:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Jan Kiszka, Nickolai Zeldovich
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>
---
slirp/arp_table.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Change from v1: adhere to qemu's code style (put braces around all
indentation blocks).
diff --git a/slirp/arp_table.c b/slirp/arp_table.c
index 5d7b8ac..bf698c1 100644
--- a/slirp/arp_table.c
+++ b/slirp/arp_table.c
@@ -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 */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH v2] slirp: Don't crash on packets from 0.0.0.0/8.
2012-11-12 16:59 [Qemu-devel] [PATCH v2] slirp: Don't crash on packets from 0.0.0.0/8 Nickolai Zeldovich
@ 2012-11-15 9:27 ` Jan Kiszka
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2012-11-15 9:27 UTC (permalink / raw)
To: Nickolai Zeldovich; +Cc: qemu-devel@nongnu.org
On 2012-11-12 17:59, Nickolai Zeldovich wrote:
> 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>
> ---
> slirp/arp_table.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> Change from v1: adhere to qemu's code style (put braces around all
> indentation blocks).
>
>
> diff --git a/slirp/arp_table.c b/slirp/arp_table.c
> index 5d7b8ac..bf698c1 100644
> --- a/slirp/arp_table.c
> +++ b/slirp/arp_table.c
> @@ -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 */
>
Thanks, applied to slirp queue.
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-15 9:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-12 16:59 [Qemu-devel] [PATCH v2] slirp: Don't crash on packets from 0.0.0.0/8 Nickolai Zeldovich
2012-11-15 9:27 ` Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).