]> git.proxmox.com Git - mirror_ovs.git/blob - lib/ofp-parse.c
ovs-ofctl: Allow priority and timeout to be specified on mod-flows.
[mirror_ovs.git] / lib / ofp-parse.c
1 /*
2 * Copyright (c) 2010, 2011 Nicira Networks.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include <config.h>
18
19 #include "ofp-parse.h"
20
21 #include <ctype.h>
22 #include <errno.h>
23 #include <stdlib.h>
24
25 #include "autopath.h"
26 #include "bundle.h"
27 #include "byte-order.h"
28 #include "dynamic-string.h"
29 #include "learn.h"
30 #include "meta-flow.h"
31 #include "netdev.h"
32 #include "multipath.h"
33 #include "nx-match.h"
34 #include "ofp-util.h"
35 #include "ofpbuf.h"
36 #include "openflow/openflow.h"
37 #include "packets.h"
38 #include "socket-util.h"
39 #include "vconn.h"
40 #include "vlog.h"
41
42 VLOG_DEFINE_THIS_MODULE(ofp_parse);
43
44 static uint8_t
45 str_to_table_id(const char *str)
46 {
47 int table_id;
48
49 if (!str_to_int(str, 10, &table_id) || table_id < 0 || table_id > 255) {
50 ovs_fatal(0, "invalid table \"%s\"", str);
51 }
52 return table_id;
53 }
54
55 static uint16_t
56 str_to_u16(const char *str, const char *name)
57 {
58 int value;
59
60 if (!str_to_int(str, 0, &value) || value < 0 || value > 65535) {
61 ovs_fatal(0, "invalid %s \"%s\"", name, str);
62 }
63 return value;
64 }
65
66 static uint32_t
67 str_to_u32(const char *str)
68 {
69 char *tail;
70 uint32_t value;
71
72 if (!str[0]) {
73 ovs_fatal(0, "missing required numeric argument");
74 }
75
76 errno = 0;
77 value = strtoul(str, &tail, 0);
78 if (errno == EINVAL || errno == ERANGE || *tail) {
79 ovs_fatal(0, "invalid numeric format %s", str);
80 }
81 return value;
82 }
83
84 static uint64_t
85 str_to_u64(const char *str)
86 {
87 char *tail;
88 uint64_t value;
89
90 if (!str[0]) {
91 ovs_fatal(0, "missing required numeric argument");
92 }
93
94 errno = 0;
95 value = strtoull(str, &tail, 0);
96 if (errno == EINVAL || errno == ERANGE || *tail) {
97 ovs_fatal(0, "invalid numeric format %s", str);
98 }
99 return value;
100 }
101
102 static void
103 str_to_mac(const char *str, uint8_t mac[6])
104 {
105 if (sscanf(str, ETH_ADDR_SCAN_FMT, ETH_ADDR_SCAN_ARGS(mac))
106 != ETH_ADDR_SCAN_COUNT) {
107 ovs_fatal(0, "invalid mac address %s", str);
108 }
109 }
110
111 static void
112 str_to_ip(const char *str, ovs_be32 *ip)
113 {
114 struct in_addr in_addr;
115
116 if (lookup_ip(str, &in_addr)) {
117 ovs_fatal(0, "%s: could not convert to IP address", str);
118 }
119 *ip = in_addr.s_addr;
120 }
121
122 static struct ofp_action_output *
123 put_output_action(struct ofpbuf *b, uint16_t port)
124 {
125 struct ofp_action_output *oao;
126
127 oao = ofputil_put_OFPAT_OUTPUT(b);
128 oao->port = htons(port);
129 return oao;
130 }
131
132 static void
133 parse_enqueue(struct ofpbuf *b, char *arg)
134 {
135 char *sp = NULL;
136 char *port = strtok_r(arg, ":q", &sp);
137 char *queue = strtok_r(NULL, "", &sp);
138 struct ofp_action_enqueue *oae;
139
140 if (port == NULL || queue == NULL) {
141 ovs_fatal(0, "\"enqueue\" syntax is \"enqueue:PORT:QUEUE\"");
142 }
143
144 oae = ofputil_put_OFPAT_ENQUEUE(b);
145 oae->port = htons(str_to_u32(port));
146 oae->queue_id = htonl(str_to_u32(queue));
147 }
148
149 static void
150 parse_output(struct ofpbuf *b, char *arg)
151 {
152 if (strchr(arg, '[')) {
153 struct nx_action_output_reg *naor;
154 struct mf_subfield src;
155
156 mf_parse_subfield(&src, arg);
157
158 naor = ofputil_put_NXAST_OUTPUT_REG(b);
159 naor->ofs_nbits = nxm_encode_ofs_nbits(src.ofs, src.n_bits);
160 naor->src = htonl(src.field->nxm_header);
161 naor->max_len = htons(UINT16_MAX);
162 } else {
163 put_output_action(b, str_to_u32(arg));
164 }
165 }
166
167 static void
168 parse_resubmit(struct ofpbuf *b, char *arg)
169 {
170 struct nx_action_resubmit *nar;
171 char *in_port_s, *table_s;
172 uint16_t in_port;
173 uint8_t table;
174
175 in_port_s = strsep(&arg, ",");
176 if (in_port_s && in_port_s[0]) {
177 if (!ofputil_port_from_string(in_port_s, &in_port)) {
178 in_port = str_to_u32(in_port_s);
179 }
180 } else {
181 in_port = OFPP_IN_PORT;
182 }
183
184 table_s = strsep(&arg, ",");
185 table = table_s && table_s[0] ? str_to_u32(table_s) : 255;
186
187 if (in_port == OFPP_IN_PORT && table == 255) {
188 ovs_fatal(0, "at least one \"in_port\" or \"table\" must be specified "
189 " on resubmit");
190 }
191
192 if (in_port != OFPP_IN_PORT && table == 255) {
193 nar = ofputil_put_NXAST_RESUBMIT(b);
194 } else {
195 nar = ofputil_put_NXAST_RESUBMIT_TABLE(b);
196 nar->table = table;
197 }
198 nar->in_port = htons(in_port);
199 }
200
201 static void
202 parse_set_tunnel(struct ofpbuf *b, const char *arg)
203 {
204 uint64_t tun_id = str_to_u64(arg);
205 if (tun_id > UINT32_MAX) {
206 ofputil_put_NXAST_SET_TUNNEL64(b)->tun_id = htonll(tun_id);
207 } else {
208 ofputil_put_NXAST_SET_TUNNEL(b)->tun_id = htonl(tun_id);
209 }
210 }
211
212 static void
213 parse_note(struct ofpbuf *b, const char *arg)
214 {
215 size_t start_ofs = b->size;
216 struct nx_action_note *nan;
217 int remainder;
218 size_t len;
219
220 nan = ofputil_put_NXAST_NOTE(b);
221
222 b->size -= sizeof nan->note;
223 while (*arg != '\0') {
224 uint8_t byte;
225 bool ok;
226
227 if (*arg == '.') {
228 arg++;
229 }
230 if (*arg == '\0') {
231 break;
232 }
233
234 byte = hexits_value(arg, 2, &ok);
235 if (!ok) {
236 ovs_fatal(0, "bad hex digit in `note' argument");
237 }
238 ofpbuf_put(b, &byte, 1);
239
240 arg += 2;
241 }
242
243 len = b->size - start_ofs;
244 remainder = len % OFP_ACTION_ALIGN;
245 if (remainder) {
246 ofpbuf_put_zeros(b, OFP_ACTION_ALIGN - remainder);
247 }
248 nan = (struct nx_action_note *)((char *)b->data + start_ofs);
249 nan->len = htons(b->size - start_ofs);
250 }
251
252 static void
253 parse_named_action(enum ofputil_action_code code, const struct flow *flow,
254 struct ofpbuf *b, char *arg)
255 {
256 struct ofp_action_dl_addr *oada;
257 struct ofp_action_vlan_pcp *oavp;
258 struct ofp_action_vlan_vid *oavv;
259 struct ofp_action_nw_addr *oana;
260 struct ofp_action_tp_port *oata;
261
262 switch (code) {
263 case OFPUTIL_OFPAT_OUTPUT:
264 parse_output(b, arg);
265 break;
266
267 case OFPUTIL_OFPAT_SET_VLAN_VID:
268 oavv = ofputil_put_OFPAT_SET_VLAN_VID(b);
269 oavv->vlan_vid = htons(str_to_u32(arg));
270 break;
271
272 case OFPUTIL_OFPAT_SET_VLAN_PCP:
273 oavp = ofputil_put_OFPAT_SET_VLAN_PCP(b);
274 oavp->vlan_pcp = str_to_u32(arg);
275 break;
276
277 case OFPUTIL_OFPAT_STRIP_VLAN:
278 ofputil_put_OFPAT_STRIP_VLAN(b);
279 break;
280
281 case OFPUTIL_OFPAT_SET_DL_SRC:
282 case OFPUTIL_OFPAT_SET_DL_DST:
283 oada = ofputil_put_action(code, b);
284 str_to_mac(arg, oada->dl_addr);
285 break;
286
287 case OFPUTIL_OFPAT_SET_NW_SRC:
288 case OFPUTIL_OFPAT_SET_NW_DST:
289 oana = ofputil_put_action(code, b);
290 str_to_ip(arg, &oana->nw_addr);
291 break;
292
293 case OFPUTIL_OFPAT_SET_NW_TOS:
294 ofputil_put_OFPAT_SET_NW_TOS(b)->nw_tos = str_to_u32(arg);
295 break;
296
297 case OFPUTIL_OFPAT_SET_TP_SRC:
298 case OFPUTIL_OFPAT_SET_TP_DST:
299 oata = ofputil_put_action(code, b);
300 oata->tp_port = htons(str_to_u32(arg));
301 break;
302
303 case OFPUTIL_OFPAT_ENQUEUE:
304 parse_enqueue(b, arg);
305 break;
306
307 case OFPUTIL_NXAST_RESUBMIT:
308 parse_resubmit(b, arg);
309 break;
310
311 case OFPUTIL_NXAST_SET_TUNNEL:
312 parse_set_tunnel(b, arg);
313 break;
314
315 case OFPUTIL_NXAST_SET_QUEUE:
316 ofputil_put_NXAST_SET_QUEUE(b)->queue_id = htonl(str_to_u32(arg));
317 break;
318
319 case OFPUTIL_NXAST_POP_QUEUE:
320 ofputil_put_NXAST_POP_QUEUE(b);
321 break;
322
323 case OFPUTIL_NXAST_REG_MOVE:
324 nxm_parse_reg_move(ofputil_put_NXAST_REG_MOVE(b), arg);
325 break;
326
327 case OFPUTIL_NXAST_REG_LOAD:
328 nxm_parse_reg_load(ofputil_put_NXAST_REG_LOAD(b), arg);
329 break;
330
331 case OFPUTIL_NXAST_NOTE:
332 parse_note(b, arg);
333 break;
334
335 case OFPUTIL_NXAST_SET_TUNNEL64:
336 ofputil_put_NXAST_SET_TUNNEL64(b)->tun_id = htonll(str_to_u64(arg));
337 break;
338
339 case OFPUTIL_NXAST_MULTIPATH:
340 multipath_parse(ofputil_put_NXAST_MULTIPATH(b), arg);
341 break;
342
343 case OFPUTIL_NXAST_AUTOPATH:
344 autopath_parse(ofputil_put_NXAST_AUTOPATH(b), arg);
345 break;
346
347 case OFPUTIL_NXAST_BUNDLE:
348 bundle_parse(b, arg);
349 break;
350
351 case OFPUTIL_NXAST_BUNDLE_LOAD:
352 bundle_parse_load(b, arg);
353 break;
354
355 case OFPUTIL_NXAST_RESUBMIT_TABLE:
356 case OFPUTIL_NXAST_OUTPUT_REG:
357 NOT_REACHED();
358
359 case OFPUTIL_NXAST_LEARN:
360 learn_parse(b, arg, flow);
361 break;
362
363 case OFPUTIL_NXAST_EXIT:
364 ofputil_put_NXAST_EXIT(b);
365 break;
366
367 case OFPUTIL_NXAST_DEC_TTL:
368 ofputil_put_NXAST_DEC_TTL(b);
369 break;
370 }
371 }
372
373 static void
374 str_to_action(const struct flow *flow, char *str, struct ofpbuf *b)
375 {
376 char *pos, *act, *arg;
377 int n_actions;
378
379 pos = str;
380 n_actions = 0;
381 while (ofputil_parse_key_value(&pos, &act, &arg)) {
382 uint16_t port;
383 int code;
384
385 code = ofputil_action_code_from_name(act);
386 if (code >= 0) {
387 parse_named_action(code, flow, b, arg);
388 } else if (!strcasecmp(act, "drop")) {
389 /* A drop action in OpenFlow occurs by just not setting
390 * an action. */
391 if (n_actions) {
392 ovs_fatal(0, "Drop actions must not be preceded by other "
393 "actions");
394 } else if (ofputil_parse_key_value(&pos, &act, &arg)) {
395 ovs_fatal(0, "Drop actions must not be followed by other "
396 "actions");
397 }
398 break;
399 } else if (!strcasecmp(act, "CONTROLLER")) {
400 struct ofp_action_output *oao;
401 oao = put_output_action(b, OFPP_CONTROLLER);
402
403 /* Unless a numeric argument is specified, we send the whole
404 * packet to the controller. */
405 if (arg[0] && (strspn(arg, "0123456789") == strlen(arg))) {
406 oao->max_len = htons(str_to_u32(arg));
407 } else {
408 oao->max_len = htons(UINT16_MAX);
409 }
410 } else if (ofputil_port_from_string(act, &port)) {
411 put_output_action(b, port);
412 } else {
413 ovs_fatal(0, "Unknown action: %s", act);
414 }
415 n_actions++;
416 }
417 }
418
419 struct protocol {
420 const char *name;
421 uint16_t dl_type;
422 uint8_t nw_proto;
423 };
424
425 static bool
426 parse_protocol(const char *name, const struct protocol **p_out)
427 {
428 static const struct protocol protocols[] = {
429 { "ip", ETH_TYPE_IP, 0 },
430 { "arp", ETH_TYPE_ARP, 0 },
431 { "icmp", ETH_TYPE_IP, IPPROTO_ICMP },
432 { "tcp", ETH_TYPE_IP, IPPROTO_TCP },
433 { "udp", ETH_TYPE_IP, IPPROTO_UDP },
434 { "ipv6", ETH_TYPE_IPV6, 0 },
435 { "ip6", ETH_TYPE_IPV6, 0 },
436 { "icmp6", ETH_TYPE_IPV6, IPPROTO_ICMPV6 },
437 { "tcp6", ETH_TYPE_IPV6, IPPROTO_TCP },
438 { "udp6", ETH_TYPE_IPV6, IPPROTO_UDP },
439 };
440 const struct protocol *p;
441
442 for (p = protocols; p < &protocols[ARRAY_SIZE(protocols)]; p++) {
443 if (!strcmp(p->name, name)) {
444 *p_out = p;
445 return true;
446 }
447 }
448 *p_out = NULL;
449 return false;
450 }
451
452 static void
453 ofp_fatal(const char *flow, bool verbose, const char *format, ...)
454 {
455 va_list args;
456
457 if (verbose) {
458 fprintf(stderr, "%s:\n", flow);
459 }
460
461 va_start(args, format);
462 ovs_fatal_valist(0, format, args);
463 }
464
465 static void
466 parse_field(const struct mf_field *mf, const char *s, struct cls_rule *rule)
467 {
468 union mf_value value, mask;
469 char *error;
470
471 error = mf_parse(mf, s, &value, &mask);
472 if (error) {
473 ovs_fatal(0, "%s", error);
474 }
475
476 mf_set(mf, &value, &mask, rule);
477 }
478
479 /* Convert 'str_' (as described in the Flow Syntax section of the ovs-ofctl man
480 * page) into 'fm' for sending the specified flow_mod 'command' to a switch.
481 * If 'actions' is specified, an action must be in 'string' and may be expanded
482 * or reallocated.
483 *
484 * To parse syntax for an OFPT_FLOW_MOD (or NXT_FLOW_MOD), use an OFPFC_*
485 * constant for 'command'. To parse syntax for an OFPST_FLOW or
486 * OFPST_AGGREGATE (or NXST_FLOW or NXST_AGGREGATE), use -1 for 'command'. */
487 void
488 parse_ofp_str(struct ofputil_flow_mod *fm, int command, const char *str_,
489 bool verbose)
490 {
491 enum {
492 F_OUT_PORT = 1 << 0,
493 F_ACTIONS = 1 << 1,
494 F_TIMEOUT = 1 << 3,
495 F_PRIORITY = 1 << 4
496 } fields;
497 char *string = xstrdup(str_);
498 char *save_ptr = NULL;
499 char *act_str = NULL;
500 char *name;
501
502 switch (command) {
503 case -1:
504 fields = F_OUT_PORT;
505 break;
506
507 case OFPFC_ADD:
508 fields = F_ACTIONS | F_TIMEOUT | F_PRIORITY;
509 break;
510
511 case OFPFC_DELETE:
512 fields = F_OUT_PORT;
513 break;
514
515 case OFPFC_DELETE_STRICT:
516 fields = F_OUT_PORT | F_PRIORITY;
517 break;
518
519 case OFPFC_MODIFY:
520 fields = F_ACTIONS | F_TIMEOUT | F_PRIORITY;
521 break;
522
523 case OFPFC_MODIFY_STRICT:
524 fields = F_ACTIONS | F_TIMEOUT | F_PRIORITY;
525 break;
526
527 default:
528 NOT_REACHED();
529 }
530
531 cls_rule_init_catchall(&fm->cr, OFP_DEFAULT_PRIORITY);
532 fm->cookie = htonll(0);
533 fm->cookie_mask = htonll(0);
534 fm->table_id = 0xff;
535 fm->command = command;
536 fm->idle_timeout = OFP_FLOW_PERMANENT;
537 fm->hard_timeout = OFP_FLOW_PERMANENT;
538 fm->buffer_id = UINT32_MAX;
539 fm->out_port = OFPP_NONE;
540 fm->flags = 0;
541 if (fields & F_ACTIONS) {
542 act_str = strstr(string, "action");
543 if (!act_str) {
544 ofp_fatal(str_, verbose, "must specify an action");
545 }
546 *act_str = '\0';
547
548 act_str = strchr(act_str + 1, '=');
549 if (!act_str) {
550 ofp_fatal(str_, verbose, "must specify an action");
551 }
552
553 act_str++;
554 }
555 for (name = strtok_r(string, "=, \t\r\n", &save_ptr); name;
556 name = strtok_r(NULL, "=, \t\r\n", &save_ptr)) {
557 const struct protocol *p;
558
559 if (parse_protocol(name, &p)) {
560 cls_rule_set_dl_type(&fm->cr, htons(p->dl_type));
561 if (p->nw_proto) {
562 cls_rule_set_nw_proto(&fm->cr, p->nw_proto);
563 }
564 } else {
565 char *value;
566
567 value = strtok_r(NULL, ", \t\r\n", &save_ptr);
568 if (!value) {
569 ofp_fatal(str_, verbose, "field %s missing value", name);
570 }
571
572 if (!strcmp(name, "table")) {
573 fm->table_id = str_to_table_id(value);
574 } else if (!strcmp(name, "out_port")) {
575 fm->out_port = atoi(value);
576 } else if (fields & F_PRIORITY && !strcmp(name, "priority")) {
577 fm->cr.priority = str_to_u16(value, name);
578 } else if (fields & F_TIMEOUT && !strcmp(name, "idle_timeout")) {
579 fm->idle_timeout = str_to_u16(value, name);
580 } else if (fields & F_TIMEOUT && !strcmp(name, "hard_timeout")) {
581 fm->hard_timeout = str_to_u16(value, name);
582 } else if (!strcmp(name, "cookie")) {
583 char *mask = strchr(value, '/');
584 if (mask) {
585 if (command == OFPFC_ADD) {
586 ofp_fatal(str_, verbose, "flow additions cannot use "
587 "a cookie mask");
588 }
589 *mask = '\0';
590 fm->cookie_mask = htonll(str_to_u64(mask+1));
591 } else {
592 fm->cookie_mask = htonll(UINT64_MAX);
593 }
594 fm->cookie = htonll(str_to_u64(value));
595 } else if (mf_from_name(name)) {
596 parse_field(mf_from_name(name), value, &fm->cr);
597 } else if (!strcmp(name, "duration")
598 || !strcmp(name, "n_packets")
599 || !strcmp(name, "n_bytes")) {
600 /* Ignore these, so that users can feed the output of
601 * "ovs-ofctl dump-flows" back into commands that parse
602 * flows. */
603 } else {
604 ofp_fatal(str_, verbose, "unknown keyword %s", name);
605 }
606 }
607 }
608 if (fields & F_ACTIONS) {
609 struct ofpbuf actions;
610
611 ofpbuf_init(&actions, sizeof(union ofp_action));
612 str_to_action(&fm->cr.flow, act_str, &actions);
613 fm->actions = ofpbuf_steal_data(&actions);
614 fm->n_actions = actions.size / sizeof(union ofp_action);
615 } else {
616 fm->actions = NULL;
617 fm->n_actions = 0;
618 }
619
620 free(string);
621 }
622
623 /* Parses 'string' as an OFPT_FLOW_MOD or NXT_FLOW_MOD with command 'command'
624 * (one of OFPFC_*) and appends the parsed OpenFlow message to 'packets'.
625 * '*cur_format' should initially contain the flow format currently configured
626 * on the connection; this function will add a message to change the flow
627 * format and update '*cur_format', if this is necessary to add the parsed
628 * flow. */
629 void
630 parse_ofp_flow_mod_str(struct list *packets, enum nx_flow_format *cur_format,
631 bool *flow_mod_table_id, char *string, uint16_t command,
632 bool verbose)
633 {
634 enum nx_flow_format min_format, next_format;
635 struct cls_rule rule_copy;
636 struct ofpbuf *ofm;
637 struct ofputil_flow_mod fm;
638
639 parse_ofp_str(&fm, command, string, verbose);
640
641 min_format = ofputil_min_flow_format(&fm.cr);
642 if (command != OFPFC_ADD && fm.cookie_mask != htonll(0)) {
643 min_format = NXFF_NXM;
644 }
645 next_format = MAX(*cur_format, min_format);
646 if (next_format != *cur_format) {
647 struct ofpbuf *sff = ofputil_make_set_flow_format(next_format);
648 list_push_back(packets, &sff->list_node);
649 *cur_format = next_format;
650 }
651
652 /* Normalize a copy of the rule. This ensures that non-normalized flows
653 * get logged but doesn't affect what gets sent to the switch, so that the
654 * switch can do whatever it likes with the flow. */
655 rule_copy = fm.cr;
656 ofputil_normalize_rule(&rule_copy, next_format);
657
658 if (fm.table_id != 0xff && !*flow_mod_table_id) {
659 struct ofpbuf *sff = ofputil_make_flow_mod_table_id(true);
660 list_push_back(packets, &sff->list_node);
661 *flow_mod_table_id = true;
662 }
663
664 ofm = ofputil_encode_flow_mod(&fm, *cur_format, *flow_mod_table_id);
665 list_push_back(packets, &ofm->list_node);
666 }
667
668 /* Similar to parse_ofp_flow_mod_str(), except that the string is read from
669 * 'stream' and the command is always OFPFC_ADD. Returns false if end-of-file
670 * is reached before reading a flow, otherwise true. */
671 bool
672 parse_ofp_flow_mod_file(struct list *packets,
673 enum nx_flow_format *cur, bool *flow_mod_table_id,
674 FILE *stream, uint16_t command)
675 {
676 struct ds s;
677 bool ok;
678
679 ds_init(&s);
680 ok = ds_get_preprocessed_line(&s, stream) == 0;
681 if (ok) {
682 parse_ofp_flow_mod_str(packets, cur, flow_mod_table_id,
683 ds_cstr(&s), command, true);
684 }
685 ds_destroy(&s);
686
687 return ok;
688 }
689
690 void
691 parse_ofp_flow_stats_request_str(struct ofputil_flow_stats_request *fsr,
692 bool aggregate, char *string)
693 {
694 struct ofputil_flow_mod fm;
695
696 parse_ofp_str(&fm, -1, string, false);
697 fsr->aggregate = aggregate;
698 fsr->cookie = fm.cookie;
699 fsr->cookie_mask = fm.cookie_mask;
700 fsr->match = fm.cr;
701 fsr->out_port = fm.out_port;
702 fsr->table_id = fm.table_id;
703 }