Date: Mon, 21 Mar 2016 14:58:12 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297150 - head/lib/libstand Message-ID: <201603211458.u2LEwC0C006065@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Mon Mar 21 14:58:12 2016 New Revision: 297150 URL: https://svnweb.freebsd.org/changeset/base/297150 Log: If the dhcp server delivers an interface-mtu option, parse it and store the value in a new global intf_mtu for use by the application. These changes were inspired by the patch provided by Robert Blayzor in PR 187094, and will allow loader(8) to propagate the value to the kernel along with the other nfs_diskless parms delivered via environment vars. Modified: head/lib/libstand/bootp.c head/lib/libstand/bootp.h head/lib/libstand/globals.c head/lib/libstand/net.h Modified: head/lib/libstand/bootp.c ============================================================================== --- head/lib/libstand/bootp.c Mon Mar 21 14:51:51 2016 (r297149) +++ head/lib/libstand/bootp.c Mon Mar 21 14:58:12 2016 (r297150) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> +#include <sys/endian.h> #include <netinet/in.h> #include <netinet/in_systm.h> @@ -393,6 +394,13 @@ vend_rfc1048(cp, len) val = (const char *)cp; strlcpy(hostname, val, sizeof(hostname)); } + if (tag == TAG_INTF_MTU) { + if ((val = getenv("dhcp.interface-mtu")) != NULL) { + intf_mtu = (u_int)strtoul(val, NULL, 0); + } else { + intf_mtu = be16dec(cp); + } + } #ifdef SUPPORT_DHCP if (tag == TAG_DHCP_MSGTYPE) { if(*cp != expected_dhcpmsgtype) Modified: head/lib/libstand/bootp.h ============================================================================== --- head/lib/libstand/bootp.h Mon Mar 21 14:51:51 2016 (r297149) +++ head/lib/libstand/bootp.h Mon Mar 21 14:58:12 2016 (r297150) @@ -91,6 +91,7 @@ struct bootp { #define TAG_DOMAINNAME ((unsigned char) 15) #define TAG_SWAPSERVER ((unsigned char) 16) #define TAG_ROOTPATH ((unsigned char) 17) +#define TAG_INTF_MTU ((unsigned char) 26) #ifdef SUPPORT_DHCP #define TAG_REQ_ADDR ((unsigned char) 50) Modified: head/lib/libstand/globals.c ============================================================================== --- head/lib/libstand/globals.c Mon Mar 21 14:51:51 2016 (r297149) +++ head/lib/libstand/globals.c Mon Mar 21 14:58:12 2016 (r297150) @@ -32,5 +32,6 @@ struct in_addr rootip; /* root ip addr struct in_addr swapip; /* swap ip address */ struct in_addr gateip; /* swap ip address */ n_long netmask = 0xffffff00; /* subnet or net mask */ +u_int intf_mtu; /* interface mtu from bootp/dhcp */ int errno; /* our old friend */ Modified: head/lib/libstand/net.h ============================================================================== --- head/lib/libstand/net.h Mon Mar 21 14:51:51 2016 (r297149) +++ head/lib/libstand/net.h Mon Mar 21 14:58:12 2016 (r297150) @@ -83,6 +83,7 @@ extern struct in_addr swapip; extern struct in_addr gateip; extern struct in_addr nameip; extern n_long netmask; +extern u_int intf_mtu; extern int debug; /* defined in the machdep sources */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603211458.u2LEwC0C006065>