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.0.7 with the foll...
details: https://anonhg.NetBSD.org/src/rev/1d0e39bada56
branches: ROY
changeset: 455214:1d0e39bada56
user: roy <roy%NetBSD.org@localhost>
date: Tue Jul 24 07:58:31 2018 +0000
description:
Import dhcpcd-7.0.7 with the following changes:
* host routes work correctly again
* vlanid is also used to calculate slaac stable private addresses
diffstat:
external/bsd/dhcpcd/dist/src/defs.h | 2 +-
external/bsd/dhcpcd/dist/src/ipv6.c | 11 ++++++++++-
external/bsd/dhcpcd/dist/src/route.c | 23 ++++++++++++++++++-----
3 files changed, 29 insertions(+), 7 deletions(-)
diffs (113 lines):
diff -r 1464450e3c24 -r 1d0e39bada56 external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h Thu Jun 21 11:55:19 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h Tue Jul 24 07:58:31 2018 +0000
@@ -28,7 +28,7 @@
#define CONFIG_H
#define PACKAGE "dhcpcd"
-#define VERSION "7.0.6"
+#define VERSION "7.0.7"
#ifndef CONFIG
# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
diff -r 1464450e3c24 -r 1d0e39bada56 external/bsd/dhcpcd/dist/src/ipv6.c
--- a/external/bsd/dhcpcd/dist/src/ipv6.c Thu Jun 21 11:55:19 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv6.c Tue Jul 24 07:58:31 2018 +0000
@@ -253,6 +253,7 @@
const struct in6_addr *prefix, int prefix_len,
const unsigned char *netiface, size_t netiface_len,
const unsigned char *netid, size_t netid_len,
+ unsigned short vlanid,
uint32_t *dad_counter,
const unsigned char *secret, size_t secret_len)
{
@@ -267,6 +268,8 @@
l = (size_t)(ROUNDUP8(prefix_len) / NBBY);
len = l + netiface_len + netid_len + sizeof(*dad_counter) + secret_len;
+ if (vlanid != 0)
+ len += sizeof(vlanid);
if (len > sizeof(buf)) {
errno = ENOBUFS;
return -1;
@@ -281,6 +284,12 @@
p += netiface_len;
memcpy(p, netid, netid_len);
p += netid_len;
+ /* Don't use a vlanid if not set.
+ * This ensures prior versions have the same unique address. */
+ if (vlanid != 0) {
+ memcpy(p, &vlanid, sizeof(vlanid));
+ p += sizeof(vlanid);
+ }
memcpy(p, dad_counter, sizeof(*dad_counter));
p += sizeof(*dad_counter);
memcpy(p, secret, secret_len);
@@ -333,7 +342,7 @@
r = ipv6_makestableprivate1(addr, prefix, prefix_len,
ifp->hwaddr, ifp->hwlen,
ifp->ssid, ifp->ssid_len,
- &dad,
+ ifp->vlanid, &dad,
ifp->ctx->secret, ifp->ctx->secret_len);
if (r == 0)
diff -r 1464450e3c24 -r 1d0e39bada56 external/bsd/dhcpcd/dist/src/route.c
--- a/external/bsd/dhcpcd/dist/src/route.c Thu Jun 21 11:55:19 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/route.c Tue Jul 24 07:58:31 2018 +0000
@@ -44,6 +44,21 @@
#include "route.h"
#include "sa.h"
+/*
+ * On some systems, host routes have no need for a netmask.
+ * However DHCP specifies host routes using an all-ones netmask.
+ * This handy function allows easy comparison when the two
+ * differ.
+ */
+static int
+rt_cmp_netmask(const struct rt *rt1, const struct rt *rt2)
+{
+
+ if (rt1->rt_flags & RTF_HOST && rt2->rt_flags & RTF_HOST)
+ return 0;
+ return sa_cmp(&rt1->rt_netmask, &rt2->rt_netmask);
+}
+
void
rt_init(struct dhcpcd_ctx *ctx)
{
@@ -63,14 +78,12 @@
assert(cmd != NULL);
assert(rt != NULL);
- assert(rt->rt_ifp != NULL);
- ifname = rt->rt_ifp->name;
sa_addrtop(&rt->rt_dest, dest, sizeof(dest));
prefix = sa_toprefix(&rt->rt_netmask);
sa_addrtop(&rt->rt_gateway, gateway, sizeof(gateway));
-
gateway_unspec = sa_is_unspecified(&rt->rt_gateway);
+ ifname = rt->rt_ifp == NULL ? "(null)" : rt->rt_ifp->name;
if (rt->rt_flags & RTF_HOST) {
if (gateway_unspec)
@@ -236,7 +249,7 @@
(f->rt_ifp == NULL ||
rt->rt_ifp->metric == f->rt_ifp->metric) &&
#endif
- sa_cmp(&rt->rt_netmask, &f->rt_netmask) == 0)
+ rt_cmp_netmask(f, rt) == 0)
return rt;
}
return NULL;
@@ -345,7 +358,7 @@
ort->rt_metric == nrt->rt_metric &&
#endif
sa_cmp(&ort->rt_dest, &nrt->rt_dest) == 0 &&
- sa_cmp(&ort->rt_netmask, &nrt->rt_netmask) == 0 &&
+ rt_cmp_netmask(ort, nrt) == 0 &&
sa_cmp(&ort->rt_gateway, &nrt->rt_gateway) == 0)
{
if (ort->rt_mtu == nrt->rt_mtu)
Home |
Main Index |
Thread Index |
Old Index