Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/mpl/dhcp/dist/common crunchgen fix
details: https://anonhg.NetBSD.org/src/rev/2c59a4e779f0
branches: trunk
changeset: 972080:2c59a4e779f0
user: manu <manu%NetBSD.org@localhost>
date: Fri May 15 12:31:03 2020 +0000
description:
crunchgen fix
Make sure local_port is not shared within a crunchgen binary. There is
more to do to get full functionnality in crunchgen, but at least this
change makes dhcpd listen on the right port again.
diffstat:
external/mpl/dhcp/dist/common/bpf.c | 6 +++---
external/mpl/dhcp/dist/common/discover.c | 6 ++----
external/mpl/dhcp/dist/common/lpf.c | 6 +++---
external/mpl/dhcp/dist/common/packet.c | 8 ++++----
external/mpl/dhcp/dist/common/raw.c | 6 +++---
external/mpl/dhcp/dist/common/socket.c | 14 +++++++-------
6 files changed, 22 insertions(+), 24 deletions(-)
diffs (196 lines):
diff -r 5e3deb25b002 -r 2c59a4e779f0 external/mpl/dhcp/dist/common/bpf.c
--- a/external/mpl/dhcp/dist/common/bpf.c Fri May 15 09:21:59 2020 +0000
+++ b/external/mpl/dhcp/dist/common/bpf.c Fri May 15 12:31:03 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bpf.c,v 1.3 2018/06/01 00:42:49 christos Exp $ */
+/* $NetBSD: bpf.c,v 1.4 2020/05/15 12:31:03 manu Exp $ */
/* bpf.c
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: bpf.c,v 1.3 2018/06/01 00:42:49 christos Exp $");
+__RCSID("$NetBSD: bpf.c,v 1.4 2020/05/15 12:31:03 manu Exp $");
#include "dhcpd.h"
#if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE) \
@@ -366,7 +366,7 @@
dhcp_bpf_relay_filter [10].k = ntohs (relay_port);
}
#endif
- p.bf_insns [8].k = ntohs (local_port);
+ p.bf_insns [8].k = ntohs (*libdhcp_callbacks.local_port);
if (ioctl (info -> rfdesc, BIOCSETF, &p) < 0)
log_fatal ("Can't install packet filter program: %m");
diff -r 5e3deb25b002 -r 2c59a4e779f0 external/mpl/dhcp/dist/common/discover.c
--- a/external/mpl/dhcp/dist/common/discover.c Fri May 15 09:21:59 2020 +0000
+++ b/external/mpl/dhcp/dist/common/discover.c Fri May 15 12:31:03 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: discover.c,v 1.2 2018/04/07 22:37:29 christos Exp $ */
+/* $NetBSD: discover.c,v 1.3 2020/05/15 12:31:03 manu Exp $ */
/* discover.c
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: discover.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
+__RCSID("$NetBSD: discover.c,v 1.3 2020/05/15 12:31:03 manu Exp $");
#include "dhcpd.h"
@@ -47,8 +47,6 @@
struct interface_info *interfaces, *dummy_interfaces, *fallback_interface;
int interfaces_invalidated;
int quiet_interface_discovery;
-u_int16_t local_port;
-u_int16_t remote_port;
u_int16_t relay_port = 0;
int dhcpv4_over_dhcpv6 = 0;
int (*dhcp_interface_setup_hook) (struct interface_info *, struct iaddr *);
diff -r 5e3deb25b002 -r 2c59a4e779f0 external/mpl/dhcp/dist/common/lpf.c
--- a/external/mpl/dhcp/dist/common/lpf.c Fri May 15 09:21:59 2020 +0000
+++ b/external/mpl/dhcp/dist/common/lpf.c Fri May 15 12:31:03 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lpf.c,v 1.2 2018/04/07 22:37:29 christos Exp $ */
+/* $NetBSD: lpf.c,v 1.3 2020/05/15 12:31:03 manu Exp $ */
/* lpf.c
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: lpf.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
+__RCSID("$NetBSD: lpf.c,v 1.3 2020/05/15 12:31:03 manu Exp $");
#include "dhcpd.h"
#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
@@ -278,7 +278,7 @@
dhcp_bpf_relay_filter [10].k = ntohs (relay_port);
}
#endif
- dhcp_bpf_filter [8].k = ntohs (local_port);
+ dhcp_bpf_filter [8].k = ntohs (*libdhcp_callbacks.local_port);
if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p,
sizeof p) < 0) {
diff -r 5e3deb25b002 -r 2c59a4e779f0 external/mpl/dhcp/dist/common/packet.c
--- a/external/mpl/dhcp/dist/common/packet.c Fri May 15 09:21:59 2020 +0000
+++ b/external/mpl/dhcp/dist/common/packet.c Fri May 15 12:31:03 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: packet.c,v 1.2 2018/04/07 22:37:29 christos Exp $ */
+/* $NetBSD: packet.c,v 1.3 2020/05/15 12:31:03 manu Exp $ */
/* packet.c
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: packet.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
+__RCSID("$NetBSD: packet.c,v 1.3 2020/05/15 12:31:03 manu Exp $");
#include "dhcpd.h"
@@ -308,10 +308,10 @@
/* Is it to the port we're serving? */
#if defined(RELAY_PORT)
- if ((udp.uh_dport != local_port) &&
+ if ((udp.uh_dport != *libdhcp_callbacks.local_port) &&
((relay_port == 0) || (udp.uh_dport != relay_port)))
#else
- if (udp.uh_dport != local_port)
+ if (udp.uh_dport != *libdhcp_callbacks.local_port)
#endif
return -1;
#endif /* USERLAND_FILTER */
diff -r 5e3deb25b002 -r 2c59a4e779f0 external/mpl/dhcp/dist/common/raw.c
--- a/external/mpl/dhcp/dist/common/raw.c Fri May 15 09:21:59 2020 +0000
+++ b/external/mpl/dhcp/dist/common/raw.c Fri May 15 12:31:03 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: raw.c,v 1.2 2018/04/07 22:37:29 christos Exp $ */
+/* $NetBSD: raw.c,v 1.3 2020/05/15 12:31:03 manu Exp $ */
/* raw.c
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: raw.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
+__RCSID("$NetBSD: raw.c,v 1.3 2020/05/15 12:31:03 manu Exp $");
#include "dhcpd.h"
@@ -60,7 +60,7 @@
/* Set up the address we're going to connect to. */
name.sin_family = AF_INET;
- name.sin_port = relay_port ? relay_port : local_port;
+ name.sin_port = relay_port ? relay_port : *libdhcp_callbacks.local_port;
name.sin_addr.s_addr = htonl (INADDR_BROADCAST);
memset (name.sin_zero, 0, sizeof (name.sin_zero));
diff -r 5e3deb25b002 -r 2c59a4e779f0 external/mpl/dhcp/dist/common/socket.c
--- a/external/mpl/dhcp/dist/common/socket.c Fri May 15 09:21:59 2020 +0000
+++ b/external/mpl/dhcp/dist/common/socket.c Fri May 15 12:31:03 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: socket.c,v 1.2 2018/04/07 22:37:29 christos Exp $ */
+/* $NetBSD: socket.c,v 1.3 2020/05/15 12:31:03 manu Exp $ */
/* socket.c
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: socket.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
+__RCSID("$NetBSD: socket.c,v 1.3 2020/05/15 12:31:03 manu Exp $");
/* SO_BINDTODEVICE support added by Elliot Poger (poger%leland.stanford.edu@localhost).
* This sockopt allows a socket to be bound to a particular interface,
@@ -165,7 +165,7 @@
case AF_INET6:
addr6 = (struct sockaddr_in6 *)&name;
addr6->sin6_family = AF_INET6;
- addr6->sin6_port = local_port;
+ addr6->sin6_port = *libdhcp_callbacks.local_port;
#if defined(RELAY_PORT)
if (relay_port &&
((info->flags & INTERFACE_STREAMS) == INTERFACE_UPSTREAM))
@@ -201,7 +201,7 @@
default:
addr = (struct sockaddr_in *)&name;
addr->sin_family = AF_INET;
- addr->sin_port = relay_port ? relay_port : local_port;
+ addr->sin_port = relay_port ? relay_port : *libdhcp_callbacks.local_port;
memcpy(&addr->sin_addr,
&local_address,
sizeof(addr->sin_addr));
@@ -535,9 +535,9 @@
}
log_info("Bound to [%s]:%d",
addr6_str,
- (int) ntohs(local_port));
+ (int) ntohs(*libdhcp_callbacks.local_port));
} else {
- log_info("Bound to *:%d", (int) ntohs(local_port));
+ log_info("Bound to *:%d", (int) ntohs(*libdhcp_callbacks.local_port));
}
}
@@ -691,7 +691,7 @@
global_v6_socket = -1;
log_info("Unbound from *:%d",
- (int) ntohs(local_port));
+ (int) ntohs(*libdhcp_callbacks.local_port));
}
#if defined(RELAY_PORT)
if (relay_port && (relay_port_v6_socket_references == 0)) {
Home |
Main Index |
Thread Index |
Old Index