summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Härdeman2025-10-26 09:19:14 +0000
committerÁlvaro Fernández Rojas2025-11-06 07:24:51 +0000
commit29357349b33a171f276fb248d416ef3239dad3c3 (patch)
tree968370cb96414f58ba873eaa19e4e29b6544bc71
parentf6ba8004d699b17289f1f191af852ffaa1a78a1a (diff)
downloadodhcpd-29357349b33a171f276fb248d416ef3239dad3c3.tar.gz
odhcpd: remove the "legacy" option
LuCI has already been updated so that the "dhcpv4" option is exposed in the UI and the option also gets set when the user clicks the "Set up DHCP Server" button in the "DHCP Server" tab in the interfaces view. Furthermore, there are instructions in the UI to enable the DHCPv4 server on a per-interface basis. Finally, the odhcp defaults script (in the openwrt repo) also sets the dhcpv4 option, as necessary. People who don't use LuCI but prefer the cmdline should presumably be able to figure out that the dhcpv4 option needs to be set (if it isn't already), so remove the "legacy" option. This supersedes this PR: https://github.com/openwrt/odhcpd/pull/275 Note that the "maindhcp" option is used by both dnsmasq and odhcpd to control which of them handles DHCPv4, and is now exposed in the LuCI UI as well, so it cannot be removed. Signed-off-by: David Härdeman <david@hardeman.nu> Link: https://github.com/openwrt/odhcpd/pull/294 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
-rw-r--r--README.md1
-rw-r--r--src/config.c17
2 files changed, 3 insertions, 15 deletions
diff --git a/README.md b/README.md
index 48ec641..7f3d347 100644
--- a/README.md
+++ b/README.md
@@ -61,7 +61,6 @@ and may also receive information from ubus
| Option | Type |Default| Description |
| :------------ | :---- | :---- | :---------- |
-| legacy | bool | 0 | Enable DHCPv4 if start but no dhcpv4 option set |
| maindhcp | bool | 0 | Use odhcpd as the main DHCPv4 service |
| leasefile | string| | DHCP/v6 lease/hostfile |
| leasetrigger | string| | Lease trigger script |
diff --git a/src/config.c b/src/config.c
index 4bf8b2a..1821b52 100644
--- a/src/config.c
+++ b/src/config.c
@@ -35,7 +35,6 @@ struct vlist_tree lease_cfgs = VLIST_TREE_INIT(lease_cfgs, lease_cfg_cmp,
AVL_TREE(interfaces, avl_strcmp, false, NULL);
struct config config = {
- .legacy = false,
.enable_tz = true,
.main_dhcpv4 = false,
.dhcp_cb = NULL,
@@ -206,7 +205,6 @@ const struct uci_blob_param_list lease_cfg_attr_list = {
};
enum {
- ODHCPD_ATTR_LEGACY,
ODHCPD_ATTR_MAINDHCP,
ODHCPD_ATTR_LEASEFILE,
ODHCPD_ATTR_LEASETRIGGER,
@@ -218,7 +216,6 @@ enum {
};
static const struct blobmsg_policy odhcpd_attrs[ODHCPD_ATTR_MAX] = {
- [ODHCPD_ATTR_LEGACY] = { .name = "legacy", .type = BLOBMSG_TYPE_BOOL },
[ODHCPD_ATTR_MAINDHCP] = { .name = "maindhcp", .type = BLOBMSG_TYPE_BOOL },
[ODHCPD_ATTR_LEASEFILE] = { .name = "leasefile", .type = BLOBMSG_TYPE_STRING },
[ODHCPD_ATTR_LEASETRIGGER] = { .name = "leasetrigger", .type = BLOBMSG_TYPE_STRING },
@@ -446,9 +443,6 @@ static void set_config(struct uci_section *s)
uci_to_blob(&b, s, &odhcpd_attr_list);
blobmsg_parse(odhcpd_attrs, ODHCPD_ATTR_MAX, tb, blob_data(b.head), blob_len(b.head));
- if ((c = tb[ODHCPD_ATTR_LEGACY]))
- config.legacy = blobmsg_get_bool(c);
-
if ((c = tb[ODHCPD_ATTR_MAINDHCP]))
config.main_dhcpv4 = blobmsg_get_bool(c);
@@ -1196,9 +1190,6 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
iface->dhcpv4_start.s_addr = htonl(blobmsg_get_u32(c));
iface->dhcpv4_end.s_addr = htonl(ntohl(iface->dhcpv4_start.s_addr) +
LIMIT_DEFAULT - 1);
-
- if (config.main_dhcpv4 && config.legacy)
- iface->dhcpv4 = MODE_SERVER;
}
if ((c = tb[IFACE_ATTR_LIMIT]))
@@ -1239,12 +1230,10 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
if ((c = tb[IFACE_ATTR_DHCPV4])) {
if ((mode = parse_mode(blobmsg_get_string(c))) >= 0) {
- if (config.main_dhcpv4) {
- iface->dhcpv4 = mode;
+ iface->dhcpv4 = config.main_dhcpv4 ? mode : MODE_DISABLED;
- if (iface->dhcpv4 != MODE_DISABLED)
- iface->ignore = false;
- }
+ if (iface->dhcpv4 != MODE_DISABLED)
+ iface->ignore = false;
} else
error("Invalid %s mode configured for interface %s",
iface_attrs[IFACE_ATTR_DHCPV4].name, iface->name);