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
daa5462f
Commit
daa5462f
authored
Jul 01, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: clean up the code and horrible usage of temp files; #5
parent
5ddbfd16
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
47 deletions
+29
-47
config.console.inc
src/etc/inc/config.console.inc
+10
-18
util.inc
src/etc/inc/util.inc
+5
-16
rc.bootup
src/etc/rc.bootup
+12
-12
rc.initial.setports
src/etc/rc.initial.setports
+2
-1
No files found.
src/etc/inc/config.console.inc
View file @
daa5462f
<?php
/*
Copyright (C) 2004-2010 Scott Ullrich
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
Copyright (C) 2015 Franco Fichtner <franco@opnsense.org>
Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
...
...
@@ -29,9 +30,7 @@
function
set_networking_interfaces_ports
()
{
global
$noreboot
;
global
$config
;
global
$fp
;
$fp
=
fopen
(
'php://stdin'
,
'r'
);
$yes_no_prompt
=
'[y|n]? '
;
...
...
@@ -84,7 +83,7 @@ EOD;
}
if
(
in_array
(
$key
,
array
(
'y'
,
'Y'
)))
{
vlan_setup
();
vlan_setup
(
$iflist
,
$fp
);
}
if
(
isset
(
$config
[
'vlans'
][
'vlan'
]))
{
...
...
@@ -198,7 +197,7 @@ Error: you cannot assign the same interface name twice!
EOD;
fclose
(
$fp
);
return
;
return
false
;
}
}
}
...
...
@@ -347,15 +346,10 @@ EODD;
fclose
(
$fp
);
if
(
file_exists
(
"/var/run/booting"
))
return
;
echo
gettext
(
"One moment while we reload the settings..."
);
echo
gettext
(
" done!"
)
.
"
\n
"
;
touch
(
'/tmp/assign_complete'
);
return
true
;
}
return
false
;
}
function
autodetect_interface
(
$ifname
,
$fp
)
...
...
@@ -382,14 +376,12 @@ EOD;
return
null
;
}
function
vlan_setup
()
function
vlan_setup
(
$iflist
,
$fp
)
{
global
$
iflist
,
$config
,
$fp
;
global
$
config
;
$yes_no_prompt
=
'[y|n]? '
;
$iflist
=
get_interface_list
();
if
(
is_array
(
$config
[
'vlans'
][
'vlan'
])
&&
count
(
$config
[
'vlans'
][
'vlan'
]))
{
echo
<<<EOD
...
...
src/etc/inc/util.inc
View file @
daa5462f
...
...
@@ -1409,32 +1409,21 @@ function is_interface_mismatch()
$do_assign
=
false
;
$i
=
0
;
$missing_interfaces
=
array
();
if
(
is_array
(
$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.
/
* Do not check these interfaces */
$i
++
;
continue
;
}
else
if
(
does_interface_exist
(
$ifcfg
[
'if'
])
==
false
)
{
$missing_interfaces
[]
=
$ifcfg
[
'if'
];
}
elseif
(
does_interface_exist
(
$ifcfg
[
'if'
])
==
false
)
{
$do_assign
=
true
;
}
else
}
else
{
$i
++
;
}
}
}
if
(
file_exists
(
'/tmp/assign_complete'
))
{
$do_assign
=
false
;
}
if
(
!
empty
(
$missing_interfaces
)
&&
$do_assign
)
{
file_put_contents
(
'/tmp/missing_interfaces'
,
implode
(
' '
,
$missing_interfaces
));
}
else
{
@
unlink
(
'/tmp/missing_interfaces'
);
}
return
$do_assign
;
}
...
...
src/etc/rc.bootup
View file @
daa5462f
...
...
@@ -139,22 +139,22 @@ echo "done.\n";
* and ask the user to reassign interfaces. This will
* avoid a reboot and thats a good thing.
*/
while
(
is_interface_mismatch
()
==
true
)
{
led_assigninterfaces
();
if
(
isset
(
$config
[
'revision'
]))
{
if
(
file_exists
(
'/tmp/missing_interfaces'
))
{
echo
"Warning: Configuration references interfaces that do not exist: "
.
file_get_contents
(
'/tmp/missing_interfaces'
)
.
"
\n
"
;
}
echo
"
\n
Network interface mismatch -- Running interface assignment option.
\n
"
;
}
else
echo
"
\n
Default interfaces not found -- Running interface assignment option.
\n
"
;
if
(
is_interface_mismatch
())
{
echo
PHP_EOL
.
gettext
(
'Default interfaces not found -- Running interface assignment option.'
)
.
PHP_EOL
;
$ifaces
=
get_interface_list
();
if
(
is_array
(
$ifaces
))
{
foreach
(
$ifaces
as
$iface
=>
$ifdata
)
foreach
(
$ifaces
as
$iface
=>
$ifdata
)
{
interfaces_bring_up
(
$iface
);
}
}
set_networking_interfaces_ports
();
led_kitt
();
$done
=
false
;
do
{
led_assigninterfaces
();
$done
=
set_networking_interfaces_ports
();
led_kitt
();
}
while
(
!
$done
);
}
/* convert config and clean backups */
...
...
src/etc/rc.initial.setports
View file @
daa5462f
...
...
@@ -37,6 +37,7 @@ require_once("vpn.inc");
require_once
(
"captiveportal.inc"
);
require_once
(
"rrd.inc"
);
set_networking_interfaces_ports
();
/* configure until valid */
while
(
!
set_networking_interfaces_ports
());
reload_interfaces_sync
();
enable_rrd_graphing
();
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