2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-28 12:37:55 +00:00

282 Commits

Author SHA1 Message Date
Thomas Markwalder
16d2eaa574 [#402,!224] kea-dhcp4 now merges global values from config backend
src/bin/dhcp4/json_config_parser.*
    Moved global merge logic into SrvConfig

src/lib/dhcpsrv/srv_config.*
    SrvConfig::merge(const ConfigBase& other) - now calls protocol
    specific merge methods

    SrvConfig::merge4() - new method for v4 merges
    SrvConfig::mergeGlobals4() - new method for merging v4 globals

src/lib/dhcpsrv/tests/srv_config_unittest.cc
    TEST_F(SrvConfigTest, mergeGlobals4) - new test
2019-02-20 11:22:49 -05:00
Marcin Siodelski
edd745c507 [#429,!217] Dropped "Signed" in StampedValue::getSignedInteger 2019-01-31 21:30:46 +01:00
Marcin Siodelski
3179f30318 [#429,!217] Removed StampedValue::toElement. 2019-01-31 21:00:16 +01:00
Thomas Markwalder
7b634d9f36 [#101,!202] Added log messages and more unit tests
src/bin/dhcp4/tests/config_backend_unittest.cc
    Added DISABLED tests for option definitions and options.

src/bin/dhcp4/dhcp4_messages.mes
src/bin/dhcp4/json_config_parser.cc
    Added two log messages
2019-01-25 08:34:11 -05:00
Thomas Markwalder
dc74694de3 [#101,!202] Interrim commit - v4 fetch and merge functional
Server fetches config, populates external SrvConfig and invokes
merge. libdhcpsrv still lacks merging of globals,opt defs,options,
and shared networks.

src/bin/dhcp4/json_config_parser.*
    configureDhcp4Server() - restored call to databaseConfigFetch()
    databaseConfigFetch(const SrvConfigPtr& srv_cfg) - completed
    implementation, now fetches external config and invokes merge

    addGlobalsToConfig()
    handleExplicitGlobal()
    handleImplicitGlobal() - new functions for populating external
    config globals with backend globals

src/bin/dhcp4/tests
    config_backend_unittest.cc - new file that tests config fetch and merge

src/lib/cc/stamped_value.*
    StampedValue::toElement(Element::types elem_type) - new method for
    creating Elements from StampedValues

src/lib/cc/tests/stamped_value_unittest.cc
    TEST(StampedValueTest, toElement) - new test

src/lib/dhcpsrv/testutils/test_config_backend.h
    TestConfigBackend() - fixed host_ assignment
2019-01-24 10:16:19 -05:00
Francis Dupont
4fc9105e2f [365-automatically-calculate-the-values-for-options-58-and-59] Removed extra traling spaces 2019-01-10 15:31:21 +01:00
Thomas Markwalder
9a7cd6e027 [#365,!194] kea-dhcp4 can be configured to calculate T1 and T2
doc/guide/dhcp4-srv.xml
    Updated user guide with new parameters and details on rules

src/lib/cc/data.cc
    DoubleElement::toJSON(std::ostream& ss) - modified to ensure whole number
     values are suffixed with ".0"

src/lib/utils/doubles.h - new file
   provides a function for equating doubles within a given tolerance

src/lib/cc/simple_parser.*
    SimpleParser::getDouble() - new method for fetching real number
    parameters as DoulbeElements

src/lib/dhcpsrv/network.*
    Added members and support for new paramters to Network4:
        calculate_tee_times_, t1_percent_, t2_percent_

src/lib/dhcpsrv/parsers/dhcp_parsers.cc
src/lib/dhcpsrv/parsers/simple_parser4.cc
    Added support for new parameters to Subnet4ConfigParser

src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_parser.yy
src/bin/dhcp4/json_config_parser.cc
    Added parser support for calculate-tee-times, t1-percent, and t2-percent

src/bin/dhcp4/dhcp4_srv.*
    Dhcpv4Srv::setTeeTimes(lease, subnet, resp) - new method for
    determining T1 adn T2 values
2019-01-09 11:14:01 -05:00
Thomas Markwalder
bbb822b115 [#260,!20] Packet queueing is now optional
src/bin/dhcp<4/6>/ctrl_dhcp<4/6>_srv.cc
    ControlledDhcpv<4/6>Srv::processConfig() - now calls
        IfaceMgr::configureDHCPPacketQueue

src/bin/dhcp<4/6>/dhcp<4/6>_parser.yy
    dhpc-queue-control parsing updated to enforce
    enable-queue/queue-type rules

src/bin/dhcp<4/6>/tests/config_parser_unittest.cc
    TEST_F(Dhcp<4/6>ParserTest, dhcpQueueControl)
    TEST_F(Dhcp<4/6>ParserTest, dhcpQueueControlInvalid)

src/lib/dhcp/iface_mgr.*
    IfaceMgr
    - closeSockets()  - now calls stopDHCPReceiver

    - openSockets<4/6>() -  now calls startDHCPReceiver

    - receive<4/6>Indirect() - new function which monitors receiver
    thread watch sockets, reads DHCP packets from queue

    - receive<4/6>Direct() - new function which monitors and reads DHCP
    packets from interface sockets directly

    - receive<4/6>() - rewritten to call receive<4/6>Indirect
    if receiver thread is running, otherwise it calls receive<4/6>Direct

    - configureDHCPPacketQueue() - new function which either enables queuing
    by creating a new packet queue, or disables it by destroying the
    existing queue

src/lib/dhcp/packet_queue_mgr.h
    PacketQueue::destroyPacketQueue() - new function

src/lib/dhcp/packet_queue_mgr<4/6>.cc
    PacketQueueMgr<4/6>::PacketQueueMgr<4/6>() - no longer creates a
    default packet queue

src/lib/dhcpsrv/cfg_iface.cc
    CfgIface::closeSockets() - removed call to stopDHCPReceiver
    CfgIface::openSockets() - removed call to startDHCPReceiver

src/lib/dhcpsrv/parsers/dhcp_queue_control_parser.*
    DHCPQueueControlParser
    - removed unused family_ member
    - parse() - added support for enable-queue

src/lib/dhcpsrv/tests/dhcp_queue_control_parser_unittest.cc
    - new file
2018-11-20 13:14:28 -05:00
Francis Dupont
fae9245a36 [268-reservation-mode-is-not-global] Updated code for global reservation mode 2018-11-20 19:00:41 +01:00
Thomas Markwalder
09d5ffebc8 [master] Adds initial congestion handling
Merge branch '42-congestion-handler-exp-1'
2018-11-08 09:06:49 -05:00
Thomas Markwalder
464ea71b2b [#42,!103] Addressed majority of review comments
Most notable change is "queue-control" is now "dhcp-queue-control"
2018-11-07 18:07:34 -05:00
Francis Dupont
2f272cd336 [66-authoritative-flag-in-kea] Cleanup code, added legacy unit test 2018-11-07 23:20:22 +07:00
Sebastian Schrader
48e656682a [5184] Check shared-network setting consistency 2018-11-07 23:17:45 +07:00
Sebastian Schrader
09987b3f2d [5184] Parse authoritative flag 2018-11-07 23:17:45 +07:00
Thomas Markwalder
4dc3ba6be0 [#42] Replaced use of QueueControl with ElementPtr
deleted:
    src/lib/dhcp/queue_control.cc
	src/lib/dhcp/queue_control.h
	src/lib/dhcp/tests/queue_control_unittest.cc

Updates is mulitple files
2018-11-05 15:29:01 -05:00
Thomas Markwalder
036d249fd1 [#42, !103] Interrim commit, kea-dhcp4 supports "queue-control"
kea-dhcp4 will parse and use "queue-control" to configure ring
    buffer size:

    "Dhcp4":
    {
        "queue-control": {
            # max number of packets the ring will hold
            "capacity" : 100
        },
    :

    This is an interrim commit for testing purposes.
    Expect a fair amount of refactoring in subsequent commits.

New files:
	src/lib/dhcp/queue_control.cc
	src/lib/dhcp/queue_control.h
	src/lib/dhcp/tests/queue_control_unittest.cc
	src/lib/dhcpsrv/parsers/queue_control_parser.cc
	src/lib/dhcpsrv/parsers/queue_control_parser.h

src/bin/dhcp4/ctrl_dhcp4_srv.cc
    ControlledDhcpv4Srv::processConfig() -
        added logic to set packet queue controller

src/bin/dhcp4/dhcp4_lexer.ll b/src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_parser.yy
src/bin/dhcp4/parser_context.*
    Added queue-control parsing

src/bin/dhcp4/json_config_parser.cc
    configureDhcp4Server() - recognize and parse "queue-control"

src/bin/dhcp4/tests/config_parser_unittest.cc
    TEST_F(Dhcp4ParserTest, queueControl)
    TEST_F(Dhcp4ParserTest, queueControlInvalid)
    - new tests

src/lib/dhcp/iface_mgr.*
    IfaceMgr::getPacketQueueControl4()
    IfaceMgr::setPacketQueueControl4()
    IfaceMgr::getPacketQueueControl6()
    IfaceMgr::setPacketQueueControl6()

src/lib/dhcp/packet_queue.*
    Use QueueControl class

src/lib/dhcpsrv/srv_config.*
    Added QueueControl member, getter/setter
    SrvConfig::toElement() - now emits queue-control if not null
2018-11-01 11:19:55 -04:00
Thomas Markwalder
b6e628c91e [#101,!87] Disable config-control in kea-dhcp4 until CB work resumes 2018-10-19 09:12:25 -04:00
Thomas Markwalder
619abfd922 [#101,!73] Addressed missed review items 2018-10-17 15:51:17 -04:00
Thomas Markwalder
0be1868faa [#101, !73] Addresses review comments 2018-10-17 15:05:27 -04:00
Thomas Markwalder
210105df57 [#101,!73] kea-dhcp4 can init CB backends based on config
src/bin/dhcp4/json_config_parser.*
    databaseConfigConnect(const SrvConfigPtr& srv_cfg)
    databaseConfigFetch(const SrvConfigPtr& srv_cfg, ElementPtr /*global_scope*/)
    - new functions

    configureDhcp4Server() - modified to call databaseConfigFetch() after
    loading hook libs

src/bin/dhcp4/tests/config_parser_unittest.cc
    TEST_F(Dhcp4ParserTest, configControlInfoNoFactory) - new test
    TEST_F(Dhcp4ParserTest, configControlInfo) - modified to register
    dummy backend

src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.*
    New files that implement DHPC4 dummy backend for testing
2018-10-16 13:21:20 -04:00
Thomas Markwalder
f4b4bb9f6e [#101,!58] Implemented ConfigBackendDhcp4Mgr, mysql backend registers/unregisters
src/hooks/dhcp/mysql_cb/mysql_cb_callouts.cc
    load() - added call to register MySQL backend
    unload() - added call to unregister MySQL backend

src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.*
    MySqlConfigBackendDHCPv4::registerBackendType()
    MySqlConfigBackendDHCPv4::unregisterBackendType()
    - new static methods for registering/unregistering

src/hooks/dhcp/mysql_cb/tests/Makefile.am
    mysql_cb_dhcp4_mgr_unittest.cc  - new file

src/lib/config_backend/base_config_backend_mgr.h
    bool unregisterBackendFactory(const std::string& db_type)
    - new method to unregister factory and delete backends

src/lib/config_backend/base_config_backend_pool.h
    void delAllBackends(const std::string& db_type)
    - new method to delete all backends of a given type

/src/lib/config_backend/tests/config_backend_mgr_unittest.cc
    TEST_F(ConfigBackendMgrTest, unregister) - new test

src/lib/dhcpsrv/Makefile.am
src/lib/dhcpsrv/config_backend_dhcp4.h
src/lib/dhcpsrv/config_backend_dhcp4.cc
    New files that implement ConfigBackendDhcp4Mgr

src/lib/dhcpsrv/config_backend_pool_dhcp4.h
    Added missing public scope, removed pure virtual function

src/lib/eval/tests/Makefile.am
    Added new dependency libkea-cc
2018-10-10 14:51:59 -04:00
Thomas Markwalder
7fd4a5c044 [#32,!23] - Added server-tag global to SrvConfig and kea-dhcp4/6
src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_parser.yy
src/bin/dhcp4/json_config_parser.cc
    added server-tag

src/bin/dhcp4/tests/config_parser_unittest.cc
    TEST_F(Dhcp4ParserTest, serverTag) - new test

src/bin/dhcp6/dhcp6_lexer.ll
src/bin/dhcp6/dhcp6_parser.yy
src/bin/dhcp6/json_config_parser.cc
    added server-tag

src/bin/dhcp6/tests/config_parser_unittest.cc
    TEST_F(Dhcp6ParserTest, serverTag)

src/lib/dhcpsrv/parsers/simple_parser4.cc
src/lib/dhcpsrv/parsers/simple_parser6.cc
    Added server-tag to global defaults

src/lib/dhcpsrv/srv_config.cc
    Added server_tag_ memger to SrvConfig

src/lib/dhcpsrv/tests/srv_config_unittest.cc
    TEST_F(SrvConfigTest, serverTag)
    TEST_F(SrvConfigTest, unparseConfigControlInfo6) - new tests
2018-10-05 09:19:44 -04:00
Thomas Markwalder
8c5e6ce814 [#32,!23] dhcp4 now parses "config-control" element
src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_parser.yy
    Added parsing support for config-control and config-databases

src/bin/dhcp4/json_config_parser.cc
    configureDhcp4Server() - added handler for config-control element

src/bin/dhcp4/parser_context.*
    added CONFIG_CONTROL and CONFIG_DATABASE

src/bin/dhcp4/tests/config_parser_unittest.cc
   TEST_F(Dhcp4ParserTest, configControlInfo) - new test
2018-10-05 09:17:50 -04:00
Marcin Siodelski
cc98fc37da [#92,!13] Moved DB access parser from dhcpsrv to database library. 2018-09-03 03:31:33 -04:00
Marcin Siodelski
11f9193ef8 [#92,!13] Moved DbAccessParser to libkea-database. 2018-09-03 03:31:33 -04:00
Thomas Markwalder
f1b3b3c76d [5704] host backends and kea-dhcp4/6 support global HR storage
- Added constants for special SubnetIDs:
    SUBNET_ID_GLOBAL, SUBNET_ID_MAX, SUBNET_ID_UNUSED

- Modified code throughout to use these constants, rather than hard-coded
  values.   Note, MySQL and PostgreSQL host backends convert from NULL to
  UNUSED and back.

- kea-dhcp4/6 servers will now parse a "reservations" element at the global
  level.

src/lib/dhcpsrv/subnet_id.h
    Added constants SubnetID SUBNET_ID_GLOBAL, SUBNET_ID_MAX, SUBNET_ID_UNUSED

src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_parser.yy
src/bin/dhcp4/json_config_parser.cc
    kea-dhcp4 parsing now handles reservations as a global element

src/bin/dhcp4/tests/config_parser_unittest.cc
    TEST_F(Dhcp4ParserTest, globalReservations) - new test to
    verify global HR parsing

src/bin/dhcp4/tests/dora_unittest.cc
src/lib/dhcpsrv/cfg_hosts.cc
src/lib/dhcpsrv/host.cc
src/lib/dhcpsrv/host_mgr.cc
src/lib/dhcpsrv/mysql_host_data_source.cc
src/lib/dhcpsrv/parsers/host_reservation_parser.cc
src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc
src/lib/dhcpsrv/tests/alloc_engine_utils.cc
src/lib/dhcpsrv/tests/host_mgr_unittest.cc
src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc
src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc
src/lib/dhcpsrv/tests/host_unittest.cc
    Replaced SubnetID 0 with SUBNET_ID_UNUSED

src/lib/dhcpsrv/srv_config.cc
    SrvConfig::toElement() - added global reservations output

src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc
    TEST_F(CfgHostsTest, globalSubnetIDs)
    TEST_F(CfgHostsTest, unusedSubnetIDs) - new tests

src/lib/dhcpsrv/tests/host_unittest.cc
    Replaced SubnetID 0 with SUBNET_ID_UNUSED
    TEST_F(HostTest, toText)  - updated to verify global ID output

src/lib/dhcpsrv/tests/mysql_host_data_source_unittest.cc
    TEST_F(MySqlHostDataSourceTest, globalSubnetId4)
    TEST_F(MySqlHostDataSourceTest, globalSubnetId6) - new tests

src/lib/dhcpsrv/tests/srv_config_unittest.cc
    TEST_F(SrvConfigTest, unparseHR) - added global HRs

src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.*
    GenericHostDataSourceTest::testGlobalSubnetId4()
    GenericHostDataSourceTest::testGlobalSubnetId6()

src/bin/dhcp6/dhcp6_lexer.ll
src/bin/dhcp6/dhcp6_parser.yy
src/bin/dhcp6/json_config_parser.cc
    kea-dhcp6 now parses reservations as a global element

src/bin/dhcp6/tests/config_parser_unittest.cc
    TEST_F(Dhcp6ParserTest, globalReservations) - new test
2018-08-07 06:46:30 -04:00
Tomek Mrugalski
9e14140b26 [5682] get-config unit-test rebuilds partially automated. 2018-07-30 19:03:18 +02:00
Tomek Mrugalski
4cb3ae1902 [5682] DHCP4, DHCP6 parsers extended to support sanity-checks 2018-07-30 19:03:18 +02:00
Thomas Markwalder
ef1c0b746b [5378] kea-dhcp4/6 now keep track of their configured global params
src/bin/dhcp4/json_config_parser.cc
    configureDhcp4Server() - added extract of configured globals

src/bin/dhcp4/tests/get_config_unittest.cc
src/bin/dhcp6/tests/get_config_unittest.cc
    Updated extracted and unparsed configs.

src/bin/dhcp6/json_config_parser.cc
    configureDhcp6Server() - added extract of configured globals

src/lib/dhcpsrv/srv_config.h
src/lib/dhcpsrv/srv_config.cc
    Added storage and maintence of configured globals
    SrvConfig::toElement() - added configured globals to result

src/lib/dhcpsrv/tests/srv_config_unittest.cc
    TEST_F(SrvConfigTest, configuredGlobals) - new test
2018-06-07 15:07:06 -04:00
Tomek Mrugalski
92e83eb2c8 [5564] Changes after review:
- dumpPackets renamed to discardPackets
 - added missing comments
2018-05-16 14:42:55 +02:00
Thomas Markwalder
5b9b5e26f0 [5564] Servers dump cached and parked packets on reconfig and shutdown
src/bin/dhcp4/dhcp4_srv.*
    - dumpPackets() - new function that frees all cached and parked packets
    - Dhcpv4Srv::~Dhcpv4Srv() - added call to dumpPackets() for cleanliness

src/bin/dhcp4/json_config_parser.cc
    configureDhcp4Server() - added a call Dhcpv4Srv::dumpPackets()

src/bin/dhcp6/dhcp6_srv.*
    - dumpPackets() - new function that frees all cached and parked packets
    - Dhcpv6Srv::~Dhcpv6Srv() - added call to dumpPackets() for cleanliness

src/bin/dhcp6/json_config_parser.cc
    configureDhcp6Server() - added a call Dhcpv6Srv::dumpPackets()

src/lib/hooks/hooks_manager.h
    - clearParkingLots() - new convenience function for clearing
     all parking lots
    - clearParkingLotsInternal() - private impl of the above
2018-05-15 16:00:22 -04:00
Francis Dupont
4e05c4fa66 [master] Tomek's changes + init + deinit fixes 2018-03-27 19:22:45 +02:00
Francis Dupont
f7ee3792cd [5533a] Addressed comments 2018-03-08 02:49:19 +01:00
Francis Dupont
0b223d0364 [5531] Done 2018-02-12 06:09:55 +01:00
Francis Dupont
66fd3572c0 [5531] Checkpoint before first syntax change 2018-02-12 01:34:48 +01:00
Francis Dupont
3bad9970b2 [5351] Checkpoint: todo servers, doc, host DB -- adding control-socket 2017-12-02 16:28:34 +01:00
Francis Dupont
bc3ea9d7d1 [5351] Added global and option def 2017-11-29 08:09:49 +01:00
Francis Dupont
f8aaf42fc5 [5277] Extended server-hostname and boot-file-name (native for subnet4, else inherited) 2017-10-01 23:20:38 +02:00
Tomek Mrugalski
3e1e56f151 [5357] Addressed comments after review:
- many more parameters are now inherited from shared-network to subnet4
 - parameters now passed as const reference
 - it is no longer possible to specify echo-client-id on shared-network
   level (because it's a global parameter)
 - example config commented properly
2017-09-13 22:23:20 +02:00
Marcin Siodelski
de94f82ba0 [5357] Corrected some little typos as a result of review. 2017-09-13 14:17:37 +02:00
Tomek Mrugalski
a5abebaa0f [5357] Parser for shared-networks in DHCPv6 implemented. 2017-09-13 10:38:27 +02:00
Tomek Mrugalski
b9c54a65ae [5357] Shared-networks parser for v4 extended. 2017-09-13 00:30:32 +02:00
Marcin Siodelski
fbadec7947 [5305] Stub entry for shared-networks element in server's config added. 2017-09-04 19:25:15 +02:00
Marcin Siodelski
5e0bc0d720 [5315] Moved DHCPv4 and DHCPv6 simple parsers to libdhcpsrv. 2017-08-15 14:00:29 +02:00
Marcin Siodelski
0a61518acf [5315] Moved Subnet parsers from DHCP binaries to libdhcpsrv. 2017-08-15 14:00:29 +02:00
Josh Soref
0a53a74418 spelling: existing 2017-07-23 12:54:55 -04:00
Josh Soref
c9cc10db5d spelling: committing 2017-07-23 11:56:50 -04:00
Josh Soref
7bf5099812 spelling: aren't 2017-07-23 11:23:40 -04:00
Francis Dupont
dd19455911 [master] Finishing merge of trac3389a (re-detect interfaces) 2017-07-05 14:52:54 +02:00
Francis Dupont
9176623787 [3389a] Moved re-detect default to simple_parse[46] 2017-07-05 00:38:40 +02:00