]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Add 05-mtu hook so we respect the desired MTU on networks.
authorRoy Marples <roy@marples.name>
Fri, 13 Jun 2008 09:55:18 +0000 (09:55 +0000)
committerRoy Marples <roy@marples.name>
Fri, 13 Jun 2008 09:55:18 +0000 (09:55 +0000)
README
dhcp.h
dhcpcd-hooks/05-mtu [new file with mode: 0644]
dhcpcd-hooks/Makefile
dhcpcd.8.in
dhcpcd.c
dhcpcd.conf

diff --git a/README b/README
index c3bea6d816709a767a1c47990e83383498848279..cc5a467308ea242defc9a866886411c69c97b8cc 100644 (file)
--- 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 dd119dd2cfbda4f62c06e059b3eef05bd7e3a158..89565d27643b799710ef2f9d64965480c1c56da2 100644 (file)
--- 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 (file)
index 0000000..4265b48
--- /dev/null
@@ -0,0 +1,5 @@
+# Configure the MTU for the interface
+
+if [ -n "${new_interface_mtu}" ]; then
+       ifconfig "${interface}" mtu "${new_interface_mtu}"
+fi
index 4766ebbe73cd141c7e5de69efd8642265aa7107b..a1662963ed6bff122bea442bcf3aa3898520d030 100644 (file)
@@ -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}
 
index e5066877a63976cb1cfc64947fae5bf9580f4e5d..a33803629aab0e5fd64a6007a23cdc8af0fe5376 100644 (file)
@@ -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
index 6c34d0287295ba65dca8f4c157dfdfc8686e99cc..2c125f27aae4b3a3c42c43054819bb6e4b8baa62 100644 (file)
--- 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);
index 240c4f7626c3502d2d6522f27e716622a7c935d4..07da045d66e66c98b040b39c17dee97e3ccbfe0c 100644 (file)
@@ -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