!26 Handle DHCPREBIND requests in the DHCPv6 server
From: @seuzw Reviewed-by: @wangxp006 Signed-off-by: @wangxp006
This commit is contained in:
commit
a91f6c4d3c
114
backport-Handle-DHCPREBIND-requests-in-the-DHCPv6-server.patch
Normal file
114
backport-Handle-DHCPREBIND-requests-in-the-DHCPv6-server.patch
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
From d55e2d086d1ff30c427fa5e0ecc79746de8a81b7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Simon Kelley <simon@thekelleys.org.uk>
|
||||||
|
Date: Fri, 9 Apr 2021 15:19:28 +0100
|
||||||
|
Subject: [PATCH] Handle DHCPREBIND requests in the DHCPv6 server.
|
||||||
|
|
||||||
|
Patch by srk, based on submitted patch from liaichun@huawei.com
|
||||||
|
---
|
||||||
|
src/rfc3315.c | 60 +++++++++++++++++++++++++++++++++++----------------
|
||||||
|
1 files changed, 42 insertions(+), 18 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/rfc3315.c b/src/rfc3315.c
|
||||||
|
index 982c68a..5c2ff97 100644
|
||||||
|
--- a/src/rfc3315.c
|
||||||
|
+++ b/src/rfc3315.c
|
||||||
|
@@ -919,11 +919,14 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||||
|
|
||||||
|
|
||||||
|
case DHCP6RENEW:
|
||||||
|
+ case DHCP6REBIND:
|
||||||
|
{
|
||||||
|
+ int address_assigned = 0;
|
||||||
|
+
|
||||||
|
/* set reply message type */
|
||||||
|
*outmsgtypep = DHCP6REPLY;
|
||||||
|
|
||||||
|
- log6_quiet(state, "DHCPRENEW", NULL, NULL);
|
||||||
|
+ log6_quiet(state, msg_type == DHCP6RENEW ? "DHCPRENEW" : "DHCPREBIND", NULL, NULL);
|
||||||
|
|
||||||
|
for (opt = state->packet_options; opt; opt = opt6_next(opt, state->end))
|
||||||
|
{
|
||||||
|
@@ -952,24 +955,35 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||||
|
state->ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA,
|
||||||
|
state->iaid, &req_addr)))
|
||||||
|
{
|
||||||
|
- /* If the server cannot find a client entry for the IA the server
|
||||||
|
- returns the IA containing no addresses with a Status Code option set
|
||||||
|
- to NoBinding in the Reply message. */
|
||||||
|
- save_counter(iacntr);
|
||||||
|
- t1cntr = 0;
|
||||||
|
-
|
||||||
|
- log6_packet(state, "DHCPREPLY", &req_addr, _("lease not found"));
|
||||||
|
-
|
||||||
|
- o1 = new_opt6(OPTION6_STATUS_CODE);
|
||||||
|
- put_opt6_short(DHCP6NOBINDING);
|
||||||
|
- put_opt6_string(_("no binding found"));
|
||||||
|
- end_opt6(o1);
|
||||||
|
-
|
||||||
|
- preferred_time = valid_time = 0;
|
||||||
|
- break;
|
||||||
|
+ if (msg_type == DHCP6REBIND)
|
||||||
|
+ {
|
||||||
|
+ /* When rebinding, we can create a lease if it doesn't exist. */
|
||||||
|
+ lease = lease6_allocate(&req_addr, state->ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA);
|
||||||
|
+ if (lease)
|
||||||
|
+ lease_set_iaid(lease, state->iaid);
|
||||||
|
+ else
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ /* If the server cannot find a client entry for the IA the server
|
||||||
|
+ returns the IA containing no addresses with a Status Code option set
|
||||||
|
+ to NoBinding in the Reply message. */
|
||||||
|
+ save_counter(iacntr);
|
||||||
|
+ t1cntr = 0;
|
||||||
|
+
|
||||||
|
+ log6_packet(state, "DHCPREPLY", &req_addr, _("lease not found"));
|
||||||
|
+
|
||||||
|
+ o1 = new_opt6(OPTION6_STATUS_CODE);
|
||||||
|
+ put_opt6_short(DHCP6NOBINDING);
|
||||||
|
+ put_opt6_string(_("no binding found"));
|
||||||
|
+ end_opt6(o1);
|
||||||
|
+
|
||||||
|
+ preferred_time = valid_time = 0;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
-
|
||||||
|
if ((this_context = address6_available(state->context, &req_addr, tagif, 1)) ||
|
||||||
|
(this_context = address6_valid(state->context, &req_addr, tagif, 1)))
|
||||||
|
{
|
||||||
|
@@ -1000,6 +1014,8 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||||
|
|
||||||
|
if (preferred_time == 0)
|
||||||
|
message = _("deprecated");
|
||||||
|
+
|
||||||
|
+ address_assigned = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@@ -1022,10 +1038,18 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||||
|
end_ia(t1cntr, min_time, 1);
|
||||||
|
end_opt6(o);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ if (!address_assigned && msg_type == DHCP6REBIND)
|
||||||
|
+ {
|
||||||
|
+ /* can't create lease for any address, return error */
|
||||||
|
+ o1 = new_opt6(OPTION6_STATUS_CODE);
|
||||||
|
+ put_opt6_short(DHCP6NOADDRS);
|
||||||
|
+ put_opt6_string(_("no addresses available"));
|
||||||
|
+ end_opt6(o1);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
tagif = add_options(state, 0);
|
||||||
|
break;
|
||||||
|
-
|
||||||
|
}
|
||||||
|
|
||||||
|
case DHCP6CONFIRM:
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: dnsmasq
|
Name: dnsmasq
|
||||||
Version: 2.82
|
Version: 2.82
|
||||||
Release: 5
|
Release: 6
|
||||||
Summary: Dnsmasq provides network infrastructure for small networks
|
Summary: Dnsmasq provides network infrastructure for small networks
|
||||||
License: GPLv2 or GPLv3
|
License: GPLv2 or GPLv3
|
||||||
URL: http://www.thekelleys.org.uk/dnsmasq/
|
URL: http://www.thekelleys.org.uk/dnsmasq/
|
||||||
@ -21,6 +21,7 @@ Patch10: backport-CVE-2020-25686_2.patch
|
|||||||
Patch11: backport-fix-regression-in-s_config_in_context-method.patch
|
Patch11: backport-fix-regression-in-s_config_in_context-method.patch
|
||||||
Patch12: backport-Add-missing-check-for-NULL-return-from-allocate_rfd.patch
|
Patch12: backport-Add-missing-check-for-NULL-return-from-allocate_rfd.patch
|
||||||
Patch13: backport-Fix-DNS-reply-when-asking-for-DNSSEC-and-a-validated.patch
|
Patch13: backport-Fix-DNS-reply-when-asking-for-DNSSEC-and-a-validated.patch
|
||||||
|
Patch14: backport-Handle-DHCPREBIND-requests-in-the-DHCPv6-server.patch
|
||||||
|
|
||||||
BuildRequires: dbus-devel pkgconfig libidn2-devel nettle-devel systemd
|
BuildRequires: dbus-devel pkgconfig libidn2-devel nettle-devel systemd
|
||||||
Requires: nettle >= 3.4
|
Requires: nettle >= 3.4
|
||||||
@ -113,6 +114,12 @@ install -Dpm644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysusersdir}/dnsmasq.conf
|
|||||||
%{_mandir}/man8/dnsmasq*
|
%{_mandir}/man8/dnsmasq*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Apr 12 2021 seuzw <930zhaowei@163.com> - 2.82-6
|
||||||
|
- Type:requirement
|
||||||
|
- Id:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:Handle DHCPREBIND requests in the DHCPv6 server
|
||||||
|
|
||||||
* Thu Feb 25 2021 zengwefeng <zwfeng@huawei.com> - 2.82-5
|
* Thu Feb 25 2021 zengwefeng <zwfeng@huawei.com> - 2.82-5
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- Id:NA
|
- Id:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user