1 ------------------------------------------------------------
3 revision-id: squid3@treenet.co.nz-20161209034636-wytrnx7ks2jv0sxt
4 parent: squid3@treenet.co.nz-20161209015833-xm965d5l6u03qhew
5 author: Egervary Gergely <gergely@egervary.hu>
6 committer: Amos Jeffries <squid3@treenet.co.nz>
8 timestamp: Fri 2016-12-09 16:46:36 +1300
10 Support IPv6 NAT with PF for NetBSD and FreeBSD
11 ------------------------------------------------------------
12 # Bazaar merge directive format 2 (Bazaar 0.90)
13 # revision_id: squid3@treenet.co.nz-20161209034636-wytrnx7ks2jv0sxt
14 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5
15 # testament_sha1: b47da8d30fe000bbe50ea978bab7594065f7dc07
16 # timestamp: 2016-12-09 03:51:01 +0000
17 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5
18 # base_revision_id: squid3@treenet.co.nz-20161209015833-\
22 === modified file 'src/ip/Intercept.cc'
23 --- src/ip/Intercept.cc 2016-10-25 08:25:30 +0000
24 +++ src/ip/Intercept.cc 2016-12-09 03:46:36 +0000
28 memset(&nl, 0, sizeof(struct pfioc_natlook));
29 - newConn->remote.getInAddr(nl.saddr.v4);
31 + if (newConn->remote.isIPv6()) {
32 + newConn->remote.getInAddr(nl.saddr.v6);
33 + newConn->local.getInAddr(nl.daddr.v6);
36 + newConn->remote.getInAddr(nl.saddr.v4);
37 + newConn->local.getInAddr(nl.daddr.v4);
41 nl.sport = htons(newConn->remote.port());
43 - newConn->local.getInAddr(nl.daddr.v4);
44 nl.dport = htons(newConn->local.port());
47 nl.proto = IPPROTO_TCP;
48 nl.direction = PF_OUT;
51 debugs(89, 9, HERE << "address: " << newConn);
54 - newConn->local = nl.rdaddr.v4;
55 + if (newConn->remote.isIPv6())
56 + newConn->local = nl.rdaddr.v6;
58 + newConn->local = nl.rdaddr.v4;
59 newConn->local.port(ntohs(nl.rdport));
60 debugs(89, 5, HERE << "address NAT: " << newConn);