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/src Import dhcpcd-7.2.1 with the foll...
details: https://anonhg.NetBSD.org/src/rev/06acb2f4eb18
branches: ROY
changeset: 455219:06acb2f4eb18
user: roy <roy%NetBSD.org@localhost>
date: Fri Apr 26 14:32:27 2019 +0000
description:
Import dhcpcd-7.2.1 with the following changes:
* auth: Use consttime_memequal to avoid latency attack
* DHCP: Fix a potential 1 byte read overflow with DHO_OPTSOVERLOADED
* DHCPv6: Fix a potential buffer overflow reading NA/TA addresses
diffstat:
external/bsd/dhcpcd/dist/src/auth.c | 8 +-
external/bsd/dhcpcd/dist/src/control.c | 2 +-
external/bsd/dhcpcd/dist/src/defs.h | 2 +-
external/bsd/dhcpcd/dist/src/dhcp.c | 14 +-
external/bsd/dhcpcd/dist/src/dhcp6.c | 6 +-
external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in | 5 +-
external/bsd/dhcpcd/dist/src/dhcpcd.h | 2 +
external/bsd/dhcpcd/dist/src/if-bsd.c | 8 +-
external/bsd/dhcpcd/dist/src/ipv4.h | 3 +-
external/bsd/dhcpcd/dist/src/ipv4ll.c | 8 +-
external/bsd/dhcpcd/dist/src/ipv6.c | 2 +
external/bsd/dhcpcd/dist/src/ipv6.h | 14 +-
external/bsd/dhcpcd/dist/src/ipv6nd.c | 181 +++++++++++++++++++------
external/bsd/dhcpcd/dist/src/ipv6nd.h | 3 +
14 files changed, 188 insertions(+), 70 deletions(-)
diffs (truncated from 637 to 300 lines):
diff -r 1dcb467e8383 -r 06acb2f4eb18 external/bsd/dhcpcd/dist/src/auth.c
--- a/external/bsd/dhcpcd/dist/src/auth.c Wed Apr 17 23:33:08 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/auth.c Fri Apr 26 14:32:27 2019 +0000
@@ -117,7 +117,11 @@
m = vm;
data = vdata;
- /* Ensure that d is inside m which *may* not be the case for DHPCPv4 */
+ /* Ensure that d is inside m which *may* not be the case for DHCPv4.
+ * This can occur if the authentication option is split using
+ * DHCP long option from RFC 3399. Section 9 which does infact note that
+ * implementations should take this into account.
+ * Fixing this would be problematic, patches welcome. */
if (data < m || data > m + mlen || data + dlen > m + mlen) {
errno = ERANGE;
return NULL;
@@ -354,7 +358,7 @@
}
free(mm);
- if (memcmp(d, &hmac_code, dlen)) {
+ if (!consttime_memequal(d, &hmac_code, dlen)) {
errno = EPERM;
return NULL;
}
diff -r 1dcb467e8383 -r 06acb2f4eb18 external/bsd/dhcpcd/dist/src/control.c
--- a/external/bsd/dhcpcd/dist/src/control.c Wed Apr 17 23:33:08 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/control.c Fri Apr 26 14:32:27 2019 +0000
@@ -318,7 +318,7 @@
if ((fd = make_sock(&sa, ifname, 0)) != -1) {
socklen_t len;
-
+
len = (socklen_t)SUN_LEN(&sa);
if (connect(fd, (struct sockaddr *)&sa, len) == -1) {
close(fd);
diff -r 1dcb467e8383 -r 06acb2f4eb18 external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h Wed Apr 17 23:33:08 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h Fri Apr 26 14:32:27 2019 +0000
@@ -28,7 +28,7 @@
#define CONFIG_H
#define PACKAGE "dhcpcd"
-#define VERSION "7.2.0"
+#define VERSION "7.2.1"
#ifndef CONFIG
# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
diff -r 1dcb467e8383 -r 06acb2f4eb18 external/bsd/dhcpcd/dist/src/dhcp.c
--- a/external/bsd/dhcpcd/dist/src/dhcp.c Wed Apr 17 23:33:08 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.c Fri Apr 26 14:32:27 2019 +0000
@@ -215,6 +215,12 @@
}
l = *p++;
+ /* Check we can read the option data, if present */
+ if (p + l > e) {
+ errno = EINVAL;
+ return NULL;
+ }
+
if (o == DHO_OPTSOVERLOADED) {
/* Ensure we only get this option once by setting
* the last bit as well as the value.
@@ -249,10 +255,6 @@
bp += ol;
}
ol = l;
- if (p + ol >= e) {
- errno = EINVAL;
- return NULL;
- }
op = p;
bl += ol;
}
@@ -2075,7 +2077,7 @@
ifp->name, inet_ntoa(astate->addr));
if (!(ifo->options & DHCPCD_INFORM))
dhcp_bind(ifp);
-#ifndef IN_IFF_TENTATIVE
+#ifndef IN_IFF_DUPLICATED
else {
struct bootp *bootp;
size_t len;
@@ -2429,7 +2431,7 @@
if (astate == NULL)
return -1;
-#ifdef IN_IFF_TENTATIVE
+#ifdef IN_IFF_NOTUSEABLE
if (ia == NULL || ia->addr_flags & IN_IFF_NOTUSEABLE) {
state->state = DHS_PROBE;
if (ia == NULL) {
diff -r 1dcb467e8383 -r 06acb2f4eb18 external/bsd/dhcpcd/dist/src/dhcp6.c
--- a/external/bsd/dhcpcd/dist/src/dhcp6.c Wed Apr 17 23:33:08 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp6.c Fri Apr 26 14:32:27 2019 +0000
@@ -2029,12 +2029,12 @@
nd = o + ol;
l -= (size_t)(nd - d);
d = nd;
- if (ol < 24) {
+ if (ol < sizeof(ia)) {
errno = EINVAL;
logerrx("%s: IA Address option truncated", ifp->name);
continue;
}
- memcpy(&ia, o, ol);
+ memcpy(&ia, o, sizeof(ia));
ia.pltime = ntohl(ia.pltime);
ia.vltime = ntohl(ia.vltime);
/* RFC 3315 22.6 */
@@ -3035,7 +3035,7 @@
* unless those values in those fields are 0.
*/
logwarnx("%s: ignoring T1 %"PRIu32
- " to due address expiry",
+ " due to address expiry",
ifp->name, state->renew);
state->renew = state->rebind = 0;
}
diff -r 1dcb467e8383 -r 06acb2f4eb18 external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in Wed Apr 17 23:33:08 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in Fri Apr 26 14:32:27 2019 +0000
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd September 15, 2018
+.Dd April 24, 2019
.Dt DHCPCD.CONF 5
.Os
.Sh NAME
@@ -376,8 +376,7 @@
noipv6rs # disable routing solicitation
denyinterfaces eth2 # Don't touch eth2 at all
interface eth0
- ipv6rs # enable routing solicitation get the
- # default IPv6 route
+ ipv6rs # enable routing solicitation for eth0
ia_na 1 # request an IPv6 address
ia_pd 2 eth1/0 # request a PD and assign it to eth1
ia_pd 3 eth2/1 eth3/2 # req a PD and assign it to eth2 and eth3
diff -r 1dcb467e8383 -r 06acb2f4eb18 external/bsd/dhcpcd/dist/src/dhcpcd.h
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.h Wed Apr 17 23:33:08 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.h Fri Apr 26 14:32:27 2019 +0000
@@ -180,7 +180,9 @@
uint8_t *secret;
size_t secret_len;
+#ifndef __sun
int nd_fd;
+#endif
struct ra_head *ra_routers;
int dhcp6_fd;
diff -r 1dcb467e8383 -r 06acb2f4eb18 external/bsd/dhcpcd/dist/src/if-bsd.c
--- a/external/bsd/dhcpcd/dist/src/if-bsd.c Wed Apr 17 23:33:08 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/if-bsd.c Fri Apr 26 14:32:27 2019 +0000
@@ -943,10 +943,15 @@
priv = (struct priv *)ia->iface->ctx->priv;
if (ioctl(priv->pf_inet6_fd, SIOCGIFALIFETIME_IN6, &ifr6) == -1)
return -1;
+ clock_gettime(CLOCK_MONOTONIC, &ia->created);
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+ t = ia->created.tv_sec;
+#else
t = time(NULL);
+#endif
+
lifetime = &ifr6.ifr_ifru.ifru_lifetime;
-
if (lifetime->ia6t_preferred)
ia->prefix_pltime = (uint32_t)(lifetime->ia6t_preferred -
MIN(t, lifetime->ia6t_preferred));
@@ -956,7 +961,6 @@
ia->prefix_vltime = (uint32_t)(lifetime->ia6t_expire -
MIN(t, lifetime->ia6t_expire));
/* Calculate the created time */
- clock_gettime(CLOCK_MONOTONIC, &ia->created);
ia->created.tv_sec -= lifetime->ia6t_vltime - ia->prefix_vltime;
} else
ia->prefix_vltime = ND6_INFINITE_LIFETIME;
diff -r 1dcb467e8383 -r 06acb2f4eb18 external/bsd/dhcpcd/dist/src/ipv4.h
--- a/external/bsd/dhcpcd/dist/src/ipv4.h Wed Apr 17 23:33:08 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv4.h Fri Apr 26 14:32:27 2019 +0000
@@ -62,9 +62,8 @@
* While it supports DaD, to seems to only expose IFF_DUPLICATE
* so we have no way of knowing if it's tentative or not.
* I don't even know if Solaris has any special treatment for tentative. */
-# define IN_IFF_TENTATIVE 0
# define IN_IFF_DUPLICATED 0x02
-# define IN_IFF_DETACHED 0
+# define IN_IFF_NOTUSEABLE IN_IFF_DUPLICATED
#endif
#ifdef IN_IFF_TENTATIVE
diff -r 1dcb467e8383 -r 06acb2f4eb18 external/bsd/dhcpcd/dist/src/ipv4ll.c
--- a/external/bsd/dhcpcd/dist/src/ipv4ll.c Wed Apr 17 23:33:08 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv4ll.c Fri Apr 26 14:32:27 2019 +0000
@@ -232,7 +232,7 @@
ipv4ll_probe(void *arg)
{
-#ifdef IN_IFF_TENTATIVE
+#ifdef IN_IFF_DUPLICATED
ipv4ll_probed(arg);
#else
arp_probe(arg);
@@ -404,7 +404,7 @@
if (ia == NULL)
ia = ipv4_iffindlladdr(ifp);
-#ifdef IN_IFF_TENTATIVE
+#ifdef IN_IFF_DUPLICATED
if (ia != NULL && ia->addr_flags & IN_IFF_DUPLICATED) {
ipv4_deladdr(ia, 0);
ia = NULL;
@@ -419,6 +419,8 @@
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);
@@ -429,7 +431,7 @@
if (state->pickedaddr.s_addr == INADDR_ANY)
state->pickedaddr.s_addr = ipv4ll_pickaddr(astate);
astate->addr = state->pickedaddr;
-#ifdef IN_IFF_TENTATIVE
+#ifdef IN_IFF_DUPLICATED
ipv4ll_probed(astate);
#else
arp_probe(astate);
diff -r 1dcb467e8383 -r 06acb2f4eb18 external/bsd/dhcpcd/dist/src/ipv6.c
--- a/external/bsd/dhcpcd/dist/src/ipv6.c Wed Apr 17 23:33:08 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv6.c Fri Apr 26 14:32:27 2019 +0000
@@ -137,7 +137,9 @@
return -1;
TAILQ_INIT(ctx->ra_routers);
+#ifndef __sun
ctx->nd_fd = -1;
+#endif
ctx->dhcp6_fd = -1;
return 0;
}
diff -r 1dcb467e8383 -r 06acb2f4eb18 external/bsd/dhcpcd/dist/src/ipv6.h
--- a/external/bsd/dhcpcd/dist/src/ipv6.h Wed Apr 17 23:33:08 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv6.h Fri Apr 26 14:32:27 2019 +0000
@@ -44,9 +44,6 @@
# endif
#endif
-#define ALLNODES "ff02::1"
-#define ALLROUTERS "ff02::2"
-
#define EUI64_GBIT 0x01
#define EUI64_UBIT 0x02
#define EUI64_TO_IFID(in6) do {(in6)->s6_addr[8] ^= EUI64_UBIT; } while (0)
@@ -77,6 +74,17 @@
(((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 )
#endif
+#ifndef IN6ADDR_LINKLOCAL_ALLNODES_INIT
+#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
+ {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
+#endif
+#ifndef IN6ADDR_LINKLOCAL_ALLROUTERS_INIT
+#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
+ {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
+#endif
+
/*
* BSD kernels don't inform userland of DAD results.
* See the discussion here:
diff -r 1dcb467e8383 -r 06acb2f4eb18 external/bsd/dhcpcd/dist/src/ipv6nd.c
--- a/external/bsd/dhcpcd/dist/src/ipv6nd.c Wed Apr 17 23:33:08 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv6nd.c Fri Apr 26 14:32:27 2019 +0000
@@ -190,54 +190,106 @@
}
static int
-ipv6nd_open(struct dhcpcd_ctx *ctx)
+ipv6nd_open0(void)
{
- int on;
+ int s, on;
struct icmp6_filter filt;
- if (ctx->nd_fd != -1)
- return ctx->nd_fd;
#define SOCK_FLAGS SOCK_CLOEXEC | SOCK_NONBLOCK
- ctx->nd_fd = xsocket(PF_INET6, SOCK_RAW | SOCK_FLAGS, IPPROTO_ICMPV6);
+ s = xsocket(PF_INET6, SOCK_RAW | SOCK_FLAGS, IPPROTO_ICMPV6);
Home |
Main Index |
Thread Index |
Old Index