summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
authorPablo Camarillo <pcamaril@cisco.com>2016-12-07 18:34:18 +0100
committerDave Barach <openvpp@barachs.net>2017-03-04 00:55:42 +0000
commitfb38095d1c9d1b84850f345f0344f82b9ae2c375 (patch)
tree374b98350db7c182c9493a219266f1229c52f1ae /src/vnet/ip
parentfa5231d75e1530a03a0c4f14706ec58067fa32d0 (diff)
Evolving SRv6 (Segment Routing for IPv6)
Implements: 1.- SR Policies with several (weighted) SID lists 2.- Binding SID 3.- SR LocalSIDs with support for the following functions - End - End.X - End.DX6 - End.DX4 - End.DX2 - End.DT6 - End.DT2 - End.B6 - End.B6.Encaps 4.- SR Steering policies (to steer a traffic through an SR Policy) - Support for IPv6 traffic (IPv6 Encapsulation / SRH insertion) - Support for IPv4 traffic (IPv6 Encapsulation) - Support for L2 traffic (T.Insert / T.Encaps) 5.- Doxygen documentation 6.- Framework (APIs) to allow the definition of new SR LocalSID behaviors by means of plugins 7.- Sample SRv6 LocalSID plugin Change-Id: I2de3d126699d4f11f54c0f7f3b71420ea41fd389 Signed-off-by: Pablo Camarillo <pcamaril@cisco.com>
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip6_packet.h33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/vnet/ip/ip6_packet.h b/src/vnet/ip/ip6_packet.h
index 4fd14b960e4..6eabeef1f3d 100644
--- a/src/vnet/ip/ip6_packet.h
+++ b/src/vnet/ip/ip6_packet.h
@@ -448,20 +448,47 @@ 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)
+#define ip6_ext_header_len(p) ((((ip6_ext_header_t *)(p))->n_data_u64s+1) << 3)
+#define ip6_ext_authhdr_len(p) ((((ip6_ext_header_t *)(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)); }
+/*
+ * Macro to find the IPv6 ext header of type t
+ * I is the IPv6 header
+ * P is the previous IPv6 ext header (NULL if none)
+ * M is the matched IPv6 ext header of type t
+ */
+#define ip6_ext_header_find_t(i, p, m, t) \
+if ((i)->protocol == t) \
+{ \
+ (m) = (void *)((i)+1); \
+ (p) = NULL; \
+} \
+else \
+{ \
+ (m) = NULL; \
+ (p) = (void *)((i)+1); \
+ while (ip6_ext_hdr((p)->next_hdr) && \
+ ((ip6_ext_header_t *)(p))->next_hdr != (t)) \
+ { \
+ (p) = ip6_ext_next_header((p)); \
+ } \
+ if ( ip6_ext_hdr((p)->next_hdr) == (t)) \
+ { \
+ (m) = (void *)(ip6_ext_next_header((p))); \
+ } \
+}
+
+
typedef CLIB_PACKED (struct {
u8 next_hdr;
/* Length of this header plus option data in 8 byte units. */