[ovs-dev] [PATCH 1/3] tunnel: Add df_default and df_inherit tunnel options.

Andrew Evans aevans at nicira.com
Wed Apr 27 21:59:24 UTC 2011


Split existing pmtud tunnel option's functionality into three. Existing pmtud
option still exists, but now governs only whether datapath sends ICMP frag
needed messages. New df_inherit option controls whether DF bit is copied from
packet inner header to outer tunnel header. New df_default option controls
whether DF bit is set if inner packet isn't IP or if df_inherit is disabled.

Suggested-by: Jesse Gross <jesse at nicira.com>
Feature #5456.
---
 include/openvswitch/tunnel.h |    8 +++++---
 lib/netdev-vport.c           |   16 +++++++++++++++-
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/include/openvswitch/tunnel.h b/include/openvswitch/tunnel.h
index a394f8a..09c0a47 100644
--- a/include/openvswitch/tunnel.h
+++ b/include/openvswitch/tunnel.h
@@ -65,8 +65,10 @@ enum {
 #define TNL_F_CSUM		(1 << 0) /* Checksum packets. */
 #define TNL_F_TOS_INHERIT	(1 << 1) /* Inherit the ToS from the inner packet. */
 #define TNL_F_TTL_INHERIT	(1 << 2) /* Inherit the TTL from the inner packet. */
-#define TNL_F_PMTUD		(1 << 3) /* Enable path MTU discovery. */
-#define TNL_F_HDR_CACHE		(1 << 4) /* Enable tunnel header caching. */
-#define TNL_F_IPSEC		(1 << 5) /* Traffic is IPsec encrypted. */
+#define TNL_F_DF_INHERIT	(1 << 3) /* Inherit the DF bit from the inner packet. */
+#define TNL_F_DF_DEFAULT	(1 << 4) /* Set the DF bit if inherit off or not IP? */
+#define TNL_F_PMTUD		(1 << 5) /* Enable path MTU discovery. */
+#define TNL_F_HDR_CACHE		(1 << 6) /* Enable tunnel header caching. */
+#define TNL_F_IPSEC		(1 << 7) /* Traffic is IPsec encrypted. */
 
 #endif /* openvswitch/tunnel.h */
diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index be26941..5260c2b 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -667,7 +667,7 @@ parse_tunnel_config(const char *name, const char *type,
     ovs_be32 daddr = htonl(0);
     uint32_t flags;
 
-    flags = TNL_F_PMTUD | TNL_F_HDR_CACHE;
+    flags = TNL_F_DF_DEFAULT | TNL_F_PMTUD | TNL_F_HDR_CACHE;
     if (!strcmp(type, "gre")) {
         is_gre = true;
     } else if (!strcmp(type, "ipsec_gre")) {
@@ -709,6 +709,14 @@ parse_tunnel_config(const char *name, const char *type,
             if (!strcmp(node->data, "true")) {
                 flags |= TNL_F_CSUM;
             }
+        } else if (!strcmp(node->name, "df_inherit")) {
+            if (!strcmp(node->data, "true")) {
+                flags &= TNL_F_DF_INHERIT;
+            }
+        } else if (!strcmp(node->name, "df_default")) {
+            if (!strcmp(node->data, "false")) {
+                flags &= ~TNL_F_DF_DEFAULT;
+            }
         } else if (!strcmp(node->name, "pmtud")) {
             if (!strcmp(node->data, "false")) {
                 flags &= ~TNL_F_PMTUD;
@@ -891,6 +899,12 @@ unparse_tunnel_config(const char *name OVS_UNUSED, const char *type OVS_UNUSED,
     if (flags & TNL_F_CSUM) {
         smap_add(args, "csum", "true");
     }
+    if (flags & TNL_F_DF_INHERIT) {
+        smap_add(args, "df_inherit", "true");
+    }
+    if (!(flags & TNL_F_DF_DEFAULT)) {
+        smap_add(args, "df_default", "false");
+    }
     if (!(flags & TNL_F_PMTUD)) {
         smap_add(args, "pmtud", "false");
     }
-- 
1.7.4.1




More information about the dev mailing list