diff mbox series

[net-next] ipv4: Set nexthop flags in a more consistent way

Message ID 20201110102553.1924232-1-idosch@idosch.org (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series [net-next] ipv4: Set nexthop flags in a more consistent way | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 13 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Ido Schimmel Nov. 10, 2020, 10:25 a.m. UTC
From: Ido Schimmel <idosch@nvidia.com>

Be more consistent about the way in which the nexthop flags are set and
set them in one go.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
RTNH_F_DEAD and RTNH_F_LINKDOWN are set separately above, so I decided
to keep them as-is.
---
 net/ipv4/fib_semantics.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

David Ahern Nov. 10, 2020, 3:25 p.m. UTC | #1
On 11/10/20 3:25 AM, Ido Schimmel wrote:
> From: Ido Schimmel <idosch@nvidia.com>
> 
> Be more consistent about the way in which the nexthop flags are set and
> set them in one go.
> 
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> ---
> RTNH_F_DEAD and RTNH_F_LINKDOWN are set separately above, so I decided
> to keep them as-is.
> ---
>  net/ipv4/fib_semantics.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>
Jakub Kicinski Nov. 12, 2020, 4:25 a.m. UTC | #2
On Tue, 10 Nov 2020 08:25:50 -0700 David Ahern wrote:
> On 11/10/20 3:25 AM, Ido Schimmel wrote:
> > From: Ido Schimmel <idosch@nvidia.com>
> > 
> > Be more consistent about the way in which the nexthop flags are set and
> > set them in one go.
> > 
> > Suggested-by: Jakub Kicinski <kuba@kernel.org>
> > Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> 
> Reviewed-by: David Ahern <dsahern@kernel.org>

Applied, thanks!
diff mbox series

Patch

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index f70b9a0c4957..7612ff6111a7 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1641,11 +1641,8 @@  int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc,
 		break;
 	}
 
-	*flags |= (nhc->nhc_flags & RTNH_F_ONLINK);
-	if (nhc->nhc_flags & RTNH_F_OFFLOAD)
-		*flags |= RTNH_F_OFFLOAD;
-	if (nhc->nhc_flags & RTNH_F_TRAP)
-		*flags |= RTNH_F_TRAP;
+	*flags |= (nhc->nhc_flags &
+		   (RTNH_F_ONLINK | RTNH_F_OFFLOAD | RTNH_F_TRAP));
 
 	if (!skip_oif && nhc->nhc_dev &&
 	    nla_put_u32(skb, RTA_OIF, nhc->nhc_dev->ifindex))