Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107158985
D35551.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
D35551.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
@@ -3848,6 +3848,12 @@
static int
pf_test_eth_rule(int dir, struct pfi_kkif *kif, struct mbuf **m0)
{
+#ifdef INET
+ struct ip ip;
+#endif
+#ifdef INET6
+ struct ip6_hdr ip6;
+#endif
struct mbuf *m = *m0;
struct ether_header *e;
struct pf_keth_rule *r, *rm, *a = NULL;
@@ -3893,39 +3899,25 @@
switch (proto) {
#ifdef INET
case ETHERTYPE_IP: {
- struct ip *ip;
- m = m_pullup(m, sizeof(struct ether_header) +
- sizeof(struct ip));
- if (m == NULL) {
- *m0 = NULL;
- return (PF_DROP);
- }
af = AF_INET;
- ip = mtodo(m, sizeof(struct ether_header));
- src = (struct pf_addr *)&ip->ip_src;
- dst = (struct pf_addr *)&ip->ip_dst;
+ m_copydata(m, sizeof(struct ether_header), sizeof(ip),
+ (caddr_t)&ip);
+ src = (struct pf_addr *)&ip.ip_src;
+ dst = (struct pf_addr *)&ip.ip_dst;
break;
}
#endif /* INET */
#ifdef INET6
case ETHERTYPE_IPV6: {
- struct ip6_hdr *ip6;
- m = m_pullup(m, sizeof(struct ether_header) +
- sizeof(struct ip6_hdr));
- if (m == NULL) {
- *m0 = NULL;
- return (PF_DROP);
- }
af = AF_INET6;
- ip6 = mtodo(m, sizeof(struct ether_header));
- src = (struct pf_addr *)&ip6->ip6_src;
- dst = (struct pf_addr *)&ip6->ip6_dst;
+ m_copydata(m, sizeof(struct ether_header), sizeof(ip6),
+ (caddr_t)&ip6);
+ src = (struct pf_addr *)&ip6.ip6_src;
+ dst = (struct pf_addr *)&ip6.ip6_dst;
break;
}
#endif /* INET6 */
}
- e = mtod(m, struct ether_header *);
- *m0 = m;
PF_RULES_RLOCK();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 12, 12:54 AM (21 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15759413
Default Alt Text
D35551.diff (1 KB)
Attached To
Mode
D35551: pf: copy out rather than m_pullup() in pf_test_eth_rule()
Attached
Detach File
Event Timeline
Log In to Comment