diff options
author | Shwetha <shwethab@cisco.com> | 2016-09-13 11:51:00 +0100 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2016-12-09 14:57:21 +0000 |
commit | b78292efdfaf70baf89c778973d4bb3b822e95dd (patch) | |
tree | ef510f2ca149ba06f40a17956d7aff41efdfa6fd /vnet/vnet/ip/ip6_packet.h | |
parent | 16a14cdb160160573e2d1ed69a52998cc30ce34f (diff) |
VPP-547: Fix for co-existence of HbH and RH header in Segment routing:
1. sr-rewrite - SR insertion in v6 : SR RH is inserted immediately after v6 header
but if hbh header is present as per RFC2460 it should immediately follow
v6 header. This is fixed.
2. sr-local : v6 packet destined to a sr segment is received if hbh is present
it is not handed over to sr-local for processing. fixed ip6-local handling to
skip hbh as there is no register handler for hbh for now.
3. sr-replicate - update in dual of sr_rewrite to handle replicate, fixes in
sr-replicate to handle presence of hbh header
Change-Id: I034523a42d2fedf97134761f956ab534babb8b36
Signed-off-by: Shwetha <shwethab@cisco.com>
Diffstat (limited to 'vnet/vnet/ip/ip6_packet.h')
-rw-r--r-- | vnet/vnet/ip/ip6_packet.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vnet/vnet/ip/ip6_packet.h b/vnet/vnet/ip/ip6_packet.h index 456c011a182..d29a06942ef 100644 --- a/vnet/vnet/ip/ip6_packet.h +++ b/vnet/vnet/ip/ip6_packet.h @@ -412,6 +412,32 @@ typedef CLIB_PACKED (struct { u8 next_hdr; /* Length of this header plus option data in 8 byte units. */ u8 n_data_u64s; +}) ip6_ext_header_t; + +always_inline u8 ip6_ext_hdr(u8 nexthdr) +{ + /* + * find out if nexthdr is an extension header or a protocol + */ + return (nexthdr == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) || + (nexthdr == IP_PROTOCOL_IP6_NONXT) || + (nexthdr == IP_PROTOCOL_IPV6_FRAGMENTATION) || + (nexthdr == IP_PROTOCOL_IPSEC_AH) || + (nexthdr == IP_PROTOCOL_IPV6_ROUTE) || + (nexthdr == IP_PROTOCOL_IP6_DESTINATION_OPTIONS); +} + +#define ip6_ext_header_len(p) (((p)->n_data_u64s+1) << 3) +#define ip6_ext_authhdr_len(p) (((p)->n_data_u64s+2) << 2) + +always_inline void * +ip6_ext_next_header (ip6_ext_header_t *ext_hdr ) +{ return (void *)((u8 *) ext_hdr + ip6_ext_header_len(ext_hdr)); } + +typedef CLIB_PACKED (struct { + u8 next_hdr; + /* Length of this header plus option data in 8 byte units. */ + u8 n_data_u64s; u8 data[0]; }) ip6_hop_by_hop_ext_t; |