* [PATCH net] mpls: fix warning with multi-label encap
@ 2019-06-07 10:49 George Wilkie
2019-06-07 15:49 ` David Ahern
2019-06-09 20:27 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: George Wilkie @ 2019-06-07 10:49 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
If you configure a route with multiple labels, e.g.
ip route add 10.10.3.0/24 encap mpls 16/100 via 10.10.2.2 dev ens4
A warning is logged:
kernel: [ 130.561819] netlink: 'ip': attribute type 1 has an invalid
length.
This happens because mpls_iptunnel_policy has set the type of
MPLS_IPTUNNEL_DST to fixed size NLA_U32.
Change it to a minimum size.
nla_get_labels() does the remaining validation.
Signed-off-by: George Wilkie <gwilkie@vyatta.att-mail.com>
---
net/mpls/mpls_iptunnel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
index 951b52d5835b..20c682143b01 100644
--- a/net/mpls/mpls_iptunnel.c
+++ b/net/mpls/mpls_iptunnel.c
@@ -28,7 +28,7 @@
#include "internal.h"
static const struct nla_policy mpls_iptunnel_policy[MPLS_IPTUNNEL_MAX + 1] = {
- [MPLS_IPTUNNEL_DST] = { .type = NLA_U32 },
+ [MPLS_IPTUNNEL_DST] = { .len = sizeof(u32) },
[MPLS_IPTUNNEL_TTL] = { .type = NLA_U8 },
};
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] mpls: fix warning with multi-label encap
2019-06-07 10:49 [PATCH net] mpls: fix warning with multi-label encap George Wilkie
@ 2019-06-07 15:49 ` David Ahern
2019-06-07 15:51 ` David Ahern
2019-06-09 20:27 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: David Ahern @ 2019-06-07 15:49 UTC (permalink / raw)
To: George Wilkie, David S. Miller; +Cc: netdev
On 6/7/19 4:49 AM, George Wilkie wrote:
> If you configure a route with multiple labels, e.g.
> ip route add 10.10.3.0/24 encap mpls 16/100 via 10.10.2.2 dev ens4
> A warning is logged:
> kernel: [ 130.561819] netlink: 'ip': attribute type 1 has an invalid
> length.
>
> This happens because mpls_iptunnel_policy has set the type of
> MPLS_IPTUNNEL_DST to fixed size NLA_U32.
> Change it to a minimum size.
> nla_get_labels() does the remaining validation.
>
> Signed-off-by: George Wilkie <gwilkie@vyatta.att-mail.com>
> ---
> net/mpls/mpls_iptunnel.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
> index 951b52d5835b..20c682143b01 100644
> --- a/net/mpls/mpls_iptunnel.c
> +++ b/net/mpls/mpls_iptunnel.c
> @@ -28,7 +28,7 @@
> #include "internal.h"
>
> static const struct nla_policy mpls_iptunnel_policy[MPLS_IPTUNNEL_MAX + 1] = {
> - [MPLS_IPTUNNEL_DST] = { .type = NLA_U32 },
> + [MPLS_IPTUNNEL_DST] = { .len = sizeof(u32) },
> [MPLS_IPTUNNEL_TTL] = { .type = NLA_U8 },
> };
>
>
MPLS_IPTUNNEL_DST is an array of u32's so that looks correct
Reviewed-by: David Ahern <dsahern@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] mpls: fix warning with multi-label encap
2019-06-07 15:49 ` David Ahern
@ 2019-06-07 15:51 ` David Ahern
0 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2019-06-07 15:51 UTC (permalink / raw)
To: George Wilkie, David S. Miller; +Cc: netdev
On 6/7/19 9:49 AM, David Ahern wrote:
> On 6/7/19 4:49 AM, George Wilkie wrote:
>> If you configure a route with multiple labels, e.g.
>> ip route add 10.10.3.0/24 encap mpls 16/100 via 10.10.2.2 dev ens4
>> A warning is logged:
>> kernel: [ 130.561819] netlink: 'ip': attribute type 1 has an invalid
>> length.
>>
>> This happens because mpls_iptunnel_policy has set the type of
>> MPLS_IPTUNNEL_DST to fixed size NLA_U32.
>> Change it to a minimum size.
>> nla_get_labels() does the remaining validation.
>>
>> Signed-off-by: George Wilkie <gwilkie@vyatta.att-mail.com>
>> ---
>> net/mpls/mpls_iptunnel.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
>> index 951b52d5835b..20c682143b01 100644
>> --- a/net/mpls/mpls_iptunnel.c
>> +++ b/net/mpls/mpls_iptunnel.c
>> @@ -28,7 +28,7 @@
>> #include "internal.h"
>>
>> static const struct nla_policy mpls_iptunnel_policy[MPLS_IPTUNNEL_MAX + 1] = {
>> - [MPLS_IPTUNNEL_DST] = { .type = NLA_U32 },
>> + [MPLS_IPTUNNEL_DST] = { .len = sizeof(u32) },
>> [MPLS_IPTUNNEL_TTL] = { .type = NLA_U8 },
>> };
>>
>>
>
> MPLS_IPTUNNEL_DST is an array of u32's so that looks correct
>
> Reviewed-by: David Ahern <dsahern@gmail.com>
>
Fixes tag:
Fixes: e3e4712ec096 ("mpls: ip tunnel support")
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] mpls: fix warning with multi-label encap
2019-06-07 10:49 [PATCH net] mpls: fix warning with multi-label encap George Wilkie
2019-06-07 15:49 ` David Ahern
@ 2019-06-09 20:27 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2019-06-09 20:27 UTC (permalink / raw)
To: gwilkie; +Cc: netdev
From: George Wilkie <gwilkie@vyatta.att-mail.com>
Date: Fri, 7 Jun 2019 11:49:41 +0100
> If you configure a route with multiple labels, e.g.
> ip route add 10.10.3.0/24 encap mpls 16/100 via 10.10.2.2 dev ens4
> A warning is logged:
> kernel: [ 130.561819] netlink: 'ip': attribute type 1 has an invalid
> length.
>
> This happens because mpls_iptunnel_policy has set the type of
> MPLS_IPTUNNEL_DST to fixed size NLA_U32.
> Change it to a minimum size.
> nla_get_labels() does the remaining validation.
>
> Signed-off-by: George Wilkie <gwilkie@vyatta.att-mail.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-09 20:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-07 10:49 [PATCH net] mpls: fix warning with multi-label encap George Wilkie
2019-06-07 15:49 ` David Ahern
2019-06-07 15:51 ` David Ahern
2019-06-09 20:27 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.