public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <ordex@autistici.org>
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.] [PATCH 5/7] batman-adv: make the Distributed ARP Table vlan aware
Date: Mon, 6 May 2013 08:05:32 +0200	[thread overview]
Message-ID: <20130506060532.GJ3773@ritirata.org> (raw)
In-Reply-To: <201305061131.01113.lindner_marek@yahoo.de>

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

On Mon, May 06, 2013 at 11:31:00AM +0800, Marek Lindner wrote:
> On Tuesday, April 23, 2013 22:34:34 Antonio Quartulli wrote:
> >  /**
> > + * batadv_dat_get_vid - extract the VLAN identifier from skb if any
> > + * @skb: the buffer containing the packet to extract the VID from
> > + * @hdr_size: the size of the batman-adv header encapsulating the packet
> > + *
> > + * If the packet contained in skb is vlan tagged then this function
> > returns the + * VID with the BATADV_VLAN_HAS_TAG flag. Otherwise returns
> > BATADV_NO_FLAGS + */
> > +static unsigned short batadv_dat_get_vid(struct sk_buff *skb, int
> > *hdr_size) +{
> > +       struct ethhdr *ethhdr;
> > +       struct vlan_ethhdr *vhdr;
> > +       unsigned short vid;
> > +
> > +       ethhdr = (struct ethhdr *)skb->data + *hdr_size;
> > +
> > +       if (ntohs(ethhdr->h_proto) != ETH_P_8021Q)
> > +               return BATADV_NO_FLAGS;
> > +
> > +       vhdr = (struct vlan_ethhdr *)ethhdr;
> > +       vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK;
> > +       vid |= BATADV_VLAN_HAS_TAG;
> > +       /* ARP parsing functions jump forward of hdr_size + ETH_HLEN.
> > +        * If the header contained in the packet is a VLAN one (which is
> > longer) +        * hdr_size is updated so that the functions will still
> > jump the +        * correct amount of bytes
> > +        */
> > +       *hdr_size += VLAN_HLEN;
> > +
> > +       return vid;
> > +}
> 
> This is a very useful function. Why do you make it DAT specific ? The other 
> patches contain the same vid extraction code over and over again. It would 
> make more sense if you added this function with your first patch and make 
> everybody use it.

mh, I agree, I simply have to remove the last line (about hdr_size - this is DAT
specific) and then I can export it. Ok. Actually I did not introduced this patch
before, because most of the code to check for a VID was already in batman-adv
and I simply extended it.

Anyhow, will do this in the next iteration.

Thanks


-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-05-06  6:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23 14:34 [B.A.T.M.A.N.] [PATCH 0/7] make the Translation Table component VLAN-aware Antonio Quartulli
2013-04-23 14:34 ` [B.A.T.M.A.N.] [PATCH 1/7] batman-adv: add the VLAN ID attribute to the TT entry Antonio Quartulli
2013-05-04 12:39   ` Marek Lindner
2013-04-23 14:34 ` [B.A.T.M.A.N.] [PATCH 2/7] batman-adv: use vid when computing local and global TT CRC Antonio Quartulli
2013-04-23 19:58   ` Marek Lindner
2013-04-23 20:04     ` Antonio Quartulli
2013-05-04 12:12       ` Marek Lindner
2013-05-04 12:17         ` Antonio Quartulli
2013-04-23 14:34 ` [B.A.T.M.A.N.] [PATCH 3/7] batman-adv: print the VID together with the TT entries Antonio Quartulli
2013-04-23 14:34 ` [B.A.T.M.A.N.] [PATCH 4/7] batman-adv: make the GW component vlan-featured Antonio Quartulli
2013-04-23 14:42   ` Antonio Quartulli
2013-05-04 12:42   ` Marek Lindner
2013-05-04 17:07     ` Antonio Quartulli
2013-04-23 14:34 ` [B.A.T.M.A.N.] [PATCH 4/7] batman-adv: make the GW module correctly talk to the new VLAN-TT Antonio Quartulli
2013-04-23 14:34 ` [B.A.T.M.A.N.] [PATCH 5/7] batman-adv: make the Distributed ARP Table vlan aware Antonio Quartulli
2013-05-06  3:31   ` Marek Lindner
2013-05-06  6:05     ` Antonio Quartulli [this message]
2013-04-23 14:34 ` [B.A.T.M.A.N.] [PATCH 6/7] batman-adv: add per VLAN interface attribute framework Antonio Quartulli
2013-04-24 12:31   ` Antonio Quartulli
2013-04-23 14:34 ` [B.A.T.M.A.N.] [PATCH 7/7] batman-adv: make the AP isolation attribute VLAN specific Antonio Quartulli

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=20130506060532.GJ3773@ritirata.org \
    --to=ordex@autistici.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