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
0090f14e
Commit
0090f14e
authored
Dec 02, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(filter.inc) generate aliases for internal networks
parent
8067e9bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
filter.inc
src/etc/inc/filter.inc
+30
-0
No files found.
src/etc/inc/filter.inc
View file @
0090f14e
...
...
@@ -397,6 +397,7 @@ function filter_configure_sync($verbose = false)
/* generate aliases */
update_filter_reload_status
(
gettext
(
"Creating aliases"
));
$aliases
=
filter_generate_aliases
(
$FilterIflist
,
$after_filter_configure_run
);
$aliases
.=
filter_generate_network_aliases
();
$gateways
=
filter_generate_gateways
();
if
(
$verbose
)
{
...
...
@@ -856,6 +857,35 @@ function filter_generate_aliases(&$FilterIflist, &$after_filter_configure_run)
return
$aliases
;
}
/**
* generate aliases for internal networks, so eventually we don't need logic in the rule parsing to bind the
* existing network/ip options.
*/
function
filter_generate_network_aliases
()
{
global
$config
;
$result
=
"### define internal aliases
\n
"
;
$interface_config
=
legacy_interfaces_details
();
foreach
(
legacy_config_get_interfaces
(
array
(
"enable"
=>
true
))
as
$if
=>
$ifdetail
)
{
$networks
=
array
();
$addresses
=
array
();
if
(
!
empty
(
$ifdetail
[
'if'
])
&&
!
empty
(
$interface_config
[
$ifdetail
[
'if'
]]))
{
$properties
=
$interface_config
[
$ifdetail
[
'if'
]];
if
(
!
empty
(
$properties
[
'ipv4'
]))
{
$networks
[]
=
gen_subnet
(
$properties
[
'ipv4'
][
0
][
'ipaddr'
],
$properties
[
'ipv4'
][
0
][
'subnetbits'
]);
$addresses
[]
=
$properties
[
'ipv4'
][
0
][
'ipaddr'
];
}
if
(
!
empty
(
$properties
[
'ipv6'
])
&&
empty
(
$properties
[
'ipv6'
][
0
][
'link-local'
]))
{
$networks
[]
=
gen_subnetv6
(
$properties
[
'ipv6'
][
0
][
'ipaddr'
],
$properties
[
'ipv6'
][
0
][
'subnetbits'
]);
$addresses
[]
=
$properties
[
'ipv6'
][
0
][
'ipaddr'
];
}
}
$result
.=
"table <internal-
{
$if
}
> { "
.
implode
(
' '
,
$networks
)
.
" }
\n
"
;
$result
.=
"table <internal-
{
$if
}
ip> { "
.
implode
(
' '
,
$addresses
)
.
" }
\n
"
;
}
return
$result
;
}
function
filter_generate_gateways
()
{
global
$config
,
$GatewaysList
;
...
...
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