Skip to content

Commit b45491d

Browse files
committed
Add ARP Responder module
Address code review comments
1 parent ca3bfa9 commit b45491d

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

core/modules/arp_responder.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ CommandResponse ArpResponder::CommandAdd(const bess::pb::ArpResponderArg &arg) {
2020
}
2121

2222
if (!entry.mac_addr.FromString(arg.mac_addr())) {
23-
return CommandFailure(EINVAL, "Invalid MAC Address: %s", arg.mac_addr().c_str());
23+
return CommandFailure(EINVAL, "Invalid MAC Address: %s",
24+
arg.mac_addr().c_str());
2425
}
2526

2627
entry.ip_addr = ip_addr;
@@ -52,7 +53,7 @@ void ArpResponder::ProcessBatch(bess::PacketBatch *batch) {
5253
// Try to find target IP in cache, if exists convert request to reply
5354
auto it = entries_.find(arp->target_ip_addr);
5455
if (it != entries_.end()) {
55-
const struct arp_entry &entry = it->second;
56+
const struct arp_entry &entry = it->second;
5657
arp->opcode = be16_t(Arp::Opcode::kReply);
5758

5859
eth->dst_addr = eth->src_addr;

core/modules/arp_responder.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ using bess::utils::be32_t;
1616
struct arp_entry {
1717
Ethernet::Address mac_addr;
1818
be32_t ip_addr;
19-
// timestamp used to expire cache entries
20-
uint64_t time;
19+
uint64_t time; // timestamp used to expire cache entries (in milliseconds)
2120
};
2221

2322
// ARP Responder module

0 commit comments

Comments
 (0)