From: Roy Marples Date: Fri, 13 Jun 2008 09:55:18 +0000 (+0000) Subject: Add 05-mtu hook so we respect the desired MTU on networks. X-Git-Tag: v4.0.2~278 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa1d32892283c03053ffad10e6137cf3ff6d69b7;p=thirdparty%2Fdhcpcd.git Add 05-mtu hook so we respect the desired MTU on networks. --- diff --git a/README b/README index c3bea6d8..cc5a4673 100644 --- a/README +++ b/README @@ -33,16 +33,16 @@ set CSTD=gnu99 to work around this. Hooks ----- -Not all the hooks in hook.d are installed by default. -By default we install 01-test.sh, 10-resolv.conf.sh and 15-hostname.sh. +Not all the hooks in dhcpcd-hooks are installed by default. +By default we install 01-test, 05-mtu, 10-resolv.conf and 15-hostname. To add more simply add them in the HOOKSCRIPTS variable. -make HOOKSCRIPTS=50-ntp.sh install +make HOOKSCRIPTS=50-ntp install Compatibility ------------- If you require compatibility with dhcpcd-3 and older style variables, -you can install 50-dhcpcd-compat.sh into the directory $LIBEXECDIR/dhcpcd.hook.d +you can install 50-dhcpcd-compat into the directory $LIBEXECDIR/dhcpcd-hooks We don't install this by default. You should also add -DCMDLINE_COMPAT to your CFLAGS if you need to be fully commandline compatible with prior versions. diff --git a/dhcp.h b/dhcp.h index dd119dd2..89565d27 100644 --- a/dhcp.h +++ b/dhcp.h @@ -70,6 +70,7 @@ enum DHCP_OPTIONS DHCP_DNSSERVER = 6, DHCP_HOSTNAME = 12, DHCP_DNSDOMAIN = 15, + DHCP_MTU = 26, DHCP_BROADCAST = 28, DHCP_STATICROUTE = 33, DHCP_NISDOMAIN = 40, diff --git a/dhcpcd-hooks/05-mtu b/dhcpcd-hooks/05-mtu new file mode 100644 index 00000000..4265b482 --- /dev/null +++ b/dhcpcd-hooks/05-mtu @@ -0,0 +1,5 @@ +# Configure the MTU for the interface + +if [ -n "${new_interface_mtu}" ]; then + ifconfig "${interface}" mtu "${new_interface_mtu}" +fi diff --git a/dhcpcd-hooks/Makefile b/dhcpcd-hooks/Makefile index 4766ebbe..a1662963 100644 --- a/dhcpcd-hooks/Makefile +++ b/dhcpcd-hooks/Makefile @@ -1,6 +1,6 @@ LIBEXECDIR= ${PREFIX}/libexec HOOKDIR= ${LIBEXECDIR}/dhcpcd-hooks -SYSTEMSCRIPTS= 01-test 10-resolv.conf 15-hostname +SYSTEMSCRIPTS= 01-test 05-mtu 10-resolv.conf 15-hostname FILES= ${SYSTEMSCRIPTS} ${HOOKSCRIPTS} FILESDIR= ${HOOKDIR} diff --git a/dhcpcd.8.in b/dhcpcd.8.in index e5066877..a3380362 100644 --- a/dhcpcd.8.in +++ b/dhcpcd.8.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd Jun 11, 2008 +.Dd Jun 13, 2008 .Dt DHCPCD 8 SMM .Sh NAME .Nm dhcpcd @@ -302,8 +302,8 @@ Don't run this hook script. Matches full name, or prefixed with 2 numbers optionally ending with .Pa .sh . .Pp -So to stop dhcpcd from touching your DNS settings you would do:- -.D1 dhcpcd -C resolv.conf +So to stop dhcpcd from touching your DNS or MTU settings you would do:- +.D1 dhcpcd -C resolv.conf -C mtu eth0 .It Fl L , -noipv4ll Don't use IPv4LL at all. .It Fl O , -nooption Ar option diff --git a/dhcpcd.c b/dhcpcd.c index 6c34d028..2c125f27 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -686,6 +686,7 @@ main(int argc, char **argv) #ifdef CMDLINE_COMPAT case 'H': /* FALLTHROUGH */ case 'M': + del_reqmask(options->reqmask, DHCP_MTU); break; case 'N': del_reqmask(options->reqmask, DHCP_NTPSERVER); diff --git a/dhcpcd.conf b/dhcpcd.conf index 240c4f76..07da045d 100644 --- a/dhcpcd.conf +++ b/dhcpcd.conf @@ -6,3 +6,6 @@ option domain_name_servers, domain_name, domain_search, host_name # Most distros have ntp support. option ntp_servers + +# We should behave nicely on networks and respect their MTU +option interface_mtu