2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-29 04:57:52 +00:00

474 Commits

Author SHA1 Message Date
Tomek Mrugalski
9079ba125e [5306] Changes after review:
- max attempts set to 0 in unit-tests (matching production code)
 - couple typos
 - new unit-test added (selectSharedNetworkByRelayAddressSubnetLevel)
 - ClientContext4 is now noncopyable
 - unused network parameter removed
2017-09-19 15:24:01 +02:00
Marcin Siodelski
521afdb269 [5306] Use match-client-id defined on shared network level. 2017-09-18 12:11:51 +02:00
Marcin Siodelski
8c0a4b5a5c [5306] Implemented getNextSubnet() including classes. 2017-09-18 10:49:49 +02:00
Marcin Siodelski
6f994e6f6e [5306] Client contexts now hold multiple hosts. 2017-09-18 10:49:49 +02:00
Marcin Siodelski
c76416e5d4 [5306] Implemented getNextSubnet() function for subnets. 2017-09-18 10:49:49 +02:00
Marcin Siodelski
c27b6b2475 [5306] Client classification for subnets added to allocation engine. 2017-09-18 10:49:49 +02:00
Marcin Siodelski
4e8ac9fcb7 [5306] Basic IPv4 shared subnets scenarios implemented in alloc engine. 2017-09-18 10:49:48 +02:00
Marcin Siodelski
46244482dc [5305] Migrated server code and tests from Subnet class to Network class. 2017-09-05 13:02:42 +02:00
Thomas Markwalder
a63885a00d [5252] Corrected lease state and assigned stat when reusing expired-reclaimed via V6 request
src/lib/dhcpsrv/alloc_engine.cc
    AllocEngine::updateLeaseData() - added logic to set lease state
    to default and increment assigned stat if the lease is expired-reclaimed

src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc
    TEST_F(AllocEngine6Test, requestReuseDeclinedLease6Stats) - new test
    to verify the behavior
2017-04-24 11:07:57 -04:00
Thomas Markwalder
fe3766aedd [5247] Corrected issues with assigned-<lease/nas/pd> stats
doc/guide/dhcp4-srv.xml
doc/guide/dhcp6-srv.xml
    Added entries for reclaimed-leases

src/lib/dhcpsrv/alloc_engine.cc

    AllocEngine::reuseExpiredLease(Lease6Ptr&...) - increment
    assigned-<nas/pds> for real allocations

    AllocEngine::extendLease6() - increment assigned-<nas/pds>
    for real allocations if the lease expired

    AllocEngine::renewLease4(const Lease4Ptr&...)
    - set lease state to STATE_DEFAULT for real allocations
    - increment assigned-leases if lease is expired or reclaimed
      for real allocations

    AllocEngine::reuseExpiredLease4(Lease4Ptr&...)
    - increment assigned-leases for real allocations

src/lib/dhcpsrv/cfg_subnets4.cc
    CfgSubnets4::removeStatistics() - added "reclaimed-leases"

src/lib/dhcpsrv/cfg_subnets6.cc
    CfgSubnets4::removeStatistics() - added "reclaimed-leases"

src/lib/dhcpsrv/lease_mgr.cc
    LeaseMgr::recountLeaseStats4()
    LeaseMgr::recountLeaseStats6()
    - added handling of "reclaimed-leases"
    - fixed name of "reclaimed-declined-addresses"

src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc
    TEST_F(AllocEngine4Test, simpleRenew4)  - new test to verify stats
    on a normal renew, non-expired
    Added EXPECT_TRUE around calls to testStatistics for invocation line numbers
    Added stat checks to several tests

src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc
    Added EXPECT_TRUE around calls to testStatistics for invocation line numbers
    Added stat checks to several tests

src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc
    Added checks of assigned stats

src/lib/dhcpsrv/tests/alloc_engine_utils.cc
    AllocEngine6Test::initSubnet() - removed artificial stat values

    NakedAllocEngine::addHost() - new method to add a host to the
    current configuration, rather than use staging/commit as the latter
