[ovs-dev] [PATCH 2/3] ofproto: Do not add flow on flow mod if new_cookie is UINT64_MAX
Isaku Yamahata
yamahata at valinux.co.jp
Fri Oct 12 07:31:52 UTC 2012
On Fri, Oct 12, 2012 at 09:26:28AM +0900, Simon Horman wrote:
> Internally a new_cookie value UINT64_MAX is used for
> an OpenFlow 1.2 flow mod whose command is not Add.
> Open Flow 1.2 does not permit adding flows for such commands.
> Also, UINT64_MAX is a prohibited cookie value, and the
> existing code created a flow with that value as for the cookie.
> Signed-off-by: Simon Horman <horms at verge.net.au>
> ---
> ofproto/ofproto.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index 97e00ab..c712bf9 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -3081,6 +3081,17 @@ modify_flows__(struct ofproto *ofproto, struct ofconn *ofconn,
> return error;
> }
>
> +static enum ofperr
> +modify_flows_add(struct ofproto *ofproto, struct ofconn *ofconn,
> + const struct ofputil_flow_mod *fm,
> + const struct ofp_header *request)
> +{
> + if (fm->cookie_mask != htonll(0) || fm->new_cookie == htonll(UINT64_MAX)) {
> + return 0;
> + }
This depends on how to interpret the spec...
The OF1.2 says A.3.4.1
> The value -1 (0xffffffffffffffff) is reserved and must not be used.
return an error when UINT64_MAX?
But I can't find any suitable error code, but OFPFMFC_UNKNOWN.
Do we need to check if cookie mask is non zero?
The spec says
> This field is ignored by OFPC_ADD messages.
thanks,
> + return add_flow(ofproto, ofconn, fm, request);
> +}
> +
> /* Implements OFPFC_MODIFY. Returns 0 on success or an OpenFlow error code on
> * failure.
> *
> @@ -3100,7 +3111,7 @@ modify_flows_loose(struct ofproto *ofproto, struct ofconn *ofconn,
> if (error) {
> return error;
> } else if (list_is_empty(&rules)) {
> - return fm->cookie_mask ? 0 : add_flow(ofproto, ofconn, fm, request);
> + return modify_flows_add(ofproto, ofconn, fm, request);
> } else {
> return modify_flows__(ofproto, ofconn, fm, request, &rules);
> }
> @@ -3126,7 +3137,7 @@ modify_flow_strict(struct ofproto *ofproto, struct ofconn *ofconn,
> if (error) {
> return error;
> } else if (list_is_empty(&rules)) {
> - return fm->cookie_mask ? 0 : add_flow(ofproto, ofconn, fm, request);
> + return modify_flows_add(ofproto, ofconn, fm, request);
> } else {
> return list_is_singleton(&rules) ? modify_flows__(ofproto, ofconn,
> fm, request, &rules)
> --
> 1.7.10.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
--
yamahata
More information about the dev
mailing list