changeset 5241:989bcc6c8e70 draft

ARP: A few minor fixes for prior
author Roy Marples <roy@marples.name>
date Wed, 20 May 2020 15:43:44 +0000
parents 0281af78918f
children 0dd9b7f7cf6b
files src/arp.c src/arp.h src/dhcp.c src/ipv4.c
diffstat 4 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/arp.c	Wed May 20 14:15:30 2020 +0100
+++ b/src/arp.c	Wed May 20 15:43:44 2020 +0000
@@ -443,7 +443,7 @@
 	    astate);
 }
 
-void
+static void
 arp_announce(struct arp_state *astate)
 {
 	struct iarp_state *state;
@@ -483,7 +483,7 @@
 {
 	struct arp_state *astate;
 
-	if (ifp->flags & IFF_NOARP)
+	if (ifp->flags & IFF_NOARP || !(ifp->options->options & DHCPCD_ARP))
 		return NULL;
 
 	astate = arp_find(ifp, ia);
--- a/src/arp.h	Wed May 20 14:15:30 2020 +0100
+++ b/src/arp.h	Wed May 20 15:43:44 2020 +0000
@@ -96,7 +96,6 @@
 void arp_packet(struct interface *, uint8_t *, size_t, unsigned int);
 struct arp_state *arp_new(struct interface *, const struct in_addr *);
 void arp_probe(struct arp_state *);
-void arp_announce(struct arp_state *);
 struct arp_state *arp_announceaddr(struct dhcpcd_ctx *, const struct in_addr *);
 struct arp_state *arp_ifannounceaddr(struct interface *, const struct in_addr *);
 void arp_cancel(struct arp_state *);
--- a/src/dhcp.c	Wed May 20 14:15:30 2020 +0100
+++ b/src/dhcp.c	Wed May 20 15:43:44 2020 +0000
@@ -2010,6 +2010,8 @@
 		state->new_len = state->offer_len;
 		get_lease(ifp, &state->lease, state->new, state->new_len);
 		ipv4_applyaddr(ifp);
+		if (ifp->ctx->options & DHCPCD_FORKED)
+			return;
 		state->new = bootp;
 		state->new_len = len;
 	}
@@ -2339,6 +2341,8 @@
 		dhcp_close(ifp);
 
 	ipv4_applyaddr(ifp);
+	if (ifp->ctx->options & DHCPCD_FORKED)
+		return;
 
 	/* If not in master mode, open an address specific socket. */
 	if (ctx->options & DHCPCD_MASTER ||
@@ -4107,7 +4111,8 @@
 	if (state != NULL && state->added) {
 		rt_build(ifp->ctx, AF_INET);
 #ifdef ARP
-		arp_announceaddr(ifp->ctx, &state->addr->addr);
+		if (ifp->options->options & DHCPCD_ARP)
+			arp_announceaddr(ifp->ctx, &state->addr->addr);
 #endif
 	}
 }
--- a/src/ipv4.c	Wed May 20 14:15:30 2020 +0100
+++ b/src/ipv4.c	Wed May 20 15:43:44 2020 +0000
@@ -747,6 +747,8 @@
 				/* Announce the preferred address to
 				 * kick ARP caches. */
 				arp_announceaddr(ifp->ctx,&lease->addr);
+				if (ifp->ctx->options & DHCPCD_FORKED)
+					return;
 #endif
 			}
 			script_runreason(ifp, state->reason);
@@ -809,6 +811,8 @@
 
 #ifdef ARP
 	arp_announceaddr(ifp->ctx, &state->addr->addr);
+	if (ifp->ctx->options & DHCPCD_FORKED)
+		return;
 #endif
 
 	if (state->state == DHS_BOUND) {