2017-04-21 11:54:45 -04:00
Francis Dupont
1d94a83eab [master] Merged trac5070 (skip in lease4_select loops) 2017-02-27 13:45:49 +01:00
Francis Dupont
74f47a4afe [5070] Adjusted comments 2017-02-27 13:41:31 +01:00
Tomek Mrugalski
49228d7caa [5070] Tweaked the next step check. 2017-02-27 12:19:18 +01:00
Francis Dupont
00ff64245a [master] spelling 2017-01-23 23:49:57 +01:00
Francis Dupont
11db0a3d15 [5070] Added checks and corresponding unit tests 2017-01-21 21:34:08 +01:00
Marcin Siodelski
03defed4d8 [master] Merge branch 'trac5029' 2016-11-07 17:05:49 +01:00
Marcin Siodelski
c5d28bf76b [5029] Allocation engine allows for multiple leases w/ the same HW addr. 2016-10-31 13:03:32 +01:00
Marcin Siodelski
3e7fa856b7 [5016] Update server code and tests to properly use exclude option. 2016-10-27 20:20:25 +02:00
Marcin Siodelski
0c0ca2fde7 [5016] Merged pull request #24 from github24 and squashed it.
This change includes the code implemented by the pull request
submitter as well as Marcin's fixes/changes on top of it, but
without a review.
2016-10-26 08:25:53 +02:00
Thomas Markwalder
1a986cf434 [5007] Addressed review comments
This is solution #2:

src/lib/dhcpsrv/alloc_engine.h
src/lib/dhcpsrv/alloc_engine.cc
    AllocEngine::extendLease6() - replaced logic to set the context flags with
    simply adding the original lease to the changed_leases_ list.

    AllocEngine::updateLeaseData() - removed logic to set the context flags.

src/bin/dhcp6/dhcp6_srv.cc
    Dhcpv6Srv::createNameChangeRequests() - replaced the context flag check
    with logic which looks for candidate IA addresses in the ctx.changed_leases_
    list.  If found and the FDQN doman name has not changed, we move on to the
    next candidate.

src/bin/dhcp6/tests/fqdn_unittest.cc
    TEST_F(FqdnDhcpv6SrvTest, createNameChangeRequestsNoAddr) - removed
    testing of context flag permutations
2016-09-16 14:27:46 -04:00
Thomas Markwalder
46f4c9fdd8 [5007] Suppress DDNS updates on DHCPv6 lease renewals unless the FQDN changes
src/lib/dhcpsrv/alloc_engine.h
src/lib/dhcpsrv/alloc_engine.cc
    - AllocEngine::extendLease6()
    - AllocEngine::updateLeaseData() - logic was added to clear the context
    DNS update flags when the renewal does not alter the lease's FQDN.

src/bin/dhcp6/dhcp6_srv.h
src/bin/dhcp6/dhcp6_srv.cc
    - Dhcpv6Srv::createNameChangeRequests() - added context as second parameter,
    and modified function to return without creating NCR(s) if both update flags
    in the context are false.

src/bin/dhcp6/tests/fqdn_unittest.cc
    - TEST_F(FqdnDhcpv6SrvTest, createNameChangeRequests) - modified to verify
    combinations of context update flags

    - TEST_F(FqdnDhcpv6SrvTest, DISABLED_processTwoRequests) - renamed
    to TEST_F(FqdnDhcpv6SrvTest, processTwoRequestsDiffFqdn) and enabled.
    It had been disabled pending 3677 which has been completed.

    - TEST_F(FqdnDhcpv6SrvTest, processTwoRequestsSameFqdn)  - new test
    which verifies that client "renewing" a lease by sending a second
    request with the different FQDN generates the correct NCRs

    - TEST_F(FqdnDhcpv6SrvTest, DISABLED_processRequestRenew) - renamed
    to TEST_F(FqdnDhcpv6SrvTest, processRequestRenewDiffFqdn) and enabled.
    It had been disabled pending 3677 which has been completed.

    - TEST_F(FqdnDhcpv6SrvTest, processRequestRenewSameFqdn) - new test
    which verifies that client renewing a lease by sending a renew
    with the same FQDN does NOT generate any NCRs
