Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src Apply patch, requested by roy in ticket #825:
details: https://anonhg.NetBSD.org/src/rev/5b731e1027b5
branches: netbsd-9
changeset: 963771:5b731e1027b5
user: martin <martin%NetBSD.org@localhost>
date: Sun Apr 12 08:29:40 2020 +0000
description:
Apply patch, requested by roy in ticket #825:
external/bsd/dhcpcd/dist/src/arp.c (apply patch)
external/bsd/dhcpcd/dist/src/arp.h (apply patch)
external/bsd/dhcpcd/dist/src/bpf.c (apply patch)
external/bsd/dhcpcd/dist/src/bpf.h (apply patch)
external/bsd/dhcpcd/dist/src/common.h (apply patch)
external/bsd/dhcpcd/dist/src/defs.h (apply patch)
external/bsd/dhcpcd/dist/src/dhcp.c (apply patch)
external/bsd/dhcpcd/dist/src/dhcp6.c (apply patch)
external/bsd/dhcpcd/dist/src/dhcp6.h (apply patch)
external/bsd/dhcpcd/dist/src/dhcpcd.c (apply patch)
external/bsd/dhcpcd/dist/src/eloop.h (apply patch)
external/bsd/dhcpcd/dist/src/if-bsd.c (apply patch)
external/bsd/dhcpcd/dist/src/if-options.c (apply patch)
external/bsd/dhcpcd/dist/src/if.c (apply patch)
external/bsd/dhcpcd/dist/src/if.h (apply patch)
external/bsd/dhcpcd/dist/src/ipv4ll.c (apply patch)
external/bsd/dhcpcd/dist/src/ipv6.c (apply patch)
external/bsd/dhcpcd/dist/src/ipv6nd.c (apply patch)
external/bsd/dhcpcd/dist/src/ipv6nd.h (apply patch)
external/bsd/dhcpcd/dist/src/logerr.c (apply patch)
external/bsd/dhcpcd/dist/src/logerr.h (apply patch)
doc/3RDPARTY (apply patch)
Update to dhcpcd-8.1.7 which fixes the following issues:
* Decode interface complex interface names eth0.100:2 eth0i100:2.
This allows us to ignore some virtual interfaces by default
* ARP: Report L2 header address on conflict for more clarity
* DHCP: Support jumbo frames (untested)
* DHCP6: Clean up old lease on failure to confirm/rebind, etc
* RA: Prefer older routers - fixes PR bin/54997
* INET6: Obscure prefixes are now calculated correctly
* macro logerr commands to allow an alternative logger
diffstat:
doc/3RDPARTY | 8 +-
external/bsd/dhcpcd/dist/src/arp.c | 39 ++-
external/bsd/dhcpcd/dist/src/arp.h | 7 +-
external/bsd/dhcpcd/dist/src/bpf.c | 39 +++-
external/bsd/dhcpcd/dist/src/bpf.h | 2 +
external/bsd/dhcpcd/dist/src/common.h | 10 +
external/bsd/dhcpcd/dist/src/defs.h | 2 +-
external/bsd/dhcpcd/dist/src/dhcp.c | 75 +++---
external/bsd/dhcpcd/dist/src/dhcp6.c | 327 +++++++++++++----------------
external/bsd/dhcpcd/dist/src/dhcp6.h | 2 -
external/bsd/dhcpcd/dist/src/dhcpcd.c | 19 +-
external/bsd/dhcpcd/dist/src/eloop.h | 3 +
external/bsd/dhcpcd/dist/src/if-bsd.c | 1 +
external/bsd/dhcpcd/dist/src/if-options.c | 14 +-
external/bsd/dhcpcd/dist/src/if.c | 46 +++-
external/bsd/dhcpcd/dist/src/if.h | 6 +
external/bsd/dhcpcd/dist/src/ipv4ll.c | 2 +-
external/bsd/dhcpcd/dist/src/ipv6.c | 46 +--
external/bsd/dhcpcd/dist/src/ipv6nd.c | 94 +++++---
external/bsd/dhcpcd/dist/src/ipv6nd.h | 4 +-
external/bsd/dhcpcd/dist/src/logerr.c | 28 +-
external/bsd/dhcpcd/dist/src/logerr.h | 45 +++-
22 files changed, 474 insertions(+), 345 deletions(-)
diffs (truncated from 1918 to 300 lines):
diff -r ad53f0523fdc -r 5b731e1027b5 doc/3RDPARTY
--- a/doc/3RDPARTY Thu Apr 09 11:29:33 2020 +0000
+++ b/doc/3RDPARTY Sun Apr 12 08:29:40 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: 3RDPARTY,v 1.1640.2.12 2020/01/28 09:48:33 martin Exp $
+# $NetBSD: 3RDPARTY,v 1.1640.2.13 2020/04/12 08:29:40 martin Exp $
#
# This file contains a list of the software that has been integrated into
# NetBSD where we are not the primary maintainer.
@@ -341,12 +341,12 @@
Use the dhcp2netbsd script.
Package: dhcpcd
-Version: 8.1.6
-Current Vers: 8.1.6
+Version: 8.1.7
+Current Vers: 8.1.7
Maintainer: roy
Archive Site: ftp://roy.marples.name/pub/dhcpcd/
Home Page: http://roy.marples.name/projects/dhcpcd/
-Date: 2020-01-27
+Date: 2020-04-10
Mailing List: dhcpcd-discuss%marples.name@localhost
License: BSD (2-clause)
Location: external/bsd/dhcpcd/dist
diff -r ad53f0523fdc -r 5b731e1027b5 external/bsd/dhcpcd/dist/src/arp.c
--- a/external/bsd/dhcpcd/dist/src/arp.c Thu Apr 09 11:29:33 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.c Sun Apr 12 08:29:40 2020 +0000
@@ -41,7 +41,7 @@
#include <string.h>
#include <unistd.h>
-#define ELOOP_QUEUE 5
+#define ELOOP_QUEUE ELOOP_ARP
#include "config.h"
#include "arp.h"
#include "bpf.h"
@@ -55,8 +55,9 @@
#include "logerr.h"
#if defined(ARP)
-#define ARP_LEN \
- (sizeof(struct arphdr) + (2 * sizeof(uint32_t)) + (2 * HWADDR_LEN))
+#define ARP_LEN \
+ (FRAMEHDRLEN_MAX + \
+ sizeof(struct arphdr) + (2 * sizeof(uint32_t)) + (2 * HWADDR_LEN))
/* ARP debugging can be quite noisy. Enable this for more noise! */
//#define ARP_DEBUG
@@ -115,7 +116,8 @@
arp_report_conflicted(const struct arp_state *astate,
const struct arp_msg *amsg)
{
- char buf[HWADDR_LEN * 3];
+ char abuf[HWADDR_LEN * 3];
+ char fbuf[HWADDR_LEN * 3];
if (amsg == NULL) {
logerrx("%s: DAD detected %s",
@@ -123,9 +125,16 @@
return;
}
- logerrx("%s: hardware address %s claims %s",
- astate->iface->name,
- hwaddr_ntoa(amsg->sha, astate->iface->hwlen, buf, sizeof(buf)),
+ hwaddr_ntoa(amsg->sha, astate->iface->hwlen, abuf, sizeof(abuf));
+ if (bpf_frame_header_len(astate->iface) == 0) {
+ logerrx("%s: %s claims %s",
+ astate->iface->name, abuf, inet_ntoa(astate->addr));
+ return;
+ }
+
+ logerrx("%s: %s(%s) claims %s",
+ astate->iface->name, abuf,
+ hwaddr_ntoa(amsg->fsha, astate->iface->hwlen, fbuf, sizeof(fbuf)),
inet_ntoa(astate->addr));
}
@@ -209,6 +218,7 @@
static void
arp_packet(struct interface *ifp, uint8_t *data, size_t len)
{
+ size_t fl = bpf_frame_header_len(ifp), falen;
const struct interface *ifn;
struct arphdr ar;
struct arp_msg arm;
@@ -216,6 +226,21 @@
struct arp_state *astate, *astaten;
uint8_t *hw_s, *hw_t;
+ /* Copy the frame header source and destination out */
+ memset(&arm, 0, sizeof(arm));
+ if (fl != 0) {
+ hw_s = bpf_frame_header_src(ifp, data, &falen);
+ if (hw_s != NULL && falen <= sizeof(arm.fsha))
+ memcpy(arm.fsha, hw_s, falen);
+ hw_t = bpf_frame_header_dst(ifp, data, &falen);
+ if (hw_t != NULL && falen <= sizeof(arm.ftha))
+ memcpy(arm.ftha, hw_t, falen);
+
+ /* Skip past the frame header */
+ data += fl;
+ len -= fl;
+ }
+
/* We must have a full ARP header */
if (len < sizeof(ar))
return;
diff -r ad53f0523fdc -r 5b731e1027b5 external/bsd/dhcpcd/dist/src/arp.h
--- a/external/bsd/dhcpcd/dist/src/arp.h Thu Apr 09 11:29:33 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.h Sun Apr 12 08:29:40 2020 +0000
@@ -54,10 +54,13 @@
struct arp_msg {
uint16_t op;
- unsigned char sha[HWADDR_LEN];
+ uint8_t sha[HWADDR_LEN];
struct in_addr sip;
- unsigned char tha[HWADDR_LEN];
+ uint8_t tha[HWADDR_LEN];
struct in_addr tip;
+ /* Frame header and sender to diagnose failures */
+ uint8_t fsha[HWADDR_LEN];
+ uint8_t ftha[HWADDR_LEN];
};
struct arp_state {
diff -r ad53f0523fdc -r 5b731e1027b5 external/bsd/dhcpcd/dist/src/bpf.c
--- a/external/bsd/dhcpcd/dist/src/bpf.c Thu Apr 09 11:29:33 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/bpf.c Sun Apr 12 08:29:40 2020 +0000
@@ -93,6 +93,38 @@
}
}
+void *
+bpf_frame_header_src(const struct interface *ifp, void *fh, size_t *len)
+{
+ uint8_t *f = fh;
+
+ switch (ifp->family) {
+ case ARPHRD_ETHER:
+ *len = sizeof(((struct ether_header *)0)->ether_shost);
+ return f + offsetof(struct ether_header, ether_shost);
+ default:
+ *len = 0;
+ errno = ENOTSUP;
+ return NULL;
+ }
+}
+
+void *
+bpf_frame_header_dst(const struct interface *ifp, void *fh, size_t *len)
+{
+ uint8_t *f = fh;
+
+ switch (ifp->family) {
+ case ARPHRD_ETHER:
+ *len = sizeof(((struct ether_header *)0)->ether_dhost);
+ return f + offsetof(struct ether_header, ether_dhost);
+ default:
+ *len = 0;
+ errno = ENOTSUP;
+ return NULL;
+ }
+}
+
static const uint8_t etherbcastaddr[] =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
@@ -215,7 +247,6 @@
bpf_read(struct interface *ifp, int fd, void *data, size_t len,
unsigned int *flags)
{
- ssize_t fl = (ssize_t)bpf_frame_header_len(ifp);
ssize_t bytes;
struct ipv4_state *state = IPV4_STATE(ifp);
@@ -250,10 +281,10 @@
*flags |= BPF_BCAST;
else
*flags &= ~BPF_BCAST;
- payload += fl;
- bytes = (ssize_t)packet.bh_caplen - fl;
- if ((size_t)bytes > len)
+ if (packet.bh_caplen > len)
bytes = (ssize_t)len;
+ else
+ bytes = (ssize_t)packet.bh_caplen;
memcpy(data, payload, (size_t)bytes);
next:
state->buffer_pos += BPF_WORDALIGN(packet.bh_hdrlen +
diff -r ad53f0523fdc -r 5b731e1027b5 external/bsd/dhcpcd/dist/src/bpf.h
--- a/external/bsd/dhcpcd/dist/src/bpf.h Thu Apr 09 11:29:33 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/bpf.h Sun Apr 12 08:29:40 2020 +0000
@@ -57,6 +57,8 @@
extern const char *bpf_name;
size_t bpf_frame_header_len(const struct interface *);
+void *bpf_frame_header_src(const struct interface *, void *, size_t *);
+void *bpf_frame_header_dst(const struct interface *, void *, size_t *);
int bpf_frame_bcast(const struct interface *, const char *frame);
int bpf_open(struct interface *, int (*)(struct interface *, int));
int bpf_close(struct interface *, int);
diff -r ad53f0523fdc -r 5b731e1027b5 external/bsd/dhcpcd/dist/src/common.h
--- a/external/bsd/dhcpcd/dist/src/common.h Thu Apr 09 11:29:33 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/common.h Sun Apr 12 08:29:40 2020 +0000
@@ -34,6 +34,16 @@
#include <stdint.h>
#include <stdio.h>
+/* Define eloop queues here, as other apps share eloop.h */
+#define ELOOP_DHCPCD 1 /* default queue */
+#define ELOOP_DHCP 2
+#define ELOOP_ARP 3
+#define ELOOP_IPV4LL 4
+#define ELOOP_IPV6 5
+#define ELOOP_IPV6ND 6
+#define ELOOP_IPV6RA_EXPIRE 7
+#define ELOOP_DHCP6 8
+
#ifndef HOSTNAME_MAX_LEN
#define HOSTNAME_MAX_LEN 250 /* 255 - 3 (FQDN) - 2 (DNS enc) */
#endif
diff -r ad53f0523fdc -r 5b731e1027b5 external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h Thu Apr 09 11:29:33 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h Sun Apr 12 08:29:40 2020 +0000
@@ -29,7 +29,7 @@
#define CONFIG_H
#define PACKAGE "dhcpcd"
-#define VERSION "8.1.6"
+#define VERSION "8.1.7"
#ifndef CONFIG
# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
diff -r ad53f0523fdc -r 5b731e1027b5 external/bsd/dhcpcd/dist/src/dhcp.c
--- a/external/bsd/dhcpcd/dist/src/dhcp.c Thu Apr 09 11:29:33 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.c Sun Apr 12 08:29:40 2020 +0000
@@ -56,8 +56,9 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
-#define ELOOP_QUEUE 2
+#include <syslog.h>
+
+#define ELOOP_QUEUE ELOOP_DHCP
#include "config.h"
#include "arp.h"
#include "bpf.h"
@@ -2758,7 +2759,7 @@
}
static void
-log_dhcp(logfunc_t *logfunc, const char *msg,
+log_dhcp(int loglevel, const char *msg,
const struct interface *ifp, const struct bootp *bootp, size_t bootp_len,
const struct in_addr *from, int ad)
{
@@ -2805,10 +2806,10 @@
print_string(sname, sizeof(sname), OT_STRING | OT_DOMAIN,
bootp->sname, sizeof(bootp->sname));
if (a == NULL)
- logfunc("%s: %s %s %s `%s'",
+ logmessage(loglevel, "%s: %s %s %s `%s'",
ifp->name, msg, tfrom, inet_ntoa(addr), sname);
else
- logfunc("%s: %s %s %s %s `%s'",
+ logmessage(loglevel, "%s: %s %s %s %s `%s'",
ifp->name, msg, a, tfrom, inet_ntoa(addr), sname);
} else {
if (r != 0) {
@@ -2816,10 +2817,10 @@
addr = *from;
}
if (a == NULL)
- logfunc("%s: %s %s %s",
+ logmessage(loglevel, "%s: %s %s %s",
ifp->name, msg, tfrom, inet_ntoa(addr));
else
- logfunc("%s: %s %s %s %s",
+ logmessage(loglevel, "%s: %s %s %s %s",
ifp->name, msg, a, tfrom, inet_ntoa(addr));
}
free(a);
@@ -2949,7 +2950,7 @@
(uint8_t *)bootp, bootp_len, 4, type,
auth, auth_len) == NULL)
{
- LOGDHCP0(logerrx, "authentication failed");
+ LOGDHCP0(LOG_ERR, "authentication failed");
return;
}
if (state->auth.token)
@@ -2959,10 +2960,10 @@
loginfox("%s: accepted reconfigure key", ifp->name);
} else if (ifo->auth.options & DHCPCD_AUTH_SEND) {
if (ifo->auth.options & DHCPCD_AUTH_REQUIRE) {
- LOGDHCP0(logerrx, "no authentication");
Home |
Main Index |
Thread Index |
Old Index