From nobody@FreeBSD.org  Wed Feb 26 20:01:15 2014
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id 83AC25B2
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 26 Feb 2014 20:01:15 +0000 (UTC)
Received: from newred.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 7074C1615
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 26 Feb 2014 20:01:15 +0000 (UTC)
Received: from cgiserv.freebsd.org ([127.0.1.6])
	by newred.freebsd.org (8.14.7/8.14.7) with ESMTP id s1QK1ECe040867
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 26 Feb 2014 20:01:14 GMT
	(envelope-from nobody@cgiserv.freebsd.org)
Received: (from nobody@localhost)
	by cgiserv.freebsd.org (8.14.7/8.14.7/Submit) id s1QK1E8L040866;
	Wed, 26 Feb 2014 20:01:14 GMT
	(envelope-from nobody)
Message-Id: <201402262001.s1QK1E8L040866@cgiserv.freebsd.org>
Date: Wed, 26 Feb 2014 20:01:14 GMT
From: Robert Blayzor <rblayzor@inoc.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: FreeBSD DHCP ignores dhcp option interface-mtu
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         187094
>Category:       kern
>Synopsis:       [nfs] [patch] FreeBSD DHCP ignores dhcp option interface-mtu
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 26 20:10:00 UTC 2014
>Closed-Date:    
>Last-Modified:  Sun Mar 09 15:41:40 UTC 2014
>Originator:     Robert Blayzor
>Release:        10.0
>Organization:
INOC, LLC
>Environment:
FreeBSD rootbsd.ops.inoc.net 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r261846: Tue Feb 25 13:50:12 UTC 2014     root@rootbsd.ops.inoc.net:/usr/obj/.amd_mnt/juno/pub/FreeBSD/10.0-RELEASE/sys/ESXBSD  amd64
>Description:
Upon PXE booting FreeBSD kernel trying to set a higher MTU via DHCP.  

Using "option interface-mtu ...."  in ISC-DHCP, MTU never properly gets set to anything higher than 1500.

Attempting to change the MTU in rc startup scripts only appears to cosmetically change..


dev@rns0 [~] cat /etc/rc.conf | grep vmx
ifconfig_vmx0="mtu 9000"

dev@rns0 [~] ifconfig vmx0
vmx0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9000
	options=60039b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,TSO6,RXCSUM_IPV6,TXCSUM_IPV6>
	ether 00:50:56:a7:03:22
	inet6 fe80::250:56ff:fea7:322%vmx0 prefixlen 64 scopeid 0x1
	inet 10.0.0.20 netmask 0xffff0000 broadcast 10.0.255.255
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
	media: Ethernet autoselect
	status: active


dev@rns0 [~] sudo ping -D -c 1 -s 1600 10.0.0.200
PING 10.0.0.200 (10.0.0.200): 1600 data bytes
ping: sendto: Message too long

dev@rns0 [~] sudo ping -D -c 1 -s 1472 10.0.0.200
PING 10.0.0.200 (10.0.0.200): 1472 data bytes
1480 bytes from 10.0.0.200: icmp_seq=0 ttl=64 time=0.064 ms

--- 10.0.0.200 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss


>How-To-Repeat:
Using dhclient or PXE boot configure DHCP server to use MTU > 1500.  ie:

 option interface-mtu 9000;


System boots and gets IP address properly but MTU cannot be set. 
>Fix:
None.

Attempting to set MTU via rc.conf startup does not work.

>Release-Note:
>Audit-Trail:

From: Robert Blayzor <rblayzor@inoc.net>
To: "bug-followup@freebsd.org" <bug-followup@FreeBSD.org>
Cc:  
Subject: Re: misc/187094: FreeBSD DHCP ignores dhcp option interface-mtu
Date: Wed, 26 Feb 2014 20:47:52 -0500

 This may not be a bug, but rather lack of functionality.
 
 DHCP option tag 26 - Interface MTU Size
 
 
 Target to fix:  sys/nfs/bootp_subr.c
 
 Working on patch.
 
 
 
 

