[ovs-dev] [#8024v2 4/5] Support matching and modifying IP TTL.

Jesse Gross jesse at nicira.com
Wed Nov 9 06:52:32 UTC 2011


On Tue, Nov 8, 2011 at 3:57 PM, Justin Pettit <jpettit at nicira.com> wrote:
> Add support matching the IPv4 TTL and IPv6 hop limit fields.  This
> commit also adds support for modifying the IPv4 TTL.  Modifying the IPv6
> hop limit isn't currently supported, since we don't support modifying
> IPv6 headers.
>
> We will likely want to change the user-space interface, since basic
> matching and setting the TTL are not generally useful.  We will probably
> want the ability to match on extraordinary events (such as TTL of 0 or 1)
> and a decrement action.
>
> Feature #8024
>
> Signed-off-by: Justin Pettit <jpettit at nicira.com>

I got a whitespace error:
Applying: Support matching and modifying IP TTL.
/home/jesse/openvswitch/.git/rebase-apply/patch:977: trailing whitespace.
Matches IP TTL or IPv6 hop limit value \fIttl\fR, which is
warning: 1 line adds whitespace errors.

> diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
> index c2b4285..7236628 100644
> --- a/include/linux/openvswitch.h
> +++ b/include/linux/openvswitch.h
> @@ -316,6 +316,7 @@ struct ovs_key_ipv4 {
>        __be32 ipv4_dst;
>        __u8   ipv4_proto;
>        __u8   ipv4_tos;
> +       __u8   ipv4_ttl;
>        __u8   ipv4_frag;       /* One of OVS_FRAG_TYPE_*. */
>  };

Now that the IPv4 and v6 structs no longer have padding at the end, we
can remove the memsets when both userspace and kernel serialize them
to Netlink and when userspace generates actions.

> @@ -325,6 +326,7 @@ struct ovs_key_ipv6 {
>        __be32 ipv6_label;
>        __u8   ipv6_proto;
>        __u8   ipv6_tos;
> +       __u8   ipv6_ttl;

Given that this is an IPv6 specific struct, I think it's better to
actually call it hop limit.  I guess the same also applied to tos
(traffic class).

> diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h
> index d0c4602..6a34268 100644
> --- a/include/openflow/nicira-ext.h
> +++ b/include/openflow/nicira-ext.h
> @@ -1632,6 +1632,15 @@ OFP_ASSERT(sizeof(struct nx_action_output_reg) == 24);
>  * Masking: Not maskable. */
>  #define NXM_NX_IP_ECN      NXM_HEADER  (0x0001, 28, 1)
>
> +/* The time-to-live/next hop of the IP header.

Was this supposes to be hop limit?

> diff --git a/lib/flow.h b/lib/flow.h
> index 248233e..52bda62 100644
> --- a/lib/flow.h
> +++ b/lib/flow.h
> @@ -35,7 +35,7 @@ struct ofpbuf;
>  /* This sequence number should be incremented whenever anything involving flows
>  * or the wildcarding of flows changes.  This will cause build assertion
>  * failures in places which likely need to be updated. */
> -#define FLOW_WC_SEQ 5
> +#define FLOW_WC_SEQ 6
>
>  #define FLOW_N_REGS 5
>  BUILD_ASSERT_DECL(FLOW_N_REGS <= NXM_NX_MAX_REGS);
> @@ -71,22 +71,23 @@ struct flow {
>     uint8_t dl_dst[6];          /* Ethernet destination address. */
>     uint8_t nw_proto;           /* IP protocol or low 8 bits of ARP opcode. */
>     uint8_t tos;                /* IP ToS. */
> +    uint8_t nw_ttl;             /* IP TTL/Hop Limit. */
>     uint8_t frag;               /* FLOW_FRAG_*. */

Is there any policy on the prefixes for these fields?  Some seem to
have nw_ but others don't.

We should implement this in the userspace datapath as well.



More information about the dev mailing list