Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177762759
D61778.1795222563.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D61778.1795222563.diff
View Options
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -615,6 +615,7 @@
int lookupflag;
uint8_t iptos;
struct m_tag *fwd_tag = NULL;
+ size_t taglen;
#ifdef INET6
struct ip6_hdr *ip6 = NULL;
int isipv6;
@@ -844,7 +845,7 @@
if (isipv6 && fwd_tag != NULL) {
struct sockaddr_in6 *next_hop6;
- next_hop6 = (struct sockaddr_in6 *)(fwd_tag + 1);
+ next_hop6 = m_tag_data(fwd_tag, &taglen);
/*
* Transparently forwarded. Pretend to be the destination.
* Already got one like this?
@@ -876,7 +877,7 @@
if (fwd_tag != NULL) {
struct sockaddr_in *next_hop;
- next_hop = (struct sockaddr_in *)(fwd_tag+1);
+ next_hop = m_tag_data(fwd_tag, &taglen);
/*
* Transparently forwarded. Pretend to be the destination.
* already got one like this?
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -1510,6 +1510,20 @@
SLIST_INIT(&m->m_pkthdr.tags);
}
+/*
+ * Return the data that follows tag t and store its length in *lenp. Under
+ * -fbounds-safety the result is bounded to the m_tag_len bytes that
+ * m_tag_alloc() allocated after the tag.
+ */
+static __inline void * __sized_by(*lenp)
+m_tag_data(struct m_tag *t, size_t *lenp)
+{
+
+ *lenp = t->m_tag_len;
+ return (__unsafe_forge_bidi_indexable(char *, t,
+ sizeof(*t) + t->m_tag_len) + sizeof(*t));
+}
+
/*
* Set up the contents of a tag. Note that this does not fill in the free
* method; the caller is expected to do that.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 21, 12:56 AM (23 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41878781
Default Alt Text
D61778.1795222563.diff (1 KB)
Attached To
Mode
D61778: mbuf: add m_tag_data() and use it for the fwd tag in tcp_input
Attached
Detach File
Event Timeline