Skip to content

Commit

Permalink
mpls: fix warning with multi-label encap
Browse files Browse the repository at this point in the history
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.

Fixes: e3e4712 ("mpls: ip tunnel support")
Signed-off-by: George Wilkie <[email protected]>
Reviewed-by: David Ahern <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
George Wilkie authored and davem330 committed Jun 9, 2019
1 parent a952054 commit 2f3f7d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/mpls/mpls_iptunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,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 },
};

Expand Down

0 comments on commit 2f3f7d1

Please sign in to comment.