netdev-vport: Warn about invalid TOS.
[openvswitch] / lib / netdev-vport.c
index d2c2672b024974abe27d684af82d69617375a919..db5c3db8d71cf77da9dd05e284ab2dd18bbe2222 100644 (file)
@@ -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")) {
@@ -682,7 +684,7 @@ parse_tunnel_config(const char *name, const char *type,
 
     if (is_ipsec) {
         static pid_t pid = 0;
-        if (pid == 0) {
+        if (pid <= 0) {
             char *file_name = xasprintf("%s/%s", ovs_rundir(),
                                         "ovs-monitor-ipsec.pid");
             pid = read_pidfile(file_name);