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
2a45301e
Commit
2a45301e
authored
Dec 06, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rc: $verbose conversion, simplify services_routing_enable()
parent
daaf3acd
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
36 deletions
+36
-36
interfaces.inc
src/etc/inc/interfaces.inc
+3
-9
system.inc
src/etc/inc/system.inc
+28
-14
rc.bootup
src/etc/rc.bootup
+2
-5
rc.initial.setports
src/etc/rc.initial.setports
+0
-1
rc.newwanip
src/etc/rc.newwanip
+2
-3
rc.newwanipv6
src/etc/rc.newwanipv6
+1
-2
rc.reload_all
src/etc/rc.reload_all
+0
-1
rc.reload_interfaces
src/etc/rc.reload_interfaces
+0
-1
No files found.
src/etc/inc/interfaces.inc
View file @
2a45301e
...
...
@@ -989,12 +989,8 @@ function interface_gif_configure(&$gif, $gifkey = "")
$iflist
=
get_configured_interface_list
();
foreach
(
$iflist
as
$ifname
)
{
if
(
$config
[
'interfaces'
][
$ifname
][
'if'
]
==
$gifif
)
{
if
(
get_interface_gateway
(
$ifname
))
{
system_routing_configure
(
$ifname
);
break
;
}
if
(
get_interface_gateway_v6
(
$ifname
))
{
system_routing_configure
(
$ifname
);
if
(
get_interface_gateway
(
$ifname
)
||
get_interface_gateway_v6
(
$ifname
))
{
system_routing_configure
(
false
,
$ifname
);
break
;
}
}
...
...
@@ -1134,7 +1130,6 @@ function interfaces_configure()
interfaces_group_setup
();
if
(
!
file_exists
(
"/var/run/booting"
))
{
/* reconfigure static routes (kernel may have deleted them) */
system_routing_configure
();
/* reload IPsec tunnels */
...
...
@@ -2879,8 +2874,7 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
}
if
(
$reloadall
==
true
)
{
/* reconfigure static routes (kernel may have deleted them) */
system_routing_configure
(
$interface
);
system_routing_configure
(
false
,
$interface
);
/* reload ipsec tunnels */
ipsec_configure
();
...
...
src/etc/inc/system.inc
View file @
2a45301e
...
...
@@ -415,10 +415,15 @@ function system_hostname_configure($verbose = false)
}
}
function
system_routing_configure
(
$interface
=
''
)
function
system_routing_configure
(
$
verbose
=
false
,
$
interface
=
''
)
{
global
$config
;
if
(
$verbose
)
{
echo
'Setting up routes...'
;
flush
();
}
$gatewayip
=
""
;
$interfacegw
=
""
;
$foundgw
=
false
;
...
...
@@ -516,6 +521,15 @@ function system_routing_configure($interface = '')
system_staticroutes_configure
(
$interface
);
set_sysctl
(
array
(
'net.inet.ip.forwarding'
=>
'1'
,
'net.inet6.ip6.forwarding'
=>
'1'
));
if
(
$verbose
)
{
echo
"done.
\n
"
;
}
return
0
;
}
...
...
@@ -662,17 +676,8 @@ function system_staticroutes_configure($interface = '')
return
0
;
}
function
system_
routing_enable
(
)
function
system_
syslogd_fixup_server
(
$server
)
{
global
$config
;
set_sysctl
(
array
(
"net.inet.ip.forwarding"
=>
"1"
,
"net.inet6.ip6.forwarding"
=>
"1"
));
}
function
system_syslogd_fixup_server
(
$server
)
{
/* If it's an IPv6 IP alone, encase it in brackets */
if
(
is_ipaddrv6
(
$server
))
{
return
"[
$server
]"
;
...
...
@@ -897,10 +902,15 @@ function system_clear_clog($logfile, $restart_syslogd = true)
}
function
system_webgui_configure
()
function
system_webgui_configure
(
$verbose
=
false
)
{
global
$config
;
if
(
$verbose
)
{
echo
'Starting GUI...'
;
flush
();
}
chdir
(
'/usr/local/www'
);
@
unlink
(
'/usr/local/www/csrf/csrf-secret.php'
);
...
...
@@ -974,8 +984,12 @@ function system_webgui_configure()
/* regenerate the php.ini files in case the setup has changed */
mwexec
(
'/usr/local/etc/rc.php_ini_setup'
);
/* attempt to start lighthttpd and return true if ok */
return
!
mwexec
(
"/usr/local/sbin/lighttpd -f /var/etc/lighty-webConfigurator.conf"
);
/* start lighthttpd */
mwexec
(
'/usr/local/sbin/lighttpd -f /var/etc/lighty-webConfigurator.conf'
);
if
(
$verbose
)
{
echo
"done.
\n
"
;
}
}
/*
...
...
src/etc/rc.bootup
View file @
2a45301e
...
...
@@ -138,12 +138,9 @@ echo "done.\n";
/* start ssh daemon */
mwexec
(
"/usr/local/etc/rc.sshd"
);
/* start web server */
echo
'Starting webConfigurator...'
.
(
system_webgui_configure
()
?
"done.
\n
"
:
"failed.
\n
"
);
system_webgui_configure
(
true
);
system_cron_configure
(
true
);
system_routing_configure
();
system_routing_enable
();
system_routing_configure
(
true
);
dnsmasq_configure_do
(
true
);
unbound_configure_do
(
true
);
services_dhcpd_configure
(
'all'
,
array
(),
true
);
...
...
src/etc/rc.initial.setports
View file @
2a45301e
...
...
@@ -43,7 +43,6 @@ if (set_networking_interfaces_ports()) {
echo
"Reloading interfaces..."
;
global
$config
;
$config
=
parse_config
();
system_routing_enable
();
interfaces_configure
();
echo
"done.
\n
"
;
enable_rrd_graphing
();
...
...
src/etc/rc.newwanip
View file @
2a45301e
...
...
@@ -168,7 +168,7 @@ if(isset($config['gifs']['gif']) && is_array($config['gifs']['gif'])){
if
(
!
empty
(
$confif
))
{
interface_configure
(
$confif
);
}
system_routing_configure
(
$ifname
);
system_routing_configure
(
false
,
$ifname
);
}
}
}
...
...
@@ -181,8 +181,7 @@ if(isset($config['gifs']['gif']) && is_array($config['gifs']['gif'])){
* could be failing back in which case we need to switch IPs back anyhow.
*/
if
(
!
is_ipaddr
(
$oldip
)
||
$curwanip
!=
$oldip
||
!
is_ipaddrv4
(
$config
[
'interfaces'
][
$interface
][
'ipaddr'
]))
{
/* reconfigure static routes (kernel may have deleted them) */
system_routing_configure
(
$interface
);
system_routing_configure
(
false
,
$interface
);
/* reconfigure our gateway monitor */
setup_gateways_monitor
();
...
...
src/etc/rc.newwanipv6
View file @
2a45301e
...
...
@@ -111,8 +111,7 @@ link_interface_to_track6($interface, "update");
/* regenerate resolv.conf if DNS overrides are allowed */
system_resolvconf_generate
(
true
);
/* reconfigure static routes (kernel may have deleted them) */
system_routing_configure
(
$interface
);
system_routing_configure
(
false
,
$interface
);
/* reconfigure our gateway monitor */
setup_gateways_monitor
();
...
...
src/etc/rc.reload_all
View file @
2a45301e
...
...
@@ -49,7 +49,6 @@ system_timezone_configure();
system_hostname_configure
();
system_hosts_generate
();
system_resolvconf_generate
();
system_routing_enable
();
interfaces_configure
();
services_dyndns_configure
();
system_cron_configure
();
...
...
src/etc/rc.reload_interfaces
View file @
2a45301e
...
...
@@ -36,6 +36,5 @@ require_once("system.inc");
require_once
(
"interfaces.inc"
);
require_once
(
"services.inc"
);
system_routing_enable
();
interfaces_configure
();
filter_configure_sync
();
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