]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Merge branch 'dhcpcd-7'
authorRoy Marples <roy@marples.name>
Fri, 26 Apr 2019 13:07:35 +0000 (14:07 +0100)
committerRoy Marples <roy@marples.name>
Fri, 26 Apr 2019 13:07:35 +0000 (14:07 +0100)
1  2 
src/dhcp.c
src/ipv4.h
src/ipv4ll.c

diff --cc src/dhcp.c
index 9526201206c08bf9da51cd2406ccf3c9d0c682ad,f24d14f603bd15f3e482b4973a4951e130ae097d..4669acdd3690bd6e6f8f738152a093f6c1871e76
@@@ -2013,20 -2041,43 +2013,20 @@@ dhcp_rebind(void *arg
        send_rebind(ifp);
  }
  
 -#ifdef ARP
  static void
 -dhcp_arp_probed(struct arp_state *astate)
 +dhcp_finish_dad(struct interface *ifp, struct in_addr *ia)
  {
 -      struct interface *ifp;
 -      struct dhcp_state *state;
 -      struct if_options *ifo;
 +      struct dhcp_state *state = D_STATE(ifp);
  
 -      ifp = astate->iface;
 -      state = D_STATE(ifp);
 -      ifo = ifp->options;
 -#ifdef ARPING
 -      if (ifo->arping_len && state->arping_index < ifo->arping_len) {
 -              /* We didn't find a profile for this
 -               * address or hwaddr, so move to the next
 -               * arping profile */
 -              if (++state->arping_index < ifo->arping_len) {
 -                      astate->addr.s_addr =
 -                          ifo->arping[state->arping_index];
 -                      arp_probe(astate);
 -                      return;
 -              }
 -              arp_free(astate);
 -              dhcpcd_startinterface(ifp);
 +      if (state->state != DHS_PROBE)
                return;
 -      }
 -#endif
 -
 -      /* Already bound so DAD has worked */
 -      if (state->state == DHS_BOUND)
 +      if (state->offer == NULL || state->offer->yiaddr != ia->s_addr)
                return;
  
 -      logdebugx("%s: DAD completed for %s",
 -          ifp->name, inet_ntoa(astate->addr));
 -      if (!(ifo->options & DHCPCD_INFORM))
 +      logdebugx("%s: DAD completed for %s", ifp->name, inet_ntoa(*ia));
 +      if (!(ifp->options->options & DHCPCD_INFORM))
                dhcp_bind(ifp);
- #ifndef IN_IFF_TENTATIVE
+ #ifndef IN_IFF_DUPLICATED
        else {
                struct bootp *bootp;
                size_t len;
@@@ -2393,7 -2427,11 +2393,7 @@@ dhcp_arp_address(struct interface *ifp
        /* If the interface already has the address configured
         * then we can't ARP for duplicate detection. */
        ia = ipv4_iffindaddr(ifp, &addr, NULL);
- #ifdef IN_IFF_TENTATIVE
 -      astate = dhcp_arp_new(ifp, &addr);
 -      if (astate == NULL)
 -              return -1;
 -
+ #ifdef IN_IFF_NOTUSEABLE
        if (ia == NULL || ia->addr_flags & IN_IFF_NOTUSEABLE) {
                state->state = DHS_PROBE;
                if (ia == NULL) {
diff --cc src/ipv4.h
Simple merge
diff --cc src/ipv4ll.c
index 8808aebaf434aa87ca910eff5e8b076981678ec2,29eaf1df2629fdf8e3c45c54d3ed7eeed5adb282..243d81406ccdbf6be02fd47c09d07da5de592ff8
@@@ -397,11 -404,8 +397,11 @@@ ipv4ll_start1(struct interface *ifp, st
        if (ia == NULL)
                ia = ipv4_iffindlladdr(ifp);
  
- #ifdef IN_IFF_TENTATIVE
 +      repick = false;
+ #ifdef IN_IFF_DUPLICATED
        if (ia != NULL && ia->addr_flags & IN_IFF_DUPLICATED) {
 +              state->pickedaddr = ia->addr; /* So it's not picked again. */
 +              repick = true;
                ipv4_deladdr(ia, 0);
                ia = NULL;
        }
                            ifp->name, inet_ntoa(ia->addr));
                        return;
                }
+ #endif
+ #ifdef IN_IFF_DUPLICATED
                loginfox("%s: using IPv4LL address %s", ifp->name, ia->saddr);
  #endif
 -              ipv4ll_probed(astate);
 +              ipv4ll_not_found(ifp);
                return;
        }
  
        loginfox("%s: probing for an IPv4LL address", ifp->name);
 -      if (state->pickedaddr.s_addr == INADDR_ANY)
 -              state->pickedaddr.s_addr = ipv4ll_pickaddr(astate);
 +      if (repick || state->pickedaddr.s_addr == INADDR_ANY)
 +              state->pickedaddr.s_addr = ipv4ll_pickaddr(ifp);
 +#ifndef KERNEL_RFC5227
        astate->addr = state->pickedaddr;
- #ifdef IN_IFF_TENTATIVE
 +#endif
 -      ipv4ll_probed(astate);
+ #ifdef IN_IFF_DUPLICATED
 +      ipv4ll_not_found(ifp);
  #else
        arp_probe(astate);
  #endif