projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mac-learning: Fix mac_entry_is_grat_arp_locked().
[openvswitch]
/
utilities
/
ovs-ofctl.c
diff --git
a/utilities/ovs-ofctl.c
b/utilities/ovs-ofctl.c
index 6c476951bde0238f9ed99716f3acfde3efc15ae2..81ce1f7e4f534da175fbdd3ee91dd9f7f5d0a8f9 100644
(file)
--- a/
utilities/ovs-ofctl.c
+++ b/
utilities/ovs-ofctl.c
@@
-18,6
+18,7
@@
#include <errno.h>
#include <getopt.h>
#include <inttypes.h>
#include <errno.h>
#include <getopt.h>
#include <inttypes.h>
+#include <sys/socket.h>
#include <net/if.h>
#include <signal.h>
#include <stdlib.h>
#include <net/if.h>
#include <signal.h>
#include <stdlib.h>
@@
-633,56
+634,67
@@
check_final_format_for_flow_mod(enum nx_flow_format flow_format)
}
static void
}
static void
-do_flow_mod__(int argc OVS_UNUSED, char *argv[], uint16_t command)
+do_flow_mod_
file_
_(int argc OVS_UNUSED, char *argv[], uint16_t command)
{
enum nx_flow_format flow_format;
struct list requests;
struct vconn *vconn;
{
enum nx_flow_format flow_format;
struct list requests;
struct vconn *vconn;
+ FILE *file;
+
+ file = !strcmp(argv[2], "-") ? stdin : fopen(argv[2], "r");
+ if (file == NULL) {
+ ovs_fatal(errno, "%s: open", argv[2]);
+ }
list_init(&requests);
flow_format = set_initial_format_for_flow_mod(&requests);
list_init(&requests);
flow_format = set_initial_format_for_flow_mod(&requests);
- parse_ofp_flow_mod_str(&requests, &flow_format, argc > 2 ? argv[2] : "",
- command);
- check_final_format_for_flow_mod(flow_format);
-
open_vconn(argv[1], &vconn);
open_vconn(argv[1], &vconn);
- transact_multiple_noreply(vconn, &requests);
+ while (parse_ofp_flow_mod_file(&requests, &flow_format, file, command)) {
+ check_final_format_for_flow_mod(flow_format);
+ transact_multiple_noreply(vconn, &requests);
+ }
vconn_close(vconn);
vconn_close(vconn);
-}
-static void
-do_add_flow(int argc, char *argv[])
-{
- do_flow_mod__(argc, argv, OFPFC_ADD);
+ if (file != stdin) {
+ fclose(file);
+ }
}
static void
}
static void
-do_
add_flows(int argc OVS_UNUSED, char *argv[]
)
+do_
flow_mod__(int argc, char *argv[], uint16_t command
)
{
enum nx_flow_format flow_format;
struct list requests;
struct vconn *vconn;
{
enum nx_flow_format flow_format;
struct list requests;
struct vconn *vconn;
- FILE *file;
- file = !strcmp(argv[2], "-") ? stdin : fopen(argv[2], "r");
- if (file == NULL) {
-
ovs_fatal(errno, "%s: open", argv[2])
;
+ if (argc > 2 && !strcmp(argv[2], "-")) {
+ do_flow_mod_file__(argc, argv, command);
+
return
;
}
list_init(&requests);
flow_format = set_initial_format_for_flow_mod(&requests);
}
list_init(&requests);
flow_format = set_initial_format_for_flow_mod(&requests);
+ parse_ofp_flow_mod_str(&requests, &flow_format, argc > 2 ? argv[2] : "",
+ command);
+ check_final_format_for_flow_mod(flow_format);
+
open_vconn(argv[1], &vconn);
open_vconn(argv[1], &vconn);
- while (parse_ofp_flow_mod_file(&requests, &flow_format, file, OFPFC_ADD)) {
- check_final_format_for_flow_mod(flow_format);
- transact_multiple_noreply(vconn, &requests);
- }
+ transact_multiple_noreply(vconn, &requests);
vconn_close(vconn);
vconn_close(vconn);
+}
- if (file != stdin) {
- fclose(file);
- }
+static void
+do_add_flow(int argc, char *argv[])
+{
+ do_flow_mod__(argc, argv, OFPFC_ADD);
+}
+
+static void
+do_add_flows(int argc, char *argv[])
+{
+ do_flow_mod_file__(argc, argv, OFPFC_ADD);
}
static void
}
static void