ipv6: add ip6_flowlabel helper
authorFlorent Fourcot <florent.fourcot@enst-bretagne.fr>
Sun, 8 Dec 2013 14:47:00 +0000 (15:47 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 Dec 2013 02:03:49 +0000 (21:03 -0500)
And use it if possible.

Signed-off-by: Florent Fourcot <florent.fourcot@enst-bretagne.fr>
Reviewed-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ipv6.h
net/ipv6/ip6_gre.c
net/ipv6/ip6_tunnel.c

index bce802e7bcfd6e2241c1b9c830b5a277d1de64ac..d0bfe3eeb824f2763d16310d493d9929dbe6a897 100644 (file)
@@ -679,6 +679,11 @@ static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr)
        return *(__be32 *)hdr & IPV6_FLOWINFO_MASK;
 }
 
+static inline __be32 ip6_flowlabel(const struct ipv6hdr *hdr)
+{
+       return *(__be32 *)hdr & IPV6_FLOWLABEL_MASK;
+}
+
 /*
  *     Prototypes exported by ipv6
  */
index c50de068bea24cd4fe4b82c9ebb7d7f761aa7bfc..e27fb78c61f21e37bd46ca9739ef3d27200d5b62 100644 (file)
@@ -845,7 +845,7 @@ static inline int ip6gre_xmit_ipv6(struct sk_buff *skb, struct net_device *dev)
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
                fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK);
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)
-               fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_FLOWLABEL_MASK);
+               fl6.flowlabel |= ip6_flowlabel(ipv6h);
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
                fl6.flowi6_mark = skb->mark;
 
index f5e8a98eb55e7c082735ae82bde157f8e6de3c2d..8d7c9867a44599c590127b9faa73527fb198c8f5 100644 (file)
@@ -1130,7 +1130,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
                fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK);
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)
-               fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_FLOWLABEL_MASK);
+               fl6.flowlabel |= ip6_flowlabel(ipv6h);
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
                fl6.flowi6_mark = skb->mark;