All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Nickolai Zeldovich <nickolai@csail.mit.edu>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2] slirp: Don't crash on packets from 0.0.0.0/8.
Date: Thu, 15 Nov 2012 10:27:40 +0100	[thread overview]
Message-ID: <50A4B58C.7080903@siemens.com> (raw)
In-Reply-To: <1352739589-5264-1-git-send-email-nickolai@csail.mit.edu>

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

      reply	other threads:[~2012-11-15  9:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50A4B58C.7080903@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=nickolai@csail.mit.edu \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.