diff options
author | Ben Pfaff <blp@nicira.com> | 2010-12-10 10:40:58 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2010-12-10 11:13:32 -0800 |
commit | cdee00fd635d1e0f1eeb5d9c009daeb59abd4777 (patch) | |
tree | 49ef94d30bcb995fa1070c3aa770a9a515b26b0a /ofproto/in-band.c | |
parent | 7f8ca6459c37ede8faf13f730bcd4d9f05dfd13b (diff) | |
download | openvswitch-cdee00fd635d1e0f1eeb5d9c009daeb59abd4777.tar.gz |
datapath: Replace "struct odp_action" by Netlink attributes.
In the medium term, we plan to migrate the datapath to use Netlink as its
communication channel. In the short term, we need to be able to have
actions with 64-bit arguments but "struct odp_action" only has room for
48 bits. So this patch shifts to variable-length arguments using Netlink
attributes, which starts in on the Netlink transition and makes 64-bit
arguments possible at the same time.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'ofproto/in-band.c')
-rw-r--r-- | ofproto/in-band.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ofproto/in-band.c b/ofproto/in-band.c index aebdb7e4b..9655f105c 100644 --- a/ofproto/in-band.c +++ b/ofproto/in-band.c @@ -28,6 +28,7 @@ #include "dpif.h" #include "flow.h" #include "netdev.h" +#include "netlink.h" #include "odp-util.h" #include "ofproto.h" #include "ofpbuf.h" @@ -428,7 +429,7 @@ in_band_msg_in_hook(struct in_band *in_band, const struct flow *flow, * allowed to be set up in the datapath. */ bool in_band_rule_check(struct in_band *in_band, const struct flow *flow, - const struct odp_actions *actions) + const struct nlattr *actions, unsigned int actions_len) { if (!in_band) { return true; @@ -440,11 +441,12 @@ in_band_rule_check(struct in_band *in_band, const struct flow *flow, && flow->nw_proto == IP_TYPE_UDP && flow->tp_src == htons(DHCP_SERVER_PORT) && flow->tp_dst == htons(DHCP_CLIENT_PORT)) { - int i; + const struct nlattr *a; + unsigned int left; - for (i=0; i<actions->n_actions; i++) { - if (actions->actions[i].output.type == ODPAT_OUTPUT - && actions->actions[i].output.port == ODPP_LOCAL) { + NL_ATTR_FOR_EACH_UNSAFE (a, left, actions, actions_len) { + if (nl_attr_type(a) == ODPAT_OUTPUT + && nl_attr_get_u32(a) == ODPP_LOCAL) { return true; } } |