Whamcloud - gitweb
LU-12411 lnet: Do not allow gateways on remote nets 98/35198/2
authorChris Horn <hornc@cray.com>
Tue, 11 Jun 2019 19:59:31 +0000 (14:59 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 25 Jun 2019 01:54:09 +0000 (01:54 +0000)
A gateway needs to be reachable over some local interface.

Signed-off-by: Chris Horn <hornc@cray.com>
Change-Id: Ib66d4f8fd48d8863097280c480648ab8e29d2767
Reviewed-on: https://review.whamcloud.com/35198
Tested-by: Jenkins
Reviewed-by: Amir Shehata <ashehata@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Sonia Sharma <sharmaso@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/router.c

index 7d7e08d..ec92e1a 100644 (file)
@@ -457,6 +457,13 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway,
        if (lnet_islocalnet(net))
                return -EEXIST;
 
+       if (!lnet_islocalnet(LNET_NIDNET(gateway))) {
+               CERROR("Cannot add route with gateway %s. There is no local interface configured on LNet %s\n",
+                      libcfs_nid2str(gateway),
+                      libcfs_net2str(LNET_NIDNET(gateway)));
+               return -EINVAL;
+       }
+
        /* Assume net, route, all new */
        LIBCFS_ALLOC(route, sizeof(*route));
        LIBCFS_ALLOC(rnet, sizeof(*rnet));