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
This commit is contained in:
Maxim Sobolev 2019-02-23 23:31:13 +00:00
parent 5426539c71
commit 221e5d2dd5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=344488

View file

@ -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);
}
}