Mercurial > hg > dhcpcd
changeset 5031:f65873a0ad5b draft
ARP: Only copy out frame header if we have it.
Frameless does exist.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Wed, 05 Feb 2020 14:54:49 +0000 |
| parents | 28bb50e31931 |
| children | 1c7a1389b42b |
| files | src/arp.c |
| diffstat | 1 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/arp.c Wed Feb 05 14:47:08 2020 +0000 +++ b/src/arp.c Wed Feb 05 14:54:49 2020 +0000 @@ -228,16 +228,18 @@ /* Copy the frame header source and destination out */ memset(&arm, 0, sizeof(arm)); - hw_s = bpf_frame_header_src(ifp, data, &falen); - if (hw_s != NULL && falen <= sizeof(arm.fsha)) - memcpy(arm.fsha, hw_s, falen); - hw_t = bpf_frame_header_dst(ifp, data, &falen); - if (hw_t != NULL && falen <= sizeof(arm.ftha)) - memcpy(arm.ftha, hw_t, falen); + if (fl != 0) { + hw_s = bpf_frame_header_src(ifp, data, &falen); + if (hw_s != NULL && falen <= sizeof(arm.fsha)) + memcpy(arm.fsha, hw_s, falen); + hw_t = bpf_frame_header_dst(ifp, data, &falen); + if (hw_t != NULL && falen <= sizeof(arm.ftha)) + memcpy(arm.ftha, hw_t, falen); - /* Skip past the frame header */ - data += fl; - len -= fl; + /* Skip past the frame header */ + data += fl; + len -= fl; + } /* We must have a full ARP header */ if (len < sizeof(ar))
