]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Continue operation when failing to send packets.
authorRoy Marples <roy@marples.name>
Tue, 29 Nov 2016 19:44:32 +0000 (19:44 +0000)
committerRoy Marples <roy@marples.name>
Tue, 29 Nov 2016 19:44:32 +0000 (19:44 +0000)
My iwn(4) interface on FreeBSD11 and 12 struggles to associate.
A side effect of this is running out of buffer until it does, but we need
dhcpcd to continue once association is made and the buffers have emptied.

dhcp.c
dhcp6.c
ipv6nd.c

diff --git a/dhcp.c b/dhcp.c
index 2763cfe4a8ff7bad1ee6887a2c7f3fd7be68e4c5..c78d23ed6ddb0302cae01f347154724e29eb5ea6 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -1767,10 +1767,10 @@ send_message(struct interface *ifp, uint8_t type,
        } else {
                size_t ulen;
 
-               r = 0;
                udp = dhcp_makeudppacket(&ulen, (uint8_t *)bootp, len, from,to);
                if (udp == NULL) {
                        logger(ifp->ctx, LOG_ERR, "dhcp_makeudppacket: %m");
+                       r = 0;
                } else {
                        r = if_sendraw(ifp, state->raw_fd,
                            ETHERTYPE_IP, (uint8_t *)udp, ulen);
@@ -1788,6 +1788,7 @@ send_message(struct interface *ifp, uint8_t type,
                        case ENETDOWN:
                        case ENETRESET:
                        case ENETUNREACH:
+                       case ENOBUFS:
                                break;
                        default:
                                if (!(ifp->ctx->options & DHCPCD_TEST))
diff --git a/dhcp6.c b/dhcp6.c
index dfccde073fc13fb52c8962b2f12e8f8836f0c28d..215fa73f905a70f0f3f5671a7f34a65aa91ef632 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -1203,9 +1203,10 @@ logsend:
        if (sendmsg(ctx->dhcp6_fd, &ctx->sndhdr, 0) == -1) {
                logger(ifp->ctx, LOG_ERR,
                    "%s: %s: sendmsg: %m", ifp->name, __func__);
-               ifp->options->options &= ~DHCPCD_IPV6;
-               dhcp6_drop(ifp, "EXPIRE6");
-               return -1;
+               /* Allow DHCPv6 to continue .... the errors
+                * would be rate limited by the protocol.
+                * Generally the error is ENOBUFS when struggling to
+                * associate with an access point. */
        }
 
        state->RTC++;
index aed0bcd0aad207d27e007522494057ceaa535ff9..06f797440d90d2448d9a617e3ea99ff69af0f473 100644 (file)
--- a/ipv6nd.c
+++ b/ipv6nd.c
@@ -307,9 +307,10 @@ ipv6nd_sendrsprobe(void *arg)
        if (sendmsg(ctx->nd_fd, &ctx->sndhdr, 0) == -1) {
                logger(ifp->ctx, LOG_ERR,
                    "%s: %s: sendmsg: %m", ifp->name, __func__);
-               ipv6nd_drop(ifp);
-               ifp->options->options &= ~(DHCPCD_IPV6 | DHCPCD_IPV6RS);
-               return;
+               /* Allow IPv6ND to continue .... at most a few errors
+                * would be logged.
+                * Generally the error is ENOBUFS when struggling to
+                * associate with an access point. */
        }
 
        if (state->rsprobes++ < MAX_RTR_SOLICITATIONS)