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 <[email protected]>
Signed-off-by: Gurucharan Shetty <[email protected]>
---
 AUTHORS              |  1 +
 INSTALL.Docker.md    |  6 +++---
 utilities/ovs-docker | 15 ++++++++++++---
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 5178b43..574fba5 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -213,6 +213,7 @@ Anuprem Chalvadi        [email protected]
 Ariel Tubaltsev         [email protected]
 Arkajit Ghosh           [email protected]
 Atzm Watanabe           [email protected]
+AurĂ©lien Poulain       [email protected]
 Bastian Blank           [email protected]
 Ben Basler              [email protected]
 Bob Ball                [email protected]
diff --git a/INSTALL.Docker.md b/INSTALL.Docker.md
index b505a9b..9e14043 100644
--- a/INSTALL.Docker.md
+++ b/INSTALL.Docker.md
@@ -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.:
diff --git a/utilities/ovs-docker b/utilities/ovs-docker
index 12c3246..43cea54 100755
--- a/utilities/ovs-docker
+++ b/utilities/ovs-docker
@@ -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.:
-- 
1.9.1

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to