From: Marek Lindner <mareklindner@neomailbox.ch>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCHv2] batman-adv: drop QinQ claim frames in bridge loop avoidance
Date: Sun, 22 Jun 2014 17:21:40 +0800 [thread overview]
Message-ID: <1676388.QilV9dKt8E@diderot> (raw)
In-Reply-To: <201406211657.42780.sw@simonwunderlich.de>
[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]
On Saturday 21 June 2014 16:57:42 Simon Wunderlich wrote:
> > Looks like copy & paste from batadv_bla_process_claim() ? How about using
> > a
> > shared function ?
>
> Yeah, it's copy and pasted. The only thing which we could put into a common
> function are the 4 checks, the local variables are used in a different way
> for the further code in each function. This didn't really look worth it so
> I didn't bother to refactor in that patch, if you feel otherwise let me
> know and i'll refactor in v2.
How about moving the while loop into batadv_bla_process_claim() itself ?
Something like:
if (vid & BATADV_VLAN_HAS_TAG) {
vhdr = vlan_eth_hdr(skb);
proto = vhdr->h_vlan_encapsulated_proto;
headlen += VLAN_HLEN;
}
if (proto == htons(ETH_P_8021Q)) {
do {
vhdr_ptr = skb_header_pointer(skb, headlen, VLAN_HLEN, &vhdr);
if (!vhdr_ptr)
return 0;
headlen += VLAN_HLEN;
} while (vhdr_ptr->h_vlan_encapsulated_proto == htons(ETH_P_8021Q));
proto = vhdr->h_vlan_encapsulated_proto;
}
if (proto != htons(ETH_P_ARP))
return 0; /* not a claim frame */
Towards the BLA claim check you can then check whether this BLA frame was
encapsulated more than once (through a local variable).
Cheers,
Marek
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
prev parent reply other threads:[~2014-06-22 9:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-13 9:15 [B.A.T.M.A.N.] [PATCHv2] batman-adv: drop QinQ claim frames in bridge loop avoidance Simon Wunderlich
2014-06-21 12:50 ` Marek Lindner
2014-06-21 14:57 ` Simon Wunderlich
2014-06-22 9:21 ` Marek Lindner [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=1676388.QilV9dKt8E@diderot \
--to=mareklindner@neomailbox.ch \
--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