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
79b125c2
Commit
79b125c2
authored
Feb 24, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interfaces: slightly restructure the netgraph needed logic
parent
5adfd6bf
Changes
1
Show 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 @
79b125c2
...
@@ -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
(
isset
(
$config
[
'l2tp'
][
'mode'
])
&&
$config
[
'l2tp'
][
'mode'
]
==
'server'
)
{
if
(
$config
[
'l2tp'
][
'interface'
]
==
$interface
)
{
return
true
;
}
}
if
(
!
$found
&&
!
empty
(
$config
[
'l2tp'
])
&&
$config
[
'l2tp'
][
'mode'
]
==
"server"
)
{
$found
=
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
:
$found
=
false
;
break
;
break
;
}
}
}
}
}
if
(
!
$found
)
{
$realif
=
get_real_interface
(
$interface
);
$realif
=
get_real_interface
(
$interface
);
if
(
isset
(
$config
[
'ppps'
][
'ppp'
]))
{
if
(
isset
(
$config
[
'ppps'
][
'ppp'
]))
{
foreach
(
$config
[
'ppps'
][
'ppp'
]
as
$pppid
=>
$ppp
)
{
foreach
(
$config
[
'ppps'
][
'ppp'
]
as
$pppid
=>
$ppp
)
{
$ports
=
explode
(
','
,
$ppp
[
'ports'
]);
$ports
=
explode
(
','
,
$ppp
[
'ports'
]);
foreach
(
$ports
as
$pid
=>
$port
)
{
foreach
(
$ports
as
$pid
=>
$port
)
{
$port
=
get_real_interface
(
$port
);
$port
=
get_real_interface
(
$port
);
if
(
$realif
==
$port
)
{
if
(
$realif
==
$port
)
{
$found
=
true
;
return
true
;
break
;
}
}
/* 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
);
$parent_if
=
get_parent_interface
(
$port
);
if
(
$realif
==
$parent_if
[
0
])
{
if
(
$realif
==
$parent_if
[
0
])
{
$found
=
true
;
return
true
;
break
;
}
}
}
}
}
}
}
}
}
if
(
!
$found
)
{
return
false
;
$realif
=
get_real_interface
(
$interface
);
legacy_netgraph_detach
(
$realif
);
}
}
}
function
interfaces_loopback_configure
()
function
interfaces_loopback_configure
()
...
@@ -3119,7 +3111,9 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
...
@@ -3119,7 +3111,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