File containing the definition of dnsmasq service configuration utilities.
More...
Go to the source code of this file.
File containing the definition of dnsmasq service configuration utilities.
- Author
- Alexandru Mereacre
- Date
- 2021
- Copyright
- SPDX-FileCopyrightText: © 2021 NQMCyber Ltd and edgesec contributors SPDX-License-Identifier: LGPL-3.0-or-later
◆ clear_dhcp_lease_entry()
int clear_dhcp_lease_entry |
( |
char * |
mac_addr, |
|
|
char * |
dhcp_leasefile_path |
|
) |
| |
Clear the DHCP lease entry for a MAC addrress.
- Parameters
-
mac_addr | The MAC address string |
dhcp_leasefile_path | The DHCP file path |
- Returns
- int 0 on success, -1 on failure
◆ define_dhcp_interface_name()
int define_dhcp_interface_name |
( |
const struct dhcp_conf * |
dconf, |
|
|
uint16_t |
vlanid, |
|
|
char * |
ifname |
|
) |
| |
Creates the DHCP interface name for the given vlan id.
- Parameters
-
| dconf | The dhcp configuration structure. |
| vlanid | The vlan id. |
[out] | ifname | The DHCP interface name. |
- Precondition
vlanid
must be less than 4095 chars
-
ifname
must point to at least #IF_NAMESIZE bytes.
- Return values
-
0 | Success |
-1 | Error (invalid args) |
◆ generate_dnsmasq_conf()
int generate_dnsmasq_conf |
( |
struct dhcp_conf * |
dconf, |
|
|
UT_array * |
dns_server_array |
|
) |
| |
Generates the dnsmasq configuration file.
- Parameters
-
dconf | The dhcp configuration structure. |
dns_server_array | The array including the DNS servers IP addresses. |
- Returns
0
on success, -1
otherwise
◆ generate_dnsmasq_script()
int generate_dnsmasq_script |
( |
char * |
dhcp_script_path, |
|
|
char * |
supervisor_control_path |
|
) |
| |
Generates the dnsmasq executable script for DHCP requests.
- Parameters
-
dhcp_script_path | The dhcp executable script path string. |
supervisor_control_path | The UNIX domains supervisor control path. |
- Returns
- 0 on success, -1 otherwise
◆ kill_dhcp_process()
bool kill_dhcp_process |
( |
void |
| ) |
|
Terminate the DHCP server.
- Returns
- bool true on success, false otherwise
◆ run_dhcp_process()
char* run_dhcp_process |
( |
const char * |
dhcp_bin_path, |
|
|
const char * |
dhcp_conf_path |
|
) |
| |
Execute the DHCP server.
This function returns a pointer to statically allocated memory, which may be overwritten by subsequent calls.
- Parameters
-
dhcp_bin_path | The DHCP server binary path |
dhcp_conf_path | The DHCP server config path |
- Returns
- The pointer to the statically allocated process name, NULL on failure. Do not pass this pointer to
free()
◆ signal_dhcp_process()
int signal_dhcp_process |
( |
const char * |
dhcp_bin_path | ) |
|
Signal the DHCP process to reload the config.
- Parameters
-
dhcp_bin_path | The DHCP server binary path |
- Returns
- int 0 on success, -1 on failure