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
ae95cf92
Commit
ae95cf92
authored
Aug 27, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whitespace firewall_nat_edit.php
parent
8f02b7ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
39 deletions
+38
-39
firewall_nat_edit.php
src/www/firewall_nat_edit.php
+38
-39
No files found.
src/www/firewall_nat_edit.php
View file @
ae95cf92
...
...
@@ -35,46 +35,45 @@ require_once("pfsense-utils.inc");
* build array with interface options for this form
*/
function
formInterfaces
()
{
global
$config
;
$interfaces
=
array
();
foreach
(
get_configured_interface_with_descr
(
false
,
true
)
as
$if
=>
$ifdesc
)
$interfaces
[
$if
]
=
$ifdesc
;
global
$config
;
$interfaces
=
array
();
foreach
(
get_configured_interface_with_descr
(
false
,
true
)
as
$if
=>
$ifdesc
)
$interfaces
[
$if
]
=
$ifdesc
;
if
(
isset
(
$config
[
'l2tp'
][
'mode'
])
&&
$config
[
'l2tp'
][
'mode'
]
==
"server"
)
$interfaces
[
'l2tp'
]
=
"L2TP VPN"
;
if
(
isset
(
$config
[
'l2tp'
][
'mode'
])
&&
$config
[
'l2tp'
][
'mode'
]
==
"server"
)
$interfaces
[
'l2tp'
]
=
"L2TP VPN"
;
if
(
isset
(
$config
[
'pptpd'
][
'mode'
])
&&
$config
[
'pptpd'
][
'mode'
]
==
"server"
)
$interfaces
[
'pptp'
]
=
"PPTP VPN"
;
if
(
isset
(
$config
[
'pptpd'
][
'mode'
])
&&
$config
[
'pptpd'
][
'mode'
]
==
"server"
)
$interfaces
[
'pptp'
]
=
"PPTP VPN"
;
if
(
is_pppoe_server_enabled
())
$interfaces
[
'pppoe'
]
=
"PPPoE VPN"
;
if
(
is_pppoe_server_enabled
())
$interfaces
[
'pppoe'
]
=
"PPPoE VPN"
;
/* add ipsec interfaces */
if
(
isset
(
$config
[
'ipsec'
][
'enable'
])
||
isset
(
$config
[
'ipsec'
][
'client'
][
'enable'
]))
$interfaces
[
"enc0"
]
=
"IPsec"
;
/* add ipsec interfaces */
if
(
isset
(
$config
[
'ipsec'
][
'enable'
])
||
isset
(
$config
[
'ipsec'
][
'client'
][
'enable'
]))
$interfaces
[
"enc0"
]
=
"IPsec"
;
/* add openvpn/tun interfaces */
if
(
isset
(
$config
[
'openvpn'
][
'openvpn-server'
])
||
isset
(
$config
[
'openvpn'
][
'openvpn-client'
]))
{
$interfaces
[
'openvpn'
]
=
'OpenVPN'
;
}
return
$interfaces
;
/* add openvpn/tun interfaces */
if
(
isset
(
$config
[
'openvpn'
][
'openvpn-server'
])
||
isset
(
$config
[
'openvpn'
][
'openvpn-client'
]))
{
$interfaces
[
'openvpn'
]
=
'OpenVPN'
;
}
return
$interfaces
;
}
/**
* fetch list of selectable networks to use in form
*/
function
formNetworks
()
{
$networks
=
array
();
$networks
[
"any"
]
=
gettext
(
"any"
);
$networks
[
"pptp"
]
=
gettext
(
"PPTP clients"
);
$networks
[
"pppoe"
]
=
gettext
(
"PPPoE clients"
);
$networks
[
"l2tp"
]
=
gettext
(
"L2TP clients"
);
foreach
(
get_configured_interface_with_descr
()
as
$ifent
=>
$ifdesc
)
{
$networks
[
$ifent
]
=
htmlspecialchars
(
$ifdesc
)
.
" "
.
gettext
(
"net"
);
$networks
[
$ifent
.
"ip"
]
=
htmlspecialchars
(
$ifdesc
)
.
" "
.
gettext
(
"address"
);
}
return
$networks
;
$networks
=
array
();
$networks
[
"any"
]
=
gettext
(
"any"
);
$networks
[
"pptp"
]
=
gettext
(
"PPTP clients"
);
$networks
[
"pppoe"
]
=
gettext
(
"PPPoE clients"
);
$networks
[
"l2tp"
]
=
gettext
(
"L2TP clients"
);
foreach
(
get_configured_interface_with_descr
()
as
$ifent
=>
$ifdesc
)
{
$networks
[
$ifent
]
=
htmlspecialchars
(
$ifdesc
)
.
" "
.
gettext
(
"net"
);
$networks
[
$ifent
.
"ip"
]
=
htmlspecialchars
(
$ifdesc
)
.
" "
.
gettext
(
"address"
);
}
return
$networks
;
}
/**
...
...
@@ -84,14 +83,14 @@ function formNetworks() {
$specialsrcdst
=
explode
(
" "
,
"any (self) pptp pppoe l2tp openvpn"
);
$ifdisp
=
get_configured_interface_with_descr
();
foreach
(
$ifdisp
as
$kif
=>
$kdescr
)
{
$specialsrcdst
[]
=
"
{
$kif
}
"
;
$specialsrcdst
[]
=
"
{
$kif
}
ip"
;
$specialsrcdst
[]
=
"
{
$kif
}
"
;
$specialsrcdst
[]
=
"
{
$kif
}
ip"
;
}
// init config and get reference
if
(
!
isset
(
$config
[
'nat'
][
'rule'
])
||
!
is_array
(
$config
[
'nat'
][
'rule'
]))
{
$config
[
'nat'
][
'rule'
]
=
array
();
$config
[
'nat'
][
'rule'
]
=
array
();
}
$a_nat
=
&
$config
[
'nat'
][
'rule'
];
...
...
@@ -170,9 +169,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$id
=
$_POST
[
'id'
];
}
if
(
isset
(
$pconfig
[
'after'
])
&&
isset
(
$a_nat
[
$pconfig
[
'after'
]]))
{
// place record after provided sequence number
$after
=
$pconfig
[
'after'
];
}
// place record after provided sequence number
$after
=
$pconfig
[
'after'
];
}
/* Validate input data */
foreach
(
$pconfig
as
$key
=>
$value
)
{
...
...
@@ -299,13 +298,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// Create a rule or if we want to create a new one
if
(
$natent
[
'associated-rule-id'
]
==
'new'
)
{
$need_filter_rule
=
true
;
unset
(
$natent
[
'associated-rule-id'
]
);
unset
(
$natent
[
'associated-rule-id'
]
);
$pconfig
[
'filter-rule-association'
]
=
'add-associated'
;
}
// If creating a new rule, where we want to add the filter rule, associated or not
else
if
(
isset
(
$pconfig
[
'filter-rule-association'
])
&&
(
$pconfig
[
'filter-rule-association'
]
==
'add-associated'
||
$pconfig
[
'filter-rule-association'
]
==
'add-unassociated'
)
)
else
if
(
isset
(
$pconfig
[
'filter-rule-association'
])
&&
(
$pconfig
[
'filter-rule-association'
]
==
'add-associated'
||
$pconfig
[
'filter-rule-association'
]
==
'add-unassociated'
)
)
$need_filter_rule
=
true
;
if
(
$need_filter_rule
)
{
...
...
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