blob: 470cf043f544869018c1901bcdbbee7cb80b8c9c [file] [log] [blame]
Paul Stewartf748a362012-03-07 12:01:20 -08001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Paul Stewarta3c56f92011-05-26 07:08:52 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <errno.h>
6#include <time.h>
7#include <unistd.h>
8#include <string.h>
Darin Petkove0a312e2011-07-20 13:45:28 -07009#include <sys/ioctl.h>
Paul Stewarta3c56f92011-05-26 07:08:52 -070010#include <sys/socket.h>
11#include <arpa/inet.h>
12#include <netinet/ether.h>
13#include <net/if.h>
14#include <net/if_arp.h>
15#include <linux/netlink.h>
16#include <linux/rtnetlink.h>
17#include <fcntl.h>
Paul Stewarta3c56f92011-05-26 07:08:52 -070018
Eric Shienbrood3e20a232012-02-16 11:35:56 -050019#include <base/bind.h>
Paul Stewarta3c56f92011-05-26 07:08:52 -070020
Paul Stewart5f06a0e2012-12-20 11:11:33 -080021#include "shill/error.h"
Paul Stewart26b327e2011-10-19 11:38:09 -070022#include "shill/event_dispatcher.h"
Paul Stewarta3c56f92011-05-26 07:08:52 -070023#include "shill/io_handler.h"
Paul Stewart1d18e8c2011-07-15 11:00:31 -070024#include "shill/ip_address.h"
Paul Stewartc39f1132011-06-22 12:02:28 -070025#include "shill/ipconfig.h"
Christopher Wileyb691efd2012-08-09 13:51:51 -070026#include "shill/logging.h"
Paul Stewarta3c56f92011-05-26 07:08:52 -070027#include "shill/rtnl_handler.h"
28#include "shill/rtnl_listener.h"
Paul Stewart75e89d22011-08-01 10:00:02 -070029#include "shill/rtnl_message.h"
Darin Petkov633ac6f2011-07-08 13:56:13 -070030#include "shill/sockets.h"
Paul Stewarta3c56f92011-05-26 07:08:52 -070031
Eric Shienbrood3e20a232012-02-16 11:35:56 -050032using base::Bind;
33using base::Unretained;
Paul Stewarta3c56f92011-05-26 07:08:52 -070034using std::string;
35
36namespace shill {
37
Julius Wernerf253c842012-12-20 14:52:30 -080038// Keep this large enough to avoid overflows on IPv6 SNM routing update spikes
Julius Werner13a7e042013-01-25 13:00:15 -080039const int RTNLHandler::kReceiveBufferSize = 512 * 1024;
Julius Wernerf253c842012-12-20 14:52:30 -080040
Ben Chanbbdef5f2012-04-23 13:58:15 -070041namespace {
42base::LazyInstance<RTNLHandler> g_rtnl_handler = LAZY_INSTANCE_INITIALIZER;
43} // namespace
Paul Stewart0d2ada32011-08-09 17:01:57 -070044
Paul Stewarta3c56f92011-05-26 07:08:52 -070045RTNLHandler::RTNLHandler()
Darin Petkov633ac6f2011-07-08 13:56:13 -070046 : sockets_(NULL),
Paul Stewarta3c56f92011-05-26 07:08:52 -070047 in_request_(false),
Paul Stewarta3c56f92011-05-26 07:08:52 -070048 rtnl_socket_(-1),
49 request_flags_(0),
mukesh agrawalf60e4062011-05-27 13:13:41 -070050 request_sequence_(0),
Paul Stewart9a908082011-08-31 12:18:48 -070051 last_dump_sequence_(0),
Eric Shienbrood3e20a232012-02-16 11:35:56 -050052 rtnl_callback_(Bind(&RTNLHandler::ParseRTNL, Unretained(this))) {
Ben Chanfad4a0b2012-04-18 15:49:59 -070053 SLOG(RTNL, 2) << "RTNLHandler created";
Paul Stewarta3c56f92011-05-26 07:08:52 -070054}
55
56RTNLHandler::~RTNLHandler() {
Ben Chanfad4a0b2012-04-18 15:49:59 -070057 SLOG(RTNL, 2) << "RTNLHandler removed";
Paul Stewarta3c56f92011-05-26 07:08:52 -070058 Stop();
59}
60
61RTNLHandler* RTNLHandler::GetInstance() {
Paul Stewart0d2ada32011-08-09 17:01:57 -070062 return g_rtnl_handler.Pointer();
Paul Stewarta3c56f92011-05-26 07:08:52 -070063}
64
Darin Petkov633ac6f2011-07-08 13:56:13 -070065void RTNLHandler::Start(EventDispatcher *dispatcher, Sockets *sockets) {
Paul Stewarta3c56f92011-05-26 07:08:52 -070066 struct sockaddr_nl addr;
67
Darin Petkov633ac6f2011-07-08 13:56:13 -070068 if (sockets_) {
Paul Stewarta3c56f92011-05-26 07:08:52 -070069 return;
Darin Petkov633ac6f2011-07-08 13:56:13 -070070 }
Paul Stewarta3c56f92011-05-26 07:08:52 -070071
Darin Petkov633ac6f2011-07-08 13:56:13 -070072 rtnl_socket_ = sockets->Socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
Paul Stewarta3c56f92011-05-26 07:08:52 -070073 if (rtnl_socket_ < 0) {
74 LOG(ERROR) << "Failed to open rtnl socket";
75 return;
76 }
77
Julius Wernerf253c842012-12-20 14:52:30 -080078 if (sockets->SetReceiveBuffer(rtnl_socket_, kReceiveBufferSize)) {
79 LOG(ERROR) << "Failed to increase receive buffer size";
80 }
81
Paul Stewarta3c56f92011-05-26 07:08:52 -070082 memset(&addr, 0, sizeof(addr));
83 addr.nl_family = AF_NETLINK;
Paul Stewart9a908082011-08-31 12:18:48 -070084 addr.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV4_ROUTE |
85 RTMGRP_IPV6_IFADDR | RTMGRP_IPV6_ROUTE;
Paul Stewarta3c56f92011-05-26 07:08:52 -070086
Darin Petkov633ac6f2011-07-08 13:56:13 -070087 if (sockets->Bind(rtnl_socket_,
88 reinterpret_cast<struct sockaddr *>(&addr),
89 sizeof(addr)) < 0) {
90 sockets->Close(rtnl_socket_);
Paul Stewarta3c56f92011-05-26 07:08:52 -070091 rtnl_socket_ = -1;
92 LOG(ERROR) << "RTNL socket bind failed";
93 return;
94 }
95
Paul Stewart5f06a0e2012-12-20 11:11:33 -080096 rtnl_handler_.reset(dispatcher->CreateInputHandler(
97 rtnl_socket_,
98 rtnl_callback_,
99 Bind(&RTNLHandler::OnReadError, Unretained(this))));
Darin Petkov633ac6f2011-07-08 13:56:13 -0700100 sockets_ = sockets;
Paul Stewarta3c56f92011-05-26 07:08:52 -0700101
Paul Stewart9a908082011-08-31 12:18:48 -0700102 NextRequest(last_dump_sequence_);
Ben Chanfad4a0b2012-04-18 15:49:59 -0700103 SLOG(RTNL, 2) << "RTNLHandler started";
Paul Stewarta3c56f92011-05-26 07:08:52 -0700104}
105
106void RTNLHandler::Stop() {
Darin Petkov633ac6f2011-07-08 13:56:13 -0700107 if (!sockets_)
Paul Stewarta3c56f92011-05-26 07:08:52 -0700108 return;
109
Paul Stewart7355ce12011-09-02 10:47:01 -0700110 rtnl_handler_.reset();
Darin Petkov633ac6f2011-07-08 13:56:13 -0700111 sockets_->Close(rtnl_socket_);
Paul Stewarta3c56f92011-05-26 07:08:52 -0700112 in_request_ = false;
Darin Petkov633ac6f2011-07-08 13:56:13 -0700113 sockets_ = NULL;
Paul Stewart65c40f52011-08-08 07:27:46 -0700114 request_flags_ = 0;
Ben Chanfad4a0b2012-04-18 15:49:59 -0700115 SLOG(RTNL, 2) << "RTNLHandler stopped";
Paul Stewarta3c56f92011-05-26 07:08:52 -0700116}
117
118void RTNLHandler::AddListener(RTNLListener *to_add) {
119 std::vector<RTNLListener *>::iterator it;
120 for (it = listeners_.begin(); it != listeners_.end(); ++it) {
121 if (to_add == *it)
122 return;
123 }
124 listeners_.push_back(to_add);
Ben Chanfad4a0b2012-04-18 15:49:59 -0700125 SLOG(RTNL, 2) << "RTNLHandler added listener";
Paul Stewarta3c56f92011-05-26 07:08:52 -0700126}
127
128void RTNLHandler::RemoveListener(RTNLListener *to_remove) {
129 std::vector<RTNLListener *>::iterator it;
130 for (it = listeners_.begin(); it != listeners_.end(); ++it) {
131 if (to_remove == *it) {
132 listeners_.erase(it);
133 return;
134 }
135 }
Ben Chanfad4a0b2012-04-18 15:49:59 -0700136 SLOG(RTNL, 2) << "RTNLHandler removed listener";
Paul Stewarta3c56f92011-05-26 07:08:52 -0700137}
138
139void RTNLHandler::SetInterfaceFlags(int interface_index, unsigned int flags,
Darin Petkov0828f5f2011-08-11 10:18:52 -0700140 unsigned int change) {
Paul Stewart536820d2012-03-19 16:05:59 -0700141 if (!sockets_) {
142 LOG(ERROR) << __func__ << " called while not started. "
143 "Assuming we are in unit tests.";
144 return;
145 }
146
Paul Stewarta3c56f92011-05-26 07:08:52 -0700147 struct rtnl_request {
148 struct nlmsghdr hdr;
149 struct ifinfomsg msg;
150 } req;
151
152 request_sequence_++;
153 memset(&req, 0, sizeof(req));
154
155 req.hdr.nlmsg_len = sizeof(req);
156 req.hdr.nlmsg_flags = NLM_F_REQUEST;
157 req.hdr.nlmsg_pid = 0;
158 req.hdr.nlmsg_seq = request_sequence_;
159 req.hdr.nlmsg_type = RTM_NEWLINK;
160 req.msg.ifi_index = interface_index;
161 req.msg.ifi_flags = flags;
162 req.msg.ifi_change = change;
163
Darin Petkov633ac6f2011-07-08 13:56:13 -0700164 if (sockets_->Send(rtnl_socket_, &req, sizeof(req), 0) < 0) {
Paul Stewarta3c56f92011-05-26 07:08:52 -0700165 LOG(ERROR) << "RTNL sendto failed: " << strerror(errno);
166 }
167}
168
169void RTNLHandler::RequestDump(int request_flags) {
170 request_flags_ |= request_flags;
171
Ben Chanfad4a0b2012-04-18 15:49:59 -0700172 SLOG(RTNL, 2) << "RTNLHandler got request to dump "
mukesh agrawal47009f82011-08-25 14:07:35 -0700173 << std::showbase << std::hex
174 << request_flags
175 << std::dec << std::noshowbase;
Paul Stewarta3c56f92011-05-26 07:08:52 -0700176
Darin Petkov633ac6f2011-07-08 13:56:13 -0700177 if (!in_request_ && sockets_)
Paul Stewart9a908082011-08-31 12:18:48 -0700178 NextRequest(last_dump_sequence_);
Paul Stewarta3c56f92011-05-26 07:08:52 -0700179}
180
Chris Masone2aa97072011-08-09 17:35:08 -0700181void RTNLHandler::DispatchEvent(int type, const RTNLMessage &msg) {
Paul Stewarta3c56f92011-05-26 07:08:52 -0700182 std::vector<RTNLListener *>::iterator it;
183 for (it = listeners_.begin(); it != listeners_.end(); ++it) {
Chris Masone2aa97072011-08-09 17:35:08 -0700184 (*it)->NotifyEvent(type, msg);
Paul Stewarta3c56f92011-05-26 07:08:52 -0700185 }
186}
187
Paul Stewartf748a362012-03-07 12:01:20 -0800188void RTNLHandler::NextRequest(uint32 seq) {
Paul Stewarta3c56f92011-05-26 07:08:52 -0700189 int flag = 0;
Paul Stewart9a908082011-08-31 12:18:48 -0700190 RTNLMessage::Type type;
Paul Stewarta3c56f92011-05-26 07:08:52 -0700191
Ben Chanfad4a0b2012-04-18 15:49:59 -0700192 SLOG(RTNL, 2) << "RTNLHandler nextrequest " << seq << " "
193 << last_dump_sequence_
194 << std::showbase << std::hex
195 << " " << request_flags_
196 << std::dec << std::noshowbase;
Paul Stewarta3c56f92011-05-26 07:08:52 -0700197
Paul Stewart9a908082011-08-31 12:18:48 -0700198 if (seq != last_dump_sequence_)
Paul Stewarta3c56f92011-05-26 07:08:52 -0700199 return;
200
Paul Stewart8c116a92012-05-02 18:30:03 -0700201 if ((request_flags_ & kRequestAddr) != 0) {
Paul Stewart9a908082011-08-31 12:18:48 -0700202 type = RTNLMessage::kTypeAddress;
Paul Stewarta3c56f92011-05-26 07:08:52 -0700203 flag = kRequestAddr;
204 } else if ((request_flags_ & kRequestRoute) != 0) {
Paul Stewart9a908082011-08-31 12:18:48 -0700205 type = RTNLMessage::kTypeRoute;
Paul Stewarta3c56f92011-05-26 07:08:52 -0700206 flag = kRequestRoute;
Paul Stewart8c116a92012-05-02 18:30:03 -0700207 } else if ((request_flags_ & kRequestLink) != 0) {
208 type = RTNLMessage::kTypeLink;
209 flag = kRequestLink;
Paul Stewarta3c56f92011-05-26 07:08:52 -0700210 } else {
Ben Chanfad4a0b2012-04-18 15:49:59 -0700211 SLOG(RTNL, 2) << "Done with requests";
Paul Stewarta3c56f92011-05-26 07:08:52 -0700212 in_request_ = false;
213 return;
214 }
215
Paul Stewart9a908082011-08-31 12:18:48 -0700216 RTNLMessage msg(
217 type,
218 RTNLMessage::kModeGet,
219 0,
220 0,
221 0,
222 0,
Paul Stewart7355ce12011-09-02 10:47:01 -0700223 IPAddress::kFamilyUnknown);
Paul Stewart9a908082011-08-31 12:18:48 -0700224 CHECK(SendMessage(&msg));
Paul Stewarta3c56f92011-05-26 07:08:52 -0700225
Paul Stewart9a908082011-08-31 12:18:48 -0700226 last_dump_sequence_ = msg.seq();
Paul Stewarta3c56f92011-05-26 07:08:52 -0700227 request_flags_ &= ~flag;
228 in_request_ = true;
229}
230
231void RTNLHandler::ParseRTNL(InputData *data) {
232 unsigned char *buf = data->buf;
233 unsigned char *end = buf + data->len;
234
235 while (buf < end) {
236 struct nlmsghdr *hdr = reinterpret_cast<struct nlmsghdr *>(buf);
mukesh agrawalf60e4062011-05-27 13:13:41 -0700237 if (!NLMSG_OK(hdr, static_cast<unsigned int>(end - buf)))
Paul Stewarta3c56f92011-05-26 07:08:52 -0700238 break;
239
Ben Chanfad4a0b2012-04-18 15:49:59 -0700240 SLOG(RTNL, 3) << __func__ << ": received payload (" << end - buf << ")";
Paul Stewart7355ce12011-09-02 10:47:01 -0700241
Chris Masone2aa97072011-08-09 17:35:08 -0700242 RTNLMessage msg;
Paul Stewart44f08cb2012-04-27 16:53:05 -0700243 ByteString payload(reinterpret_cast<unsigned char *>(hdr), hdr->nlmsg_len);
244 SLOG(RTNL, 5) << "RTNL received payload length " << payload.GetLength()
245 << ": \"" << payload.HexEncode() << "\"";
246 if (!msg.Decode(payload)) {
Ben Chanfad4a0b2012-04-18 15:49:59 -0700247 SLOG(RTNL, 3) << __func__ << ": rtnl packet type "
Paul Stewart44f08cb2012-04-27 16:53:05 -0700248 << hdr->nlmsg_type
249 << " length " << hdr->nlmsg_len
250 << " sequence " << hdr->nlmsg_seq;
251
Chris Masone2aa97072011-08-09 17:35:08 -0700252 switch (hdr->nlmsg_type) {
253 case NLMSG_NOOP:
254 case NLMSG_OVERRUN:
255 break;
256 case NLMSG_DONE:
257 NextRequest(hdr->nlmsg_seq);
258 break;
259 case NLMSG_ERROR:
260 {
261 struct nlmsgerr *err =
262 reinterpret_cast<nlmsgerr *>(NLMSG_DATA(hdr));
263 LOG(ERROR) << "error " << -err->error << " ("
264 << strerror(-err->error) << ")";
265 break;
266 }
267 default:
268 NOTIMPLEMENTED() << "Unknown NL message type.";
269 }
270 } else {
271 switch (msg.type()) {
Paul Stewart9a908082011-08-31 12:18:48 -0700272 case RTNLMessage::kTypeLink:
Chris Masone2aa97072011-08-09 17:35:08 -0700273 DispatchEvent(kRequestLink, msg);
274 break;
Paul Stewart9a908082011-08-31 12:18:48 -0700275 case RTNLMessage::kTypeAddress:
Chris Masone2aa97072011-08-09 17:35:08 -0700276 DispatchEvent(kRequestAddr, msg);
277 break;
Paul Stewart9a908082011-08-31 12:18:48 -0700278 case RTNLMessage::kTypeRoute:
Chris Masone2aa97072011-08-09 17:35:08 -0700279 DispatchEvent(kRequestRoute, msg);
280 break;
281 default:
282 NOTIMPLEMENTED() << "Unknown RTNL message type.";
283 }
284 }
Paul Stewarta3c56f92011-05-26 07:08:52 -0700285 buf += hdr->nlmsg_len;
286 }
287}
288
Paul Stewart9a908082011-08-31 12:18:48 -0700289bool RTNLHandler::AddressRequest(int interface_index,
290 RTNLMessage::Mode mode,
291 int flags,
292 const IPAddress &local,
Paul Stewart1062d9d2012-04-27 10:42:27 -0700293 const IPAddress &broadcast,
Paul Stewart48100b02012-03-19 07:53:52 -0700294 const IPAddress &peer) {
Paul Stewart1062d9d2012-04-27 10:42:27 -0700295 CHECK(local.family() == broadcast.family());
Paul Stewart48100b02012-03-19 07:53:52 -0700296 CHECK(local.family() == peer.family());
Paul Stewartc39f1132011-06-22 12:02:28 -0700297
Paul Stewart9a908082011-08-31 12:18:48 -0700298 RTNLMessage msg(
299 RTNLMessage::kTypeAddress,
300 mode,
301 NLM_F_REQUEST | flags,
302 0,
303 0,
304 interface_index,
305 local.family());
Paul Stewartc39f1132011-06-22 12:02:28 -0700306
Paul Stewart9a908082011-08-31 12:18:48 -0700307 msg.set_address_status(RTNLMessage::AddressStatus(
308 local.prefix(),
309 0,
310 0));
Paul Stewartc39f1132011-06-22 12:02:28 -0700311
Paul Stewart9a908082011-08-31 12:18:48 -0700312 msg.SetAttribute(IFA_LOCAL, local.address());
Paul Stewart1062d9d2012-04-27 10:42:27 -0700313 if (!broadcast.IsDefault()) {
314 msg.SetAttribute(IFA_BROADCAST, broadcast.address());
Paul Stewartc39f1132011-06-22 12:02:28 -0700315 }
Paul Stewart48100b02012-03-19 07:53:52 -0700316 if (!peer.IsDefault()) {
317 msg.SetAttribute(IFA_ADDRESS, peer.address());
318 }
Paul Stewartc39f1132011-06-22 12:02:28 -0700319
Paul Stewart9a908082011-08-31 12:18:48 -0700320 return SendMessage(&msg);
Paul Stewartc39f1132011-06-22 12:02:28 -0700321}
322
323bool RTNLHandler::AddInterfaceAddress(int interface_index,
Paul Stewart9a908082011-08-31 12:18:48 -0700324 const IPAddress &local,
Paul Stewart48100b02012-03-19 07:53:52 -0700325 const IPAddress &broadcast,
326 const IPAddress &peer) {
Paul Stewart9a908082011-08-31 12:18:48 -0700327 return AddressRequest(interface_index,
328 RTNLMessage::kModeAdd,
Paul Stewart8c116a92012-05-02 18:30:03 -0700329 NLM_F_CREATE | NLM_F_EXCL | NLM_F_ECHO,
Paul Stewart9a908082011-08-31 12:18:48 -0700330 local,
Paul Stewart48100b02012-03-19 07:53:52 -0700331 broadcast,
332 peer);
Paul Stewartc39f1132011-06-22 12:02:28 -0700333}
334
335bool RTNLHandler::RemoveInterfaceAddress(int interface_index,
Paul Stewart9a908082011-08-31 12:18:48 -0700336 const IPAddress &local) {
337 return AddressRequest(interface_index,
338 RTNLMessage::kModeDelete,
Paul Stewart8c116a92012-05-02 18:30:03 -0700339 NLM_F_ECHO,
Paul Stewart9a908082011-08-31 12:18:48 -0700340 local,
Paul Stewart48100b02012-03-19 07:53:52 -0700341 IPAddress(local.family()),
Paul Stewart9a908082011-08-31 12:18:48 -0700342 IPAddress(local.family()));
Paul Stewartc39f1132011-06-22 12:02:28 -0700343}
344
Paul Stewartcba0f7f2012-02-29 16:33:05 -0800345bool RTNLHandler::RemoveInterface(int interface_index) {
346 RTNLMessage msg(
347 RTNLMessage::kTypeLink,
348 RTNLMessage::kModeDelete,
349 NLM_F_REQUEST,
350 0,
351 0,
352 interface_index,
353 IPAddress::kFamilyUnknown);
354 return SendMessage(&msg);
355}
356
Darin Petkove0a312e2011-07-20 13:45:28 -0700357int RTNLHandler::GetInterfaceIndex(const string &interface_name) {
358 if (interface_name.empty()) {
359 LOG(ERROR) << "Empty interface name -- unable to obtain index.";
360 return -1;
361 }
362 struct ifreq ifr;
363 if (interface_name.size() >= sizeof(ifr.ifr_name)) {
364 LOG(ERROR) << "Interface name too long: " << interface_name.size() << " >= "
365 << sizeof(ifr.ifr_name);
366 return -1;
367 }
368 int socket = sockets_->Socket(PF_INET, SOCK_DGRAM, 0);
369 if (socket < 0) {
370 PLOG(ERROR) << "Unable to open INET socket";
371 return -1;
372 }
373 ScopedSocketCloser socket_closer(sockets_, socket);
374 memset(&ifr, 0, sizeof(ifr));
375 strncpy(ifr.ifr_name, interface_name.c_str(), sizeof(ifr.ifr_name));
376 if (sockets_->Ioctl(socket, SIOCGIFINDEX, &ifr) < 0) {
377 PLOG(ERROR) << "SIOCGIFINDEX error for " << interface_name;
378 return -1;
379 }
380 return ifr.ifr_ifindex;
381}
382
Paul Stewart75e89d22011-08-01 10:00:02 -0700383bool RTNLHandler::SendMessage(RTNLMessage *message) {
Paul Stewart44f08cb2012-04-27 16:53:05 -0700384 message->set_seq(request_sequence_);
Paul Stewart75e89d22011-08-01 10:00:02 -0700385 ByteString msgdata = message->Encode();
386
387 if (msgdata.GetLength() == 0) {
388 return false;
389 }
390
Paul Stewart44f08cb2012-04-27 16:53:05 -0700391 SLOG(RTNL, 5) << "RTNL sending payload with request sequence "
392 << request_sequence_ << ", length " << msgdata.GetLength()
393 << ": \"" << msgdata.HexEncode() << "\"";
394
395 request_sequence_++;
396
Paul Stewart75e89d22011-08-01 10:00:02 -0700397 if (sockets_->Send(rtnl_socket_,
Paul Stewart9a908082011-08-31 12:18:48 -0700398 msgdata.GetConstData(),
Paul Stewart75e89d22011-08-01 10:00:02 -0700399 msgdata.GetLength(),
400 0) < 0) {
401 PLOG(ERROR) << "RTNL send failed: " << strerror(errno);
402 return false;
403 }
404
405 return true;
406}
407
Paul Stewart5f06a0e2012-12-20 11:11:33 -0800408void RTNLHandler::OnReadError(const Error &error) {
409 LOG(FATAL) << "RTNL Socket read returns error: "
410 << error.message();
411}
412
Paul Stewarta3c56f92011-05-26 07:08:52 -0700413} // namespace shill