X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ofproto%2Fofproto-dpif.c;h=d8d1e38430fb4e4ca6663c925b2efa7cb9dbf89a;hb=5e0c05bc058c78a11be6747f62e6ad88e5d06b70;hp=ab1cbe7ee609210b2d7e3dfa50bc5d1bb643c2dc;hpb=1ed8d3525139a260587a53d531327012ed3a0664;p=openvswitch diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index ab1cbe7e..d8d1e384 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -2456,6 +2456,7 @@ send_packet_in_miss(struct ofproto_dpif *ofproto, const struct ofpbuf *packet, pin.packet_len = packet->size; pin.total_len = packet->size; pin.reason = OFPR_NO_MATCH; + pin.controller_id = 0; pin.table_id = 0; pin.cookie = 0; @@ -4465,7 +4466,8 @@ flood_packets(struct action_xlate_ctx *ctx, bool all) static void execute_controller_action(struct action_xlate_ctx *ctx, int len, - enum ofp_packet_in_reason reason) + enum ofp_packet_in_reason reason, + uint16_t controller_id) { struct ofputil_packet_in pin; struct ofpbuf *packet; @@ -4511,6 +4513,7 @@ execute_controller_action(struct action_xlate_ctx *ctx, int len, pin.packet = packet->data; pin.packet_len = packet->size; pin.reason = reason; + pin.controller_id = controller_id; pin.table_id = ctx->table_id; pin.cookie = ctx->rule ? ctx->rule->up.flow_cookie : 0; @@ -4535,7 +4538,7 @@ compose_dec_ttl(struct action_xlate_ctx *ctx) ctx->flow.nw_ttl--; return false; } else { - execute_controller_action(ctx, UINT16_MAX, OFPR_INVALID_TTL); + execute_controller_action(ctx, UINT16_MAX, OFPR_INVALID_TTL, 0); /* Stop processing for current table. */ return true; @@ -4567,7 +4570,7 @@ xlate_output_action__(struct action_xlate_ctx *ctx, flood_packets(ctx, true); break; case OFPP_CONTROLLER: - execute_controller_action(ctx, max_len, OFPR_ACTION); + execute_controller_action(ctx, max_len, OFPR_ACTION, 0); break; case OFPP_NONE: break; @@ -4805,6 +4808,7 @@ do_xlate_actions(const union ofp_action *in, size_t n_in, const struct nx_action_autopath *naa; const struct nx_action_bundle *nab; const struct nx_action_output_reg *naor; + const struct nx_action_controller *nac; enum ofputil_action_code code; ovs_be64 tun_id; @@ -4965,6 +4969,12 @@ do_xlate_actions(const union ofp_action *in, size_t n_in, ctx->has_fin_timeout = true; xlate_fin_timeout(ctx, (const struct nx_action_fin_timeout *) ia); break; + + case OFPUTIL_NXAST_CONTROLLER: + nac = (const struct nx_action_controller *) ia; + execute_controller_action(ctx, ntohs(nac->max_len), nac->reason, + ntohs(nac->controller_id)); + break; } } @@ -5888,7 +5898,7 @@ ofproto_unixctl_fdb_flush(struct unixctl_conn *conn, int argc, if (argc > 1) { ofproto = ofproto_dpif_lookup(argv[1]); if (!ofproto) { - unixctl_command_reply(conn, 501, "no such bridge"); + unixctl_command_reply_error(conn, "no such bridge"); return; } mac_learning_flush(ofproto->ml, &ofproto->revalidate_set); @@ -5898,7 +5908,7 @@ ofproto_unixctl_fdb_flush(struct unixctl_conn *conn, int argc, } } - unixctl_command_reply(conn, 200, "table successfully flushed"); + unixctl_command_reply(conn, "table successfully flushed"); } static void @@ -5911,7 +5921,7 @@ ofproto_unixctl_fdb_show(struct unixctl_conn *conn, int argc OVS_UNUSED, ofproto = ofproto_dpif_lookup(argv[1]); if (!ofproto) { - unixctl_command_reply(conn, 501, "no such bridge"); + unixctl_command_reply_error(conn, "no such bridge"); return; } @@ -5923,7 +5933,7 @@ ofproto_unixctl_fdb_show(struct unixctl_conn *conn, int argc OVS_UNUSED, e->vlan, ETH_ADDR_ARGS(e->mac), mac_entry_age(ofproto->ml, e)); } - unixctl_command_reply(conn, 200, ds_cstr(&ds)); + unixctl_command_reply(conn, ds_cstr(&ds)); ds_destroy(&ds); } @@ -6028,8 +6038,8 @@ ofproto_unixctl_trace(struct unixctl_conn *conn, int argc, const char *argv[], ofproto = ofproto_dpif_lookup(dpname); if (!ofproto) { - unixctl_command_reply(conn, 501, "Unknown ofproto (use ofproto/list " - "for help)"); + unixctl_command_reply_error(conn, "Unknown ofproto (use ofproto/list " + "for help)"); goto exit; } if (argc == 3 || (argc == 4 && !strcmp(argv[3], "-generate"))) { @@ -6042,7 +6052,7 @@ ofproto_unixctl_trace(struct unixctl_conn *conn, int argc, const char *argv[], ofpbuf_init(&odp_key, 0); error = odp_flow_key_from_string(flow_s, NULL, &odp_key); if (error) { - unixctl_command_reply(conn, 501, "Bad flow syntax"); + unixctl_command_reply_error(conn, "Bad flow syntax"); goto exit; } @@ -6051,7 +6061,7 @@ ofproto_unixctl_trace(struct unixctl_conn *conn, int argc, const char *argv[], odp_key.size, &flow, &initial_tci, NULL); if (error == ODP_FIT_ERROR) { - unixctl_command_reply(conn, 501, "Invalid flow"); + unixctl_command_reply_error(conn, "Invalid flow"); goto exit; } @@ -6073,7 +6083,7 @@ ofproto_unixctl_trace(struct unixctl_conn *conn, int argc, const char *argv[], msg = eth_from_hex(packet_s, &packet); if (msg) { - unixctl_command_reply(conn, 501, msg); + unixctl_command_reply_error(conn, msg); goto exit; } @@ -6085,7 +6095,7 @@ ofproto_unixctl_trace(struct unixctl_conn *conn, int argc, const char *argv[], flow_extract(packet, priority, tun_id, in_port, &flow); initial_tci = flow.vlan_tci; } else { - unixctl_command_reply(conn, 501, "Bad command syntax"); + unixctl_command_reply_error(conn, "Bad command syntax"); goto exit; } @@ -6125,7 +6135,7 @@ ofproto_unixctl_trace(struct unixctl_conn *conn, int argc, const char *argv[], } } - unixctl_command_reply(conn, 200, ds_cstr(&result)); + unixctl_command_reply(conn, ds_cstr(&result)); exit: ds_destroy(&result); @@ -6138,7 +6148,7 @@ ofproto_dpif_clog(struct unixctl_conn *conn OVS_UNUSED, int argc OVS_UNUSED, const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED) { clogged = true; - unixctl_command_reply(conn, 200, NULL); + unixctl_command_reply(conn, NULL); } static void @@ -6146,7 +6156,7 @@ ofproto_dpif_unclog(struct unixctl_conn *conn OVS_UNUSED, int argc OVS_UNUSED, const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED) { clogged = false; - unixctl_command_reply(conn, 200, NULL); + unixctl_command_reply(conn, NULL); } /* Runs a self-check of flow translations in 'ofproto'. Appends a message to @@ -6185,8 +6195,8 @@ ofproto_dpif_self_check(struct unixctl_conn *conn, if (argc > 1) { ofproto = ofproto_dpif_lookup(argv[1]); if (!ofproto) { - unixctl_command_reply(conn, 501, "Unknown ofproto (use " - "ofproto/list for help)"); + unixctl_command_reply_error(conn, "Unknown ofproto (use " + "ofproto/list for help)"); return; } ofproto_dpif_self_check__(ofproto, &reply); @@ -6196,7 +6206,7 @@ ofproto_dpif_self_check(struct unixctl_conn *conn, } } - unixctl_command_reply(conn, 200, ds_cstr(&reply)); + unixctl_command_reply(conn, ds_cstr(&reply)); ds_destroy(&reply); }