Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
8f010ec5
Commit
8f010ec5
authored
Jul 28, 2016
by
Ad Schellevis
Committed by
GitHub
Jul 28, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1080 from djGrrr/master
Fix IPv6 Outbound NAT
parents
155fca31
4c88ef63
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
filter.inc
src/etc/inc/filter.inc
+21
-5
No files found.
src/etc/inc/filter.inc
View file @
8f010ec5
...
...
@@ -1316,7 +1316,7 @@ function filter_nat_rules_outbound_automatic(&$FilterIflist, $src)
}
/* Generate a 'nat on' or 'no nat on' rule for given interface */
function
filter_nat_rules_generate_if
(
&
$FilterIflist
,
$if
,
$src
=
"any"
,
$srcport
=
""
,
$dst
=
"any"
,
$dstport
=
""
,
$natip
=
""
,
$natport
=
""
,
$nonat
=
false
,
$staticnatport
=
false
,
$proto
=
""
,
$poolopts
=
""
,
$log
=
false
)
function
filter_nat_rules_generate_if
(
&
$FilterIflist
,
$if
,
$src
=
"any"
,
$srcport
=
""
,
$dst
=
"any"
,
$dstport
=
""
,
$natip
=
""
,
$natport
=
""
,
$nonat
=
false
,
$staticnatport
=
false
,
$proto
=
""
,
$poolopts
=
""
,
$log
=
false
,
$ipproto
=
"inet"
)
{
global
$config
;
...
...
@@ -1331,8 +1331,15 @@ function filter_nat_rules_generate_if(&$FilterIflist, $if, $src = "any", $srcpor
$tgt
=
"
{
$natip
}
/32"
;
}
}
else
{
$natip
=
get_interface_ip
(
$if
);
if
(
is_ipaddr
(
$natip
))
{
if
(
$ipproto
==
"inet6"
)
{
$natip
=
get_interface_ipv6
(
$if
);
}
else
{
$natip
=
get_interface_ip
(
$if
);
}
if
(
is_ipaddrv6
(
$natip
)){
$tgt
=
"
{
$natip
}
/128"
;
}
elseif
(
is_ipaddr
(
$natip
))
{
$tgt
=
"
{
$natip
}
/32"
;
}
else
{
$tgt
=
"("
.
$FilterIflist
[
$if
][
'if'
]
.
")"
;
...
...
@@ -1352,6 +1359,14 @@ function filter_nat_rules_generate_if(&$FilterIflist, $if, $src = "any", $srcpor
}
else
{
$protocol
=
""
;
}
/* Add the ip protocol */
if
(
!
empty
(
$ipproto
)
&&
$ipproto
!=
"inet"
)
{
$ipprotocol
=
"
{
$ipproto
}
"
;
}
else
{
$ipprotocol
=
""
;
}
/* Add the hard set source port (useful for ISAKMP) */
if
(
$natport
!=
""
)
{
$tgt
.=
" port
{
$natport
}
"
;
...
...
@@ -1400,7 +1415,7 @@ function filter_nat_rules_generate_if(&$FilterIflist, $if, $src = "any", $srcpor
$if_friendly
=
$FilterIflist
[
$if
][
'descr'
];
/* Put all the pieces together */
if
(
$if_friendly
)
{
$natrule
=
"
{
$nat
}
{
$logtag
}
on
\$
{
$if_friendly
}
{
$protocol
}
from
{
$src
}
to
{
$dst
}
{
$target
}
{
$poolopts
}
{
$staticnatport_txt
}
\n
"
;
$natrule
=
"
{
$nat
}
{
$logtag
}
on
\$
{
$if_friendly
}
{
$ipprotocol
}
{
$protocol
}
from
{
$src
}
to
{
$dst
}
{
$target
}
{
$poolopts
}
{
$staticnatport_txt
}
\n
"
;
}
else
{
$natrule
.=
"# Could not convert
{
$if
}
to friendly name(alias)
\n
"
;
}
...
...
@@ -1616,7 +1631,8 @@ function filter_nat_rules_generate(&$FilterIflist)
isset
(
$obent
[
'staticnatport'
]),
$obent
[
'protocol'
],
$poolopts
,
isset
(
$obent
[
'log'
])
isset
(
$obent
[
'log'
]),
$obent
[
'ipprotocol'
]
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment