summaryrefslogtreecommitdiffstats
path: root/usr.sbin/dhcpd/options.c
diff options
context:
space:
mode:
authoryasuoka <yasuoka@openbsd.org>2014-07-11 09:42:27 +0000
committeryasuoka <yasuoka@openbsd.org>2014-07-11 09:42:27 +0000
commit84d8c0490a01f97e4ce467a7c833d1cfccb94e06 (patch)
tree2e35a2f0ed9b65e56f5fbf6b9ad1417af18b62dc /usr.sbin/dhcpd/options.c
parentMore e_os2.h clean up. Also move the includes inside the guard. (diff)
downloadwireguard-openbsd-84d8c0490a01f97e4ce467a7c833d1cfccb94e06.tar.xz
wireguard-openbsd-84d8c0490a01f97e4ce467a7c833d1cfccb94e06.zip
Add -u option to bind UDP port as a socket to answer DHCPINFORM from
the clients on non ethernet interfaces (eg. tun(4) or pppx(4)). input krw ok krw
Diffstat (limited to 'usr.sbin/dhcpd/options.c')
-rw-r--r--usr.sbin/dhcpd/options.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/dhcpd/options.c b/usr.sbin/dhcpd/options.c
index a42c688e466..91f6395425b 100644
--- a/usr.sbin/dhcpd/options.c
+++ b/usr.sbin/dhcpd/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.26 2010/01/02 04:21:16 krw Exp $ */
+/* $OpenBSD: options.c,v 1.27 2014/07/11 09:42:27 yasuoka Exp $ */
/* DHCP options parsing and reassembly. */
@@ -509,6 +509,14 @@ do_packet(struct interface_info *interface, struct dhcp_packet *packet,
if (tp.options_valid &&
tp.options[DHO_DHCP_MESSAGE_TYPE].data)
tp.packet_type = tp.options[DHO_DHCP_MESSAGE_TYPE].data[0];
+
+ if (interface->is_udpsock) {
+ if (tp.packet_type != DHCPINFORM) {
+ note("Unable to handle a DHCP message type=%d on UDP "
+ "socket", tp.packet_type);
+ return;
+ }
+ }
if (tp.packet_type)
dhcp(&tp);
else