summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2018-05-06 16:26:11 +0100
committerRoy Marples <roy@marples.name>2018-05-06 16:26:11 +0100
commit03b7f6f101cf1a62cb36755a515884751d8df480 (patch)
tree2c6412d3f87717596c73db2f4af5ee31d927e0c3
parent51ac565dafd1f5f6afe95a5d3b6a4a4d7d64f8ae (diff)
downloaddhcpcd-03b7f6f101cf1a62cb36755a515884751d8df480.tar.xz
arp: clarify that we check ar_hln in the BPF filter
While here, re-arrange it a little to match the structure.
-rw-r--r--src/arp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/arp.c b/src/arp.c
index 3949ca4a..f8bff87a 100644
--- a/src/arp.c
+++ b/src/arp.c
@@ -128,13 +128,16 @@ arp_packet(struct interface *ifp, uint8_t *data, size_t len)
/* Protocol must be IP. */
if (ar.ar_pro != htons(ETHERTYPE_IP))
continue;
- /* Only these types are recognised */
- if (ar.ar_op != htons(ARPOP_REPLY) &&
- ar.ar_op != htons(ARPOP_REQUEST))
+ /* lladdr length matches */
+ if (ar.ar_hln != ifp->hwlen)
continue;
/* Protocol length must match in_addr_t */
if (ar.ar_pln != sizeof(arm.sip.s_addr))
return;
+ /* Only these types are recognised */
+ if (ar.ar_op != htons(ARPOP_REPLY) &&
+ ar.ar_op != htons(ARPOP_REQUEST))
+ continue;
#endif
/* Get pointers to the hardware addresses */