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
15fd790f
Commit
15fd790f
authored
Feb 24, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interfaces: slightly restructure the netgraph needed logic
(cherry picked from commit
79b125c2
)
parent
b2e8049e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
52 deletions
+46
-52
interfaces.inc
src/etc/inc/interfaces.inc
+46
-52
No files found.
src/etc/inc/interfaces.inc
View file @
15fd790f
...
@@ -134,76 +134,68 @@ function does_interface_exist($interface)
...
@@ -134,76 +134,68 @@ function does_interface_exist($interface)
}
}
}
}
function
interface_netgraph_needed
(
$interface
)
function
interface_netgraph_needed
(
$interface
=
"wan"
)
{
{
global
$config
;
global
$config
;
$found
=
false
;
if
(
isset
(
$config
[
'pptpd'
][
'mode'
])
&&
$config
[
'pptpd'
][
'mode'
]
==
'server'
)
{
if
(
!
empty
(
$config
[
'pptpd'
])
&&
if
(
'wan'
==
$interface
)
{
$config
[
'pptpd'
][
'mode'
]
==
"server"
return
true
;
)
{
}
$found
=
true
;
}
}
if
(
!
$found
&&
!
empty
(
$config
[
'l2tp'
])
&&
$config
[
'l2tp'
][
'mode'
]
==
"server"
if
(
isset
(
$config
[
'l2tp'
][
'mode'
])
&&
$config
[
'l2tp'
][
'mode'
]
==
'server'
)
{
)
{
if
(
$config
[
'l2tp'
][
'interface'
]
==
$interface
)
{
$found
=
true
;
return
true
;
}
}
}
if
(
!
$found
&&
isset
(
$config
[
'pppoes'
][
'pppoe'
])
&&
is_array
(
$config
[
'pppoes'
][
'pppoe'
]))
{
if
(
isset
(
$config
[
'pppoes'
][
'pppoe'
]))
{
foreach
(
$config
[
'pppoes'
][
'pppoe'
]
as
$pppoe
)
{
foreach
(
$config
[
'pppoes'
][
'pppoe'
]
as
$pppoe
)
{
if
(
$pppoe
[
'mode'
]
!=
"server"
)
{
if
(
$pppoe
[
'mode'
]
!=
'server'
)
{
continue
;
continue
;
}
}
if
(
$pppoe
[
'interface'
]
==
$interface
)
{
if
(
$pppoe
[
'interface'
]
==
$interface
)
{
$found
=
true
;
return
true
;
}
}
break
;
}
}
}
}
if
(
!
$found
)
{
if
(
!
empty
(
$config
[
'interfaces'
][
$interface
]))
{
if
(
isset
(
$config
[
'interfaces'
][
$interface
][
'ipaddr'
]))
{
switch
(
$config
[
'interfaces'
][
$interface
][
'ipaddr'
])
{
switch
(
$config
[
'interfaces'
][
$interface
][
'ipaddr'
])
{
case
"ppp"
:
case
'ppp'
:
case
"pppoe"
:
case
'pppoe'
:
case
"l2tp"
:
case
'l2tp'
:
case
"pptp"
:
case
'pptp'
:
$found
=
true
;
return
true
;
break
;
default
:
default
:
break
;
$found
=
false
;
break
;
}
}
}
}
}
if
(
!
$found
)
{
$realif
=
get_real_interface
(
$interface
);
$realif
=
get_real_interface
(
$interface
);
if
(
isset
(
$config
[
'ppps'
][
'ppp'
]))
{
foreach
(
$config
[
'ppps'
][
'ppp'
]
as
$pppid
=>
$ppp
)
{
if
(
isset
(
$config
[
'ppps'
][
'ppp'
]))
{
$ports
=
explode
(
','
,
$ppp
[
'ports'
]);
foreach
(
$config
[
'ppps'
][
'ppp'
]
as
$pppid
=>
$ppp
)
{
foreach
(
$ports
as
$pid
=>
$port
)
{
$ports
=
explode
(
','
,
$ppp
[
'ports'
]);
$port
=
get_real_interface
(
$port
);
foreach
(
$ports
as
$pid
=>
$port
)
{
if
(
$realif
==
$port
)
{
$port
=
get_real_interface
(
$port
);
$found
=
true
;
if
(
$realif
==
$port
)
{
break
;
return
true
;
}
}
/* Find the parent interfaces of the vlans in the MLPPP configs
/*
* there should be only one element in the array here
* Find the parent interfaces of the vlans in the MLPPP
* -- this could be better . . . */
* configs there should be only one element in the array
$parent_if
=
get_parent_interface
(
$port
);
*/
if
(
$realif
==
$parent_if
[
0
])
{
$parent_if
=
get_parent_interface
(
$port
);
$found
=
true
;
if
(
$realif
==
$parent_if
[
0
])
{
break
;
return
true
;
}
}
}
}
}
}
}
}
}
if
(
!
$found
)
{
return
false
;
$realif
=
get_real_interface
(
$interface
);
legacy_netgraph_detach
(
$realif
);
}
}
}
function
interfaces_loopback_configure
()
function
interfaces_loopback_configure
()
...
@@ -3125,7 +3117,9 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
...
@@ -3125,7 +3117,9 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
interfaces_bring_up
(
$wancfg
[
'if'
]);
interfaces_bring_up
(
$wancfg
[
'if'
]);
}
}
interface_netgraph_needed
(
$interface
);
if
(
!
interface_netgraph_needed
(
$interface
))
{
legacy_netgraph_detach
(
$realif
);
}
if
(
!
file_exists
(
"/var/run/booting"
))
{
if
(
!
file_exists
(
"/var/run/booting"
))
{
link_interface_to_vips
(
$interface
,
"update"
);
link_interface_to_vips
(
$interface
,
"update"
);
...
...
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