From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: ell@lists.01.org
Subject: [PATCH 13/15] dhcp-server: Rapid commit enable/disable setter
Date: Mon, 02 Aug 2021 16:04:22 +0200 [thread overview]
Message-ID: <20210802140424.170150-13-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <20210802140424.170150-1-andrew.zaborowski@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2501 bytes --]
---
ell/dhcp-server.c | 14 +++++++++++++-
ell/dhcp.h | 2 ++
ell/ell.sym | 1 +
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/ell/dhcp-server.c b/ell/dhcp-server.c
index 971bc54..f92807a 100644
--- a/ell/dhcp-server.c
+++ b/ell/dhcp-server.c
@@ -89,6 +89,7 @@ struct l_dhcp_server {
struct l_acd *acd;
bool authoritative : 1;
+ bool rapid_commit : 1;
};
#define MAC "%02x:%02x:%02x:%02x:%02x:%02x"
@@ -781,7 +782,7 @@ static void listener_event(const void *data, size_t len, void *user_data)
if (!server_id_match)
break;
- if (rapid_commit_opt) {
+ if (rapid_commit_opt && server->rapid_commit) {
lease = l_dhcp_server_discover(server, requested_ip_opt,
client_id_opt,
message->chaddr);
@@ -966,6 +967,7 @@ LIB_EXPORT struct l_dhcp_server *l_dhcp_server_new(int ifindex)
server->started = false;
server->authoritative = true;
+ server->rapid_commit = true;
server->lease_seconds = DEFAULT_DHCP_LEASE_SEC;
server->max_expired = MAX_EXPIRED_LEASES;
@@ -1308,6 +1310,16 @@ LIB_EXPORT void l_dhcp_server_set_authoritative(struct l_dhcp_server *server,
server->authoritative = authoritative;
}
+LIB_EXPORT void l_dhcp_server_set_enable_rapid_commit(
+ struct l_dhcp_server *server,
+ bool enable)
+{
+ if (unlikely(!server))
+ return;
+
+ server->rapid_commit = enable;
+}
+
LIB_EXPORT struct l_dhcp_lease *l_dhcp_server_discover(
struct l_dhcp_server *server,
uint32_t requested_ip_opt,
diff --git a/ell/dhcp.h b/ell/dhcp.h
index 58deb7e..5873c90 100644
--- a/ell/dhcp.h
+++ b/ell/dhcp.h
@@ -143,6 +143,8 @@ bool l_dhcp_server_set_gateway(struct l_dhcp_server *server, const char *ip);
bool l_dhcp_server_set_dns(struct l_dhcp_server *server, char **dns);
void l_dhcp_server_set_authoritative(struct l_dhcp_server *server,
bool authoritative);
+void l_dhcp_server_set_enable_rapid_commit(struct l_dhcp_server *server,
+ bool enable);
struct l_dhcp_lease *l_dhcp_server_discover(struct l_dhcp_server *server,
uint32_t requested_ip_opt,
diff --git a/ell/ell.sym b/ell/ell.sym
index a781dea..b29d98d 100644
--- a/ell/ell.sym
+++ b/ell/ell.sym
@@ -260,6 +260,7 @@ global:
l_dhcp_server_set_gateway;
l_dhcp_server_set_dns;
l_dhcp_server_set_authoritative;
+ l_dhcp_server_set_enable_rapid_commit;
l_dhcp_server_discover;
l_dhcp_server_request;
l_dhcp_server_decline;
--
2.30.2
next prev parent reply other threads:[~2021-08-02 14:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-02 14:04 [PATCH 01/15] dhcp-server: Add "authoritative" mode Andrew Zaborowski
2021-08-02 14:04 ` [PATCH 02/15] dhcp-server: Handle DHCPDECLINE for active leases Andrew Zaborowski
2021-08-02 14:04 ` [PATCH 03/15] dhcp-server: Respect client's broadcast flag Andrew Zaborowski
2021-08-02 14:04 ` [PATCH 04/15] dhcp-server: Look up leases by client identifier option Andrew Zaborowski
2021-08-02 14:04 ` [PATCH 05/15] dhcp-server: Copy client identifier from the client message Andrew Zaborowski
2021-08-02 14:04 ` [PATCH 06/15] dhcp-server: Save lease mac before calling add_lease Andrew Zaborowski
2021-08-02 14:04 ` [PATCH 07/15] dhcp-server: Ensure broadcast address is not selected Andrew Zaborowski
2021-08-02 14:04 ` [PATCH 08/15] dhcp-server: Reuse leases in find_free_or_expired_ip Andrew Zaborowski
2021-08-02 14:04 ` [PATCH 09/15] dhcp-server: Refactor lease lookup Andrew Zaborowski
2021-08-02 14:04 ` [PATCH 10/15] dhcp-server: Allow reactivating expired leases Andrew Zaborowski
2021-08-02 14:04 ` [PATCH 11/15] dhcp: Support RFC4039 Rapid Commit Andrew Zaborowski
2021-08-02 14:04 ` [PATCH 12/15] dhcp-server: " Andrew Zaborowski
2021-08-02 14:04 ` Andrew Zaborowski [this message]
2021-08-02 14:04 ` [PATCH 14/15] unit: Stricter checks in unit-dhcp Andrew Zaborowski
2021-08-02 14:04 ` [PATCH 15/15] unit: Test DHCP rapid commit Andrew Zaborowski
2021-08-02 18:15 ` [PATCH 01/15] dhcp-server: Add "authoritative" mode Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210802140424.170150-13-andrew.zaborowski@intel.com \
--to=andrew.zaborowski@intel.com \
--cc=ell@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).