+/*
+ * 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 ( ((p)->next_hdr) == (t)) \
+ { \
+ (m) = (void *)(ip6_ext_next_header((p))); \
+ } \
+}
+
+