Ejemplo n.º 1
0
static void
emit_ct(struct action_context *ctx, bool recirc_next, bool commit)
{
    struct ofpact_conntrack *ct = ofpact_put_CT(ctx->ofpacts);
    ct->flags |= commit ? NX_CT_F_COMMIT : 0;

    /* If "recirc" is set, we automatically go to the next table. */
    if (recirc_next) {
        if (ctx->cur_ltable < ctx->n_tables) {
            ct->recirc_table = ctx->first_ptable + ctx->cur_ltable + 1;
        } else {
            action_error(ctx, "\"ct_next\" action not allowed in last table.");
            return;
        }
    } else {
        ct->recirc_table = NX_CT_RECIRC_NONE;
    }

    ct->zone_src.field = mf_from_id(MFF_LOG_CT_ZONE);
    ct->zone_src.ofs = 0;
    ct->zone_src.n_bits = 16;

    /* We do not support ALGs yet. */
    ct->alg = 0;

    /* CT only works with IP, so set up a prerequisite. */
    struct expr *expr;
    char *error;

    expr = expr_parse_string("ip", ctx->symtab, &error);
    ovs_assert(!error);
    ctx->prereqs = expr_combine(EXPR_T_AND, ctx->prereqs, expr);
}
Ejemplo n.º 2
0
void act_eth_dst(struct ofpbuf* buf, const uint8_t *dstMac, int flowHasVlan) {
    if (dstMac) {
        uint8_t mask[6];
        memset(mask, 0xff, sizeof(mask));
        struct ofpact_set_field *sf =
            ofpact_put_set_field(buf, mf_from_id(MFF_ETH_DST), dstMac, mask);
        sf->flow_has_vlan = flowHasVlan;
    }
}
Ejemplo n.º 3
0
static void initSubFieldExt(struct mf_subfield *sf, enum mf_field_id id,
                            uint8_t start, uint8_t nBits) {
    const struct mf_field *field = mf_from_id(id);
    sf->field = field;
    sf->ofs = start;
    if (nBits)
        sf->n_bits = nBits;
    else
        sf->n_bits = field->n_bits;
}
Ejemplo n.º 4
0
void act_conntrack(struct ofpbuf* buf,
                   uint16_t flags,
                   uint16_t zoneImm,
                   int zoneSrc,
                   uint8_t recircTable,
                   uint16_t alg) {
    struct ofpact_conntrack* act = ofpact_put_CT(buf);
    act->flags = flags;
    act->zone_imm = zoneImm;
    if (zoneSrc) {
        const struct mf_field *field = mf_from_id(zoneSrc);
        act->zone_src.field = field;
        act->zone_src.ofs = 0;
        act->zone_src.n_bits = 16;
    }
    act->alg = alg;
    act->recirc_table = recircTable;
}
Ejemplo n.º 5
0
void act_ip_dst_v6(struct ofpbuf* buf, uint8_t* addr) {
    uint8_t mask[16];
    memset(mask, 0xff, sizeof(mask));
    ofpact_put_set_field(buf, mf_from_id(MFF_IPV6_DST), addr, mask);
}