diff options
| author | Roy Marples <roy@marples.name> | 2018-05-06 16:26:11 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2018-05-06 16:26:11 +0100 |
| commit | 03b7f6f101cf1a62cb36755a515884751d8df480 (patch) | |
| tree | 2c6412d3f87717596c73db2f4af5ee31d927e0c3 | |
| parent | 51ac565dafd1f5f6afe95a5d3b6a4a4d7d64f8ae (diff) | |
| download | dhcpcd-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.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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 */ |
