Commit 0b358f98 authored by Franco Fichtner's avatar Franco Fichtner

services: dhcpd6 is its own service; closes #1027

(cherry picked from commit a4bb9cd5)
parent 96d3e9ef
...@@ -412,7 +412,7 @@ function services_dhcpd_configure($family = 'all', $blacklist = array()) ...@@ -412,7 +412,7 @@ function services_dhcpd_configure($family = 'all', $blacklist = array())
} }
} }
function is_dhcp_server_enabled() function is_dhcpv4_server_enabled()
{ {
global $config; global $config;
...@@ -439,7 +439,7 @@ function services_dhcpdv4_configure() ...@@ -439,7 +439,7 @@ function services_dhcpdv4_configure()
killbypid("{$g['dhcpd_chroot_path']}/var/run/dhcpd.pid"); killbypid("{$g['dhcpd_chroot_path']}/var/run/dhcpd.pid");
/* DHCP enabled on any interfaces? */ /* DHCP enabled on any interfaces? */
if (!is_dhcp_server_enabled()) { if (!is_dhcpv4_server_enabled()) {
return 0; return 0;
} }
...@@ -2555,16 +2555,26 @@ function services_get() ...@@ -2555,16 +2555,26 @@ function services_get()
$services[] = $pconfig; $services[] = $pconfig;
} }
if (is_dhcp_server_enabled()) { if (is_dhcpv4_server_enabled()) {
$pconfig = array(); $pconfig = array();
$pconfig['name'] = "dhcpd"; $pconfig['name'] = 'dhcpd';
$pconfig['description'] = gettext("DHCP Service"); $pconfig['description'] = gettext("DHCP Server");
$pconfig['php']['restart'] = array('services_dhcpd_configure'); $pconfig['php']['restart'] = array('services_dhcpdv4_configure');
$pconfig['php']['start'] = array('services_dhcpd_configure'); $pconfig['php']['start'] = array('services_dhcpdv4_configure');
$pconfig['pidfile'] = "{$g['dhcpd_chroot_path']}/var/run/dhcpd.pid"; $pconfig['pidfile'] = "{$g['dhcpd_chroot_path']}/var/run/dhcpd.pid";
$services[] = $pconfig; $services[] = $pconfig;
} }
if (is_dhcpv6_server_enabled()) {
$pconfig = array();
$pconfig['name'] = 'dhcpd6';
$pconfig['description'] = gettext("DHCPv6 Server");
$pconfig['php']['restart'] = array('services_dhcpdv6_configure');
$pconfig['php']['start'] = array('services_dhcpdv6_configure');
$pconfig['pidfile'] = "{$g['dhcpd_chroot_path']}/var/run/dhcpdv6.pid";
$services[] = $pconfig;
}
if (is_apinger_enabled()) { if (is_apinger_enabled()) {
$pconfig = array(); $pconfig = array();
$pconfig['name'] = "apinger"; $pconfig['name'] = "apinger";
......
...@@ -345,8 +345,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -345,8 +345,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
$service_hook = 'dhcpd'; $service_hook = 'dhcpd6';
legacy_html_escape_form_data($pconfig); legacy_html_escape_form_data($pconfig);
include("head.inc"); include("head.inc");
?> ?>
......
...@@ -108,11 +108,11 @@ include("head.inc"); ...@@ -108,11 +108,11 @@ include("head.inc");
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<section class="col-xs-12"> <section class="col-xs-12">
<?php if ($dhcpd_enabled):
print_info_box(gettext('The DHCPv6 server is currently enabled. Cannot enable the DHCPv6 relay while the DHCPv6 server is enabled on any interface.'));
else: ?>
<div class="content-box"> <div class="content-box">
<form method="post" name="iform" id="iform"> <form method="post" name="iform" id="iform">
<?php if ($dhcpd_enabled): ?>
<p><?= gettext('DHCPv6 Server is currently enabled. Cannot enable the DHCPv6 Relay service while the DHCPv6 Server is enabled on any interface.') ?></p>
<?php else: ?>
<div> <div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped opnsense_standard_table_form"> <table class="table table-striped opnsense_standard_table_form">
...@@ -179,10 +179,10 @@ include("head.inc"); ...@@ -179,10 +179,10 @@ include("head.inc");
</table> </table>
</div> </div>
</div> </div>
<?php
endif; ?>
</form> </form>
</div> </div>
<?php
endif; ?>
</section> </section>
</div> </div>
</div> </div>
......
...@@ -369,10 +369,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -369,10 +369,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
exit; exit;
} }
$service_hook = 'dhcpd'; $service_hook = 'dhcpd6';
include("head.inc"); include("head.inc");
?>
?>
<body> <body>
<script> <script>
$( document ).ready(function() { $( document ).ready(function() {
......
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