public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] [PATCHv3 2/6] batman-adv: speed up dat by snooping received ip traffic
Date: Fri, 06 May 2016 12:03:57 +0200	[thread overview]
Message-ID: <1774690.zXGivVJ4dJ@sven-edge> (raw)
In-Reply-To: <1462525107-19750-3-git-send-email-apape@phoenixcontact.com>

[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]

Hi,

just some ideas (maybe not all of them are good):

[...]
> +       ethhdr = eth_hdr(skb);
> +
> +       switch (ntohs(ethhdr->h_proto)) {
> +       case ETH_P_IP:
> +               iphdr = skb_header_pointer(skb, ETH_HLEN, sizeof(tmp_iphdr),
> +                                          &tmp_iphdr);
> +               break;
> +       case ETH_P_8021Q:
> +               vhdr = skb_header_pointer(skb, 0, sizeof(tmp_vhdr),
> +                                         &tmp_vhdr);
> +               if (!vhdr)
> +                       break;

Do we need to continue here when there is no vhdr? Maybe just return.

> +               if (ntohs(vhdr->h_vlan_encapsulated_proto) == ETH_P_IP) {

Maybe the check here could be inverted to just return when this is not ETH_P_IP

> +                       iphdr = skb_header_pointer(skb, sizeof(tmp_vhdr),
> +                                                  sizeof(tmp_iphdr),
> +                                                  &tmp_iphdr);
> +               }
> +               break;
> +       }
> +
> +       if (iphdr) {

You could just modify the check to:

if (!iphdr)
	return;

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-05-06 10:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06  8:58 [B.A.T.M.A.N.] [PATCHv3 0/6] batman-adv: Optimizations for setups running dat and bla Andreas Pape
2016-05-06  8:58 ` [B.A.T.M.A.N.] [PATCHv3 1/6] batman-adv: prevent multiple ARP replies sent by gateways if dat enbled Andreas Pape
2016-05-06  8:58 ` [B.A.T.M.A.N.] [PATCHv3 2/6] batman-adv: speed up dat by snooping received ip traffic Andreas Pape
2016-05-06  9:53   ` Sven Eckelmann
2016-05-06 10:03   ` Sven Eckelmann [this message]
2016-05-19 19:33   ` Linus Lüssing
2016-05-19 22:22     ` Linus Lüssing
2016-05-19 19:45   ` Linus Lüssing
2016-05-19 20:30     ` Linus Lüssing
2016-05-19 22:48       ` Linus Lüssing
2016-05-19 23:11       ` Linus Lüssing
2016-05-20 11:32     ` [B.A.T.M.A.N.] Antwort: " Andreas Pape
2016-05-20 12:56       ` Antonio Quartulli
2016-05-20 13:51   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-06-13 13:45     ` Andreas Pape
2016-06-23 20:34       ` Linus Lüssing
2016-05-06  8:58 ` [B.A.T.M.A.N.] [PATCHv3 3/6] batman-adv: prevent duplication of ARP replies when DAT is used Andreas Pape
2016-05-06  8:58 ` [B.A.T.M.A.N.] [PATCHv3 4/6] batman-adv: drop unicast packets from other backbone gw Andreas Pape
2016-05-06 10:43   ` Sven Eckelmann
2016-05-06  8:58 ` [B.A.T.M.A.N.] [PATCHv3 5/6] batman-adv: changed debug messages for easier bla debugging Andreas Pape
2016-05-06  8:58 ` [B.A.T.M.A.N.] [PATCHv3 6/6] batman-adv: handle race condition for claims between gateways Andreas Pape

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=1774690.zXGivVJ4dJ@sven-edge \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox