]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Zero length UDP packets are not an error condition on the socket.
authorRoy Marples <roy@marples.name>
Tue, 25 Nov 2014 20:40:00 +0000 (20:40 +0000)
committerRoy Marples <roy@marples.name>
Tue, 25 Nov 2014 20:40:00 +0000 (20:40 +0000)
Thanks to Michał Kępień.

arp.c
dhcp.c
dhcp6.c
ipv6nd.c

diff --git a/arp.c b/arp.c
index 86274a6dba137717ada2db4c4b5a609c21d88c1c..3a1de858fde239a3214e562dfaf90cdaa577aa6e 100644 (file)
--- a/arp.c
+++ b/arp.c
@@ -124,7 +124,7 @@ arp_packet(void *arg)
        while (!(flags & RAW_EOF)) {
                bytes = if_readrawpacket(ifp, ETHERTYPE_ARP,
                    arp_buffer, sizeof(arp_buffer), &flags);
-               if (bytes == 0 || bytes == -1) {
+               if (bytes == -1) {
                        syslog(LOG_ERR, "%s: arp if_readrawpacket: %m",
                            ifp->name);
                        dhcp_close(ifp);
diff --git a/dhcp.c b/dhcp.c
index 43e4046c0f87b5fd66aa1e9be6842647d3644dc0..a98c5b952e9f8e776ab1f3b1adb4fce840b198ff 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -2782,7 +2782,7 @@ dhcp_handlepacket(void *arg)
        while (!(flags & RAW_EOF)) {
                bytes = (size_t)if_readrawpacket(ifp, ETHERTYPE_IP,
                    ifp->ctx->packet, udp_dhcp_len, &flags);
-               if (bytes == 0 || (ssize_t)bytes == -1) {
+               if ((ssize_t)bytes == -1) {
                        syslog(LOG_ERR, "%s: dhcp if_readrawpacket: %m",
                            ifp->name);
                        dhcp_close(ifp);
diff --git a/dhcp6.c b/dhcp6.c
index 72d765e7b98a042347fcc361150e5608986ff20e..f4b77179ee3d559e87eb97ce20302125b15730da 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -2551,7 +2551,7 @@ dhcp6_handledata(void *arg)
        ctx = dhcpcd_ctx->ipv6;
        ctx->rcvhdr.msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo));
        bytes = recvmsg(ctx->dhcp_fd, &ctx->rcvhdr, 0);
-       if (bytes == -1 || bytes == 0) {
+       if (bytes == -1) {
                syslog(LOG_ERR, "recvmsg: %m");
                close(ctx->dhcp_fd);
                eloop_event_delete(dhcpcd_ctx->eloop, ctx->dhcp_fd, 0);
index 574e69a2b6eaaa7d802c32dbdfa16be89e7cae57..56a7a4b36f2b7452d1773818bb8c299b550900f6 100644 (file)
--- a/ipv6nd.c
+++ b/ipv6nd.c
@@ -1500,7 +1500,7 @@ ipv6nd_handledata(void *arg)
        ctx->rcvhdr.msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo)) +
            CMSG_SPACE(sizeof(int));
        len = recvmsg(ctx->nd_fd, &ctx->rcvhdr, 0);
-       if (len == -1 || len == 0) {
+       if (len == -1) {
                syslog(LOG_ERR, "recvmsg: %m");
                eloop_event_delete(dhcpcd_ctx->eloop, ctx->nd_fd, 0);
                close(ctx->nd_fd);