Skip to content

Commit 1e32ec3

Browse files
committed
Merge branch 'flowi6_tos'
Daniel Borkmann says: ==================== flowi6_tos fixes This set is a follow-up to address Jiri's recent feedback [1] on the flowi6_tos issue, that it is not used for IPv6 route lookups. The three patches fix all current users of flowi6_tos and remove the define to avoid any future confusion on this. Tested the vxlan and geneve ones with IPv6 routing rules. For details, please see individual patches. [ As fixes are currently applied against net-next tree, I've rebased it against that. ] Thanks! [1] http://patchwork.ozlabs.org/patch/592055/ ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents c78a85a + 69716a2 commit 1e32ec3

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

drivers/net/geneve.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,8 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
843843
if (info) {
844844
fl6->daddr = info->key.u.ipv6.dst;
845845
fl6->saddr = info->key.u.ipv6.src;
846-
fl6->flowi6_tos = RT_TOS(info->key.tos);
847-
fl6->flowlabel = info->key.label;
846+
fl6->flowlabel = ip6_make_flowinfo(RT_TOS(info->key.tos),
847+
info->key.label);
848848
dst_cache = &info->dst_cache;
849849
} else {
850850
prio = geneve->tos;
@@ -855,8 +855,8 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
855855
use_cache = false;
856856
}
857857

858-
fl6->flowi6_tos = RT_TOS(prio);
859-
fl6->flowlabel = geneve->label;
858+
fl6->flowlabel = ip6_make_flowinfo(RT_TOS(prio),
859+
geneve->label);
860860
fl6->daddr = geneve->remote.sin6.sin6_addr;
861861
dst_cache = &geneve->dst_cache;
862862
}
@@ -1049,7 +1049,8 @@ static netdev_tx_t geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
10491049
if (unlikely(err))
10501050
goto err;
10511051

1052-
prio = ip_tunnel_ecn_encap(fl6.flowi6_tos, iip, skb);
1052+
prio = ip_tunnel_ecn_encap(ip6_tclass(fl6.flowlabel),
1053+
iip, skb);
10531054
ttl = geneve->ttl;
10541055
if (!ttl && ipv6_addr_is_multicast(&fl6.daddr))
10551056
ttl = 1;

drivers/net/vxlan.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,10 +1810,9 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan,
18101810

18111811
memset(&fl6, 0, sizeof(fl6));
18121812
fl6.flowi6_oif = oif;
1813-
fl6.flowi6_tos = RT_TOS(tos);
18141813
fl6.daddr = *daddr;
18151814
fl6.saddr = vxlan->cfg.saddr.sin6.sin6_addr;
1816-
fl6.flowlabel = label;
1815+
fl6.flowlabel = ip6_make_flowinfo(RT_TOS(tos), label);
18171816
fl6.flowi6_mark = skb->mark;
18181817
fl6.flowi6_proto = IPPROTO_UDP;
18191818

include/net/flow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ struct flowi6 {
127127
#define flowi6_oif __fl_common.flowic_oif
128128
#define flowi6_iif __fl_common.flowic_iif
129129
#define flowi6_mark __fl_common.flowic_mark
130-
#define flowi6_tos __fl_common.flowic_tos
131130
#define flowi6_scope __fl_common.flowic_scope
132131
#define flowi6_proto __fl_common.flowic_proto
133132
#define flowi6_flags __fl_common.flowic_flags
134133
#define flowi6_secid __fl_common.flowic_secid
135134
#define flowi6_tun_key __fl_common.flowic_tun_key
136135
struct in6_addr daddr;
137136
struct in6_addr saddr;
137+
/* Note: flowi6_tos is encoded in flowlabel, too. */
138138
__be32 flowlabel;
139139
union flowi_uli uli;
140140
#define fl6_sport uli.ports.sport

include/net/ipv6.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,12 @@ static inline u8 ip6_tclass(__be32 flowinfo)
835835
{
836836
return ntohl(flowinfo & IPV6_TCLASS_MASK) >> IPV6_TCLASS_SHIFT;
837837
}
838+
839+
static inline __be32 ip6_make_flowinfo(unsigned int tclass, __be32 flowlabel)
840+
{
841+
return htonl(tclass << IPV6_TCLASS_SHIFT) | flowlabel;
842+
}
843+
838844
/*
839845
* Prototypes exported by ipv6
840846
*/

include/trace/events/fib6.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ TRACE_EVENT(fib6_table_lookup,
3737
__entry->tb_id = tb_id;
3838
__entry->oif = flp->flowi6_oif;
3939
__entry->iif = flp->flowi6_iif;
40-
__entry->tos = flp->flowi6_tos;
40+
__entry->tos = ip6_tclass(flp->flowlabel);
4141
__entry->scope = flp->flowi6_scope;
4242
__entry->flags = flp->flowi6_flags;
4343

0 commit comments

Comments
 (0)