Mercurial > hg > dhcpcd
changeset 4167:4d4937553032 draft
dhcp: improve error logging about UDP checksum failure
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Mon, 23 Oct 2017 10:55:28 +0100 |
| parents | 3d5e01232bf7 |
| children | e8510a89cdb2 |
| files | src/dhcp.c |
| diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dhcp.c Sat Oct 21 14:10:02 2017 +0100 +++ b/src/dhcp.c Mon Oct 23 10:55:28 2017 +0100 @@ -3146,7 +3146,7 @@ if (data_len < sizeof(p->ip) + sizeof(p->udp)) { if (from) from->s_addr = INADDR_ANY; - errno = EINVAL; + errno = ERANGE; return -1; } p = (struct bootp_pkt *)data; @@ -3159,7 +3159,7 @@ bytes = ntohs(p->ip.ip_len); if (bytes > data_len) { - errno = EINVAL; + errno = ENOBUFS; return -1; } @@ -3199,8 +3199,12 @@ if (valid_udp_packet(data, len, &from, flags & RAW_PARTIALCSUM) == -1) { - logerrx("%s: invalid UDP packet from %s", - ifp->name, inet_ntoa(from)); + if (errno == EINVAL) + logerrx("%s: UDP checksum failure from %s", + ifp->name, inet_ntoa(from)); + else + logerr("%s: invalid UDP packet from %s", + ifp->name, inet_ntoa(from)); return; } if (ifp->flags & IFF_POINTOPOINT &&
