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
06a7ea48
Commit
06a7ea48
authored
Nov 25, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy/ipsec) fix esp/ah options on multiple phase2 entries
parent
3e0e936b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
11 deletions
+39
-11
vpn.inc
src/etc/inc/vpn.inc
+39
-11
No files found.
src/etc/inc/vpn.inc
View file @
06a7ea48
...
...
@@ -689,6 +689,7 @@ EOD;
$ph2ent
[
'pfsgroup'
]
=
$a_client
[
'pfs_group'
];
}
if
(
isset
(
$ph2ent
[
'protocol'
])
&&
$ph2ent
[
'protocol'
]
==
'esp'
)
{
$ealgoESPsp2arr_details
=
array
();
if
(
is_array
(
$ph2ent
[
'encryption-algorithm-option'
]))
{
foreach
(
$ph2ent
[
'encryption-algorithm-option'
]
as
$ealg
)
{
$ealg_id
=
$ealg
[
'name'
];
...
...
@@ -715,7 +716,7 @@ EOD;
if
(
!
empty
(
$modp
))
{
$tmpealgo
.=
"-
{
$modp
}
"
;
}
$ealgoESPsp2arr
[]
=
$tmpealgo
;
$ealgoESPsp2arr
_details
[]
=
$tmpealgo
;
}
}
else
{
$tmpealgo
=
"
{
$ealg_id
}{
$keylen
}
"
;
...
...
@@ -723,7 +724,7 @@ EOD;
if
(
!
empty
(
$modp
))
{
$tmpealgo
.=
"-
{
$modp
}
"
;
}
$ealgoESPsp2arr
[]
=
$tmpealgo
;
$ealgoESPsp2arr
_details
[]
=
$tmpealgo
;
}
}
}
...
...
@@ -736,7 +737,7 @@ EOD;
if
(
!
empty
(
$modp
))
{
$tmpealgo
.=
"-
{
$modp
}
"
;
}
$ealgoESPsp2arr
[]
=
$tmpealgo
;
$ealgoESPsp2arr
_details
[]
=
$tmpealgo
;
}
}
else
{
$tmpealgo
=
"
{
$ealg_id
}{
$ealg_kl
}
"
;
...
...
@@ -744,12 +745,14 @@ EOD;
if
(
!
empty
(
$modp
))
{
$tmpealgo
.=
"-
{
$modp
}
"
;
}
$ealgoESPsp2arr
[]
=
$tmpealgo
;
$ealgoESPsp2arr
_details
[]
=
$tmpealgo
;
}
}
}
}
$ealgoESPsp2arr
[]
=
$ealgoESPsp2arr_details
;
}
else
if
(
isset
(
$ph2ent
[
'protocol'
])
&&
$ph2ent
[
'protocol'
]
==
'ah'
)
{
$ealgoAHsp2arr_details
=
array
();
if
(
!
empty
(
$ph2ent
[
'hash-algorithm-option'
])
&&
is_array
(
$ph2ent
[
'hash-algorithm-option'
]))
{
$modp
=
vpn_ipsec_convert_to_modp
(
$ph2ent
[
'pfsgroup'
]);
foreach
(
$ph2ent
[
'hash-algorithm-option'
]
as
$tmpAHalgo
)
{
...
...
@@ -757,9 +760,10 @@ EOD;
if
(
!
empty
(
$modp
))
{
$tmpAHalgo
=
"-
{
$modp
}
"
;
}
$ealgoAHsp2arr
[]
=
$tmpAHalgo
;
$ealgoAHsp2arr
_details
[]
=
$tmpAHalgo
;
}
}
$ealgoAHsp2arr
[]
=
$ealgoAHsp2arr_details
;
}
if
(
!
empty
(
$ph2ent
[
'lifetime'
]))
{
...
...
@@ -799,12 +803,6 @@ EOD;
if
(
!
empty
(
$ealgosp1
))
{
$connEntry
.=
"
\t
{
$ealgosp1
}
\n
"
;
}
if
(
!
empty
(
$ealgoAHsp2arr
))
{
$connEntry
.=
"
\t
ah = "
.
join
(
','
,
$ealgoAHsp2arr
)
.
"!
\n
"
;
}
if
(
!
empty
(
$ealgoESPsp2arr
))
{
$connEntry
.=
"
\t
esp = "
.
join
(
','
,
$ealgoESPsp2arr
)
.
"!
\n
"
;
}
if
(
!
empty
(
$authentication
))
{
$connEntry
.=
"
\t
{
$authentication
}
\n
"
;
}
...
...
@@ -824,6 +822,12 @@ EOD;
}
$tmpconf
.=
"
\t
rightsubnet ="
.
$rightsubnet_spec
[
$idx
]
.
"
\n
"
;
$tmpconf
.=
"
\t
leftsubnet = "
.
$leftsubnet_spec
[
$idx
]
.
"
\n
"
;
if
(
!
empty
(
$ealgoESPsp2arr
[
$idx
]))
{
$tmpconf
.=
"
\t
esp = "
.
join
(
','
,
$ealgoESPsp2arr
[
$idx
])
.
"!
\n
"
;
}
if
(
!
empty
(
$ealgoAHsp2arr
[
$idx
]))
{
$connEntry
.=
"
\t
ah = "
.
join
(
','
,
$ealgoAHsp2arr
[
$idx
])
.
"!
\n
"
;
}
$ipsecconf
.=
$tmpconf
;
}
}
else
{
...
...
@@ -835,6 +839,30 @@ EOD;
if
(
!
empty
(
$leftsubnet_spec
))
{
$tmpconf
.=
"
\t
leftsubnet = "
.
join
(
","
,
$leftsubnet_spec
)
.
"
\n
"
;
}
// merge esp phase 2 arrays.
$esp_content
=
array
();
foreach
(
$ealgoESPsp2arr
as
$ealgoESPsp2arr_details
)
{
foreach
(
$ealgoESPsp2arr_details
as
$esp_item
)
{
if
(
!
in_array
(
$esp_item
,
$esp_content
))
{
$esp_content
[]
=
$esp_item
;
}
}
}
// merge ah phase 2 arrays.
$ah_content
=
array
();
foreach
(
$ealgoAHsp2arr
as
$ealgoAHsp2arr_details
)
{
foreach
(
$ealgoAHsp2arr_details
as
$ah_item
)
{
if
(
!
in_array
(
$ah_item
,
$ah_content
))
{
$ah_content
[]
=
$ah_item
;
}
}
}
if
(
!
empty
(
$esp_content
))
{
$tmpconf
.=
"
\t
esp = "
.
join
(
','
,
$esp_content
)
.
"!
\n
"
;
}
if
(
!
empty
(
$ah_content
))
{
$tmpconf
.=
"
\t
ah = "
.
join
(
','
,
$ah_content
)
.
"!
\n
"
;
}
$ipsecconf
.=
$tmpconf
;
}
}
...
...
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