[ovs-dev] [#8024v2 4/5] Support matching and modifying IP TTL.
Justin Pettit
jpettit at nicira.com
Wed Nov 9 20:12:58 UTC 2011
On Nov 9, 2011, at 12:00 PM, Justin Pettit wrote:
>> Should we make the "ttl=" be "hop_limit=" as well?
>>
>> Otherwise, looks good.
As we discussed off-line, it's probably better to use "hlimit" since it's shorter and we're already breaking from other kernel naming conventions. An incremental is at the end of the message.
--Justin
-=-=-=-=-=-=-=-
diff --git a/datapath/flow.c b/datapath/flow.c
index 61e7e43..54d7bda 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -979,7 +979,7 @@ int flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp,
swkey->ipv6.label = ipv6_key->ipv6_label;
swkey->ip.proto = ipv6_key->ipv6_proto;
swkey->ip.tos = ipv6_key->ipv6_tos;
- swkey->ip.ttl = ipv6_key->ipv6_hop_limit;
+ swkey->ip.ttl = ipv6_key->ipv6_hlimit;
swkey->ip.frag = ipv6_key->ipv6_frag;
memcpy(&swkey->ipv6.addr.src, ipv6_key->ipv6_src,
sizeof(swkey->ipv6.addr.src));
@@ -1264,7 +1264,7 @@ int flow_to_nlattrs(const struct sw_flow_key *swkey, struct sk_buff *skb)
ipv6_key->ipv6_label = swkey->ipv6.label;
ipv6_key->ipv6_proto = swkey->ip.proto;
ipv6_key->ipv6_tos = swkey->ip.tos;
- ipv6_key->ipv6_hop_limit = swkey->ip.ttl;
+ ipv6_key->ipv6_hlimit = swkey->ip.ttl;
ipv6_key->ipv6_frag = swkey->ip.frag;
} else if (swkey->eth.type == htons(ETH_P_ARP)) {
struct ovs_key_arp *arp_key;
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
index cb6e6bb..c94c534 100644
--- a/include/linux/openvswitch.h
+++ b/include/linux/openvswitch.h
@@ -326,7 +326,7 @@ struct ovs_key_ipv6 {
__be32 ipv6_label; /* 20-bits in least-significant bits. */
__u8 ipv6_proto;
__u8 ipv6_tos;
- __u8 ipv6_hop_limit;
+ __u8 ipv6_hlimit;
__u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */
};
diff --git a/lib/odp-util.c b/lib/odp-util.c
index cd8b2d5..c4046d7 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -387,10 +387,10 @@ format_odp_key_attr(const struct nlattr *a, struct ds *ds)
inet_ntop(AF_INET6, ipv6_key->ipv6_dst, dst_str, sizeof dst_str);
ds_put_format(ds, "ipv6(src=%s,dst=%s,label=%#"PRIx32",proto=%"PRId8
- ",tos=%#"PRIx8",hop_limit=%"PRIu8",frag=%s)",
+ ",tos=%#"PRIx8",hlimit=%"PRIu8",frag=%s)",
src_str, dst_str, ntohl(ipv6_key->ipv6_label),
ipv6_key->ipv6_proto, ipv6_key->ipv6_tos,
- ipv6_key->ipv6_hop_limit,
+ ipv6_key->ipv6_hlimit,
ovs_frag_type_to_string(ipv6_key->ipv6_frag));
break;
}
@@ -639,15 +639,15 @@ parse_odp_key_attr(const char *s, struct ofpbuf *key)
int ipv6_label;
int ipv6_proto;
int ipv6_tos;
- int ipv6_hop_limit;
+ int ipv6_hlimit;
char frag[8];
enum ovs_frag_type ipv6_frag;
int n = -1;
if (sscanf(s, "ipv6(src="IPV6_SCAN_FMT",dst="IPV6_SCAN_FMT","
- "label=%i,proto=%i,tos=%i,hop_limit=%i,frag=%7[a-z])%n",
+ "label=%i,proto=%i,tos=%i,hlimit=%i,frag=%7[a-z])%n",
ipv6_src_s, ipv6_dst_s, &ipv6_label,
- &ipv6_proto, &ipv6_tos, &ipv6_hop_limit, frag, &n) > 0
+ &ipv6_proto, &ipv6_tos, &ipv6_hlimit, frag, &n) > 0
&& n > 0
&& ovs_frag_type_from_string(frag, &ipv6_frag)) {
struct ovs_key_ipv6 ipv6_key;
@@ -659,7 +659,7 @@ parse_odp_key_attr(const char *s, struct ofpbuf *key)
ipv6_key.ipv6_label = htonl(ipv6_label);
ipv6_key.ipv6_proto = ipv6_proto;
ipv6_key.ipv6_tos = ipv6_tos;
- ipv6_key.ipv6_hop_limit = ipv6_hop_limit;
+ ipv6_key.ipv6_hlimit = ipv6_hlimit;
ipv6_key.ipv6_frag = ipv6_frag;
nl_msg_put_unspec(key, OVS_KEY_ATTR_IPV6,
&ipv6_key, sizeof ipv6_key);
@@ -892,7 +892,7 @@ odp_flow_key_from_flow(struct ofpbuf *buf, const struct flow *flow)
ipv6_key->ipv6_label = flow->ipv6_label;
ipv6_key->ipv6_proto = flow->nw_proto;
ipv6_key->ipv6_tos = flow->tos;
- ipv6_key->ipv6_hop_limit = flow->nw_ttl;
+ ipv6_key->ipv6_hlimit = flow->nw_ttl;
ipv6_key->ipv6_frag = ovs_to_odp_frag(flow->frag);
} else if (flow->dl_type == htons(ETH_TYPE_ARP)) {
struct ovs_key_arp *arp_key;
@@ -1081,7 +1081,7 @@ odp_flow_key_to_flow(const struct nlattr *key, size_t key_len,
flow->ipv6_label = ipv6_key->ipv6_label;
flow->nw_proto = ipv6_key->ipv6_proto;
flow->tos = ipv6_key->ipv6_tos;
- flow->nw_ttl = ipv6_key->ipv6_hop_limit;
+ flow->nw_ttl = ipv6_key->ipv6_hlimit;
if (!odp_to_ovs_frag(ipv6_key->ipv6_frag, flow)) {
return EINVAL;
}
More information about the dev
mailing list