2016-09-15 16:10:53 -04:00
Marcin Siodelski
9b2f0336a2 [4497] Enable copying retrieved options in callouts. 2016-07-08 07:50:19 +02:00
Francis Dupont
b239ccf360 [4321] Cosmetics changes (no real code change) 2016-07-04 13:13:59 +02:00
Marcin Siodelski
9df2012346 [4321] Do not replace allocated reserved address in the IA.
If IA contains allocated lease for which there is a reservation
the liftime of this lease is extended. Any newly reserved
lease will be assigned to a different IA, possibly replacing
dynamically allocated lease.
2016-06-17 15:32:20 +02:00
Marcin Siodelski
de5f1831ed [4321] Extended host tests for multiple IAs.
Tests now use common function to verify the server's response.
Also, improved commentary in the tests.
2016-06-16 12:32:57 +02:00
Marcin Siodelski
2e3cedb832 [4321] Added basic test for multiple v6 reservations. 2016-06-13 11:57:53 +02:00
Marcin Siodelski
fb8666ba0b [4321] Test DHCPv6 client can send multiple IAs. 2016-06-13 11:57:53 +02:00
Marcin Siodelski
17e2afb7f3 [4320] Global set of allocated addresses in the ClientContext6. 2016-06-06 15:12:29 +02:00
Marcin Siodelski
b2b8f69dfd [4320] Allocation engine updates context with allocated resources.
The new context field allocated_resources_ is now updated during
lease allocation or renewal with addresses/prefixes assigned.
2016-06-06 13:19:37 +02:00
Marcin Siodelski
1a3fe2cd3a [4320] Added container holding allocated addresses in IA context. 2016-06-06 12:11:23 +02:00
Marcin Siodelski
1d77f223f5 [4320] ClientContext6 now holds information about multiple IAs. 2016-06-04 08:20:07 +02:00
Thomas Markwalder
1d7afd1c02 [4481] Made query4 and query6 callout arguments uniformly available
The client packet is now uniformly available to all client packet driven
callouts for both v4 and v6:

Added "query4" to lease4_select and lease4_renew
    src/bin/dhcp4/dhcp4_hooks.dox
        Added query4 argument to lease4_select and lease4_renew documentation

    src/bin/dhcp4/tests/hooks_unittest.cc
        Revamped to track both query4 and response4 arguments
        TEST_F(HooksDhcpv4SrvTest, lease4RenewSimple) - modified to verify
        query4 set by lease4_renew callout

    src/lib/dhcpsrv/alloc_engine.cc
        - AllocEngine::createLease4()
        - AllocEngine::reuseExpiredLease4() - modified to add query4 to
        lease4_select callout arguments
        - AllocEngine::renewLease4() - modified to add query4 to lease4_renew
        callout arguments

    src/lib/dhcpsrv/tests/alloc_engine_hooks_unittest.cc
        HookAllocEngine4Test() - modified to track query4 argument
        TEST_F(HookAllocEngine4Test, lease4_select) - modified to verify query4
        callout argument

Added "query6" to pkt6_send and lease6_select
    src/bin/dhcp6/dhcp6_hooks.dox
        Added query6 argument to pkt6_send and lease6_select documentation

    src/bin/dhcp6/dhcp6_srv.cc
        Dhcpv6Srv::processPacket(Pkt6Ptr& query, Pkt6Ptr& rsp) - modified to
        add query6 to the pkt_send callout arguments

    src/bin/dhcp6/tests/hooks_unittest.cc
        Revamped to track both query4 and response4 arguments
        TEST_F(HooksDhcpv6SrvTest, simplePkt6Send) - modified to
        verify query6 set by pkt6_send callout

    src/lib/dhcpsrv/alloc_engine.cc
        - AllocEngine::createLease4()
        - AllocEngine::reuseExpiredLease6() - modified to add query6 to
        lease6_select callout arguments
        callout arguments

    src/lib/dhcpsrv/tests/alloc_engine_hooks_unittest.cc
        HookAllocEngine6Test() - modified to track query6 argument
        TEST_F(HookAllocEngine6Test, lease4_select) - modified to verify
        query6 argument
