summaryrefslogtreecommitdiff
path: root/proto_arp.c
diff options
context:
space:
mode:
Diffstat (limited to 'proto_arp.c')
-rw-r--r--proto_arp.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/proto_arp.c b/proto_arp.c
index 9f2a4e0..3560cd1 100644
--- a/proto_arp.c
+++ b/proto_arp.c
@@ -51,14 +51,9 @@ enum addr_direct {
static void arp_print_addrs(struct arphdr *arp, enum addr_direct addr_dir)
{
- char *dir = addr_dir == ADDR_SENDER ? "Sender" : "Target";
- bool has_eth;
- bool has_ip4;
+ const char *dir = addr_dir == ADDR_SENDER ? "Sender" : "Target";
- has_eth = ntohs(arp->ar_hrd) == ARPHRD_ETHER;
- has_ip4 = ntohs(arp->ar_pro) == ETH_P_IP;
-
- if (has_eth) {
+ if (ntohs(arp->ar_hrd) == ARPHRD_ETHER) {
uint8_t *mac;
mac = addr_dir == ADDR_SENDER ? &arp->ar_sha[0] : &arp->ar_tha[0];
@@ -67,7 +62,7 @@ static void arp_print_addrs(struct arphdr *arp, enum addr_direct addr_dir)
dir, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}
- if (has_ip4) {
+ if (ntohs(arp->ar_pro) == ETH_P_IP) {
char ip_str[INET_ADDRSTRLEN];
uint32_t ip;