From: Cody Doucette <doucette@bu.edu>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: dev@dpdk.org, Cody Doucette <doucette@bu.edu>
Subject: [PATCH v5 2/3] net: add IPv6 extension header definitions
Date: Wed, 31 Oct 2018 00:17:15 +0000 [thread overview]
Message-ID: <20181031001716.149941-3-doucette@bu.edu> (raw)
In-Reply-To: <20181031001716.149941-1-doucette@bu.edu>
Add a common IPv6 extension header and an inline function
for determining whether a next header field represents
an IPv6 extension header.
Signed-off-by: Cody Doucette <doucette@bu.edu>
---
lib/librte_net/rte_ip.h | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index f2a8904a2..43dbb15e4 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -350,6 +350,14 @@ struct ipv6_hdr {
#define IPV6_HDR_FL_MASK ((1u << IPV6_HDR_TC_SHIFT) - 1)
#define IPV6_HDR_TC_MASK (0xf << IPV6_HDR_TC_SHIFT)
+/**
+ * IPv6 extension header
+ */
+struct ipv6_opt_hdr {
+ uint8_t nexthdr; /**< Next header. */
+ uint8_t hdrlen; /**< Length; presence & meaning varies by ext type. */
+} __attribute__((packed));
+
/**
* Process the pseudo-header checksum of an IPv6 header.
*
@@ -421,6 +429,25 @@ rte_ipv6_udptcp_cksum(const struct ipv6_hdr *ipv6_hdr, const void *l4_hdr)
return (uint16_t)cksum;
}
+/**
+ * Check whether an IPv6 nexthdr value is for an IPv6 extension header.
+ *
+ * @param nexthdr
+ * The protocol/next header field from an IPv6 (extension) header.
+ * @return
+ * Whether the nexthdr field is for an IPv6 extension header.
+ */
+static inline int
+ipv6_ext_hdr(uint8_t nexthdr)
+{
+ return (nexthdr == IPPROTO_HOPOPTS) ||
+ (nexthdr == IPPROTO_ROUTING) ||
+ (nexthdr == IPPROTO_FRAGMENT) ||
+ (nexthdr == IPPROTO_AH) ||
+ (nexthdr == IPPROTO_NONE) ||
+ (nexthdr == IPPROTO_DSTOPTS);
+}
+
#ifdef __cplusplus
}
#endif
--
2.17.1
next prev parent reply other threads:[~2018-10-31 0:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-31 0:17 [PATCH v4 0/3] Extend rte_ipv6_frag_get_ipv6_fragment_header() Cody Doucette
2018-10-31 0:17 ` [PATCH v5 1/3] net/failsafe: remove D_XOPEN_SOURCE flag Cody Doucette
2018-10-31 0:17 ` Cody Doucette [this message]
2018-10-31 0:17 ` [PATCH v5 3/3] ip_frag: extend IPv6 fragment header retrieval Cody Doucette
-- strict thread matches above, loose matches on Subject: below --
2018-10-31 2:17 [PATCH v5 0/3] Extend rte_ipv6_frag_get_ipv6_fragment_header() Cody Doucette
2018-10-31 2:17 ` [PATCH v5 2/3] net: add IPv6 extension header definitions Cody Doucette
2018-10-31 17:03 ` Thomas Monjalon
2018-11-05 8:45 ` Olivier Matz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181031001716.149941-3-doucette@bu.edu \
--to=doucette@bu.edu \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.