Merge branch ‘net-fail-route’ [Linux 5.0]

This Linux kernel change "Merge branch ‘net-fail-route’" is included in the Linux 5.0 release. This change is authored by David S. Miller <davem [at] davemloft.net> on Tue Feb 26 13:23:17 2019 -0800. The commit for this change in Linux stable tree is d8e9674 (patch). Other info about this change: Merge: 3da1ed7 be48220

Merge branch 'net-fail-route'

David Ahern says:

====================
net: Fail route add with unsupported nexthop attribute

RTA_VIA was added for MPLS as a way of specifying a gateway from a
different address family. IPv4 and IPv6 do not currently support RTA_VIA
so using it leads to routes that are not what the user intended. Catch
and fail - returning a proper error message.

MPLS on the other hand does not support RTA_GATEWAY since it does not
make sense to have a nexthop from the MPLS address family. Similarly,
catch and fail - returning a proper error message.
====================

Signed-off-by: David S. Miller <[email protected]>

There is no are 0 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/mpls/af_mpls.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 7d55d4c..fa763e2 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -1838,6 +1838,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,

Leave a Reply

Your email address will not be published. Required fields are marked *