Skip to content

Commit 67800f9

Browse files
tomratbertdavem330
authored andcommitted
ipv6: Call skb_get_hash_flowi6 to get skb->hash in ip6_make_flowlabel
We can't call skb_get_hash here since the packet is not complete to do flow_dissector. Create hash based on flowi6 instead. Signed-off-by: Tom Herbert <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f70ea01 commit 67800f9

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

include/net/ipv6.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,12 +708,13 @@ static inline void iph_to_flow_copy_v6addrs(struct flow_keys *flow,
708708

709709
#if IS_ENABLED(CONFIG_IPV6)
710710
static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
711-
__be32 flowlabel, bool autolabel)
711+
__be32 flowlabel, bool autolabel,
712+
struct flowi6 *fl6)
712713
{
713714
if (!flowlabel && (autolabel || net->ipv6.sysctl.auto_flowlabels)) {
714715
u32 hash;
715716

716-
hash = skb_get_hash(skb);
717+
hash = skb_get_hash_flowi6(skb, fl6);
717718

718719
/* Since this is being sent on the wire obfuscate hash a bit
719720
* to minimize possbility that any useful information to an

net/ipv6/ip6_gre.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
728728
*/
729729
ipv6h = ipv6_hdr(skb);
730730
ip6_flow_hdr(ipv6h, INET_ECN_encapsulate(0, dsfield),
731-
ip6_make_flowlabel(net, skb, fl6->flowlabel, false));
731+
ip6_make_flowlabel(net, skb, fl6->flowlabel, false, fl6));
732732
ipv6h->hop_limit = tunnel->parms.hop_limit;
733733
ipv6h->nexthdr = proto;
734734
ipv6h->saddr = fl6->saddr;
@@ -1182,7 +1182,8 @@ static int ip6gre_header(struct sk_buff *skb, struct net_device *dev,
11821182

11831183
ip6_flow_hdr(ipv6h, 0,
11841184
ip6_make_flowlabel(dev_net(dev), skb,
1185-
t->fl.u.ip6.flowlabel, false));
1185+
t->fl.u.ip6.flowlabel, false,
1186+
&t->fl.u.ip6));
11861187
ipv6h->hop_limit = t->parms.hop_limit;
11871188
ipv6h->nexthdr = NEXTHDR_GRE;
11881189
ipv6h->saddr = t->parms.laddr;

net/ipv6/ip6_output.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
207207
hlimit = ip6_dst_hoplimit(dst);
208208

209209
ip6_flow_hdr(hdr, tclass, ip6_make_flowlabel(net, skb, fl6->flowlabel,
210-
np->autoflowlabel));
210+
np->autoflowlabel, fl6));
211211

212212
hdr->payload_len = htons(seg_len);
213213
hdr->nexthdr = proto;
@@ -1649,7 +1649,7 @@ struct sk_buff *__ip6_make_skb(struct sock *sk,
16491649

16501650
ip6_flow_hdr(hdr, v6_cork->tclass,
16511651
ip6_make_flowlabel(net, skb, fl6->flowlabel,
1652-
np->autoflowlabel));
1652+
np->autoflowlabel, fl6));
16531653
hdr->hop_limit = v6_cork->hop_limit;
16541654
hdr->nexthdr = proto;
16551655
hdr->saddr = fl6->saddr;

net/ipv6/ip6_tunnel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
10951095
skb_reset_network_header(skb);
10961096
ipv6h = ipv6_hdr(skb);
10971097
ip6_flow_hdr(ipv6h, INET_ECN_encapsulate(0, dsfield),
1098-
ip6_make_flowlabel(net, skb, fl6->flowlabel, false));
1098+
ip6_make_flowlabel(net, skb, fl6->flowlabel, false, fl6));
10991099
ipv6h->hop_limit = t->parms.hop_limit;
11001100
ipv6h->nexthdr = proto;
11011101
ipv6h->saddr = fl6->saddr;

0 commit comments

Comments
 (0)