Commit 9a5d36ae authored by Franco Fichtner's avatar Franco Fichtner

dhcprelay: port to #1256

(cherry picked from commit 203732a9)
parent 42290252
...@@ -1353,24 +1353,23 @@ EOD; ...@@ -1353,24 +1353,23 @@ EOD;
return 0; return 0;
} }
function services_dhcrelay_configure() function services_dhcrelay_configure($verbose = false)
{ {
global $config; global $config;
$dhcrelayifs = array(); $dhcrelayifs = array();
/* kill any running dhcrelay */ killbypid('/var/run/dhcrelay.pid', 'TERM', true);
killbypid('/var/run/dhcrelay.pid');
$dhcrelaycfg =& $config['dhcrelay']; $dhcrelaycfg = &$config['dhcrelay'];
/* DHCPRelay enabled on any interfaces? */ if (!isset($dhcrelaycfg['enable'])) {
if (!isset($dhcrelaycfg['enable'])) return;
return 0; }
if (file_exists("/var/run/booting")) { if ($verbose) {
echo gettext("Starting DHCP relay service..."); echo 'Starting DHCP Relay...';
} else { flush();
sleep(1);
} }
$iflist = get_configured_interface_list(); $iflist = get_configured_interface_list();
...@@ -1459,7 +1458,7 @@ function services_dhcrelay_configure() ...@@ -1459,7 +1458,7 @@ function services_dhcrelay_configure()
/* fire up dhcrelay */ /* fire up dhcrelay */
if (empty($dhcrelayifs)) { if (empty($dhcrelayifs)) {
log_error("No suitable interface found for running dhcrelay!"); log_error("No suitable interface found for running dhcrelay!");
return; /* XXX */ return;
} }
$cmd = "/usr/local/sbin/dhcrelay -i " . implode(" -i ", $dhcrelayifs); $cmd = "/usr/local/sbin/dhcrelay -i " . implode(" -i ", $dhcrelayifs);
...@@ -1472,28 +1471,28 @@ function services_dhcrelay_configure() ...@@ -1472,28 +1471,28 @@ function services_dhcrelay_configure()
mwexec($cmd); mwexec($cmd);
unset($cmd); unset($cmd);
return 0; if ($verbose) {
echo "done\n";
}
} }
function services_dhcrelay6_configure() function services_dhcrelay6_configure($verbose = false)
{ {
global $config; global $config;
$dhcrelayifs = array(); $dhcrelayifs = array();
/* kill any running dhcrelay */ killbypid('/var/run/dhcrelay6.pid', 'TERM', true);
killbypid('/var/run/dhcrelay6.pid');
$dhcrelaycfg =& $config['dhcrelay6']; $dhcrelaycfg = &$config['dhcrelay6'];
/* DHCPv6 Relay enabled on any interfaces? */
if (!isset($dhcrelaycfg['enable'])) { if (!isset($dhcrelaycfg['enable'])) {
return 0; return;
} }
if (file_exists("/var/run/booting")) { if ($verbose) {
echo gettext("Starting DHCPv6 relay service..."); echo 'Starting DHCPv6 Relay...';
} else { flush();
sleep(1);
} }
$iflist = get_configured_interface_list(); $iflist = get_configured_interface_list();
...@@ -1578,7 +1577,7 @@ function services_dhcrelay6_configure() ...@@ -1578,7 +1577,7 @@ function services_dhcrelay6_configure()
/* fire up dhcrelay */ /* fire up dhcrelay */
if (empty($dhcrelayifs) || empty($srvifaces) ) { if (empty($dhcrelayifs) || empty($srvifaces) ) {
log_error("No suitable interface found for running dhcrelay -6!"); log_error("No suitable interface found for running dhcrelay -6!");
return; /* XXX */ return;
} }
$cmd = '/usr/local/sbin/dhcrelay -6 -pf /var/run/dhcrelay6.pid'; $cmd = '/usr/local/sbin/dhcrelay -6 -pf /var/run/dhcrelay6.pid';
...@@ -1591,7 +1590,9 @@ function services_dhcrelay6_configure() ...@@ -1591,7 +1590,9 @@ function services_dhcrelay6_configure()
mwexec($cmd); mwexec($cmd);
unset($cmd); unset($cmd);
return 0; if ($verbose) {
echo "done\n";
}
} }
function services_dyndns_list() function services_dyndns_list()
......
...@@ -184,17 +184,10 @@ services_dnsmasq_configure(true); ...@@ -184,17 +184,10 @@ services_dnsmasq_configure(true);
/* start unbound service */ /* start unbound service */
services_unbound_configure(true); services_unbound_configure(true);
/* start DHCP service */
services_dhcpd_configure(); services_dhcpd_configure();
/* start dhcpleases dhpcp hosts leases program */
services_dhcpleases_configure(); services_dhcpleases_configure();
services_dhcrelay_configure(true);
/* start DHCP relay */ services_dhcrelay6_configure(true);
services_dhcrelay_configure();
/* start DHCP6 relay */
services_dhcrelay6_configure();
/* dyndns service updates */ /* dyndns service updates */
mwexec("/usr/local/etc/rc.dyndns.update"); mwexec("/usr/local/etc/rc.dyndns.update");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment