summaryrefslogtreecommitdiffstats
path: root/usr.sbin/dhcpd/options.c
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2007-10-09 03:17:34 +0000
committerkrw <krw@openbsd.org>2007-10-09 03:17:34 +0000
commit7eb1ada035d941b8d80d525d2cadb5fa16f7b796 (patch)
treee72a7bd35a9c37f4e2f0c227c4905a8caaef2d2f /usr.sbin/dhcpd/options.c
parentMALLOC+bzero -> malloc+M_ZERO. Don't forget FREE->free this time. (diff)
downloadwireguard-openbsd-7eb1ada035d941b8d80d525d2cadb5fa16f7b796.tar.xz
wireguard-openbsd-7eb1ada035d941b8d80d525d2cadb5fa16f7b796.zip
"Minimum IP MTU" means what it says. Ensure that packets returned by
dhcpd are the minimum size or larger no matter what the client thinks the minimum allowable size is. Found by Nahuel Riva and Gera Richarte. Fix by millert@.
Diffstat (limited to 'usr.sbin/dhcpd/options.c')
-rw-r--r--usr.sbin/dhcpd/options.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/dhcpd/options.c b/usr.sbin/dhcpd/options.c
index 126622d059f..2006f82a53f 100644
--- a/usr.sbin/dhcpd/options.c
+++ b/usr.sbin/dhcpd/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.8 2006/12/15 14:09:13 stevesk Exp $ */
+/* $OpenBSD: options.c,v 1.9 2007/10/09 03:17:34 krw Exp $ */
/* DHCP options parsing and reassembly. */
@@ -224,9 +224,12 @@ cons_options(struct packet *inpacket, struct dhcp_packet *outpacket,
inpacket &&
inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data &&
(inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].len >=
- sizeof(u_int16_t)))
+ sizeof(u_int16_t))) {
mms = getUShort(
inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data);
+ if (mms < 576)
+ mms = 576; /* mms must be >= minimum IP MTU */
+ }
if (mms)
main_buffer_size = mms - DHCP_FIXED_LEN;