Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/ROY]: src/external/bsd/dhcpcd/dist Import dhcpcd-7.0.0 with the followin...



details:   https://anonhg.NetBSD.org/src/rev/68cced455bb4
branches:  ROY
changeset: 455205:68cced455bb4
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Jan 01 11:48:51 2018 +0000

description:
Import dhcpcd-7.0.0 with the following changes:
  *  dhcp: when unicasting on L3, unicast on L2 as well
  *  dhcp: when rebooting, don't set cidaddr
  *  dhcp6: don't listen on IPv6 addresses when not using DHCPv6
  *  dhcp: only set probe state when probing (fixes REBOOT reason)
  *  ipv6: disable kernel RA if interface is active
  *  hooks: set protocol to link for link layer events

diffstat:

 external/bsd/dhcpcd/dist/LICENSE                     |    2 +-
 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in |    2 +-
 external/bsd/dhcpcd/dist/src/arp.c                   |    2 +-
 external/bsd/dhcpcd/dist/src/arp.h                   |    2 +-
 external/bsd/dhcpcd/dist/src/auth.c                  |    2 +-
 external/bsd/dhcpcd/dist/src/auth.h                  |    2 +-
 external/bsd/dhcpcd/dist/src/bpf.c                   |    2 +-
 external/bsd/dhcpcd/dist/src/bpf.h                   |    2 +-
 external/bsd/dhcpcd/dist/src/common.c                |    2 +-
 external/bsd/dhcpcd/dist/src/common.h                |    2 +-
 external/bsd/dhcpcd/dist/src/control.c               |    2 +-
 external/bsd/dhcpcd/dist/src/control.h               |    2 +-
 external/bsd/dhcpcd/dist/src/defs.h                  |    4 +-
 external/bsd/dhcpcd/dist/src/dev.h                   |    2 +-
 external/bsd/dhcpcd/dist/src/dhcp-common.c           |    2 +-
 external/bsd/dhcpcd/dist/src/dhcp-common.h           |    2 +-
 external/bsd/dhcpcd/dist/src/dhcp.c                  |  103 ++++++++++++++----
 external/bsd/dhcpcd/dist/src/dhcp.h                  |    2 +-
 external/bsd/dhcpcd/dist/src/dhcp6.c                 |   19 +-
 external/bsd/dhcpcd/dist/src/dhcp6.h                 |    2 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.8.in             |    2 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.c                |   28 ++++-
 external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in        |    2 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.h                |    2 +-
 external/bsd/dhcpcd/dist/src/eloop.c                 |    2 +-
 external/bsd/dhcpcd/dist/src/eloop.h                 |    2 +-
 external/bsd/dhcpcd/dist/src/if-bsd.c                |    2 +-
 external/bsd/dhcpcd/dist/src/if-options.c            |    2 +-
 external/bsd/dhcpcd/dist/src/if-options.h            |    2 +-
 external/bsd/dhcpcd/dist/src/if.c                    |   36 +++--
 external/bsd/dhcpcd/dist/src/if.h                    |    8 +-
 external/bsd/dhcpcd/dist/src/ipv4.c                  |    2 +-
 external/bsd/dhcpcd/dist/src/ipv4.h                  |    2 +-
 external/bsd/dhcpcd/dist/src/ipv4ll.c                |    2 +-
 external/bsd/dhcpcd/dist/src/ipv4ll.h                |    2 +-
 external/bsd/dhcpcd/dist/src/ipv6.c                  |    2 +-
 external/bsd/dhcpcd/dist/src/ipv6.h                  |    2 +-
 external/bsd/dhcpcd/dist/src/ipv6nd.c                |    4 +-
 external/bsd/dhcpcd/dist/src/ipv6nd.h                |    2 +-
 external/bsd/dhcpcd/dist/src/logerr.c                |    2 +-
 external/bsd/dhcpcd/dist/src/logerr.h                |    2 +-
 external/bsd/dhcpcd/dist/src/route.c                 |    2 +-
 external/bsd/dhcpcd/dist/src/route.h                 |    2 +-
 external/bsd/dhcpcd/dist/src/sa.c                    |    2 +-
 external/bsd/dhcpcd/dist/src/sa.h                    |    2 +-
 external/bsd/dhcpcd/dist/src/script.c                |    8 +-
 external/bsd/dhcpcd/dist/src/script.h                |    2 +-
 47 files changed, 186 insertions(+), 102 deletions(-)

diffs (truncated from 1010 to 300 lines):

diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/LICENSE
--- a/external/bsd/dhcpcd/dist/LICENSE  Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/LICENSE  Mon Jan 01 11:48:51 2018 +0000
@@ -1,4 +1,4 @@
-Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in
--- a/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in      Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in      Mon Jan 01 11:48:51 2018 +0000
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2006-2017 Roy Marples
+.\" Copyright (c) 2006-2018 Roy Marples
 .\" All rights reserved
 .\"
 .\" Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/arp.c
