X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fofp-parse.c;h=d563a4e440efc3d24f7611070c418d7ec0cd7e25;hb=a23aab1fc2f66b63ba9b7e4b9c9a8f6d58c367d0;hp=069687b15aed0a7e4ed71140b1734c8cc7c4d94f;hpb=15f1f1b63ab5514f8dfafa8f4c90ecee44693e1d;p=openvswitch diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index 069687b1..d563a4e4 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -21,6 +21,7 @@ #include #include +#include "byte-order.h" #include "dynamic-string.h" #include "netdev.h" #include "ofp-util.h" @@ -30,9 +31,8 @@ #include "socket-util.h" #include "vconn.h" #include "vlog.h" -#include "xtoxll.h" -VLOG_DEFINE_THIS_MODULE(ofp_parse) +VLOG_DEFINE_THIS_MODULE(ofp_parse); static uint32_t str_to_u32(const char *str) @@ -40,6 +40,10 @@ str_to_u32(const char *str) char *tail; uint32_t value; + if (!str) { + ovs_fatal(0, "missing required numeric argument"); + } + errno = 0; value = strtoul(str, &tail, 0); if (errno == EINVAL || errno == ERANGE || *tail) { @@ -267,6 +271,17 @@ str_to_action(char *str, struct ofpbuf *b) nah = put_action(b, sizeof *nah, OFPAT_VENDOR); nah->vendor = htonl(NX_VENDOR_ID); nah->subtype = htons(NXAST_DROP_SPOOFED_ARP); + } 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, "output")) { put_output_action(b, str_to_u32(arg)); } else if (!strcasecmp(act, "enqueue")) {