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
08524d5e
Commit
08524d5e
authored
Jul 02, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: make sure that we're not iterating over empty interfaces
parent
39689a70
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
24 deletions
+39
-24
filter.inc
src/etc/inc/filter.inc
+1
-1
util.inc
src/etc/inc/util.inc
+32
-23
rc.initial.banner
src/etc/rc.initial.banner
+6
-0
No files found.
src/etc/inc/filter.inc
View file @
08524d5e
...
...
@@ -62,7 +62,7 @@ function is_bogonsv6_used() {
global
$config
,
$g
;
# Only use bogonsv6 table if IPv6 Allow is on, and at least 1 enabled interface also has "blockbogons" enabled.
$usebogonsv6
=
false
;
if
(
isset
(
$config
[
'system'
][
'ipv6allow'
]))
{
if
(
isset
(
$config
[
'system'
][
'ipv6allow'
])
&&
isset
(
$config
[
'interfaces'
])
)
{
foreach
(
$config
[
'interfaces'
]
as
$ifacedata
)
{
if
(
isset
(
$ifacedata
[
'enable'
])
&&
isset
(
$ifacedata
[
'blockbogons'
]))
{
$usebogonsv6
=
true
;
...
...
src/etc/inc/util.inc
View file @
08524d5e
...
...
@@ -723,12 +723,16 @@ function get_configured_interface_list($only_opt = false, $withdisabled = false)
$iflist
=
array
();
/* if list */
if
(
isset
(
$config
[
'interfaces'
]))
{
foreach
(
$config
[
'interfaces'
]
as
$if
=>
$ifdetail
)
{
if
(
$only_opt
&&
(
$if
==
"wan"
||
$if
==
"lan"
))
if
(
$only_opt
&&
(
$if
==
"wan"
||
$if
==
"lan"
))
{
continue
;
if
(
isset
(
$ifdetail
[
'enable'
])
||
$withdisabled
==
true
)
}
if
(
isset
(
$ifdetail
[
'enable'
])
||
$withdisabled
==
true
)
{
$iflist
[
$if
]
=
$if
;
}
}
}
return
$iflist
;
}
...
...
@@ -740,6 +744,7 @@ function get_configured_interface_list_by_realif($only_opt = false, $withdisable
$iflist
=
array
();
/* if list */
if
(
isset
(
$config
[
'interfaces'
]))
{
foreach
(
$config
[
'interfaces'
]
as
$if
=>
$ifdetail
)
{
if
(
$only_opt
&&
(
$if
==
"wan"
||
$if
==
"lan"
))
continue
;
...
...
@@ -749,6 +754,7 @@ function get_configured_interface_list_by_realif($only_opt = false, $withdisable
$iflist
[
$tmpif
]
=
$if
;
}
}
}
return
$iflist
;
}
...
...
@@ -760,6 +766,7 @@ function get_configured_interface_with_descr($only_opt = false, $withdisabled =
$iflist
=
array
();
/* if list */
if
(
isset
(
$config
[
'interfaces'
]))
{
foreach
(
$config
[
'interfaces'
]
as
$if
=>
$ifdetail
)
{
if
(
$only_opt
&&
(
$if
==
"wan"
||
$if
==
"lan"
))
continue
;
...
...
@@ -770,6 +777,7 @@ function get_configured_interface_with_descr($only_opt = false, $withdisabled =
$iflist
[
$if
]
=
strtoupper
(
$ifdetail
[
'descr'
]);
}
}
}
return
$iflist
;
}
...
...
@@ -921,10 +929,11 @@ function get_interface_list($mode = "active", $keyby = "physical", $vfaces = "")
$toput
[
'ipaddr'
]
=
$aip
[
1
];
}
}
if
(
is
_array
(
$config
[
'interfaces'
]))
{
foreach
(
$config
[
'interfaces'
]
as
$name
=>
$int
)
if
(
is
set
(
$config
[
'interfaces'
]))
{
foreach
(
$config
[
'interfaces'
]
as
$name
=>
$int
)
{
if
(
$int
[
'if'
]
==
$ifname
)
$friendly
=
$name
;
}
}
switch
(
$keyby
)
{
case
"physical"
:
if
(
$friendly
!=
""
)
{
...
...
@@ -1410,7 +1419,7 @@ function is_interface_mismatch()
$do_assign
=
false
;
$i
=
0
;
if
(
is
_array
(
$config
[
'interfaces'
]))
{
if
(
is
set
(
$config
[
'interfaces'
]))
{
foreach
(
$config
[
'interfaces'
]
as
$ifname
=>
$ifcfg
)
{
if
(
preg_match
(
"/^enc|^cua|^tun|^tap|^l2tp|^pptp|^ppp|^ovpn|^gif|^gre|^lagg|^bridge|vlan|_wlan/i"
,
$ifcfg
[
'if'
]))
{
/* Do not check these interfaces */
...
...
src/etc/rc.initial.banner
View file @
08524d5e
...
...
@@ -41,6 +41,12 @@ $machine = trim(`uname -m`);
print
"
\n
*** Welcome to
{
$product
}
{
$version
}
(
{
$machine
}
) on
{
$hostname
}
***
\n
"
;
$iflist
=
get_configured_interface_with_descr
(
false
,
true
);
if
(
empty
(
$iflist
))
{
printf
(
"
\n\t
No network interfaces are assigned.
\n
"
);
return
;
}
foreach
(
$iflist
as
$ifname
=>
$friendly
)
{
/* point to this interface's config */
$ifconf
=
$config
[
'interfaces'
][
$ifname
];
...
...
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