2016-05-11 13:12:19 -04:00
Marcin Siodelski
97f5350c04 [4303] Removed unnecessary variable initialization. 2016-04-27 17:29:49 +02:00
Marcin Siodelski
aec8c63604 [4303] Address second round of review comments.
- No additional check for HR mode in findReservations
- Additional commentary in the loop collecting host ids.
2016-04-27 15:34:33 +02:00
Marcin Siodelski
88da7d9cee [4303] Addressed remaining review comments. 2016-04-27 11:29:14 +02:00
Marcin Siodelski
9a34bbb53c [4303] Renamed CfgHostReservations to CfgHostOperations.
This change was suggested during a ticket review.
2016-04-26 17:18:45 +02:00
Marcin Siodelski
440fd061d3 [4303] Values in 'host-reservation-identifiers' used by the servers.
Both DHCPv4 and DHCPv6.
2016-04-14 14:40:55 +02:00
Marcin Siodelski
1f0f7c7d21 [4303] Servers now search for host reservations using any identifier. 2016-04-13 12:05:25 +02:00
Shawn Routhier
6f0b3a5c03 [trac4309] Fix some typos 2016-03-17 07:38:28 -07:00
Thomas Markwalder
d981c5ce84 [4309] Fixed Coverity issue 1341466e in alloc_engine.cc
src/lib/dhcpsrv/alloc_engine.cc
 - AllocEngine::reclaimExpiredLease(const Lease6Ptr& lease,
                                 const DbReclaimMode& reclaim_mode,
                                 const CalloutHandlePtr& callout_handle)

   Simplified logic for flagging a lease for removal.  Renamed "remove_tmp"
   to "remove_lease" for clarity.

 - AllocEngine::reclaimExpiredLease(const Lease4Ptr& lease,
                                 const DbReclaimMode& reclaim_mode,
                                 const CalloutHandlePtr& callout_handle)

   Simplified logic for flagging a lease for removal.  Renamed "remove_tmp"
   to "remove_lease" for clarity.
2016-03-14 15:07:35 -04:00
Marcin Siodelski
fe9dd86d20 [4236] Replaced license text in all files containing it. 2015-12-16 13:37:29 +01:00
Tomek Mrugalski
e1cd854c40 [master] Merge branch 'trac3988' (lease{4,6}_recover hooks)
# Conflicts:
#	src/lib/dhcpsrv/alloc_engine.cc
#	src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc
2015-11-30 12:36:46 +01:00
Tomek Mrugalski
1195d77278 [3988] Changes after review:
- several v4 => v6
 - simpler remove_tmp logic
 - ExpirationAllocEngine4Test constructor now cleans up hook buffers
2015-11-23 18:33:18 +01:00
Marcin Siodelski
5880e706cb [master] Merge branch 'trac3977' 2015-10-27 11:19:35 +01:00
Francis Dupont
c7b26c2e62 [master] spelling 2015-10-21 21:21:55 +02:00
Tomek Mrugalski
8d52e11cbb [3988] lease{4,6}_recover hook implemented (with unit-tests) 2015-10-21 15:51:40 +02:00
Marcin Siodelski
fd3e11d169 [3977] Improved logging in methods queueing NCRs and reclaiming leases. 2015-10-21 12:25:04 +02:00
Marcin Siodelski
5de74693c4 [3977] Name change requests are now generated when lease is reused.
This change triggered a lot of code refactoring for generating the
NameChangeRequests. Long story short is that the functions responsible
for generating NCRs from the lease information have been moved to
the libdhcpsrv where they better fit and where they may be used
by both allocation engine and the servers.
2015-10-20 14:27:22 +02:00
Marcin Siodelski
3bd8891c0b [master] Merge branch 'trac3975' 2015-10-15 08:45:58 +02:00
Marcin Siodelski
ee0daa0fd8 [3975] Addressed review comments. 2015-10-14 19:28:04 +02:00