Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src Pull up the following revisions, requested by roy in tick...
details: https://anonhg.NetBSD.org/src/rev/d09ece995c02
branches: netbsd-9
changeset: 461303:d09ece995c02
user: martin <martin%NetBSD.org@localhost>
date: Fri Nov 22 08:01:49 2019 +0000
description:
Pull up the following revisions, requested by roy in ticket #461:
external/bsd/dhcpcd/dist/src/arp.c up to 1.1.1.13
external/bsd/dhcpcd/dist/src/arp.h up to 1.1.1.9
external/bsd/dhcpcd/dist/src/control.c up to 1.1.1.9
external/bsd/dhcpcd/dist/src/defs.h up to 1.1.1.33
external/bsd/dhcpcd/dist/src/dhcp.c up to 1.30
external/bsd/dhcpcd/dist/src/dhcp6.c up to 1.14
external/bsd/dhcpcd/dist/src/dhcpcd.c up to 1.29
external/bsd/dhcpcd/dist/src/eloop.c up to 1.1.1.8
external/bsd/dhcpcd/dist/src/eloop.h up to 1.1.1.6
external/bsd/dhcpcd/dist/src/if-bsd.c up to 1.15
external/bsd/dhcpcd/dist/src/if.c up to 1.1.1.18
external/bsd/dhcpcd/dist/src/if.h up to 1.1.1.13
external/bsd/dhcpcd/dist/src/ipv4.c up to 1.1.1.19
external/bsd/dhcpcd/dist/src/ipv6nd.c up to 1.13
external/bsd/dhcpcd/dist/src/ipv6nd.h up to 1.1.1.14
external/bsd/dhcpcd/dist/src/script.c up to 1.1.1.12
doc/3RDPARTY (manually adjusted)
Import dhcpcd-8.1.2 with the following changes:
* hooks: STOPPED is now run on timeout and exit
* BSD: Use IP_REVCIF rather than IN_PKTINFO
* DHCP: When rebinding, ensure we have a DHCP ARP state
* RA: Sort routers when reachability changes
* RA: Apply hoplimit, reachable and retrans timer values to kernel
* RA: Warn if advertised MTU > interface MTU
* dhcpcd: Report SSID connection to when we gain carrier
* DHCP: Fix corruption of address flags when renewing
diffstat:
doc/3RDPARTY | 8 +-
external/bsd/dhcpcd/dist/src/arp.c | 17 +-
external/bsd/dhcpcd/dist/src/arp.h | 1 +
external/bsd/dhcpcd/dist/src/control.c | 6 +-
external/bsd/dhcpcd/dist/src/defs.h | 2 +-
external/bsd/dhcpcd/dist/src/dhcp.c | 204 +++++++++++---------
external/bsd/dhcpcd/dist/src/dhcp6.c | 79 +++++---
external/bsd/dhcpcd/dist/src/dhcpcd.c | 32 +++-
external/bsd/dhcpcd/dist/src/eloop.c | 27 ++-
external/bsd/dhcpcd/dist/src/eloop.h | 1 +
external/bsd/dhcpcd/dist/src/if-bsd.c | 71 +++++-
external/bsd/dhcpcd/dist/src/if.c | 20 +-
external/bsd/dhcpcd/dist/src/if.h | 3 +
external/bsd/dhcpcd/dist/src/ipv4.c | 25 +-
external/bsd/dhcpcd/dist/src/ipv6nd.c | 323 +++++++++++++++++++-------------
external/bsd/dhcpcd/dist/src/ipv6nd.h | 5 +
external/bsd/dhcpcd/dist/src/script.c | 87 +++++---
17 files changed, 561 insertions(+), 350 deletions(-)
diffs (truncated from 1641 to 300 lines):
diff -r 027e0b0b0b79 -r d09ece995c02 doc/3RDPARTY
--- a/doc/3RDPARTY Thu Nov 21 19:29:58 2019 +0000
+++ b/doc/3RDPARTY Fri Nov 22 08:01:49 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: 3RDPARTY,v 1.1640.2.6 2019/10/17 19:34:12 martin Exp $
+# $NetBSD: 3RDPARTY,v 1.1640.2.7 2019/11/22 08:01:49 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.1
-Current Vers: 8.1.1
+Version: 8.1.2
+Current Vers: 8.1.2
Maintainer: roy
Archive Site: ftp://roy.marples.name/pub/dhcpcd/
Home Page: http://roy.marples.name/projects/dhcpcd/
-Date: 2019-10-16
+Date: 2019-11-13
Mailing List: dhcpcd-discuss%marples.name@localhost
License: BSD (2-clause)
Location: external/bsd/dhcpcd/dist
diff -r 027e0b0b0b79 -r d09ece995c02 external/bsd/dhcpcd/dist/src/arp.c
--- a/external/bsd/dhcpcd/dist/src/arp.c Thu Nov 21 19:29:58 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.c Fri Nov 22 08:01:49 2019 +0000
@@ -206,7 +206,6 @@
return true;
}
-
static void
arp_packet(struct interface *ifp, uint8_t *data, size_t len)
{
@@ -280,9 +279,9 @@
}
static void
-arp_tryfree(struct interface *ifp)
+arp_tryfree(struct iarp_state *state)
{
- struct iarp_state *state = ARP_STATE(ifp);
+ struct interface *ifp = state->ifp;
/* If there are no more ARP states, close the socket. */
if (TAILQ_FIRST(&state->arp_states) == NULL) {
@@ -302,15 +301,14 @@
static void
arp_read(void *arg)
{
- struct interface *ifp = arg;
- struct iarp_state *state;
+ struct iarp_state *state = arg;
+ struct interface *ifp = state->ifp;
uint8_t buf[ARP_LEN];
ssize_t bytes;
/* Some RAW mechanisms are generic file descriptors, not sockets.
* This means we have no kernel call to just get one packet,
* so we have to process the entire buffer. */
- state = ARP_STATE(ifp);
state->bpf_flags &= ~BPF_EOF;
state->bpf_flags |= BPF_READING;
while (!(state->bpf_flags & BPF_EOF)) {
@@ -329,7 +327,7 @@
if (state != NULL) {
state->bpf_flags &= ~BPF_READING;
/* Try and free the state if nothing left to do. */
- arp_tryfree(ifp);
+ arp_tryfree(state);
}
}
@@ -343,7 +341,7 @@
state->bpf_fd = bpf_open(ifp, bpf_arp);
if (state->bpf_fd == -1)
return -1;
- eloop_event_add(ifp->ctx->eloop, state->bpf_fd, arp_read, ifp);
+ eloop_event_add(ifp->ctx->eloop, state->bpf_fd, arp_read, state);
}
return state->bpf_fd;
}
@@ -571,6 +569,7 @@
logerr(__func__);
return NULL;
}
+ state->ifp = ifp;
state->bpf_fd = -1;
state->bpf_flags = 0;
TAILQ_INIT(&state->arp_states);
@@ -618,7 +617,7 @@
if (astate->free_cb)
astate->free_cb(astate);
free(astate);
- arp_tryfree(ifp);
+ arp_tryfree(state);
}
void
diff -r 027e0b0b0b79 -r d09ece995c02 external/bsd/dhcpcd/dist/src/arp.h
--- a/external/bsd/dhcpcd/dist/src/arp.h Thu Nov 21 19:29:58 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.h Fri Nov 22 08:01:49 2019 +0000
@@ -78,6 +78,7 @@
TAILQ_HEAD(arp_statehead, arp_state);
struct iarp_state {
+ struct interface *ifp;
int bpf_fd;
unsigned int bpf_flags;
struct arp_statehead arp_states;
diff -r 027e0b0b0b79 -r d09ece995c02 external/bsd/dhcpcd/dist/src/control.c
--- a/external/bsd/dhcpcd/dist/src/control.c Thu Nov 21 19:29:58 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/control.c Fri Nov 22 08:01:49 2019 +0000
@@ -274,9 +274,8 @@
if (ctx->control_fd == -1)
return 0;
- eloop_event_delete(ctx->eloop, ctx->control_fd);
- close(ctx->control_fd);
- ctx->control_fd = -1;
+
+ control_close(ctx);
if (unlink(ctx->control_sock) == -1)
retval = -1;
@@ -455,6 +454,7 @@
{
if (ctx->control_fd != -1) {
+ eloop_event_delete(ctx->eloop, ctx->control_fd);
close(ctx->control_fd);
ctx->control_fd = -1;
}
diff -r 027e0b0b0b79 -r d09ece995c02 external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h Thu Nov 21 19:29:58 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h Fri Nov 22 08:01:49 2019 +0000
@@ -29,7 +29,7 @@
#define CONFIG_H
#define PACKAGE "dhcpcd"
-#define VERSION "8.1.1"
+#define VERSION "8.1.2"
#ifndef CONFIG
# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
diff -r 027e0b0b0b79 -r d09ece995c02 external/bsd/dhcpcd/dist/src/dhcp.c
--- a/external/bsd/dhcpcd/dist/src/dhcp.c Thu Nov 21 19:29:58 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.c Fri Nov 22 08:01:49 2019 +0000
@@ -41,6 +41,10 @@
#include <netinet/udp.h>
#undef __FAVOR_BSD
+#ifdef AF_LINK
+# include <net/if_dl.h>
+#endif
+
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -132,9 +136,7 @@
#endif
static void dhcp_handledhcp(struct interface *, struct bootp *, size_t,
const struct in_addr *);
-#ifdef IP_PKTINFO
static void dhcp_handleifudp(void *);
-#endif
static int dhcp_initstate(struct interface *);
void
@@ -1550,7 +1552,10 @@
n = 1;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n)) == -1)
goto eexit;
-#ifdef IP_RECVPKTINFO
+#ifdef IP_RECVIF
+ if (setsockopt(s, IPPROTO_IP, IP_RECVIF, &n, sizeof(n)) == -1)
+ goto eexit;
+#else
if (setsockopt(s, IPPROTO_IP, IP_RECVPKTINFO, &n, sizeof(n)) == -1)
goto eexit;
#endif
@@ -1647,39 +1652,36 @@
static ssize_t
dhcp_sendudp(struct interface *ifp, struct in_addr *to, void *data, size_t len)
{
- int s;
- struct msghdr msg;
- struct sockaddr_in sin;
- struct iovec iov[1];
+ struct sockaddr_in sin = {
+ .sin_family = AF_INET,
+ .sin_addr = *to,
+ .sin_port = htons(BOOTPS),
+#ifdef HAVE_SA_LEN
+ .sin_len = sizeof(sin),
+#endif
+ };
+ struct iovec iov[] = {
+ { .iov_base = data, .iov_len = len }
+ };
+ struct msghdr msg = {
+ .msg_name = (void *)&sin,
+ .msg_namelen = sizeof(sin),
+ .msg_iov = iov,
+ .msg_iovlen = 1,
+ };
struct dhcp_state *state = D_STATE(ifp);
ssize_t r;
-
- iov[0].iov_base = data;
- iov[0].iov_len = len;
-
- memset(&sin, 0, sizeof(sin));
- sin.sin_family = AF_INET;
- sin.sin_addr = *to;
- sin.sin_port = htons(BOOTPS);
-#ifdef HAVE_SA_LEN
- sin.sin_len = sizeof(sin);
-#endif
-
- memset(&msg, 0, sizeof(msg));
- msg.msg_name = (void *)&sin;
- msg.msg_namelen = sizeof(sin);
- msg.msg_iov = iov;
- msg.msg_iovlen = 1;
-
- s = state->udp_fd;
- if (s == -1) {
- s = dhcp_openudp(ifp);
- if (s == -1)
+ int fd;
+
+ fd = state->udp_fd;
+ if (fd == -1) {
+ fd = dhcp_openudp(ifp);
+ if (fd == -1)
return -1;
}
- r = sendmsg(s, &msg, 0);
+ r = sendmsg(fd, &msg, 0);
if (state->udp_fd == -1)
- close(s);
+ close(fd);
return r;
}
@@ -1780,7 +1782,7 @@
* As such we remove it from consideration without actually
* stopping the interface. */
if (r == -1) {
- logerr("%s: if_sendraw", ifp->name);
+ logerr("%s: bpf_send", ifp->name);
switch(errno) {
case ENETDOWN:
case ENETRESET:
@@ -2257,30 +2259,27 @@
ipv4_applyaddr(ifp);
-#ifdef IP_PKTINFO
/* Close the BPF filter as we can now receive DHCP messages
* on a UDP socket. */
- if (state->udp_fd == -1 ||
- (state->old != NULL && state->old->yiaddr != state->new->yiaddr))
- {
- dhcp_close(ifp);
- /* If not in master mode, open an address specific socket. */
- if (ctx->udp_fd == -1) {
- state->udp_fd = dhcp_openudp(ifp);
- if (state->udp_fd == -1) {
- logerr(__func__);
- /* Address sharing without master mode is
- * not supported. It's also possible another
- * DHCP client could be running which is
- * even worse.
- * We still need to work, so re-open BPF. */
- dhcp_openbpf(ifp);
- } else
- eloop_event_add(ctx->eloop,
- state->udp_fd, dhcp_handleifudp, ifp);
- }
+ if (!(state->udp_fd == -1 ||
+ (state->old != NULL && state->old->yiaddr != state->new->yiaddr)))
+ return;
+ dhcp_close(ifp);
+
+ /* If not in master mode, open an address specific socket. */
+ if (ctx->udp_fd != -1)
+ return;
+ state->udp_fd = dhcp_openudp(ifp);
+ if (state->udp_fd == -1) {
+ logerr(__func__);
+ /* Address sharing without master mode is not supported.
+ * It's also possible another DHCP client could be running,
+ * which is even worse.
+ * We still need to work, so re-open BPF. */
+ dhcp_openbpf(ifp);
+ return;
Home |
Main Index |
Thread Index |
Old Index