Skip to content

Commit bb3c4ab

Browse files
idoschdavem330
authored andcommitted
ipv6: Add "offload" and "trap" indications to routes
In a similar fashion to previous patch, add "offload" and "trap" indication to IPv6 routes. This is done by using two unused bits in 'struct fib6_info' to hold these indications. Capable drivers are expected to set these when processing the various in-kernel route notifications. Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Reviewed-by: David Ahern <[email protected]> Acked-by: Roopa Prabhu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 90b93f1 commit bb3c4ab

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

include/net/ip6_fib.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ struct fib6_info {
192192
dst_nopolicy:1,
193193
dst_host:1,
194194
fib6_destroying:1,
195-
unused:3;
195+
offload:1,
196+
trap:1,
197+
unused:1;
196198

197199
struct rcu_head rcu;
198200
struct nexthop *nh;
@@ -329,6 +331,13 @@ static inline void fib6_info_release(struct fib6_info *f6i)
329331
call_rcu(&f6i->rcu, fib6_info_destroy_rcu);
330332
}
331333

334+
static inline void fib6_info_hw_flags_set(struct fib6_info *f6i, bool offload,
335+
bool trap)
336+
{
337+
f6i->offload = offload;
338+
f6i->trap = trap;
339+
}
340+
332341
enum fib6_walk_state {
333342
#ifdef CONFIG_IPV6_SUBTREES
334343
FWS_S,

net/ipv6/route.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5576,6 +5576,13 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
55765576
expires -= jiffies;
55775577
}
55785578

5579+
if (!dst) {
5580+
if (rt->offload)
5581+
rtm->rtm_flags |= RTM_F_OFFLOAD;
5582+
if (rt->trap)
5583+
rtm->rtm_flags |= RTM_F_TRAP;
5584+
}
5585+
55795586
if (rtnl_put_cacheinfo(skb, dst, 0, expires, dst ? dst->error : 0) < 0)
55805587
goto nla_put_failure;
55815588

0 commit comments

Comments
 (0)