From owner-svn-src-head@freebsd.org Sat Feb 23 23:31:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F9E5150812E; Sat, 23 Feb 2019 23:31:14 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B363E73611; Sat, 23 Feb 2019 23:31:13 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B55C244EE; Sat, 23 Feb 2019 23:31:13 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1NNVD9K059333; Sat, 23 Feb 2019 23:31:13 GMT (envelope-from sobomax@FreeBSD.org) Received: (from sobomax@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1NNVDdm059332; Sat, 23 Feb 2019 23:31:13 GMT (envelope-from sobomax@FreeBSD.org) Message-Id: <201902232331.x1NNVDdm059332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sobomax set sender to sobomax@FreeBSD.org using -f From: Maxim Sobolev Date: Sat, 23 Feb 2019 23:31:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344488 - head/sbin/dhclient X-SVN-Group: head X-SVN-Commit-Author: sobomax X-SVN-Commit-Paths: head/sbin/dhclient X-SVN-Commit-Revision: 344488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B363E73611 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Feb 2019 23:31:14 -0000 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); } }