X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utilities%2Fovs-ofctl.c;h=82e135abd1d6d629bf535addd191fed67a8a867e;hb=cc01d0bb79103a01aa0afc3484249fd518b877ea;hp=e46e1a2dbe23f0ccab8d7beeb40f7fbe692e7a5e;hpb=e94b92baf63322117e22a7432e1740afa3073587;p=openvswitch diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index e46e1a2d..82e135ab 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -51,12 +51,6 @@ VLOG_DEFINE_THIS_MODULE(ofctl); - -#define MOD_PORT_CMD_UP "up" -#define MOD_PORT_CMD_DOWN "down" -#define MOD_PORT_CMD_FLOOD "flood" -#define MOD_PORT_CMD_NOFLOOD "noflood" - /* Use strict matching for flow mod commands? */ static bool strict; @@ -217,7 +211,7 @@ open_vconn__(const char *name, const char *default_suffix, struct stat s; char *bridge_path, *datapath_name, *datapath_type; - bridge_path = xasprintf("%s/%s.%s", ovs_rundir, name, default_suffix); + bridge_path = xasprintf("%s/%s.%s", ovs_rundir(), name, default_suffix); dp_parse_name(name, &datapath_name, &datapath_type); if (strstr(name, ":")) { @@ -239,7 +233,7 @@ open_vconn__(const char *name, const char *default_suffix, } socket_name = xasprintf("%s/%s.%s", - ovs_rundir, dpif_name, default_suffix); + ovs_rundir(), dpif_name, default_suffix); if (stat(socket_name, &s)) { ovs_fatal(errno, "cannot connect to %s: stat failed on %s", name, socket_name); @@ -307,7 +301,7 @@ dump_trivial_transaction(const char *vconn_name, uint8_t request_type) static void dump_stats_transaction(const char *vconn_name, struct ofpbuf *request) { - uint32_t send_xid = ((struct ofp_header *) request->data)->xid; + ovs_be32 send_xid = ((struct ofp_header *) request->data)->xid; struct vconn *vconn; bool done = false; @@ -443,8 +437,7 @@ do_dump_flows(int argc, char *argv[]) req = alloc_stats_request(sizeof *req, OFPST_FLOW, &request); parse_ofp_str(&pf, NULL, argc > 2 ? argv[2] : ""); - flow_to_match(&pf.rule.flow, pf.rule.wc.wildcards, NXFF_OPENFLOW10, - &req->match); + ofputil_cls_rule_to_match(&pf.rule, NXFF_OPENFLOW10, &req->match); memset(&req->pad, 0, sizeof req->pad); req->out_port = htons(pf.out_port); @@ -460,8 +453,7 @@ do_dump_aggregate(int argc, char *argv[]) req = alloc_stats_request(sizeof *req, OFPST_AGGREGATE, &request); parse_ofp_str(&pf, NULL, argc > 2 ? argv[2] : ""); - flow_to_match(&pf.rule.flow, pf.rule.wc.wildcards, NXFF_OPENFLOW10, - &req->match); + ofputil_cls_rule_to_match(&pf.rule, NXFF_OPENFLOW10, &req->match); memset(&req->pad, 0, sizeof req->pad); req->out_port = htons(pf.out_port); @@ -692,19 +684,14 @@ do_mod_port(int argc OVS_UNUSED, char *argv[]) opm->mask = htonl(0); opm->advertise = htonl(0); - printf("modifying port: %s\n", osf->ports[port_idx].name); - - if (!strncasecmp(argv[3], MOD_PORT_CMD_UP, sizeof MOD_PORT_CMD_UP)) { + if (!strcasecmp(argv[3], "up")) { opm->mask |= htonl(OFPPC_PORT_DOWN); - } else if (!strncasecmp(argv[3], MOD_PORT_CMD_DOWN, - sizeof MOD_PORT_CMD_DOWN)) { + } else if (!strcasecmp(argv[3], "down")) { opm->mask |= htonl(OFPPC_PORT_DOWN); opm->config |= htonl(OFPPC_PORT_DOWN); - } else if (!strncasecmp(argv[3], MOD_PORT_CMD_FLOOD, - sizeof MOD_PORT_CMD_FLOOD)) { + } else if (!strcasecmp(argv[3], "flood")) { opm->mask |= htonl(OFPPC_NO_FLOOD); - } else if (!strncasecmp(argv[3], MOD_PORT_CMD_NOFLOOD, - sizeof MOD_PORT_CMD_NOFLOOD)) { + } else if (!strcasecmp(argv[3], "noflood")) { opm->mask |= htonl(OFPPC_NO_FLOOD); opm->config |= htonl(OFPPC_NO_FLOOD); } else { @@ -755,7 +742,7 @@ do_ping(int argc, char *argv[]) ofp_print(stdout, reply, reply->size, 2); } printf("%zu bytes from %s: xid=%08"PRIx32" time=%.1f ms\n", - reply->size - sizeof *rpy_hdr, argv[1], rpy_hdr->xid, + reply->size - sizeof *rpy_hdr, argv[1], ntohl(rpy_hdr->xid), (1000*(double)(end.tv_sec - start.tv_sec)) + (.001*(end.tv_usec - start.tv_usec))); ofpbuf_delete(request);