[PATCH 3/3] bridge: Add support for VLANs

Tobias Jungel tobias.jungel at bisdn.de
Thu Dec 3 08:55:38 PST 2015


On Mi, 2015-12-02 at 19:30 +0100, Thomas Haller wrote:
> On Wed, 2015-12-02 at 09:24 -0800, David Ahern wrote:
> > Hi Thomas:
> > 
> > On 12/2/15 7:42 AM, Thomas Haller wrote:
> > > Hi David,
> > > 
> > > 
> > > I pushed these 3 patches to upstream branch
> > > https://github.com/thom311/libnl/commit/bridge-vlan
> > > (for easier review).
> > > 
> > > 
> > > I added fixup with the things I was talking about.
> > > (untested so far :) )
> > > 
> > > 
> > > If we agree on that, I would squash the fixup commits and merge
> > > it.
> > > Opinions?
> > 
> > Thanks for the fixups. I'll test these as soon as I can and get
> > back
> > to 
> > you. Might take a few days.
> > 
> 
> Hi David, Tobias,
> 
> I just reworked the branch again (heavily).
> 
> Latest and greatest at:
> https://github.com/thom311/libnl/commit/bridge-vlan
> 
> 
> Now it contains Tobias' patch and I did the changes I was talking in
> the other thread about.
> 
> I added your original patches with fixup commits to make it somewhat
> clearer what I changed.
> 
> 
> (beware: I didn't actually test it).
> 
> 
> Thomas


Hi Thomas,

thanks for the work. It looks fine so far besides this one:


You have to either apply this

diff --git a/lib/route/link.c b/lib/route/link.c
index 0338606..21d7d98 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -604,7 +604,7 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who,
                /* parsing of IFLA_AF_SPEC is dependent on the family used
                 * in the request message.
                 */
-               if (af_ops && af_ops->ao_parse_af_full) {
+               if (family == AF_BRIDGE && af_ops && af_ops->ao_parse_af_full) {
                        err = af_ops->ao_parse_af_full(link,
                                                       tb[IFLA_AF_SPEC],
                                                       link->l_af_data[af_ops->ao_family]);


or this patch

diff --git a/lib/route/link/bridge.c b/lib/route/link/bridge.c
index 51e6e3b..91ebce4 100644
--- a/lib/route/link/bridge.c
+++ b/lib/route/link/bridge.c
@@ -184,7 +184,7 @@ static int bridge_parse_af_full(struct rtnl_link *link, struct nlattr *attr_full
                        continue;
 
                if (nla_len(attr) != sizeof(struct bridge_vlan_info))
-                       return -EINVAL;
+                       return 0;
 
                vinfo = nla_data(attr);
                if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK)


otherwise parsing will fail in case you get a AF_UNSPEC msg.

The second seems way better, unless there is a chance that other AF will interfere with AF_BRIGE parsing.

To test this just run nl-monitor.


/tobi



More information about the libnl mailing list