Page MenuHomeFreeBSD

D49143.1789654188.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D49143.1789654188.diff

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
@@ -7993,10 +7993,6 @@
&nk->addr[didx], pd->af,
nk->af))
return (PF_DROP);
- if (nk->af == AF_INET)
- pd->proto = IPPROTO_ICMP;
- else
- pd->proto = IPPROTO_ICMPV6;
pf_change_ap(pd->m, pd2.src, &th.th_sport,
pd->ip_sum, &th.th_sum, &nk->addr[pd2.sidx],
nk->port[sidx], 1, pd->af, nk->af);
@@ -8004,9 +8000,23 @@
pd->ip_sum, &th.th_sum, &nk->addr[pd2.didx],
nk->port[didx], 1, pd->af, nk->af);
m_copyback(pd2.m, pd2.off, 8, (c_caddr_t)&th);
- PF_ACPY(pd->src,
+ PF_ACPY(&pd->nsaddr,
&nk->addr[pd2.sidx], nk->af);
- PF_ACPY(pd->dst,
+ if (nk->af == AF_INET) {
+ pd->proto = IPPROTO_ICMP;
+ } else {
+ pd->proto = IPPROTO_ICMPV6;
+ /*
+ * IPv4 becomes IPv6 so we must
+ * put IPv4 src addr to least
+ * 32bits in IPv6 address to
+ * keep traceroute/icmp
+ * working.
+ */
+ pd->nsaddr.addr32[3] =
+ pd->src->addr32[0];
+ }
+ PF_ACPY(&pd->ndaddr,
&nk->addr[pd2.didx], nk->af);
pd->naf = nk->af;
return (PF_AFRT);
@@ -8114,10 +8124,6 @@
&nk->addr[didx], pd->af,
nk->af))
return (PF_DROP);
- if (nk->af == AF_INET)
- pd->proto = IPPROTO_ICMP;
- else
- pd->proto = IPPROTO_ICMPV6;
pf_change_ap(pd->m, pd2.src, &uh.uh_sport,
pd->ip_sum, &uh.uh_sum, &nk->addr[pd2.sidx],
nk->port[sidx], 1, pd->af, nk->af);
@@ -8128,6 +8134,20 @@
(c_caddr_t)&uh);
PF_ACPY(&pd->nsaddr,
&nk->addr[pd2.sidx], nk->af);
+ if (nk->af == AF_INET) {
+ pd->proto = IPPROTO_ICMP;
+ } else {
+ pd->proto = IPPROTO_ICMPV6;
+ /*
+ * IPv4 becomes IPv6 so we must
+ * put IPv4 src addr to least
+ * 32bits in IPv6 address to
+ * keep traceroute/icmp
+ * working.
+ */
+ pd->nsaddr.addr32[3] =
+ pd->src->addr32[0];
+ }
PF_ACPY(&pd->ndaddr,
&nk->addr[pd2.didx], nk->af);
pd->naf = nk->af;
@@ -8254,16 +8274,26 @@
&nk->addr[didx], pd->af,
nk->af))
return (PF_DROP);
- if (nk->af == AF_INET)
- pd->proto = IPPROTO_ICMP;
- else
- pd->proto = IPPROTO_ICMPV6;
sh.src_port = nk->port[sidx];
sh.dest_port = nk->port[didx];
m_copyback(pd2.m, pd2.off, sizeof(sh), (c_caddr_t)&sh);
- PF_ACPY(pd->src,
+ PF_ACPY(&pd->nsaddr,
&nk->addr[pd2.sidx], nk->af);
- PF_ACPY(pd->dst,
+ if (nk->af == AF_INET) {
+ pd->proto = IPPROTO_ICMP;
+ } else {
+ pd->proto = IPPROTO_ICMPV6;
+ /*
+ * IPv4 becomes IPv6 so we must
+ * put IPv4 src addr to least
+ * 32bits in IPv6 address to
+ * keep traceroute/icmp
+ * working.
+ */
+ pd->nsaddr.addr32[3] =
+ pd->src->addr32[0];
+ }
+ PF_ACPY(&pd->ndaddr,
&nk->addr[pd2.didx], nk->af);
pd->naf = nk->af;
return (PF_AFRT);
@@ -8381,7 +8411,6 @@
&nk->addr[didx], pd->af,
nk->af))
return (PF_DROP);
- pd->proto = IPPROTO_ICMPV6;
if (pf_translate_icmp_af(nk->af, iih))
return (PF_DROP);
if (virtual_type == htons(ICMP_ECHO) &&
@@ -8391,6 +8420,16 @@
(c_caddr_t)&iih);
PF_ACPY(&pd->nsaddr,
&nk->addr[pd2.sidx], nk->af);
+ pd->proto = IPPROTO_ICMPV6;
+ /*
+ * IPv4 becomes IPv6 so we must
+ * put IPv4 src addr to least
+ * 32bits in IPv6 address to
+ * keep traceroute/icmp
+ * working.
+ */
+ pd->nsaddr.addr32[3] =
+ pd->src->addr32[0];
PF_ACPY(&pd->ndaddr,
&nk->addr[pd2.didx], nk->af);
pd->naf = nk->af;

File Metadata

Mime Type
text/plain
Expires
Thu, Sep 17, 2:09 PM (6 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29732461
Default Alt Text
D49143.1789654188.diff (3 KB)

Event Timeline