Module Name: src
Committed By: roy
Date: Sat Jun 2 09:44:27 UTC 2018
Modified Files:
src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcpcd.c if-options.c
Log Message:
Sync
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/src/bpf.c
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/dhcpcd/dist/src/dhcp.c \
src/external/bsd/dhcpcd/dist/src/if-options.c
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/dhcpcd/dist/src/bpf.c
diff -u src/external/bsd/dhcpcd/dist/src/bpf.c:1.6 src/external/bsd/dhcpcd/dist/src/bpf.c:1.7
--- src/external/bsd/dhcpcd/dist/src/bpf.c:1.6 Mon Jan 1 11:50:56 2018
+++ src/external/bsd/dhcpcd/dist/src/bpf.c Sat Jun 2 09:44:27 2018
@@ -108,7 +108,7 @@ bpf_open(struct interface *ifp, int (*fi
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 @@ static const struct bpf_insn bpf_arp_eth
/* 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 @@ static const struct bpf_insn bpf_bootp_e
#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),
Index: src/external/bsd/dhcpcd/dist/src/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp.c:1.9 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.10
--- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.9 Tue Mar 27 06:16:34 2018
+++ src/external/bsd/dhcpcd/dist/src/dhcp.c Sat Jun 2 09:44:27 2018
@@ -3276,7 +3276,7 @@ valid_udp_packet(void *data, size_t data
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 @@ valid_udp_packet(void *data, size_t data
}
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 @@ dhcp_handlepacket(struct interface *ifp,
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",
Index: src/external/bsd/dhcpcd/dist/src/if-options.c
diff -u src/external/bsd/dhcpcd/dist/src/if-options.c:1.9 src/external/bsd/dhcpcd/dist/src/if-options.c:1.10
--- src/external/bsd/dhcpcd/dist/src/if-options.c:1.9 Wed May 2 22:08:45 2018
+++ src/external/bsd/dhcpcd/dist/src/if-options.c Sat Jun 2 09:44:27 2018
@@ -1360,6 +1360,7 @@ parse_option(struct dhcpcd_ctx *ctx, con
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 @@ parse_option(struct dhcpcd_ctx *ctx, con
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));
Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.10 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.11
--- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.10 Fri Apr 6 10:47:47 2018
+++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c Sat Jun 2 09:44:27 2018
@@ -770,20 +770,23 @@ dhcpcd_handlecarrier(struct dhcpcd_ctx *
}
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 @@ dhcpcd_startinterface(void *arg)
}
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);
}
}
}