Skip to content

Commit bdcad48

Browse files
idoschgregkh
authored andcommitted
rtnetlink: Add RTNH_F_TRAP flag
[ Upstream commit 968a83f ] The flag indicates to user space that the nexthop is not programmed to forward packets in hardware, but rather to trap them to the CPU. This is needed, for example, when the MAC of the nexthop neighbour is not resolved and packets should reach the CPU to trigger neighbour resolution. The flag will be used in subsequent patches by netdevsim to test nexthop objects programming to device drivers and in the future by mlxsw as well. Changes since RFC: * Reword commit message Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Stable-dep-of: 390b3a3 ("nexthop: Forbid FDB status change while nexthop is in a group") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9ce701c commit bdcad48

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

include/uapi/linux/rtnetlink.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,13 @@ struct rtnexthop {
396396
#define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */
397397
#define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */
398398
#define RTNH_F_ONLINK 4 /* Gateway is forced on link */
399-
#define RTNH_F_OFFLOAD 8 /* offloaded route */
399+
#define RTNH_F_OFFLOAD 8 /* Nexthop is offloaded */
400400
#define RTNH_F_LINKDOWN 16 /* carrier-down on nexthop */
401401
#define RTNH_F_UNRESOLVED 32 /* The entry is unresolved (ipmr) */
402+
#define RTNH_F_TRAP 64 /* Nexthop is trapping packets */
402403

403-
#define RTNH_COMPARE_MASK (RTNH_F_DEAD | RTNH_F_LINKDOWN | RTNH_F_OFFLOAD)
404+
#define RTNH_COMPARE_MASK (RTNH_F_DEAD | RTNH_F_LINKDOWN | \
405+
RTNH_F_OFFLOAD | RTNH_F_TRAP)
404406

405407
/* Macros to handle hexthops */
406408

net/ipv4/fib_semantics.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,8 @@ int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc,
17051705
*flags |= (nhc->nhc_flags & RTNH_F_ONLINK);
17061706
if (nhc->nhc_flags & RTNH_F_OFFLOAD)
17071707
*flags |= RTNH_F_OFFLOAD;
1708+
if (nhc->nhc_flags & RTNH_F_TRAP)
1709+
*flags |= RTNH_F_TRAP;
17081710

17091711
if (!skip_oif && nhc->nhc_dev &&
17101712
nla_put_u32(skb, RTA_OIF, nhc->nhc_dev->ifindex))

0 commit comments

Comments
 (0)