net/ipv4/fib_semantics.c | 8 -------- 1 file changed, 8 deletions(-)
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>
---
net/ipv4/fib_semantics.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index f7c9c6a9f53e..475ffcbf4927 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);
@@ -890,9 +885,6 @@ static int fib_encap_match(struct net *net, u16 encap_type,
struct lwtunnel_state *lwtstate;
int ret, result = 0;
- if (encap_type == LWTUNNEL_ENCAP_NONE)
- return 0;
-
ret = lwtunnel_build_state(net, encap_type, encap, AF_INET,
cfg, &lwtstate, extack);
if (!ret) {
--
2.34.1
On Tue, Jun 24, 2025 at 6:46 AM 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>
> ---
> net/ipv4/fib_semantics.c | 8 --------
> 1 file changed, 8 deletions(-)
>
> diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
> index f7c9c6a9f53e..475ffcbf4927 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);
> @@ -890,9 +885,6 @@ static int fib_encap_match(struct net *net, u16 encap_type,
> struct lwtunnel_state *lwtstate;
> int ret, result = 0;
>
> - if (encap_type == LWTUNNEL_ENCAP_NONE)
> - return 0;
Now this condition returns -EINVAL, which confuses fib_encap_match(), no ?
> -
> ret = lwtunnel_build_state(net, encap_type, encap, AF_INET,
> cfg, &lwtstate, extack);
> if (!ret) {
> --
> 2.34.1
>
On 2025/6/25 2:26, Kuniyuki Iwashima wrote:
> On Tue, Jun 24, 2025 at 6:46 AM 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>
>> ---
>> net/ipv4/fib_semantics.c | 8 --------
>> 1 file changed, 8 deletions(-)
>>
>> diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
>> index f7c9c6a9f53e..475ffcbf4927 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);
>> @@ -890,9 +885,6 @@ static int fib_encap_match(struct net *net, u16 encap_type,
>> struct lwtunnel_state *lwtstate;
>> int ret, result = 0;
>>
>> - if (encap_type == LWTUNNEL_ENCAP_NONE)
>> - return 0;
>
> Now this condition returns -EINVAL, which confuses fib_encap_match(), no ?
Right, sorry for overlook this, will restore in v2.
>
>
>> -
>> ret = lwtunnel_build_state(net, encap_type, encap, AF_INET,
>> cfg, &lwtstate, extack);
>> if (!ret) {
>> --
>> 2.34.1
>>
>
© 2016 - 2026 Red Hat, Inc.