Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(linux.net): DHCP server selection method #5578

Merged
merged 13 commits into from
Nov 25, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public class DnsmasqTool implements DhcpLinuxTool {
private String globalConfigFilename = "/etc/dnsmasq.d/dnsmasq-globals.conf";
private static final String GLOBAL_CONFIGURATION = "port=0\nbind-dynamic\n";

static final Command IS_ACTIVE_COMMAND = new Command(new String[] { "systemctl", "is-active", "--quiet",
DhcpServerTool.DNSMASQ.getValue() });
static final Command RESTART_COMMAND = new Command(new String[] { "systemctl", "restart",
DhcpServerTool.DNSMASQ.getValue() });
static final Command IS_ACTIVE_COMMAND = new Command(
new String[] { "systemctl", "is-active", "--quiet", DhcpServerTool.DNSMASQ.getValue() });
static final Command RESTART_COMMAND = new Command(
new String[] { "systemctl", "restart", DhcpServerTool.DNSMASQ.getValue() });

private CommandExecutorService executorService;
private Map<String, byte[]> configsLastHash = Collections.synchronizedMap(new HashMap<>());
Expand Down Expand Up @@ -88,6 +88,7 @@ public CommandStatus startInterface(String interfaceName) throws KuraProcessExec
CommandStatus restartStatus = this.executorService.execute(RESTART_COMMAND);

if (!restartStatus.getExitStatus().isSuccessful()) {
logger.error("dnsmasq Systemd unit startup failed. Is dnsmasq package installed on the system?");
marcellorinaldo marked this conversation as resolved.
Show resolved Hide resolved
removeInterfaceConfig(interfaceName);
restartStatus = this.executorService.execute(RESTART_COMMAND);
}
Expand Down