mukesh agrawal | 2c15d2c | 2012-02-21 16:09:21 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "shill/routing_table.h" |
| 6 | |
| 7 | #include <arpa/inet.h> |
| 8 | #include <fcntl.h> |
| 9 | #include <linux/netlink.h> |
| 10 | #include <linux/rtnetlink.h> |
| 11 | #include <netinet/ether.h> |
| 12 | #include <net/if.h> |
| 13 | #include <net/if_arp.h> |
| 14 | #include <string.h> |
| 15 | #include <sys/socket.h> |
| 16 | #include <time.h> |
| 17 | #include <unistd.h> |
| 18 | |
| 19 | #include <string> |
| 20 | |
| 21 | #include <base/callback_old.h> |
| 22 | #include <base/file_path.h> |
| 23 | #include <base/file_util.h> |
| 24 | #include <base/hash_tables.h> |
| 25 | #include <base/logging.h> |
| 26 | #include <base/memory/scoped_ptr.h> |
| 27 | #include <base/stl_util-inl.h> |
| 28 | #include <base/stringprintf.h> |
| 29 | |
| 30 | #include "shill/byte_string.h" |
| 31 | #include "shill/routing_table_entry.h" |
| 32 | #include "shill/rtnl_handler.h" |
| 33 | #include "shill/rtnl_listener.h" |
| 34 | #include "shill/rtnl_message.h" |
| 35 | |
| 36 | using std::string; |
| 37 | using std::vector; |
| 38 | |
| 39 | namespace shill { |
| 40 | |
Paul Stewart | 0d2ada3 | 2011-08-09 17:01:57 -0700 | [diff] [blame] | 41 | static base::LazyInstance<RoutingTable> g_routing_table( |
| 42 | base::LINKER_INITIALIZED); |
| 43 | |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 44 | // static |
| 45 | const char RoutingTable::kRouteFlushPath4[] = "/proc/sys/net/ipv4/route/flush"; |
Paul Stewart | 0d2ada3 | 2011-08-09 17:01:57 -0700 | [diff] [blame] | 46 | // static |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 47 | const char RoutingTable::kRouteFlushPath6[] = "/proc/sys/net/ipv6/route/flush"; |
| 48 | |
| 49 | RoutingTable::RoutingTable() |
| 50 | : route_callback_(NewCallback(this, &RoutingTable::RouteMsgHandler)), |
| 51 | route_listener_(NULL) { |
| 52 | VLOG(2) << __func__; |
| 53 | } |
| 54 | |
| 55 | RoutingTable::~RoutingTable() {} |
| 56 | |
| 57 | RoutingTable* RoutingTable::GetInstance() { |
Paul Stewart | 0d2ada3 | 2011-08-09 17:01:57 -0700 | [diff] [blame] | 58 | return g_routing_table.Pointer(); |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | void RoutingTable::Start() { |
| 62 | VLOG(2) << __func__; |
| 63 | |
| 64 | route_listener_.reset( |
| 65 | new RTNLListener(RTNLHandler::kRequestRoute, route_callback_.get())); |
| 66 | RTNLHandler::GetInstance()->RequestDump( |
Paul Stewart | 9a90808 | 2011-08-31 12:18:48 -0700 | [diff] [blame] | 67 | RTNLHandler::kRequestRoute); |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | void RoutingTable::Stop() { |
| 71 | VLOG(2) << __func__; |
| 72 | |
| 73 | route_listener_.reset(); |
| 74 | } |
| 75 | |
| 76 | bool RoutingTable::AddRoute(int interface_index, |
| 77 | const RoutingTableEntry &entry) { |
mukesh agrawal | 2c15d2c | 2012-02-21 16:09:21 -0800 | [diff] [blame] | 78 | VLOG(2) << __func__ << " " |
| 79 | << "index " << interface_index |
| 80 | << "gateway " << entry.gateway.ToString() << " " |
| 81 | << "metric " << entry.metric; |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 82 | |
| 83 | CHECK(!entry.from_rtnl); |
| 84 | if (!ApplyRoute(interface_index, |
| 85 | entry, |
Paul Stewart | 9a90808 | 2011-08-31 12:18:48 -0700 | [diff] [blame] | 86 | RTNLMessage::kModeAdd, |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 87 | NLM_F_CREATE | NLM_F_EXCL)) { |
| 88 | return false; |
| 89 | } |
| 90 | tables_[interface_index].push_back(entry); |
| 91 | return true; |
| 92 | } |
| 93 | |
| 94 | bool RoutingTable::GetDefaultRoute(int interface_index, |
| 95 | IPAddress::Family family, |
| 96 | RoutingTableEntry *entry) { |
mukesh agrawal | d4ef677 | 2012-02-21 16:28:04 -0800 | [diff] [blame] | 97 | RoutingTableEntry *found_entry; |
| 98 | bool ret = GetDefaultRouteInternal(interface_index, family, &found_entry); |
| 99 | if (ret) { |
| 100 | *entry = *found_entry; |
| 101 | } |
| 102 | return ret; |
| 103 | } |
| 104 | |
| 105 | bool RoutingTable::GetDefaultRouteInternal(int interface_index, |
| 106 | IPAddress::Family family, |
| 107 | RoutingTableEntry **entry) { |
mukesh agrawal | 2c15d2c | 2012-02-21 16:09:21 -0800 | [diff] [blame] | 108 | VLOG(2) << __func__ << " index " << interface_index << " family " << family; |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 109 | |
| 110 | base::hash_map<int, vector<RoutingTableEntry> >::iterator table = |
| 111 | tables_.find(interface_index); |
| 112 | |
| 113 | if (table == tables_.end()) { |
mukesh agrawal | 2c15d2c | 2012-02-21 16:09:21 -0800 | [diff] [blame] | 114 | VLOG(2) << __func__ << " no table"; |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 115 | return false; |
| 116 | } |
| 117 | |
| 118 | vector<RoutingTableEntry>::iterator nent; |
| 119 | |
| 120 | for (nent = table->second.begin(); nent != table->second.end(); ++nent) { |
| 121 | if (nent->dst.IsDefault() && nent->dst.family() == family) { |
mukesh agrawal | d4ef677 | 2012-02-21 16:28:04 -0800 | [diff] [blame] | 122 | *entry = &(*nent); |
mukesh agrawal | 2c15d2c | 2012-02-21 16:09:21 -0800 | [diff] [blame] | 123 | VLOG(2) << __func__ << " found " |
| 124 | << "gateway " << nent->gateway.ToString() << " " |
| 125 | << "metric " << nent->metric; |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 126 | return true; |
| 127 | } |
| 128 | } |
| 129 | |
mukesh agrawal | 2c15d2c | 2012-02-21 16:09:21 -0800 | [diff] [blame] | 130 | VLOG(2) << __func__ << " no route"; |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 131 | return false; |
| 132 | } |
| 133 | |
| 134 | bool RoutingTable::SetDefaultRoute(int interface_index, |
| 135 | const IPConfigRefPtr &ipconfig, |
| 136 | uint32 metric) { |
mukesh agrawal | 2c15d2c | 2012-02-21 16:09:21 -0800 | [diff] [blame] | 137 | VLOG(2) << __func__ << " index " << interface_index << " metric " << metric; |
| 138 | |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 139 | const IPConfig::Properties &ipconfig_props = ipconfig->properties(); |
mukesh agrawal | d4ef677 | 2012-02-21 16:28:04 -0800 | [diff] [blame] | 140 | RoutingTableEntry *old_entry; |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 141 | IPAddress gateway_address(ipconfig_props.address_family); |
| 142 | if (!gateway_address.SetAddressFromString(ipconfig_props.gateway)) { |
| 143 | return false; |
| 144 | } |
| 145 | |
mukesh agrawal | d4ef677 | 2012-02-21 16:28:04 -0800 | [diff] [blame] | 146 | if (GetDefaultRouteInternal(interface_index, |
| 147 | ipconfig_props.address_family, |
| 148 | &old_entry)) { |
| 149 | if (old_entry->gateway.Equals(gateway_address)) { |
| 150 | if (old_entry->metric != metric) { |
Paul Stewart | c1dec4d | 2011-12-08 15:25:28 -0800 | [diff] [blame] | 151 | ReplaceMetric(interface_index, old_entry, metric); |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 152 | } |
| 153 | return true; |
| 154 | } else { |
mukesh agrawal | d4ef677 | 2012-02-21 16:28:04 -0800 | [diff] [blame] | 155 | // TODO(quiche): Update internal state as well? |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 156 | ApplyRoute(interface_index, |
mukesh agrawal | d4ef677 | 2012-02-21 16:28:04 -0800 | [diff] [blame] | 157 | *old_entry, |
Paul Stewart | 9a90808 | 2011-08-31 12:18:48 -0700 | [diff] [blame] | 158 | RTNLMessage::kModeDelete, |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 159 | 0); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | IPAddress default_address(ipconfig_props.address_family); |
| 164 | default_address.SetAddressToDefault(); |
| 165 | |
| 166 | return AddRoute(interface_index, |
| 167 | RoutingTableEntry(default_address, |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 168 | default_address, |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 169 | gateway_address, |
| 170 | metric, |
| 171 | RT_SCOPE_UNIVERSE, |
| 172 | false)); |
| 173 | } |
| 174 | |
| 175 | void RoutingTable::FlushRoutes(int interface_index) { |
| 176 | VLOG(2) << __func__; |
| 177 | |
| 178 | base::hash_map<int, vector<RoutingTableEntry> >::iterator table = |
| 179 | tables_.find(interface_index); |
| 180 | |
| 181 | if (table == tables_.end()) { |
| 182 | return; |
| 183 | } |
| 184 | |
| 185 | vector<RoutingTableEntry>::iterator nent; |
| 186 | |
| 187 | for (nent = table->second.begin(); nent != table->second.end(); ++nent) { |
Paul Stewart | 9a90808 | 2011-08-31 12:18:48 -0700 | [diff] [blame] | 188 | ApplyRoute(interface_index, *nent, RTNLMessage::kModeDelete, 0); |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 189 | } |
| 190 | } |
| 191 | |
| 192 | void RoutingTable::ResetTable(int interface_index) { |
| 193 | tables_.erase(interface_index); |
| 194 | } |
| 195 | |
| 196 | void RoutingTable::SetDefaultMetric(int interface_index, uint32 metric) { |
mukesh agrawal | 2c15d2c | 2012-02-21 16:09:21 -0800 | [diff] [blame] | 197 | VLOG(2) << __func__ << " " |
| 198 | << "index " << interface_index << " metric " << metric; |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 199 | |
mukesh agrawal | d4ef677 | 2012-02-21 16:28:04 -0800 | [diff] [blame] | 200 | RoutingTableEntry *entry; |
| 201 | if (GetDefaultRouteInternal( |
| 202 | interface_index, IPAddress::kFamilyIPv4, &entry) && |
| 203 | entry->metric != metric) { |
Paul Stewart | c1dec4d | 2011-12-08 15:25:28 -0800 | [diff] [blame] | 204 | ReplaceMetric(interface_index, entry, metric); |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 205 | } |
| 206 | |
mukesh agrawal | d4ef677 | 2012-02-21 16:28:04 -0800 | [diff] [blame] | 207 | if (GetDefaultRouteInternal( |
| 208 | interface_index, IPAddress::kFamilyIPv6, &entry) && |
| 209 | entry->metric != metric) { |
Paul Stewart | c1dec4d | 2011-12-08 15:25:28 -0800 | [diff] [blame] | 210 | ReplaceMetric(interface_index, entry, metric); |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 211 | } |
| 212 | } |
| 213 | |
Chris Masone | 2aa9707 | 2011-08-09 17:35:08 -0700 | [diff] [blame] | 214 | void RoutingTable::RouteMsgHandler(const RTNLMessage &msg) { |
Paul Stewart | 9a90808 | 2011-08-31 12:18:48 -0700 | [diff] [blame] | 215 | if (msg.type() != RTNLMessage::kTypeRoute || |
Paul Stewart | 7355ce1 | 2011-09-02 10:47:01 -0700 | [diff] [blame] | 216 | msg.family() == IPAddress::kFamilyUnknown || |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 217 | !msg.HasAttribute(RTA_OIF)) { |
| 218 | return; |
| 219 | } |
| 220 | |
| 221 | const RTNLMessage::RouteStatus &route_status = msg.route_status(); |
| 222 | |
| 223 | if (route_status.type != RTN_UNICAST || |
| 224 | route_status.protocol != RTPROT_BOOT || |
| 225 | route_status.table != RT_TABLE_MAIN) { |
| 226 | return; |
| 227 | } |
| 228 | |
| 229 | uint32 interface_index = 0; |
| 230 | if (!msg.GetAttribute(RTA_OIF).ConvertToCPUUInt32(&interface_index)) { |
| 231 | return; |
| 232 | } |
| 233 | |
| 234 | uint32 metric = 0; |
| 235 | if (msg.HasAttribute(RTA_PRIORITY)) { |
| 236 | msg.GetAttribute(RTA_PRIORITY).ConvertToCPUUInt32(&metric); |
| 237 | } |
| 238 | |
| 239 | IPAddress default_addr(msg.family()); |
| 240 | default_addr.SetAddressToDefault(); |
| 241 | |
| 242 | ByteString dst_bytes(default_addr.address()); |
| 243 | if (msg.HasAttribute(RTA_DST)) { |
| 244 | dst_bytes = msg.GetAttribute(RTA_DST); |
| 245 | } |
| 246 | ByteString src_bytes(default_addr.address()); |
| 247 | if (msg.HasAttribute(RTA_SRC)) { |
| 248 | src_bytes = msg.GetAttribute(RTA_SRC); |
| 249 | } |
| 250 | ByteString gateway_bytes(default_addr.address()); |
| 251 | if (msg.HasAttribute(RTA_GATEWAY)) { |
| 252 | gateway_bytes = msg.GetAttribute(RTA_GATEWAY); |
| 253 | } |
| 254 | |
| 255 | RoutingTableEntry entry( |
Paul Stewart | 9e3fcd7 | 2011-08-26 15:46:16 -0700 | [diff] [blame] | 256 | IPAddress(msg.family(), dst_bytes, route_status.dst_prefix), |
| 257 | IPAddress(msg.family(), src_bytes, route_status.src_prefix), |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 258 | IPAddress(msg.family(), gateway_bytes), |
| 259 | metric, |
| 260 | route_status.scope, |
| 261 | true); |
| 262 | |
| 263 | vector<RoutingTableEntry> &table = tables_[interface_index]; |
| 264 | vector<RoutingTableEntry>::iterator nent; |
| 265 | for (nent = table.begin(); nent != table.end(); ++nent) { |
| 266 | if (nent->dst.Equals(entry.dst) && |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 267 | nent->src.Equals(entry.src) && |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 268 | nent->gateway.Equals(entry.gateway) && |
| 269 | nent->scope == entry.scope) { |
Paul Stewart | c1dec4d | 2011-12-08 15:25:28 -0800 | [diff] [blame] | 270 | if (msg.mode() == RTNLMessage::kModeDelete && |
| 271 | nent->metric == entry.metric) { |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 272 | table.erase(nent); |
Paul Stewart | c1dec4d | 2011-12-08 15:25:28 -0800 | [diff] [blame] | 273 | } else if (msg.mode() == RTNLMessage::kModeAdd) { |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 274 | nent->from_rtnl = true; |
| 275 | nent->metric = entry.metric; |
| 276 | } |
| 277 | return; |
| 278 | } |
| 279 | } |
| 280 | |
Paul Stewart | 9a90808 | 2011-08-31 12:18:48 -0700 | [diff] [blame] | 281 | if (msg.mode() == RTNLMessage::kModeAdd) { |
mukesh agrawal | 2c15d2c | 2012-02-21 16:09:21 -0800 | [diff] [blame] | 282 | VLOG(2) << __func__ << " adding " |
| 283 | << "index " << interface_index |
| 284 | << "gateway " << entry.gateway.ToString() << " " |
| 285 | << "metric " << entry.metric; |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 286 | table.push_back(entry); |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | bool RoutingTable::ApplyRoute(uint32 interface_index, |
| 291 | const RoutingTableEntry &entry, |
Paul Stewart | 9a90808 | 2011-08-31 12:18:48 -0700 | [diff] [blame] | 292 | RTNLMessage::Mode mode, |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 293 | unsigned int flags) { |
| 294 | VLOG(2) << base::StringPrintf("%s: index %d mode %d flags 0x%x", |
| 295 | __func__, interface_index, mode, flags); |
| 296 | |
| 297 | RTNLMessage msg( |
Paul Stewart | 9a90808 | 2011-08-31 12:18:48 -0700 | [diff] [blame] | 298 | RTNLMessage::kTypeRoute, |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 299 | mode, |
Paul Stewart | e613202 | 2011-08-16 09:11:02 -0700 | [diff] [blame] | 300 | NLM_F_REQUEST | flags, |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 301 | 0, |
| 302 | 0, |
| 303 | 0, |
| 304 | entry.dst.family()); |
| 305 | |
| 306 | msg.set_route_status(RTNLMessage::RouteStatus( |
Paul Stewart | 9e3fcd7 | 2011-08-26 15:46:16 -0700 | [diff] [blame] | 307 | entry.dst.prefix(), |
| 308 | entry.src.prefix(), |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 309 | RT_TABLE_MAIN, |
| 310 | RTPROT_BOOT, |
| 311 | entry.scope, |
| 312 | RTN_UNICAST, |
| 313 | 0)); |
| 314 | |
| 315 | msg.SetAttribute(RTA_DST, entry.dst.address()); |
| 316 | if (!entry.src.IsDefault()) { |
| 317 | msg.SetAttribute(RTA_SRC, entry.src.address()); |
| 318 | } |
| 319 | if (!entry.gateway.IsDefault()) { |
| 320 | msg.SetAttribute(RTA_GATEWAY, entry.gateway.address()); |
| 321 | } |
| 322 | msg.SetAttribute(RTA_PRIORITY, ByteString::CreateFromCPUUInt32(entry.metric)); |
| 323 | msg.SetAttribute(RTA_OIF, ByteString::CreateFromCPUUInt32(interface_index)); |
| 324 | |
| 325 | return RTNLHandler::GetInstance()->SendMessage(&msg); |
| 326 | } |
| 327 | |
Paul Stewart | c1dec4d | 2011-12-08 15:25:28 -0800 | [diff] [blame] | 328 | // Somewhat surprisingly, the kernel allows you to create multiple routes |
| 329 | // to the same destination through the same interface with different metrics. |
| 330 | // Therefore, to change the metric on a route, we can't just use the |
| 331 | // NLM_F_REPLACE flag by itself. We have to explicitly remove the old route. |
| 332 | // We do so after creating the route at a new metric so there is no traffic |
| 333 | // disruption to existing network streams. |
| 334 | void RoutingTable::ReplaceMetric(uint32 interface_index, |
mukesh agrawal | d4ef677 | 2012-02-21 16:28:04 -0800 | [diff] [blame] | 335 | RoutingTableEntry *entry, |
Paul Stewart | c1dec4d | 2011-12-08 15:25:28 -0800 | [diff] [blame] | 336 | uint32 metric) { |
mukesh agrawal | 2c15d2c | 2012-02-21 16:09:21 -0800 | [diff] [blame] | 337 | VLOG(2) << __func__ << " " |
| 338 | << "index " << interface_index << " metric " << metric; |
mukesh agrawal | d4ef677 | 2012-02-21 16:28:04 -0800 | [diff] [blame] | 339 | RoutingTableEntry new_entry = *entry; |
Paul Stewart | c1dec4d | 2011-12-08 15:25:28 -0800 | [diff] [blame] | 340 | new_entry.metric = metric; |
| 341 | // First create the route at the new metric. |
| 342 | ApplyRoute(interface_index, new_entry, RTNLMessage::kModeAdd, |
| 343 | NLM_F_CREATE | NLM_F_REPLACE); |
| 344 | // Then delete the route at the old metric. |
mukesh agrawal | d4ef677 | 2012-02-21 16:28:04 -0800 | [diff] [blame] | 345 | ApplyRoute(interface_index, *entry, RTNLMessage::kModeDelete, 0); |
| 346 | // Now, update our routing table (via |*entry|) from |new_entry|. |
| 347 | *entry = new_entry; |
Paul Stewart | c1dec4d | 2011-12-08 15:25:28 -0800 | [diff] [blame] | 348 | } |
| 349 | |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 350 | bool RoutingTable::FlushCache() { |
| 351 | static const char *kPaths[2] = { kRouteFlushPath4, kRouteFlushPath6 }; |
| 352 | bool ret = true; |
| 353 | |
| 354 | VLOG(2) << __func__; |
| 355 | |
| 356 | for (size_t i = 0; i < arraysize(kPaths); ++i) { |
| 357 | if (file_util::WriteFile(FilePath(kPaths[i]), "-1", 2) != 2) { |
| 358 | LOG(ERROR) << base::StringPrintf("Cannot write to route flush file %s", |
| 359 | kPaths[i]); |
| 360 | ret = false; |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | return ret; |
| 365 | } |
| 366 | |
| 367 | } // namespace shill |