ovs-docker: Ability to set the MTU of the container interface.
authorGurucharan Shetty <gshetty@nicira.com>
Mon, 25 May 2015 08:04:01 +0000 (01:04 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Wed, 27 May 2015 15:06:09 +0000 (08:06 -0700)
When containers are connected to a OVS bridge and tunnels
are created, it makese sense to reduce the MTU of the interafce.

Reported-by: Aurélien Poulai <aurepoulain@viacesi.fr>
Signed-off-by: Gurucharan Shetty <shettyg@nicira.com>
AUTHORS
INSTALL.Docker.md
utilities/ovs-docker

diff --git a/AUTHORS b/AUTHORS
index 5178b43..574fba5 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -213,6 +213,7 @@ Anuprem Chalvadi        achalvadi@vmware.com
 Ariel Tubaltsev         atubaltsev@vmware.com
 Arkajit Ghosh           arkajit.ghosh@tcs.com
 Atzm Watanabe           atzm@stratosphere.co.jp
+AurĂ©lien Poulain       aurepoulain@viacesi.fr
 Bastian Blank           waldi@debian.org
 Ben Basler              bbasler@nicira.com
 Bob Ball                bob.ball@citrix.com
index b505a9b..9e14043 100644 (file)
@@ -55,12 +55,12 @@ and then attaches it to the Open vSwitch bridge 'br-int'.  This is done by
 creating a veth pair.  One end of the interface becomes 'eth1' inside the
 container and the other end attaches to 'br-int'.
 
-The script also lets one to add IP address, MAC address and Gateway address to
-the interface.  e.g.:
+The script also lets one to add IP address, MAC address, Gateway address and
+MTU for the interface.  e.g.:
 
 ```
 % ovs-docker add-port br-int eth1 $CONTAINER_ID --ipaddress=192.168.1.2/24 \
---macaddress=a2:c3:0d:49:7f:f8 --gateway=192.168.1.1
+--macaddress=a2:c3:0d:49:7f:f8 --gateway=192.168.1.1 --mtu=1450
 ```
 
 * A previously added network interface can be deleted.  e.g.:
index 12c3246..43cea54 100755 (executable)
@@ -86,6 +86,10 @@ add_port () {
                 GATEWAY=`expr X"$1" : 'X[^=]*=\(.*\)'`
                 shift
                 ;;
+            --mtu=*)
+                MTU=`expr X"$1" : 'X[^=]*=\(.*\)'`
+                shift
+                ;;
             *)
                 echo >&2 "$UTIL add-port: unknown option \"$1\""
                 exit 1
@@ -137,6 +141,10 @@ add_port () {
     ip netns exec "$PID" ip link set dev "${PORTNAME}_c" name "$INTERFACE"
     ip netns exec "$PID" ip link set "$INTERFACE" up
 
+    if [ -n "$MTU" ]; then
+        ip netns exec "$PID" ip link set dev "$INTERFACE" mtu "$MTU"
+    fi
+
     if [ -n "$ADDRESS" ]; then
         ip netns exec "$PID" ip addr add "$ADDRESS" dev "$INTERFACE"
     fi
@@ -216,14 +224,15 @@ usage: ${UTIL} COMMAND
 Commands:
   add-port BRIDGE INTERFACE CONTAINER [--ipaddress="ADDRESS"]
                     [--gateway=GATEWAY] [--macaddress="MACADDRESS"]
+                    [--mtu=MTU]
                     Adds INTERFACE inside CONTAINER and connects it as a port
                     in Open vSwitch BRIDGE. Optionally, sets ADDRESS on
                     INTERFACE. ADDRESS can include a '/' to represent network
-                    prefix length. Optionally, sets a GATEWAY and a MACADDRESS.
-                    e.g.:
+                    prefix length. Optionally, sets a GATEWAY, MACADDRESS
+                    and MTU.  e.g.:
                     ${UTIL} add-port br-int eth1 c474a0e2830e
                     --ipaddress=192.168.1.2/24 --gateway=192.168.1.1
-                    --macaddress="a2:c3:0d:49:7f:f8"
+                    --macaddress="a2:c3:0d:49:7f:f8" --mtu=1450
   del-port BRIDGE INTERFACE CONTAINER
                     Deletes INTERFACE inside CONTAINER and removes its
                     connection to Open vSwitch BRIDGE. e.g.: