예제 #1
0
void
action_set_execute(struct action_set *set, struct packet *pkt) {
    struct action_set_entry *entry, *next;

    LIST_FOR_EACH_SAFE(entry, next, struct action_set_entry, node, &set->actions) {
        dp_execute_action(pkt, entry->action);
        list_remove(&entry->node);
        free(entry);

        /* According to the spec. if there was a group action, the output
         * port action should be ignored */
        if (pkt->out_group != OFPG_ANY) {
            uint32_t group_id = pkt->out_group;
            pkt->out_group = OFPG_ANY;

            action_set_clear_actions(pkt->action_set);
            group_table_execute(pkt->dp->groups, pkt, group_id);

            return;
        } else if (pkt->out_port != OFPP_ANY) {
            uint32_t port_id = pkt->out_port;
            uint32_t queue_id = pkt->out_queue;
            uint16_t max_len = pkt->out_port_max_len;
            pkt->out_port = OFPP_ANY;
            pkt->out_port_max_len = 0;
            pkt->out_queue = 0;

            action_set_clear_actions(pkt->action_set);
            dp_actions_output_port(pkt, port_id, queue_id, max_len);
            return;
        }
    }
}
예제 #2
0
void
action_set_execute(struct action_set *set, struct packet *pkt, uint64_t cookie) {
    struct action_set_entry *entry, *next;

    LIST_FOR_EACH_SAFE(entry, next, struct action_set_entry, node, &set->actions) {
        dp_execute_action(pkt, entry->action);
        list_remove(&entry->node);
        free(entry);
    }

    /* Clear the action set in any case. Group processing depend on
     * a clean action-set. Jean II */
    action_set_clear_actions(pkt->action_set);

        /* According to the spec. if there was a group action, the output
         * port action should be ignored */
        if (pkt->out_group != OFPG_ANY) {
            uint32_t group_id = pkt->out_group;
            pkt->out_group = OFPG_ANY;

            /* Transfer packet to the group. It will be destroyed. Jean II */
            group_table_execute(pkt->dp->groups, pkt, group_id);

            return;
        } else if (pkt->out_port != OFPP_ANY) {
            uint32_t port_id = pkt->out_port;
            uint32_t queue_id = pkt->out_queue;
            uint16_t max_len = pkt->out_port_max_len;
            pkt->out_port = OFPP_ANY;
            pkt->out_port_max_len = 0;
            pkt->out_queue = 0;

            dp_actions_output_port(pkt, port_id, queue_id, max_len, cookie);
            packet_destroy(pkt);
            return;
        }

    /* No output or group action. Just drop the packet. Jean II */
    packet_destroy(pkt);
}