OSDN Git Service

Add "scope link" when adding routes without a nexthop.
authorSreeram Ramachandran <sreeram@google.com>
Fri, 18 Jul 2014 20:03:47 +0000 (13:03 -0700)
committerLorenzo Colitti <lorenzo@google.com>
Tue, 29 Jul 2014 06:09:46 +0000 (15:09 +0900)
This is consistent with what /sbin/ip does, and it makes
recursive lookups on secondary tables work even when the main
table is empty.

This was originally proposed by Sreeram as http://ag/506456 to
fix a VPN issue, but then abandoned because it did not fix that
particular problem.

Bug: 16628572
Change-Id: I85753389c683ae2127b21af722463a35a33b60eb

server/RouteController.cpp

index 355326d..943a4c1 100644 (file)
@@ -388,6 +388,7 @@ WARN_UNUSED_RESULT int modifyIpRoute(uint16_t action, uint32_t table, const char
         .rtm_type = type,
         .rtm_family = family,
         .rtm_dst_len = prefixLength,
+        .rtm_scope = static_cast<uint8_t>(nexthop ? RT_SCOPE_UNIVERSE : RT_SCOPE_LINK),
     };
 
     rtattr rtaDst     = { U16_RTA_LENGTH(rawLength), RTA_DST };