[PATCH v2 net-next] ipv4: fib: Remove unnecessary encap_type check

Yue Haibing posted 1 patch 3 months, 2 weeks ago
net/ipv4/fib_semantics.c | 5 -----
1 file changed, 5 deletions(-)
[PATCH v2 net-next] ipv4: fib: Remove unnecessary encap_type check
Posted by Yue Haibing 3 months, 2 weeks ago
lwtunnel_build_state() has check validity of encap_type,
so no need to do this before call it.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
---
v2: Restore encap_type check in fib_encap_match()
---
 net/ipv4/fib_semantics.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index f7c9c6a9f53e..a2f04992f579 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -625,11 +625,6 @@ int fib_nh_common_init(struct net *net, struct fib_nh_common *nhc,
 	if (encap) {
 		struct lwtunnel_state *lwtstate;
 
-		if (encap_type == LWTUNNEL_ENCAP_NONE) {
-			NL_SET_ERR_MSG(extack, "LWT encap type not specified");
-			err = -EINVAL;
-			goto lwt_failure;
-		}
 		err = lwtunnel_build_state(net, encap_type, encap,
 					   nhc->nhc_family, cfg, &lwtstate,
 					   extack);
-- 
2.34.1
Re: [PATCH v2 net-next] ipv4: fib: Remove unnecessary encap_type check
Posted by Kuniyuki Iwashima 3 months, 2 weeks ago
On Tue, Jun 24, 2025 at 7:04 PM Yue Haibing <yuehaibing@huawei.com> wrote:
>
> lwtunnel_build_state() has check validity of encap_type,
> so no need to do this before call it.
>
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>

Next time please wait 24h before reposting.
https://docs.kernel.org/process/maintainer-netdev.html

Thanks!


> ---
> v2: Restore encap_type check in fib_encap_match()
> ---
>  net/ipv4/fib_semantics.c | 5 -----
>  1 file changed, 5 deletions(-)
>
> diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
> index f7c9c6a9f53e..a2f04992f579 100644
> --- a/net/ipv4/fib_semantics.c
> +++ b/net/ipv4/fib_semantics.c
> @@ -625,11 +625,6 @@ int fib_nh_common_init(struct net *net, struct fib_nh_common *nhc,
>         if (encap) {
>                 struct lwtunnel_state *lwtstate;
>
> -               if (encap_type == LWTUNNEL_ENCAP_NONE) {
> -                       NL_SET_ERR_MSG(extack, "LWT encap type not specified");
> -                       err = -EINVAL;
> -                       goto lwt_failure;
> -               }
>                 err = lwtunnel_build_state(net, encap_type, encap,
>                                            nhc->nhc_family, cfg, &lwtstate,
>                                            extack);
> --
> 2.34.1
>