| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/base/address_tracker_linux.h" | 5 #include "net/base/address_tracker_linux.h" |
| 6 | 6 |
| 7 #include <linux/if.h> | 7 #include <linux/if.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 namespace { | 122 namespace { |
| 123 | 123 |
| 124 class NetlinkMessage { | 124 class NetlinkMessage { |
| 125 public: | 125 public: |
| 126 explicit NetlinkMessage(uint16_t type) : buffer_(NLMSG_HDRLEN) { | 126 explicit NetlinkMessage(uint16_t type) : buffer_(NLMSG_HDRLEN) { |
| 127 header()->nlmsg_type = type; | 127 header()->nlmsg_type = type; |
| 128 Align(); | 128 Align(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void AddPayload(const void* data, size_t length) { | 131 void AddPayload(const void* data, size_t length) { |
| 132 CHECK_EQ(static_cast<size_t>(NLMSG_HDRLEN), | 132 // Payload must be added first. |
| 133 buffer_.size()) << "Payload must be added first"; | 133 CHECK_EQ(static_cast<size_t>(NLMSG_HDRLEN), buffer_.size()); |
| 134 Append(data, length); | 134 Append(data, length); |
| 135 Align(); | 135 Align(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void AddAttribute(uint16_t type, const void* data, size_t length) { | 138 void AddAttribute(uint16_t type, const void* data, size_t length) { |
| 139 struct nlattr attr; | 139 struct nlattr attr; |
| 140 attr.nla_len = NLA_HDRLEN + length; | 140 attr.nla_len = NLA_HDRLEN + length; |
| 141 attr.nla_type = type; | 141 attr.nla_type = type; |
| 142 Append(&attr, sizeof(attr)); | 142 Append(&attr, sizeof(attr)); |
| 143 Align(); | 143 Align(); |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 tracker_->Init(); | 733 tracker_->Init(); |
| 734 | 734 |
| 735 runner1.VerifyCompletes(); | 735 runner1.VerifyCompletes(); |
| 736 runner2.VerifyCompletes(); | 736 runner2.VerifyCompletes(); |
| 737 } | 737 } |
| 738 | 738 |
| 739 } // namespace | 739 } // namespace |
| 740 | 740 |
| 741 } // namespace internal | 741 } // namespace internal |
| 742 } // namespace net | 742 } // namespace net |
| OLD | NEW |