- port = OFPP_CONTROLLER;
- if (arg) {
- if (!strcasecmp(arg, "all")) {
- action[i].arg.output.max_len= htons(0);
- } else {
- action[i].arg.output.max_len= htons(str_to_int(arg));
- }
+ struct ofp_action_output *ca = (struct ofp_action_output *)ah;
+
+ if (act_len < sizeof *ca) {
+ ofp_fatal(0, "Insufficient room for controller action\n");
+ }
+
+ act_len = sizeof *ca;
+ ca->type = htons(OFPAT_OUTPUT);
+ ca->port = htons(OFPP_CONTROLLER);
+
+ /* Unless a numeric argument is specified, we send the whole
+ * packet to the controller. */
+ if (arg && (strspn(act, "0123456789") == strlen(act))) {
+ ca->max_len= htons(str_to_int(arg));