]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
DHCP: Dont close ARP gratuitously
authorRoy Marples <roy@marples.name>
Tue, 19 Feb 2019 23:15:43 +0000 (23:15 +0000)
committerRoy Marples <roy@marples.name>
Tue, 19 Feb 2019 23:15:43 +0000 (23:15 +0000)
Note we may wish to handle ACD for DHCP in the future.

src/arp.c
src/arp.h
src/dhcp.c

index 4e1e114a3db46827c77f5956a3c3de242aa57330..cbcefa8dc33c6cc8fee37c83503f25481205e20f 100644 (file)
--- a/src/arp.c
+++ b/src/arp.c
@@ -175,17 +175,18 @@ arp_packet(struct interface *ifp, uint8_t *data, size_t len)
        }
 }
 
-void
+static void
 arp_close(struct interface *ifp)
 {
        struct iarp_state *state;
 
-       if ((state = ARP_STATE(ifp)) != NULL && state->bpf_fd != -1) {
-               eloop_event_delete(ifp->ctx->eloop, state->bpf_fd);
-               bpf_close(ifp, state->bpf_fd);
-               state->bpf_fd = -1;
-               state->bpf_flags |= BPF_EOF;
-       }
+       if ((state = ARP_STATE(ifp)) == NULL || state->bpf_fd == -1)
+               return;
+
+       eloop_event_delete(ifp->ctx->eloop, state->bpf_fd);
+       bpf_close(ifp, state->bpf_fd);
+       state->bpf_fd = -1;
+       state->bpf_flags |= BPF_EOF;
 }
 
 static void
index d5e8c468f70534e2f347b88bd425bf8bd9e6e99d..1c0be04351e1758c90f63f75f6ff78bb561a5e9b 100644 (file)
--- a/src/arp.h
+++ b/src/arp.h
@@ -90,7 +90,6 @@ struct iarp_state {
 int arp_open(struct interface *);
 ssize_t arp_request(const struct interface *, in_addr_t, in_addr_t);
 void arp_probe(struct arp_state *);
-void arp_close(struct interface *);
 void arp_report_conflicted(const struct arp_state *, const struct arp_msg *);
 struct arp_state *arp_new(struct interface *, const struct in_addr *);
 struct arp_state *arp_find(struct interface *, const struct in_addr *);
index 29e27dc4b8afc243d8d51399779b97ce9230c361..d0f9a453a1c168c18631c039777d211450ccf3f3 100644 (file)
@@ -2062,11 +2062,6 @@ dhcp_arp_probed(struct arp_state *astate)
                        return;
                }
                arp_free(astate);
-#ifdef KERNEL_RFC5227
-               /* As arping is finished, close the ARP socket.
-                * The kernel will handle ACD from here. */
-               arp_close(ifp);
-#endif
                dhcpcd_startinterface(ifp);
                return;
        }
@@ -2144,11 +2139,6 @@ dhcp_arp_conflicted(struct arp_state *astate, const struct arp_msg *amsg)
                        return;
                }
                arp_free(astate);
-#ifdef KERNEL_RFC5227
-               /* As arping is finished, close the ARP socket.
-                * The kernel will handle ACD from here. */
-               arp_close(ifp);
-#endif
                eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
                dhcpcd_startinterface(ifp);
                return;
@@ -2208,8 +2198,10 @@ static void
 dhcp_arp_announced(struct arp_state *state)
 {
 
-       /* Free the ARP state as we currently don't care about ACD for DHCP. */
+// TODO: DHCP addresses handle ACD?
+//#ifdef KERNEL_RFC5227
        arp_free(state);
+//#endif
 }
 #endif