Page MenuHomeFreeBSD

D55663.diff
No OneTemporary

D55663.diff

diff --git a/sys/netinet/ip6.h b/sys/netinet/ip6.h
--- a/sys/netinet/ip6.h
+++ b/sys/netinet/ip6.h
@@ -109,6 +109,20 @@
#define IPV6_DSCP(ip6) ((ntohl((ip6)->ip6_flow) >> IPV6_FLOWLABEL_LEN) & 0xfc)
#define IPV6_ECN(ip6) ((ntohl((ip6)->ip6_flow) >> IPV6_FLOWLABEL_LEN) & 0x03)
+#ifdef _KERNEL
+/*
+ * for IPv6 pseudo header checksum
+ * XXX nonstandard
+ */
+struct ip6_hdr_pseudo {
+ struct in6_addr ip6ph_src;
+ struct in6_addr ip6ph_dst;
+ u_int32_t ip6ph_len;
+ u_int8_t ip6ph_zero[3];
+ u_int8_t ip6ph_nxt;
+} __packed;
+#endif
+
/*
* Extension Headers
*/
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -126,6 +126,11 @@
#include <netipsec/ipsec_support.h>
+#ifdef CTASSERT
+CTASSERT(sizeof(struct ip6_hdr) == 40);
+CTASSERT(sizeof(struct ip6_hdr_pseudo) == 40);
+#endif
+
ip6proto_input_t *ip6_protox[IPPROTO_MAX] = {
[0 ... IPPROTO_MAX - 1] = rip6_input };
ip6proto_ctlinput_t *ip6_ctlprotox[IPPROTO_MAX] = {
diff --git a/sys/netipsec/xform_tcp.c b/sys/netipsec/xform_tcp.c
--- a/sys/netipsec/xform_tcp.c
+++ b/sys/netipsec/xform_tcp.c
@@ -156,25 +156,23 @@
static int
ip6_pseudo_compute(struct mbuf *m, MD5_CTX *ctx)
{
- struct ip6_pseudo {
- struct in6_addr src, dst;
- uint32_t len;
- uint32_t nxt;
- } ip6p __aligned(4);
+ struct ip6_hdr_pseudo ip6ph = {
+ .ip6ph_zero = { 0 }
+ };
struct ip6_hdr *ip6;
int hdr_len;
ip6 = mtod(m, struct ip6_hdr *);
- ip6p.src = ip6->ip6_src;
- ip6p.dst = ip6->ip6_dst;
+ ip6ph.ip6ph_src = ip6->ip6_src;
+ ip6ph.ip6ph_dst = ip6->ip6_dst;
hdr_len = sizeof(struct ip6_hdr);
if (ip6->ip6_nxt == IPPROTO_UDP)
/* TCP over UDP */
hdr_len += sizeof(struct udphdr);
/* XXX: ext headers */
- ip6p.len = htonl(m->m_pkthdr.len - hdr_len);
- ip6p.nxt = htonl(IPPROTO_TCP);
- MD5Update(ctx, (char *)&ip6p, sizeof(ip6p));
+ ip6ph.ip6ph_len = htonl(m->m_pkthdr.len - hdr_len);
+ ip6ph.ip6ph_nxt = IPPROTO_TCP;
+ MD5Update(ctx, (char *)&ip6ph, sizeof(ip6ph));
return (hdr_len);
}
#endif

File Metadata

Mime Type
text/plain
Expires
Tue, Mar 10, 4:15 PM (7 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29486196
Default Alt Text
D55663.diff (2 KB)

Event Timeline