shill: LinkMonitor: Add ArpClient code
Add ArpClient class and start hooking it up to LinkMonitor.
BUG=chromium-os:32600
TEST=Unit tests. Some real-world testing using the test harness
to transmit and receive ARP on a real network.
Change-Id: Ic05d8d7eb921878e3776f35b4be285554ef86456
Reviewed-on: https://gerrit.chromium.org/gerrit/28148
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/arp_packet.cc b/arp_packet.cc
index 5c3998b..6b131ce 100644
--- a/arp_packet.cc
+++ b/arp_packet.cc
@@ -13,6 +13,8 @@
namespace shill {
+const size_t ArpPacket::kMinPayloadSize = ETH_ZLEN - ETH_HLEN;
+
ArpPacket::ArpPacket()
: local_ip_address_(IPAddress::kFamilyUnknown),
remote_ip_address_(IPAddress::kFamilyUnknown) {}
@@ -157,6 +159,10 @@
packet->Append(remote_mac_address_);
packet->Append(remote_ip_address_.address());
+ if (packet->GetLength() < kMinPayloadSize) {
+ packet->Append(ByteString(kMinPayloadSize - packet->GetLength()));
+ }
+
return true;
}