From d80c4907ee3492ade1e7b375dfa1450147c4d16f Mon Sep 17 00:00:00 2001 From: Roberto Majadas Date: Thu, 26 Mar 2015 10:41:30 +0100 Subject: [PATCH] Add MTU support to network devices --- base_deb/etc/one-context.d/00-network | 16 ++++++++++++++++ base_rpm/etc/one-context.d/00-network | 15 +++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/base_deb/etc/one-context.d/00-network b/base_deb/etc/one-context.d/00-network index 03f9e88..4ad31a3 100755 --- a/base_deb/etc/one-context.d/00-network +++ b/base_deb/etc/one-context.d/00-network @@ -52,6 +52,13 @@ get_mask() { echo $mask } +# Gets device MTU +get_mtu() { + mtu=$(get_iface_var "MTU") + + echo $mtu +} + is_gateway() { if [ -z "$GATEWAY_IFACE_NUM" ]; then true @@ -108,6 +115,10 @@ iface $DEV inet static netmask $MASK EOT + if [ -n "$MTU" ]; then + echo " mtu $MTU" + fi + if [ -n "$GATEWAY" ]; then echo " gateway $GATEWAY" fi @@ -122,6 +133,10 @@ iface $DEV inet6 static netmask 64 EOT + if [ -n "$MTU" ]; then + echo " mtu $MTU" + fi + if [ -n "$GATEWAY6" ]; then echo " gateway $GATEWAY6" fi @@ -168,6 +183,7 @@ EOT IP=$(get_ip) NETWORK=$(get_network) MASK=$(get_mask) + MTU=$(get_mtu) GATEWAY=$(get_gateway) IPV6=$(get_iface_var "IPV6") diff --git a/base_rpm/etc/one-context.d/00-network b/base_rpm/etc/one-context.d/00-network index 6f5b5c0..061f7ed 100755 --- a/base_rpm/etc/one-context.d/00-network +++ b/base_rpm/etc/one-context.d/00-network @@ -52,6 +52,13 @@ get_mask() { echo $mask } +# Gets device MTU +get_mtu() { + mtu=$(get_iface_var "MTU") + + echo $mtu +} + is_gateway() { if [ -z "$GATEWAY_IFACE_NUM" ]; then true @@ -105,6 +112,9 @@ gen_iface_conf() { NETMASK=$MASK IPADDR=$IP EOT + if [ -n "$MTU" ]; then + echo "MTU=$MTU" + fi if [ -n "$GATEWAY" ]; then echo "GATEWAY=$GATEWAY" @@ -119,6 +129,10 @@ IPV6INIT=yes IPV6ADDR=$IPV6 EOT + if [ -n "$MTU" ]; then + echo "MTU=$MTU" + fi + if [ -n "$GATEWAY6" ]; then echo "IPV6_DEFAULTGW=$GATEWAY6" fi @@ -159,6 +173,7 @@ gen_network_configuration() IP=$(get_ip) NETWORK=$(get_network) MASK=$(get_mask) + MTU=$(get_mtu) GATEWAY=$(get_gateway) IPV6=$(get_iface_var "IPV6")