--- a/external/bsd/dhcpcd/dist/src/arp.c        Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.c        Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - ARP handler
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/arp.h
--- a/external/bsd/dhcpcd/dist/src/arp.h        Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.h        Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/auth.c
--- a/external/bsd/dhcpcd/dist/src/auth.c       Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/auth.c       Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/auth.h
--- a/external/bsd/dhcpcd/dist/src/auth.h       Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/auth.h       Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/bpf.c
--- a/external/bsd/dhcpcd/dist/src/bpf.c        Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/bpf.c        Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd: BPF arp and bootp filtering
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/bpf.h
--- a/external/bsd/dhcpcd/dist/src/bpf.h        Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/bpf.h        Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd: BPF arp and bootp filtering
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/common.c
--- a/external/bsd/dhcpcd/dist/src/common.c     Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/common.c     Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/common.h
--- a/external/bsd/dhcpcd/dist/src/common.h     Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/common.h     Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/control.c
--- a/external/bsd/dhcpcd/dist/src/control.c    Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/control.c    Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/control.h
--- a/external/bsd/dhcpcd/dist/src/control.h    Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/control.h    Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h       Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h       Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,7 +28,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "7.0.0-rc4"
+#define VERSION                        "7.0.0"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/dev.h
--- a/external/bsd/dhcpcd/dist/src/dev.h        Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/dev.h        Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/dhcp-common.c
--- a/external/bsd/dhcpcd/dist/src/dhcp-common.c        Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp-common.c        Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/dhcp-common.h
--- a/external/bsd/dhcpcd/dist/src/dhcp-common.h        Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp-common.h        Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
diff -r 5bb3b9388f38 -r 68cced455bb4 external/bsd/dhcpcd/dist/src/dhcp.c
--- a/external/bsd/dhcpcd/dist/src/dhcp.c       Wed Dec 06 10:33:29 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.c       Mon Jan 01 11:48:51 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -777,7 +777,8 @@
            (type == DHCP_INFORM || type == DHCP_RELEASE ||
            (type == DHCP_REQUEST &&
            state->addr->mask.s_addr == lease->mask.s_addr &&
-           (state->new == NULL || IS_DHCP(state->new)))))
+           (state->new == NULL || IS_DHCP(state->new)) &&
+           !(state->added & STATE_FAKE))))
                bootp->ciaddr = state->addr->addr.s_addr;
 
        bootp->op = BOOTREQUEST;
@@ -845,6 +846,7 @@
                if (type == DHCP_DECLINE ||
                    (type == DHCP_REQUEST &&
                    (state->addr == NULL ||
+                   state->added & STATE_FAKE ||
                    lease->addr.s_addr != state->addr->addr.s_addr)))
                {
                        PUT_ADDR(DHO_IPADDRESS, &lease->addr);
@@ -1587,10 +1589,6 @@
        int s;
        struct sockaddr_in sin;
        int n;
-       struct dhcp_state *state;
-#ifdef SO_BINDTODEVICE
-       struct ifreq ifr;
-#endif
 
        if ((s = xsocket(PF_INET, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_UDP)) == -1)
                return -1;
@@ -1598,20 +1596,12 @@
        n = 1;
        if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n)) == -1)
                goto eexit;
-#ifdef SO_BINDTODEVICE
-       if (ifp) {
-               memset(&ifr, 0, sizeof(ifr));
-               strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
-               if (setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, &ifr,
-                   sizeof(ifr)) == -1)
-                       goto eexit;
-       }
-#endif
        memset(&sin, 0, sizeof(sin));
        sin.sin_family = AF_INET;
        sin.sin_port = htons(BOOTPC);
        if (ifp) {
-               state = D_STATE(ifp);
+               struct dhcp_state *state = D_STATE(ifp);
+
                if (state->addr)
                        sin.sin_addr.s_addr = state->addr->addr.s_addr;
        }
@@ -1694,6 +1684,63 @@
        return udpp;
 }
 
+static ssize_t
+dhcp_sendudp(struct interface *ifp, struct in_addr *to, void *data, size_t len)
+{
+       int s;
+       struct msghdr msg;
+       struct sockaddr_in sin;
+       struct iovec iov[1];
+       ssize_t r;
+#ifdef IP_PKTINFO
+       uint8_t cmsg[CMSG_SPACE(sizeof(struct in_pktinfo))];
+       struct cmsghdr *cm;
+       struct in_pktinfo ipi;
+#endif
+
+       iov[0].iov_base = data;
+       iov[0].iov_len = len;
+
+       memset(&sin, 0, sizeof(sin));
+       sin.sin_family = AF_INET;
+       sin.sin_addr = *to;
+       sin.sin_port = htons(BOOTPS);
+#ifdef HAVE_SA_LEN
+       sin.sin_len = sizeof(sin);
+#endif
+
+       memset(&msg, 0, sizeof(msg));
+       msg.msg_name = (void *)&sin;
+       msg.msg_namelen = sizeof(sin);
+       msg.msg_iov = iov;
+       msg.msg_iovlen = 1;
+
+#ifdef IP_PKTINFO
+       /* Set the outbound interface */
+       msg.msg_control = cmsg;
+       msg.msg_controllen = sizeof(cmsg);
+
+       memset(&ipi, 0, sizeof(ipi));
+       ipi.ipi_ifindex = ifp->index;
+       cm = CMSG_FIRSTHDR(&msg);
+       if (cm == NULL) {
+               errno = ESRCH;
+               return -1;
+       }
+       cm->cmsg_level = IPPROTO_IP;
+       cm->cmsg_type = IP_PKTINFO;
+       cm->cmsg_len = CMSG_LEN(sizeof(ipi));
+       memcpy(CMSG_DATA(cm), &ipi, sizeof(ipi));
+#endif
+
+       s = dhcp_openudp(ifp);
+       if (s == -1)
+               return -1;



Home | Main Index | Thread Index | Old Index