Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Feb 2019 23:31:13 +0000 (UTC)
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r344488 - head/sbin/dhclient
Message-ID:  <201902232331.x1NNVDdm059332@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sobomax
Date: Sat Feb 23 23:31:13 2019
New Revision: 344488
URL: https://svnweb.freebsd.org/changeset/base/344488

Log:
  Further refine r336195: do not even attempt to verify/update interface's
  MTU if we've set it once and there were no changes on the DHCP server
  side since the last refresh. This is consistent I believe with how dhclient
  handles other settings like IP address, mask etc.
  
  Approved by:	cem, eugen
  Differential Revision:	https://reviews.freebsd.org/D18546

Modified:
  head/sbin/dhclient/dhclient.c

Modified: head/sbin/dhclient/dhclient.c
==============================================================================
--- head/sbin/dhclient/dhclient.c	Sat Feb 23 21:14:00 2019	(r344487)
+++ head/sbin/dhclient/dhclient.c	Sat Feb 23 23:31:13 2019	(r344488)
@@ -863,6 +863,7 @@ bind_lease(struct interface_info *ip)
 	opt = &ip->client->new->options[DHO_INTERFACE_MTU];
 	if (opt->len == sizeof(u_int16_t)) {
 		u_int16_t mtu = 0;
+		u_int16_t old_mtu = 0;
 		bool supersede = (ip->client->config->default_actions[DHO_INTERFACE_MTU] ==
 			ACTION_SUPERSEDE);
 
@@ -871,12 +872,19 @@ bind_lease(struct interface_info *ip)
 		else
 			mtu = be16dec(opt->data);
 
+		if (ip->client->active) {
+			opt = &ip->client->active->options[DHO_INTERFACE_MTU];
+			if (opt->len == sizeof(u_int16_t)) {
+				old_mtu = be16dec(opt->data);
+			}
+		}
+
 		if (mtu < MIN_MTU) {
 			/* Treat 0 like a user intentionally doesn't want to change MTU and,
 			 * therefore, warning is not needed */
 			if (!supersede || mtu != 0)
 				warning("mtu size %u < %d: ignored", (unsigned)mtu, MIN_MTU);
-		} else {
+		} else if (ip->client->state != S_RENEWING || mtu != old_mtu) {
 			interface_set_mtu_unpriv(privfd, mtu);
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902232331.x1NNVDdm059332>