vlog: Remove explicit calls to vlog_init().
[sliver-openvswitch.git] / utilities / ovs-ofctl.c
index 1a0c936..31b58a6 100644 (file)
@@ -19,6 +19,7 @@
 #include <errno.h>
 #include <getopt.h>
 #include <inttypes.h>
+#include <sys/socket.h>
 #include <net/if.h>
 #include <netinet/in.h>
 #include <signal.h>
@@ -38,6 +39,7 @@
 #include "netlink.h"
 #include "odp-util.h"
 #include "ofp-print.h"
+#include "ofp-util.h"
 #include "ofpbuf.h"
 #include "openflow/nicira-ext.h"
 #include "openflow/openflow.h"
@@ -72,8 +74,6 @@ int
 main(int argc, char *argv[])
 {
     set_program_name(argv[0]);
-    time_init();
-    vlog_init();
     parse_options(argc, argv);
     signal(SIGPIPE, SIG_IGN);
     run_command(argc - optind, argv + optind, all_commands);
@@ -767,6 +767,7 @@ str_to_flow(char *string, struct ofp_match *match, struct ofpbuf *actions,
             uint16_t *idle_timeout, uint16_t *hard_timeout, 
             uint64_t *cookie)
 {
+    struct ofp_match normalized;
     char *save_ptr = NULL;
     char *name;
     uint32_t wildcards;
@@ -868,6 +869,18 @@ str_to_flow(char *string, struct ofp_match *match, struct ofpbuf *actions,
         }
     }
     match->wildcards = htonl(wildcards);
+
+    normalized = *match;
+    normalize_match(&normalized);
+    if (memcmp(match, &normalized, sizeof normalized)) {
+        char *old = ofp_match_to_literal_string(match);
+        char *new = ofp_match_to_literal_string(&normalized);
+        VLOG_WARN("The specified flow is not in normal form:");
+        VLOG_WARN(" as specified: %s", old);
+        VLOG_WARN("as normalized: %s", new);
+        free(old);
+        free(new);
+    }
 }
 
 static void