Merge branch 'mainstream'
[sliver-openvswitch.git] / utilities / ovs-ofctl.c
index e8453f3..e62e646 100644 (file)
@@ -36,6 +36,7 @@
 #include "compiler.h"
 #include "dirs.h"
 #include "dynamic-string.h"
+#include "fatal-signal.h"
 #include "nx-match.h"
 #include "odp-util.h"
 #include "ofp-actions.h"
@@ -113,7 +114,7 @@ main(int argc, char *argv[])
 {
     set_program_name(argv[0]);
     parse_options(argc, argv);
-    signal(SIGPIPE, SIG_IGN);
+    fatal_ignore_sigpipe();
     run_command(argc - optind, argv + optind, get_all_commands());
     return 0;
 }
@@ -1852,7 +1853,7 @@ ofctl_ofp_parse_pcap(int argc OVS_UNUSED, char *argv[])
     int error;
     bool first;
 
-    file = pcap_open(argv[1], "rb");
+    file = ovs_pcap_open(argv[1], "rb");
     if (!file) {
         ovs_fatal(errno, "%s: open failed", argv[1]);
     }
@@ -1863,12 +1864,13 @@ ofctl_ofp_parse_pcap(int argc OVS_UNUSED, char *argv[])
         struct ofpbuf *packet;
         long long int when;
         struct flow flow;
+        const struct pkt_metadata md = PKT_METADATA_INITIALIZER(ODPP_NONE);
 
-        error = pcap_read(file, &packet, &when);
+        error = ovs_pcap_read(file, &packet, &when);
         if (error) {
             break;
         }
-        flow_extract(packet, 0, 0, NULL, NULL, &flow);
+        flow_extract(packet, &md, &flow);
         if (flow.dl_type == htons(ETH_TYPE_IP)
             && flow.nw_proto == IPPROTO_TCP
             && (is_openflow_port(flow.tp_src, argv + 2) ||
@@ -3199,7 +3201,7 @@ ofctl_parse_pcap(int argc OVS_UNUSED, char *argv[])
 {
     FILE *pcap;
 
-    pcap = pcap_open(argv[1], "rb");
+    pcap = ovs_pcap_open(argv[1], "rb");
     if (!pcap) {
         ovs_fatal(errno, "%s: open failed", argv[1]);
     }
@@ -3207,16 +3209,17 @@ ofctl_parse_pcap(int argc OVS_UNUSED, char *argv[])
     for (;;) {
         struct ofpbuf *packet;
         struct flow flow;
+        const struct pkt_metadata md = PKT_METADATA_INITIALIZER(ODPP_NONE);
         int error;
 
-        error = pcap_read(pcap, &packet, NULL);
+        error = ovs_pcap_read(pcap, &packet, NULL);
         if (error == EOF) {
             break;
         } else if (error) {
             ovs_fatal(error, "%s: read failed", argv[1]);
         }
 
-        flow_extract(packet, 0, 0, NULL, NULL, &flow);
+        flow_extract(packet, &md, &flow);
         flow_print(stdout, &flow);
         putchar('\n');
         ofpbuf_delete(packet);