aboutsummaryrefslogtreecommitdiff
path: root/lib/ofp-parse.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-12-10 10:42:42 -0800
committerBen Pfaff <blp@nicira.com>2010-12-10 11:14:13 -0800
commitb9298d3f825703063c9538aa37407da43e1e4781 (patch)
treeb17463dd7194e5fd41cf79ce1115c93861450bd0 /lib/ofp-parse.c
parentff9d38264c74e2e807ba0fd759e44116d1203670 (diff)
Expand tunnel IDs from 32 to 64 bits.
We have a need to identify tunnels with keys longer than 32 bits. This commit adds basic datapath and OpenFlow support for such keys. It doesn't actually add any tunnel protocols that support 64-bit keys, so this is not very useful yet. The 'arg' member of struct odp_msg had to be expanded to 64-bits also, because it sometimes contains a tunnel ID. This member also contains the argument passed to ODPAT_CONTROLLER, so I expanded that action's argument to 64 bits also so that it can use the full width of the expanded 'arg'. Userspace doesn't take advantage of the new space though (it was only using 16 bits anyhow). This commit has been tested only to the extent that it doesn't disrupt basic Open vSwitch operation. I have not tested it with tunnel traffic. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com> Feature #3976.
Diffstat (limited to 'lib/ofp-parse.c')
-rw-r--r--lib/ofp-parse.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 1c7ce4fc..a72d1aa4 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -257,12 +257,22 @@ str_to_action(char *str, struct ofpbuf *b)
nar->vendor = htonl(NX_VENDOR_ID);
nar->subtype = htons(NXAST_RESUBMIT);
nar->in_port = htons(str_to_u32(arg));
- } else if (!strcasecmp(act, "set_tunnel")) {
- struct nx_action_set_tunnel *nast;
- nast = put_action(b, sizeof *nast, OFPAT_VENDOR);
- nast->vendor = htonl(NX_VENDOR_ID);
- nast->subtype = htons(NXAST_SET_TUNNEL);
- nast->tun_id = htonl(str_to_u32(arg));
+ } else if (!strcasecmp(act, "set_tunnel")
+ || !strcasecmp(act, "set_tunnel64")) {
+ uint64_t tun_id = str_to_u64(arg);
+ if (!strcasecmp(act, "set_tunnel64") || tun_id > UINT32_MAX) {
+ struct nx_action_set_tunnel64 *nast64;
+ nast64 = put_action(b, sizeof *nast64, OFPAT_VENDOR);
+ nast64->vendor = htonl(NX_VENDOR_ID);
+ nast64->subtype = htons(NXAST_SET_TUNNEL64);
+ nast64->tun_id = htonll(tun_id);
+ } else {
+ struct nx_action_set_tunnel *nast;
+ nast = put_action(b, sizeof *nast, OFPAT_VENDOR);
+ nast->vendor = htonl(NX_VENDOR_ID);
+ nast->subtype = htons(NXAST_SET_TUNNEL);
+ nast->tun_id = htonl(tun_id);
+ }
} else if (!strcasecmp(act, "drop_spoofed_arp")) {
struct nx_action_header *nah;
nah = put_action(b, sizeof *nah, OFPAT_VENDOR);
@@ -451,7 +461,7 @@ parse_field_value(struct cls_rule *rule, enum field_index index,
switch (index) {
case F_TUN_ID:
- cls_rule_set_tun_id(rule, htonl(str_to_u32(value)));
+ cls_rule_set_tun_id(rule, htonll(str_to_u64(value)));
break;
case F_IN_PORT: