- act[actlen] = '\0';
-
- if (!strcasecmp(act, "mod_vlan_vid")) {
- struct ofp_action_vlan_vid *va;
- va = put_action(b, sizeof *va, OFPAT_SET_VLAN_VID);
- va->vlan_vid = htons(str_to_u32(arg));
- } else if (!strcasecmp(act, "mod_vlan_pcp")) {
- struct ofp_action_vlan_pcp *va;
- va = put_action(b, sizeof *va, OFPAT_SET_VLAN_PCP);
- va->vlan_pcp = str_to_u32(arg);
- } else if (!strcasecmp(act, "strip_vlan")) {
- struct ofp_action_header *ah;
- ah = put_action(b, sizeof *ah, OFPAT_STRIP_VLAN);
- ah->type = htons(OFPAT_STRIP_VLAN);
- } else if (!strcasecmp(act, "mod_dl_src")) {
- put_dl_addr_action(b, OFPAT_SET_DL_SRC, arg);
- } else if (!strcasecmp(act, "mod_dl_dst")) {
- put_dl_addr_action(b, OFPAT_SET_DL_DST, arg);
- } else if (!strcasecmp(act, "mod_nw_src")) {
- struct ofp_action_nw_addr *na;
- na = put_action(b, sizeof *na, OFPAT_SET_NW_SRC);
- str_to_ip(arg, &na->nw_addr, NULL);
- } else if (!strcasecmp(act, "mod_nw_dst")) {
- struct ofp_action_nw_addr *na;
- na = put_action(b, sizeof *na, OFPAT_SET_NW_DST);
- str_to_ip(arg, &na->nw_addr, NULL);
- } else if (!strcasecmp(act, "mod_tp_src")) {
- struct ofp_action_tp_port *ta;
- ta = put_action(b, sizeof *ta, OFPAT_SET_TP_SRC);
- ta->tp_port = htons(str_to_u32(arg));
- } else if (!strcasecmp(act, "mod_tp_dst")) {
- struct ofp_action_tp_port *ta;
- ta = put_action(b, sizeof *ta, OFPAT_SET_TP_DST);
- ta->tp_port = htons(str_to_u32(arg));
- } else if (!strcasecmp(act, "mod_nw_tos")) {
- struct ofp_action_nw_tos *nt;
- nt = put_action(b, sizeof *nt, OFPAT_SET_NW_TOS);
- nt->nw_tos = str_to_u32(arg);
- } else if (!strcasecmp(act, "resubmit")) {
- struct nx_action_resubmit *nar;
- nar = put_action(b, sizeof *nar, OFPAT_VENDOR);
- nar->vendor = htonl(NX_VENDOR_ID);
- nar->subtype = htons(NXAST_RESUBMIT);
- nar->in_port = htons(str_to_u32(arg));
- } else if (!strcasecmp(act, "set_tunnel")
- || !strcasecmp(act, "set_tunnel64")) {
- uint64_t tun_id = str_to_u64(arg);
- if (!strcasecmp(act, "set_tunnel64") || tun_id > UINT32_MAX) {
- struct nx_action_set_tunnel64 *nast64;
- nast64 = put_action(b, sizeof *nast64, OFPAT_VENDOR);
- nast64->vendor = htonl(NX_VENDOR_ID);
- nast64->subtype = htons(NXAST_SET_TUNNEL64);
- nast64->tun_id = htonll(tun_id);
- } else {
- struct nx_action_set_tunnel *nast;
- nast = put_action(b, sizeof *nast, OFPAT_VENDOR);
- nast->vendor = htonl(NX_VENDOR_ID);
- nast->subtype = htons(NXAST_SET_TUNNEL);
- nast->tun_id = htonl(tun_id);
- }
- } else if (!strcasecmp(act, "set_queue")) {
- struct nx_action_set_queue *nasq;
- nasq = put_action(b, sizeof *nasq, OFPAT_VENDOR);
- nasq->vendor = htonl(NX_VENDOR_ID);
- nasq->subtype = htons(NXAST_SET_QUEUE);
- nasq->queue_id = htonl(str_to_u32(arg));
- } else if (!strcasecmp(act, "pop_queue")) {
- struct nx_action_header *nah;
- nah = put_action(b, sizeof *nah, OFPAT_VENDOR);
- nah->vendor = htonl(NX_VENDOR_ID);
- nah->subtype = htons(NXAST_POP_QUEUE);
- } else if (!strcasecmp(act, "note")) {
- size_t start_ofs = b->size;
- struct nx_action_note *nan;
- int remainder;
- size_t len;
-
- nan = put_action(b, sizeof *nan, OFPAT_VENDOR);
- nan->vendor = htonl(NX_VENDOR_ID);
- nan->subtype = htons(NXAST_NOTE);
-
- b->size -= sizeof nan->note;
- while (*arg != '\0') {
- uint8_t byte;
- bool ok;
-
- if (*arg == '.') {
- arg++;
- }
- if (*arg == '\0') {
- break;
- }