From: Robert Blayzor <rblayzor@inoc.net>
To: "bug-followup@freebsd.org" <bug-followup@FreeBSD.org>
Cc:  
Subject: Re: misc/187094: FreeBSD DHCP ignores dhcp option interface-mtu
Date: Thu, 27 Feb 2014 13:24:11 -0500

 I would like to submit the following patch that corrects two major issues:
 
 -  Look for and set MTU according to  DHCP option tag 26 for Interface MTU. 
    This allows booting interface to be used on a jumbo frame enabled network.
 
    Currently this is broken and cannot be overridden or set later.
 
 -  Remove ancient proxy ARP setting.  Currently it is more of a problem that 
    a host is multi-homed and booting interface network may not have a router.
    (ie: default route is on another interface/network)
 
    The default today is to use DHCP router tag and if no router tag is
    supplied by DHCP, default route will be set to hosts self.  Not supplying
    a route is a completely valid option, especially since many hosts
    multi-homed.
 
 
 Patch is against 10.0-RELEASE
 
 Index: bootp_subr.c
 ===================================================================
 --- bootp_subr.c	(revision 261846)
 +++ bootp_subr.c	(working copy)
 @@ -196,6 +196,8 @@
  #define TAG_HOSTNAME	 12  /* Client host name */
  #define TAG_ROOT	 17  /* Root path */
 
 +#define TAG_INTF_MTU     26  /* Interface MTU Size (RFC2132) */
 +
  /* DHCP specific tags */
  #define TAG_OVERLOAD	 52  /* Option Overload */
  #define TAG_MAXMSGSIZE   57  /* Maximum DHCP Message Size */
 @@ -229,6 +231,8 @@
  #endif
 
  static char bootp_cookie[128];
 +static unsigned int bootp_ifmtu = 0;
 +
  static struct socket *bootp_so;
  SYSCTL_STRING(_kern, OID_AUTO, bootp_cookie, CTLFLAG_RD,
  	bootp_cookie, 0, "Cookie (T134) supplied by bootp server");
 @@ -1030,7 +1034,22 @@
  		return (0);
  	}
 
 -	printf("Adjusted interface %s\n", ifctx->ireq.ifr_name);
 +	printf("Adjusted interface %s", ifctx->ireq.ifr_name);
 +
 +	/* Do BOOTP interface options */
 +	if (bootp_ifmtu != 0) {
 +	        printf(" (MTU=%d", bootp_ifmtu);
 +	        if (bootp_ifmtu > 1514)
 +	                printf("/JUMBO");
 +	        printf(")");
 +
 +		ifr->ifr_mtu = bootp_ifmtu;
 +		error = ifioctl(bootp_so, SIOCSIFMTU, (caddr_t) ifr, td);
 +		if (error != 0)
 +		        panic("%s: SIOCSIFMTU, error=%d", __func__, error);
 +	}
 +        printf("\n");
 +
  	/*
  	 * Do enough of ifconfig(8) so that the chosen interface
  	 * can talk to the servers.  (just set the address)
 @@ -1053,7 +1072,12 @@
 
  	/* Add new default route */
 
 -	if (ifctx->gotgw != 0 || gctx->gotgw == 0) {
 +        /*  Only set default route if we received one in the request.
 +            Proxy ARP considered obsolete.  More valid to NOT set
 +            a router in request as the host may be multi-homed and
 +            gateway may not be on this interface.
 +	*/
 +	if (ifctx->gotgw != 0 || gctx->gotgw != 0) {
  		clear_sinaddr(&defdst);
  		clear_sinaddr(&defmask);
  		/* XXX MRT just table 0 */
 @@ -1518,6 +1542,11 @@
  		p[i] = '\0';
  	}
 
 +        p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen,
 +		       TAG_INTF_MTU);
 +        if (p != NULL) {
 +	        bootp_ifmtu = (((unsigned char)p[0] << 8) + (unsigned char)p[1]);
 +	}
 
  	printf("\n");
 
>Unformatted:
