Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102094236
D46685.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D46685.diff
View Options
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -2001,7 +2001,7 @@
switch (af) {
#ifdef INET
case AF_INET: {
- struct ip *ip = mtod(m, struct ip *);
+ struct ip *ip = mtod_(m, struct ip *);
return (in_localip(ip->ip_dst));
}
@@ -2010,7 +2010,7 @@
case AF_INET6: {
struct ip6_hdr *ip6;
struct in6_ifaddr *ia;
- ip6 = mtod(m, struct ip6_hdr *);
+ ip6 = mtod_(m, struct ip6_hdr *);
ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false);
if (ia == NULL)
return (false);
@@ -3409,7 +3409,7 @@
switch (af) {
#ifdef INET
case AF_INET:
- h = mtod(m, struct ip *);
+ h = mtod_(m, struct ip *);
/* IP header fields included in the TCP checksum */
h->ip_p = IPPROTO_TCP;
@@ -3422,7 +3422,7 @@
#endif /* INET */
#ifdef INET6
case AF_INET6:
- h6 = mtod(m, struct ip6_hdr *);
+ h6 = mtod_(m, struct ip6_hdr *);
/* IP header fields included in the TCP checksum */
h6->ip6_nxt = IPPROTO_TCP;
@@ -3676,13 +3676,13 @@
switch (af) {
#ifdef INET
case AF_INET:
- h4 = mtod(m, struct ip *);
+ h4 = mtod_(m, struct ip *);
len = ntohs(h4->ip_len) - off;
break;
#endif
#ifdef INET6
case AF_INET6:
- h6 = mtod(m, struct ip6_hdr *);
+ h6 = mtod_(m, struct ip6_hdr *);
len = ntohs(h6->ip6_plen) - (off - sizeof(*h6));
break;
#endif
@@ -7694,7 +7694,7 @@
switch (af) {
#ifdef INET
case AF_INET: {
- const struct ip *h = mtod(m, struct ip *);
+ const struct ip *h = mtod_(m, struct ip *);
u_int16_t fragoff = (ntohs(h->ip_off) & IP_OFFMASK) << 3;
if (fragoff) {
@@ -7717,7 +7717,7 @@
#endif /* INET */
#ifdef INET6
case AF_INET6: {
- const struct ip6_hdr *h = mtod(m, struct ip6_hdr *);
+ const struct ip6_hdr *h = mtod_(m, struct ip6_hdr *);
if (m->m_pkthdr.len < off + len ||
(ntohs(h->ip6_plen) + sizeof(struct ip6_hdr)) <
@@ -7853,7 +7853,7 @@
m0 = *m;
}
- ip = mtod(m0, struct ip *);
+ ip = mtod_(m0, struct ip *);
bzero(&dst, sizeof(dst));
dst.sin_family = AF_INET;
@@ -7911,7 +7911,7 @@
("%s: m0->m_len < sizeof(struct ip)\n", __func__));
goto bad;
}
- ip = mtod(m0, struct ip *);
+ ip = mtod_(m0, struct ip *);
}
if (ifp->if_flags & IFF_LOOPBACK)
@@ -8101,7 +8101,7 @@
m0 = *m;
}
- ip6 = mtod(m0, struct ip6_hdr *);
+ ip6 = mtod_(m0, struct ip6_hdr *);
bzero(&dst, sizeof(dst));
dst.sin6_family = AF_INET6;
@@ -8162,7 +8162,7 @@
__func__));
goto bad;
}
- ip6 = mtod(m0, struct ip6_hdr *);
+ ip6 = mtod_(m0, struct ip6_hdr *);
}
if (ifp->if_flags & IFF_LOOPBACK)
@@ -8249,7 +8249,7 @@
if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) {
sum = m->m_pkthdr.csum_data;
} else {
- ip = mtod(m, struct ip *);
+ ip = mtod_(m, struct ip *);
sum = in_pseudo(ip->ip_src.s_addr,
ip->ip_dst.s_addr, htonl((u_short)len +
m->m_pkthdr.csum_data + IPPROTO_TCP));
@@ -8263,7 +8263,7 @@
if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) {
sum = m->m_pkthdr.csum_data;
} else {
- ip = mtod(m, struct ip *);
+ ip = mtod_(m, struct ip *);
sum = in_pseudo(ip->ip_src.s_addr,
ip->ip_dst.s_addr, htonl((u_short)len +
m->m_pkthdr.csum_data + IPPROTO_UDP));
@@ -8676,7 +8676,7 @@
goto done;
}
m = *m0; /* pf_normalize messes with m0 */
- h = mtod(m, struct ip *);
+ h = mtod_(m, struct ip *);
off = h->ip_hl << 2;
if (off < (int)sizeof(struct ip)) {
@@ -9252,7 +9252,7 @@
goto done;
}
m = *m0; /* pf_normalize messes with m0 */
- h = mtod(m, struct ip6_hdr *);
+ h = mtod_(m, struct ip6_hdr *);
off = ((caddr_t)h - m->m_data) + sizeof(struct ip6_hdr);
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 1:24 PM (21 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
11871247
Default Alt Text
D46685.diff (3 KB)
Attached To
Mode
D46685: pf: Migrate to asserted mtod_()
Attached
Detach File
Event Timeline
Log In to Comment