mpls: Return error for RTA_GATEWAY attribute
authorDavid Ahern <dsahern@gmail.com>
Tue, 26 Feb 2019 17:00:04 +0000 (09:00 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Mar 2019 21:03:09 +0000 (14:03 -0700)
[ Upstream commit be48220edd48ca0d569782992840488a52373a24 ]

MPLS does not support nexthops with an MPLS address family.
Specifically, it does not handle RTA_GATEWAY attribute. Make it
clear by returning an error.

Fixes: 03c0566542f4c ("mpls: Netlink commands to add, remove, and dump routes")
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/mpls/af_mpls.c

index aee385eb72e72026717406fe4d4ab133783d4615..9a153f64b8d7bbb1b91d914536e0b97d493b5b4c 100644 (file)
@@ -1787,6 +1787,9 @@ static int rtm_to_route_config(struct sk_buff *skb,
                                goto errout;
                        break;
                }
+               case RTA_GATEWAY:
+                       NL_SET_ERR_MSG(extack, "MPLS does not support RTA_GATEWAY attribute");
+                       goto errout;
                case RTA_VIA:
                {
                        if (nla_get_via(nla, &cfg->rc_via_alen,