Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/dhcpcd/dist/src Sync
details: https://anonhg.NetBSD.org/src/rev/d02a315e6901
branches: trunk
changeset: 319527:d02a315e6901
user: roy <roy%NetBSD.org@localhost>
date: Sat Jun 02 09:44:27 2018 +0000
description:
Sync
diffstat:
external/bsd/dhcpcd/dist/src/bpf.c | 6 +++---
external/bsd/dhcpcd/dist/src/dhcp.c | 10 ++++++++--
external/bsd/dhcpcd/dist/src/dhcpcd.c | 28 ++++++++++++++++------------
external/bsd/dhcpcd/dist/src/if-options.c | 5 +----
4 files changed, 28 insertions(+), 21 deletions(-)
diffs (147 lines):
diff -r 8a1c1aee6f31 -r d02a315e6901 external/bsd/dhcpcd/dist/src/bpf.c
--- a/external/bsd/dhcpcd/dist/src/bpf.c Sat Jun 02 09:42:48 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/bpf.c Sat Jun 02 09:44:27 2018 +0000
@@ -108,7 +108,7 @@
size_t buf_len;
struct bpf_version pv;
#ifdef BIOCIMMEDIATE
- int flags;
+ unsigned int flags;
#endif
#ifndef O_CLOEXEC
int fd_opts;
@@ -411,7 +411,7 @@
/* Make sure the hardware length matches. */
BPF_STMT(BPF_LD + BPF_B + BPF_IND, offsetof(struct arphdr, ar_hln)),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K,
- sizeof((struct ether_arp *)0)->arp_sha, 1, 0),
+ sizeof(((struct ether_arp *)0)->arp_sha), 1, 0),
BPF_STMT(BPF_RET + BPF_K, 0),
};
#define bpf_arp_ether_len __arraycount(bpf_arp_ether)
@@ -540,7 +540,7 @@
#define BPF_BOOTP_ETHER_LEN __arraycount(bpf_bootp_ether)
static const struct bpf_insn bpf_bootp_filter[] = {
- /* Make sure it's an IPv4 packet. */
+ /* Make sure it's an optionless IPv4 packet. */
BPF_STMT(BPF_LD + BPF_B + BPF_IND, 0),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0x45, 1, 0),
BPF_STMT(BPF_RET + BPF_K, 0),
diff -r 8a1c1aee6f31 -r d02a315e6901 external/bsd/dhcpcd/dist/src/dhcp.c
--- a/external/bsd/dhcpcd/dist/src/dhcp.c Sat Jun 02 09:42:48 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.c Sat Jun 02 09:44:27 2018 +0000
@@ -3276,7 +3276,7 @@
struct bootp_pkt *p;
uint16_t bytes;
- if (data_len < sizeof(p->ip) + sizeof(p->udp)) {
+ if (data_len < sizeof(p->ip)) {
if (from)
from->s_addr = INADDR_ANY;
errno = ERANGE;
@@ -3291,6 +3291,12 @@
}
bytes = ntohs(p->ip.ip_len);
+ /* Check we have a payload */
+ if (bytes <= sizeof(p->ip) + sizeof(p->udp)) {
+ errno = ERANGE;
+ return -1;
+ }
+ /* Check we don't go beyond the payload */
if (bytes > data_len) {
errno = ENOBUFS;
return -1;
@@ -3334,7 +3340,7 @@
state->bpf_flags & RAW_PARTIALCSUM) == -1)
{
if (errno == EINVAL)
- logerrx("%s: UDP checksum failure from %s",
+ logerrx("%s: checksum failure from %s",
ifp->name, inet_ntoa(from));
else
logerr("%s: invalid UDP packet from %s",
diff -r 8a1c1aee6f31 -r d02a315e6901 external/bsd/dhcpcd/dist/src/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.c Sat Jun 02 09:42:48 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.c Sat Jun 02 09:44:27 2018 +0000
@@ -770,20 +770,23 @@
}
static void
-warn_iaid_conflict(struct interface *ifp, uint8_t *iaid)
+warn_iaid_conflict(struct interface *ifp, uint16_t ia_type, uint8_t *iaid)
{
struct interface *ifn;
size_t i;
+ struct if_ia *ia;
TAILQ_FOREACH(ifn, ifp->ctx->ifaces, next) {
if (ifn == ifp || !ifn->active)
continue;
- if (memcmp(ifn->options->iaid, iaid,
+ if (ia_type == 0 &&
+ memcmp(ifn->options->iaid, iaid,
sizeof(ifn->options->iaid)) == 0)
break;
for (i = 0; i < ifn->options->ia_len; i++) {
- if (memcmp(&ifn->options->ia[i].iaid, iaid,
- sizeof(ifn->options->ia[i].iaid)) == 0)
+ ia = &ifn->options->ia[i];
+ if (ia->ia_type == ia_type &&
+ memcmp(ia->iaid, iaid, sizeof(ia->iaid)) == 0)
break;
}
}
@@ -839,20 +842,21 @@
}
if (ifo->options & (DHCPCD_DUID | DHCPCD_IPV6)) {
+ struct if_ia *ia;
+
/* Report IAIDs */
loginfox("%s: IAID %s", ifp->name,
hwaddr_ntoa(ifo->iaid, sizeof(ifo->iaid),
buf, sizeof(buf)));
- warn_iaid_conflict(ifp, ifo->iaid);
+ warn_iaid_conflict(ifp, 0, ifo->iaid);
for (i = 0; i < ifo->ia_len; i++) {
- if (memcmp(ifo->iaid, ifo->ia[i].iaid,
- sizeof(ifo->iaid)))
- {
- loginfox("%s: IAID %s",
- ifp->name, hwaddr_ntoa(ifo->ia[i].iaid,
- sizeof(ifo->ia[i].iaid),
+ ia = &ifo->ia[i];
+ if (memcmp(ifo->iaid, ia->iaid, sizeof(ifo->iaid))) {
+ loginfox("%s: IA type %u IAID %s",
+ ifp->name, ia->ia_type,
+ hwaddr_ntoa(ia->iaid, sizeof(ia->iaid),
buf, sizeof(buf)));
- warn_iaid_conflict(ifp, ifo->ia[i].iaid);
+ warn_iaid_conflict(ifp, ia->ia_type, ia->iaid);
}
}
}
diff -r 8a1c1aee6f31 -r d02a315e6901 external/bsd/dhcpcd/dist/src/if-options.c
--- a/external/bsd/dhcpcd/dist/src/if-options.c Sat Jun 02 09:42:48 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/if-options.c Sat Jun 02 09:44:27 2018 +0000
@@ -1360,6 +1360,7 @@
for (sl = 0; sl < ifo->ia_len; sl++) {
if ((arg == NULL && !ifo->ia[sl].iaid_set) ||
(arg != NULL && ifo->ia[sl].iaid_set &&
+ ifo->ia[sl].ia_type == (uint16_t)i &&
ifo->ia[sl].iaid[0] == iaid[0] &&
ifo->ia[sl].iaid[1] == iaid[1] &&
ifo->ia[sl].iaid[2] == iaid[2] &&
@@ -1369,10 +1370,6 @@
break;
}
}
- if (ia && ia->ia_type != (uint16_t)i) {
- logerrx("Cannot mix IA for the same IAID");
- break;
- }
if (ia == NULL) {
ia = reallocarray(ifo->ia,
ifo->ia_len + 1, sizeof(*ifo->ia));
Home |
Main Index |
Thread Index |
Old Index