X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=utilities%2Fovs-ofctl.c;h=2988fb60a1d2064dab073f5816d9631807eb5c2f;hb=a797eab3d57910765fd1515600feb4ffe20b31ce;hp=da0a54b6cea59805d82de60614388bb185ad1c84;hpb=e8f9a7bbf1b4dd4cfd4f16a3a9c28ccf406b7d26;p=sliver-openvswitch.git diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index da0a54b6c..2988fb60a 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -890,9 +890,7 @@ prepare_dump_flows(int argc, char *argv[], bool aggregate, error = parse_ofp_flow_stats_request_str(&fsr, aggregate, argc > 2 ? argv[2] : "", - &usable_protocols, - !(allowed_protocols - & OFPUTIL_P_OF10_ANY)); + &usable_protocols); if (error) { ovs_fatal(0, "%s", error); } @@ -1134,8 +1132,7 @@ ofctl_flow_mod_file(int argc OVS_UNUSED, char *argv[], uint16_t command) char *error; error = parse_ofp_flow_mod_file(argv[2], command, &fms, &n_fms, - &usable_protocols, - !(allowed_protocols & OFPUTIL_P_OF10_ANY)); + &usable_protocols); if (error) { ovs_fatal(0, "%s", error); } @@ -1154,9 +1151,7 @@ ofctl_flow_mod(int argc, char *argv[], uint16_t command) enum ofputil_protocol usable_protocols; error = parse_ofp_flow_mod_str(&fm, argc > 2 ? argv[2] : "", command, - &usable_protocols, - !(allowed_protocols - & OFPUTIL_P_OF10_ANY)); + &usable_protocols); if (error) { ovs_fatal(0, "%s", error); } @@ -1544,7 +1539,7 @@ ofctl_monitor(int argc, char *argv[]) case OFP13_VERSION: break; default: - NOT_REACHED(); + OVS_NOT_REACHED(); } } @@ -1606,7 +1601,7 @@ ofctl_packet_out(int argc, char *argv[]) struct vconn *vconn; char *error; int i; - enum ofputil_protocol usable_protocols; /* TODO: Use in proto selection */ + enum ofputil_protocol usable_protocols; /* XXX: Use in proto selection */ ofpbuf_init(&ofpacts, 64); error = parse_ofpacts(argv[3], &ofpacts, &usable_protocols); @@ -1810,7 +1805,7 @@ ofctl_ofp_parse(int argc OVS_UNUSED, char *argv[]) length = ntohs(oh->length); if (length < sizeof *oh) { - ovs_fatal(0, "%s: %zu-byte message is too short for OpenFlow", + ovs_fatal(0, "%s: %"PRIuSIZE"-byte message is too short for OpenFlow", filename, length); } @@ -1840,7 +1835,7 @@ ofctl_ping(int argc, char *argv[]) payload = argc > 2 ? atoi(argv[2]) : 64; if (payload > max_payload) { - ovs_fatal(0, "payload must be between 0 and %zu bytes", max_payload); + ovs_fatal(0, "payload must be between 0 and %"PRIuSIZE" bytes", max_payload); } open_vconn(argv[1], &vconn); @@ -1868,7 +1863,7 @@ ofctl_ping(int argc, char *argv[]) printf("Reply:\n"); ofp_print(stdout, reply, reply->size, verbosity + 2); } - printf("%zu bytes from %s: xid=%08"PRIx32" time=%.1f ms\n", + printf("%"PRIuSIZE" bytes from %s: xid=%08"PRIx32" time=%.1f ms\n", reply->size, argv[1], ntohl(rpy_hdr->xid), (1000*(double)(end.tv_sec - start.tv_sec)) + (.001*(end.tv_usec - start.tv_usec))); @@ -1891,7 +1886,7 @@ ofctl_benchmark(int argc OVS_UNUSED, char *argv[]) payload_size = atoi(argv[2]); if (payload_size > max_payload) { - ovs_fatal(0, "payload must be between 0 and %zu bytes", max_payload); + ovs_fatal(0, "payload must be between 0 and %"PRIuSIZE" bytes", max_payload); } message_size = sizeof(struct ofp_header) + payload_size; @@ -2231,8 +2226,7 @@ read_flows_from_file(const char *filename, struct classifier *cls, int index) char *error; enum ofputil_protocol usable; - error = parse_ofp_str(&fm, OFPFC_ADD, ds_cstr(&s), &usable, - !(allowed_protocols & OFPUTIL_P_OF10_ANY)); + error = parse_ofp_str(&fm, OFPFC_ADD, ds_cstr(&s), &usable); if (error) { ovs_fatal(0, "%s:%d: %s", filename, line_number, error); } @@ -2398,7 +2392,7 @@ ofctl_replace_flows(int argc OVS_UNUSED, char *argv[]) struct vconn *vconn; struct fte *fte; - classifier_init(&cls); + classifier_init(&cls, NULL); usable_protocols = read_flows_from_file(argv[2], &cls, FILE_IDX); protocol = open_vconn(argv[1], &vconn); @@ -2468,7 +2462,7 @@ ofctl_diff_flows(int argc OVS_UNUSED, char *argv[]) struct ds a_s, b_s; struct fte *fte; - classifier_init(&cls); + classifier_init(&cls, NULL); read_flows_from_source(argv[1], &cls, 0); read_flows_from_source(argv[2], &cls, 1); @@ -2651,8 +2645,7 @@ ofctl_parse_flow(int argc OVS_UNUSED, char *argv[]) struct ofputil_flow_mod fm; char *error; - error = parse_ofp_flow_mod_str(&fm, argv[1], OFPFC_ADD, &usable_protocols, - !(allowed_protocols & OFPUTIL_P_OF10_ANY)); + error = parse_ofp_flow_mod_str(&fm, argv[1], OFPFC_ADD, &usable_protocols); if (error) { ovs_fatal(0, "%s", error); } @@ -2670,8 +2663,7 @@ ofctl_parse_flows(int argc OVS_UNUSED, char *argv[]) char *error; error = parse_ofp_flow_mod_file(argv[1], OFPFC_ADD, &fms, &n_fms, - &usable_protocols, - !(allowed_protocols & OFPUTIL_P_OF10_ANY)); + &usable_protocols); if (error) { ovs_fatal(0, "%s", error); } @@ -2774,15 +2766,15 @@ print_differences(const char *prefix, for (i = 0; i < MIN(a_len, b_len); i++) { if (a[i] != b[i]) { - printf("%s%2zu: %02"PRIx8" -> %02"PRIx8"\n", + printf("%s%2"PRIuSIZE": %02"PRIx8" -> %02"PRIx8"\n", prefix, i, a[i], b[i]); } } for (i = a_len; i < b_len; i++) { - printf("%s%2zu: (none) -> %02"PRIx8"\n", prefix, i, b[i]); + printf("%s%2"PRIuSIZE": (none) -> %02"PRIx8"\n", prefix, i, b[i]); } for (i = b_len; i < a_len; i++) { - printf("%s%2zu: %02"PRIx8" -> (none)\n", prefix, i, a[i]); + printf("%s%2"PRIuSIZE": %02"PRIx8" -> (none)\n", prefix, i, a[i]); } } @@ -2813,7 +2805,8 @@ ofctl_parse_ofp10_actions(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) /* Convert to ofpacts. */ ofpbuf_init(&ofpacts, 0); size = of10_in.size; - error = ofpacts_pull_openflow10(&of10_in, of10_in.size, &ofpacts); + error = ofpacts_pull_openflow_actions(&of10_in, of10_in.size, + OFP10_VERSION, &ofpacts); if (error) { printf("bad OF1.1 actions: %s\n\n", ofperr_get_name(error)); ofpbuf_uninit(&ofpacts); @@ -2831,7 +2824,8 @@ ofctl_parse_ofp10_actions(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) /* Convert back to ofp10 actions and print differences from input. */ ofpbuf_init(&of10_out, 0); - ofpacts_put_openflow10(ofpacts.data, ofpacts.size, &of10_out); + ofpacts_put_openflow_actions(ofpacts.data, ofpacts.size, &of10_out, + OFP10_VERSION); print_differences("", of10_in.data, of10_in.size, of10_out.data, of10_out.size); @@ -2881,7 +2875,7 @@ ofctl_parse_ofp10_match(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) ovs_fatal(0, "Trailing garbage in hex data"); } if (match_expout.size != sizeof(struct ofp10_match)) { - ovs_fatal(0, "Input is %zu bytes, expected %zu", + ovs_fatal(0, "Input is %"PRIuSIZE" bytes, expected %"PRIuSIZE, match_expout.size, sizeof(struct ofp10_match)); } @@ -2896,7 +2890,7 @@ ofctl_parse_ofp10_match(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) ovs_fatal(0, "Trailing garbage in hex data"); } if (match_in.size != sizeof(struct ofp10_match)) { - ovs_fatal(0, "Input is %zu bytes, expected %zu", + ovs_fatal(0, "Input is %"PRIuSIZE" bytes, expected %"PRIuSIZE, match_in.size, sizeof(struct ofp10_match)); } @@ -2945,7 +2939,7 @@ ofctl_parse_ofp11_match(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) ovs_fatal(0, "Trailing garbage in hex data"); } if (match_in.size != sizeof(struct ofp11_match)) { - ovs_fatal(0, "Input is %zu bytes, expected %zu", + ovs_fatal(0, "Input is %"PRIuSIZE" bytes, expected %"PRIuSIZE, match_in.size, sizeof(struct ofp11_match)); } @@ -2999,8 +2993,8 @@ ofctl_parse_ofp11_actions(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) /* Convert to ofpacts. */ ofpbuf_init(&ofpacts, 0); size = of11_in.size; - error = ofpacts_pull_openflow11_actions(&of11_in, OFP11_VERSION, - of11_in.size, &ofpacts); + error = ofpacts_pull_openflow_actions(&of11_in, of11_in.size, + OFP11_VERSION, &ofpacts); if (error) { printf("bad OF1.1 actions: %s\n\n", ofperr_get_name(error)); ofpbuf_uninit(&ofpacts); @@ -3018,7 +3012,8 @@ ofctl_parse_ofp11_actions(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) /* Convert back to ofp11 actions and print differences from input. */ ofpbuf_init(&of11_out, 0); - ofpacts_put_openflow11_actions(ofpacts.data, ofpacts.size, &of11_out); + ofpacts_put_openflow_actions(ofpacts.data, ofpacts.size, &of11_out, + OFP11_VERSION); print_differences("", of11_in.data, of11_in.size, of11_out.data, of11_out.size); @@ -3068,14 +3063,16 @@ ofctl_parse_ofp11_instructions(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) /* Convert to ofpacts. */ ofpbuf_init(&ofpacts, 0); size = of11_in.size; - error = ofpacts_pull_openflow11_instructions(&of11_in, OFP11_VERSION, - of11_in.size, &ofpacts); + error = ofpacts_pull_openflow_instructions(&of11_in, of11_in.size, + OFP11_VERSION, &ofpacts); if (!error) { /* Verify actions, enforce consistency. */ struct flow flow; memset(&flow, 0, sizeof flow); - error = ofpacts_check(ofpacts.data, ofpacts.size, &flow, OFPP_MAX, - table_id ? atoi(table_id) : 0, true); + error = ofpacts_check_consistency(ofpacts.data, ofpacts.size, + &flow, OFPP_MAX, + table_id ? atoi(table_id) : 0, + 255, OFPUTIL_P_OF11_STD); } if (error) { printf("bad OF1.1 instructions: %s\n\n", ofperr_get_name(error)); @@ -3095,8 +3092,8 @@ ofctl_parse_ofp11_instructions(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) /* Convert back to ofp11 instructions and print differences from * input. */ ofpbuf_init(&of11_out, 0); - ofpacts_put_openflow11_instructions(ofpacts.data, ofpacts.size, - &of11_out); + ofpacts_put_openflow_instructions(ofpacts.data, ofpacts.size, + &of11_out, OFP13_VERSION); print_differences("", of11_in.data, of11_in.size, of11_out.data, of11_out.size); @@ -3125,7 +3122,7 @@ ofctl_parse_pcap(int argc OVS_UNUSED, char *argv[]) struct flow flow; int error; - error = pcap_read(pcap, &packet); + error = pcap_read(pcap, &packet, NULL); if (error == EOF) { break; } else if (error) { @@ -3173,8 +3170,7 @@ ofctl_check_vlan(int argc OVS_UNUSED, char *argv[]) string_s = match_to_string(&match, OFP_DEFAULT_PRIORITY); printf("%s -> ", string_s); fflush(stdout); - error_s = parse_ofp_str(&fm, -1, string_s, &usable_protocols, - !(allowed_protocols & OFPUTIL_P_OF10_ANY)); + error_s = parse_ofp_str(&fm, -1, string_s, &usable_protocols); if (error_s) { ovs_fatal(0, "%s", error_s); }