Skip to content

Commit 356dc4e

Browse files
IurmanJNipaLocal
authored andcommitted
net: ipv6: ioam6: use consistent dst names
Be consistent and use the same terminology as other lwt users: orig_dst is the dst_entry before the transformation, while dst is either the dst_entry in the cache or the dst_entry after the transformation Signed-off-by: Justin Iurman <justin.iurman@uliege.be> Signed-off-by: NipaLocal <nipa@local>
1 parent 98a53f9 commit 356dc4e

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

net/ipv6/ioam6_iptunnel.c

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -336,23 +336,24 @@ static int ioam6_do_encap(struct net *net, struct sk_buff *skb,
336336

337337
static int ioam6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
338338
{
339-
struct dst_entry *dst = skb_dst(skb), *cache_dst = NULL;
339+
struct dst_entry *orig_dst = skb_dst(skb);
340+
struct dst_entry *dst = NULL;
340341
struct ioam6_lwt *ilwt;
341342
int err = -EINVAL;
342343
u32 pkt_cnt;
343344

344345
if (skb->protocol != htons(ETH_P_IPV6))
345346
goto drop;
346347

347-
ilwt = ioam6_lwt_state(dst->lwtstate);
348+
ilwt = ioam6_lwt_state(orig_dst->lwtstate);
348349

349350
/* Check for insertion frequency (i.e., "k over n" insertions) */
350351
pkt_cnt = atomic_fetch_inc(&ilwt->pkt_cnt);
351352
if (pkt_cnt % ilwt->freq.n >= ilwt->freq.k)
352353
goto out;
353354

354355
local_bh_disable();
355-
cache_dst = dst_cache_get(&ilwt->cache);
356+
dst = dst_cache_get(&ilwt->cache);
356357
local_bh_enable();
357358

358359
switch (ilwt->mode) {
@@ -362,7 +363,7 @@ static int ioam6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
362363
if (ipv6_hdr(skb)->nexthdr == NEXTHDR_HOP)
363364
goto out;
364365

365-
err = ioam6_do_inline(net, skb, &ilwt->tuninfo, cache_dst);
366+
err = ioam6_do_inline(net, skb, &ilwt->tuninfo, dst);
366367
if (unlikely(err))
367368
goto drop;
368369

@@ -372,7 +373,7 @@ static int ioam6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
372373
/* Encapsulation (ip6ip6) */
373374
err = ioam6_do_encap(net, skb, &ilwt->tuninfo,
374375
ilwt->has_tunsrc, &ilwt->tunsrc,
375-
&ilwt->tundst, cache_dst);
376+
&ilwt->tundst, dst);
376377
if (unlikely(err))
377378
goto drop;
378379

@@ -390,7 +391,7 @@ static int ioam6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
390391
goto drop;
391392
}
392393

393-
if (unlikely(!cache_dst)) {
394+
if (unlikely(!dst)) {
394395
struct ipv6hdr *hdr = ipv6_hdr(skb);
395396
struct flowi6 fl6;
396397

@@ -401,37 +402,37 @@ static int ioam6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
401402
fl6.flowi6_mark = skb->mark;
402403
fl6.flowi6_proto = hdr->nexthdr;
403404

404-
cache_dst = ip6_route_output(net, NULL, &fl6);
405-
if (cache_dst->error) {
406-
err = cache_dst->error;
405+
dst = ip6_route_output(net, NULL, &fl6);
406+
if (dst->error) {
407+
err = dst->error;
407408
goto drop;
408409
}
409410

410411
/* cache only if we don't create a dst reference loop */
411-
if (dst->lwtstate != cache_dst->lwtstate) {
412+
if (orig_dst->lwtstate != dst->lwtstate) {
412413
local_bh_disable();
413-
dst_cache_set_ip6(&ilwt->cache, cache_dst, &fl6.saddr);
414+
dst_cache_set_ip6(&ilwt->cache, dst, &fl6.saddr);
414415
local_bh_enable();
415416
}
416417

417-
err = skb_cow_head(skb, LL_RESERVED_SPACE(cache_dst->dev));
418+
err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev));
418419
if (unlikely(err))
419420
goto drop;
420421
}
421422

422423
/* avoid lwtunnel_output() reentry loop when destination is the same
423424
* after transformation (e.g., with the inline mode)
424425
*/
425-
if (dst->lwtstate != cache_dst->lwtstate) {
426+
if (orig_dst->lwtstate != dst->lwtstate) {
426427
skb_dst_drop(skb);
427-
skb_dst_set(skb, cache_dst);
428+
skb_dst_set(skb, dst);
428429
return dst_output(net, sk, skb);
429430
}
430431
out:
431-
dst_release(cache_dst);
432-
return dst->lwtstate->orig_output(net, sk, skb);
432+
dst_release(dst);
433+
return orig_dst->lwtstate->orig_output(net, sk, skb);
433434
drop:
434-
dst_release(cache_dst);
435+
dst_release(dst);
435436
kfree_skb(skb);
436437
return err;
437438
}

0 commit comments

Comments
 (0)