mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-15 15:06:42 +00:00
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:
parent
5426539c71
commit
221e5d2dd5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=344488
@ -863,6 +863,7 @@ bind_lease(struct interface_info *ip)
|
|||||||
opt = &ip->client->new->options[DHO_INTERFACE_MTU];
|
opt = &ip->client->new->options[DHO_INTERFACE_MTU];
|
||||||
if (opt->len == sizeof(u_int16_t)) {
|
if (opt->len == sizeof(u_int16_t)) {
|
||||||
u_int16_t mtu = 0;
|
u_int16_t mtu = 0;
|
||||||
|
u_int16_t old_mtu = 0;
|
||||||
bool supersede = (ip->client->config->default_actions[DHO_INTERFACE_MTU] ==
|
bool supersede = (ip->client->config->default_actions[DHO_INTERFACE_MTU] ==
|
||||||
ACTION_SUPERSEDE);
|
ACTION_SUPERSEDE);
|
||||||
|
|
||||||
@ -871,12 +872,19 @@ bind_lease(struct interface_info *ip)
|
|||||||
else
|
else
|
||||||
mtu = be16dec(opt->data);
|
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) {
|
if (mtu < MIN_MTU) {
|
||||||
/* Treat 0 like a user intentionally doesn't want to change MTU and,
|
/* Treat 0 like a user intentionally doesn't want to change MTU and,
|
||||||
* therefore, warning is not needed */
|
* therefore, warning is not needed */
|
||||||
if (!supersede || mtu != 0)
|
if (!supersede || mtu != 0)
|
||||||
warning("mtu size %u < %d: ignored", (unsigned)mtu, MIN_MTU);
|
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);
|
interface_set_mtu_unpriv(privfd, mtu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user