diff options
| author | Marius Strobl <marius@FreeBSD.org> | 2018-06-07 15:51:23 +0000 |
|---|---|---|
| committer | Marius Strobl <marius@FreeBSD.org> | 2018-06-07 15:51:23 +0000 |
| commit | 5de478ffc6a5a8f8eba8e74962d608b9fd76d974 (patch) | |
| tree | 9fe256b6ffd79885e7bf0a60d175a0c014ed1e17 | |
| parent | 7cf8e0dc8315f7cfee2120148c7e2bef1d1f795e (diff) | |
Notes
| -rw-r--r-- | sbin/dhclient/dhclient.c | 18 | ||||
| -rw-r--r-- | sbin/dhclient/dhclient.conf.5 | 10 |
2 files changed, 24 insertions, 4 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 070fcf5374fc3..ec4ad127a4a70 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -828,11 +828,23 @@ 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 = be16dec(opt->data); - if (mtu < MIN_MTU) - warning("mtu size %u < %d: ignored", (unsigned)mtu, MIN_MTU); + u_int16_t mtu = 0; + bool supersede = (ip->client->config->default_actions[DHO_INTERFACE_MTU] == + ACTION_SUPERSEDE); + + if (supersede) + mtu = getUShort(ip->client->config->defaults[DHO_INTERFACE_MTU].data); else + 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 { interface_set_mtu_unpriv(privfd, mtu); + } } /* Write out the new lease. */ diff --git a/sbin/dhclient/dhclient.conf.5 b/sbin/dhclient/dhclient.conf.5 index fb9d9f17048c0..2f28c57225747 100644 --- a/sbin/dhclient/dhclient.conf.5 +++ b/sbin/dhclient/dhclient.conf.5 @@ -38,7 +38,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 1, 1997 +.Dd May 31, 2018 .Dt DHCLIENT.CONF 5 .Os .Sh NAME @@ -227,6 +227,14 @@ rather than any value supplied by the server, these values can be defined in the .Ic supersede statement. +.Pp +Some options values have special meaning: +.Bl -tag -width indent +.It Ar interface-mtu +Any server-supplied interface MTU is ignored by the client if a +.Ic supersede +zero value is configured. +.El .It Xo .Ic prepend No { Op Ar option declaration .Oo , Ar ... option declaration Oc } |
