From: Justin Pettit Date: Wed, 13 May 2009 06:35:45 +0000 (-0700) Subject: Don't print warning about removing policy on startup. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6aab08e31b7cae2ac6bb30bb96a665a05fcdac79;p=openvswitch Don't print warning about removing policy on startup. The policing code attempts to delete any traffic control configuration on startup, so that interfaces come up in a known state. If the interface didn't have any traffic control configuration, this would cause it to print a couple of scary sounding warning messages. This commit makes it so those no longer print. --- diff --git a/lib/netdev.c b/lib/netdev.c index 9768abee..8c19d078 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -1205,7 +1205,12 @@ netdev_get_stats(const struct netdev *netdev, struct netdev_stats *stats) #define POLICE_ADD_CMD "/sbin/tc qdisc add dev %s handle ffff: ingress" #define POLICE_CONFIG_CMD "/sbin/tc filter add dev %s parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 police rate %dkbit burst %dk mtu 65535 drop flowid :1" -#define POLICE_DEL_CMD "/sbin/tc qdisc del dev %s handle ffff: ingress" +/* We redirect stderr to /dev/null because we often want to remove all + * traffic control configuration on a port so its in a known state. If + * this done when there is no such configuration, tc complains, so we just + * always ignore it. + */ +#define POLICE_DEL_CMD "/sbin/tc qdisc del dev %s handle ffff: ingress 2>/dev/null" /* Attempts to set input rate limiting (policing) policy. */ int @@ -1226,7 +1231,9 @@ netdev_nodev_set_policing(const char *netdev_name, uint32_t kbits_rate, /* xxx This should be more careful about only adding if it * xxx actually exists, as opposed to always deleting it. */ snprintf(command, sizeof(command), POLICE_DEL_CMD, netdev_name); - system(command); + if (system(command) == -1) { + VLOG_WARN_RL(&rl, "%s: problem removing policing", netdev_name); + } snprintf(command, sizeof(command), POLICE_ADD_CMD, netdev_name); if (system(command) != 0) { @@ -1243,9 +1250,8 @@ netdev_nodev_set_policing(const char *netdev_name, uint32_t kbits_rate, } } else { snprintf(command, sizeof(command), POLICE_DEL_CMD, netdev_name); - if (system(command) != 0) { + if (system(command) == -1) { VLOG_WARN_RL(&rl, "%s: problem removing policing", netdev_name); - return -1; } }