[ovs-dev] [PATCH] netdev-vport: Warn about invalid TOS.

Ben Pfaff blp at nicira.com
Fri Jul 20 17:25:08 UTC 2012


Otherwise the kernel will reject it later and the result is no tunnel,
whereas a tunnel with an unexpected TOS seems like a better result.

Bug #12566.
Reported-by: Luca Giraudo <lgiraudo at nicira.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/netdev-vport.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 836069f..db5c3db 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -614,8 +614,10 @@ parse_tunnel_config(const char *name, const char *type,
                 char *endptr;
                 int tos;
                 tos = strtol(node->value, &endptr, 0);
-                if (*endptr == '\0') {
+                if (*endptr == '\0' && tos == (tos & IP_DSCP_MASK)) {
                     nl_msg_put_u8(options, OVS_TUNNEL_ATTR_TOS, tos);
+                } else {
+                    VLOG_WARN("%s: invalid TOS %s", name, node->value);
                 }
             }
         } else if (!strcmp(node->key, "ttl")) {
-- 
1.7.2.5




More information about the dev mailing list