Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F173113584
D58557.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D58557.diff
View Options
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
@@ -63,6 +63,7 @@
#ifdef INET6
#include <netinet/ip6.h>
+#include <netinet6/ip6_var.h>
#include <netipsec/ipsec6.h>
#endif
@@ -154,25 +155,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 = {}
+ };
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));
+ /* Append TCP segment and fixup length. */
+ ip6ph.ip6ph_len = htonl(m->m_pkthdr.len - hdr_len);
+ ip6ph.ip6ph_nxt = IPPROTO_TCP;
+ MD5Update(ctx, &ip6ph, sizeof(ip6ph));
return (hdr_len);
}
#endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Sep 24, 5:16 PM (1 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35790007
Default Alt Text
D58557.diff (1 KB)
Attached To
Mode
D58557: netipsec: Refactor TCP-MD5 shim to use ip6_hdr_pseudo{} for brevity.
Attached
Detach File
Event Timeline
Log In to Comment