X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=datapath%2Fforward.c;h=7e987e338cf79c46fe29ee1e3ab0cd05d2e7b297;hb=6f8d45bf7dd4007410f42f7233243cff409d06c6;hp=ced0cac62db75577ddd407fac29c0795c561da21;hpb=5bb08bc0efb4aaf4349073e07383728cf9d2f77d;p=openvswitch diff --git a/datapath/forward.c b/datapath/forward.c index ced0cac6..7e987e33 100644 --- a/datapath/forward.c +++ b/datapath/forward.c @@ -21,9 +21,6 @@ /* FIXME: do we need to use GFP_ATOMIC everywhere here? */ -static void execute_actions(struct datapath *, struct sk_buff *, - const struct sw_flow_key *, - const struct ofp_action *, int n_actions); static int make_writable(struct sk_buff **); static struct sk_buff *retrieve_skb(uint32_t id); @@ -60,7 +57,7 @@ static int do_output(struct datapath *dp, struct sk_buff *skb, size_t max_len, max_len, OFPR_ACTION)); } -static void execute_actions(struct datapath *dp, struct sk_buff *skb, +void execute_actions(struct datapath *dp, struct sk_buff *skb, const struct sw_flow_key *key, const struct ofp_action *actions, int n_actions) { @@ -346,6 +343,7 @@ static int add_flow(struct sw_chain *chain, const struct ofp_flow_mod *ofm) { int error = -ENOMEM; + int i; int n_acts; struct sw_flow *flow; @@ -357,6 +355,19 @@ add_flow(struct sw_chain *chain, const struct ofp_flow_mod *ofm) goto error; } + /* To prevent loops, make sure there's no action to send to the + * OFP_TABLE virtual port. + */ + for (i=0; iactions[i]; + + if (a->type == htons(OFPAT_OUTPUT) + && a->arg.output.port == htons(OFPP_TABLE)) { + /* xxx Send fancy new error message? */ + goto error; + } + } + /* Allocate memory. */ flow = flow_alloc(n_acts, GFP_ATOMIC); if (flow == NULL)