From 040eee1aa49b49df4698d83a05af57c220127fd1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 13:36:04 +0200 Subject: Adding upstream version 2.2.0. Signed-off-by: Daniel Baumann --- doc/sphinx/uml/appendRequestedOptions.png | Bin 0 -> 50399 bytes doc/sphinx/uml/appendRequestedOptions.svg | 41 ++++ doc/sphinx/uml/appendRequestedOptions.uml | 31 +++ doc/sphinx/uml/appendRequestedVendorOptions.png | Bin 0 -> 93787 bytes doc/sphinx/uml/appendRequestedVendorOptions.svg | 63 +++++ doc/sphinx/uml/appendRequestedVendorOptions.uml | 53 ++++ doc/sphinx/uml/assign-lease4.png | Bin 0 -> 112935 bytes doc/sphinx/uml/assign-lease4.svg | 113 +++++++++ doc/sphinx/uml/assign-lease4.uml | 64 +++++ doc/sphinx/uml/buildCfgOptionList.png | Bin 0 -> 87919 bytes doc/sphinx/uml/buildCfgOptionList.svg | 62 +++++ doc/sphinx/uml/buildCfgOptionList.uml | 52 ++++ doc/sphinx/uml/currentHost4.png | Bin 0 -> 146644 bytes doc/sphinx/uml/currentHost4.svg | 147 +++++++++++ doc/sphinx/uml/currentHost4.uml | 83 +++++++ doc/sphinx/uml/lease-states.png | Bin 0 -> 51470 bytes doc/sphinx/uml/lease-states.svg | 67 +++++ doc/sphinx/uml/lease-states.uml | 38 +++ doc/sphinx/uml/main-loop.png | Bin 0 -> 44502 bytes doc/sphinx/uml/main-loop.svg | 99 ++++++++ doc/sphinx/uml/main-loop.uml | 60 +++++ doc/sphinx/uml/packet4.png | Bin 0 -> 220586 bytes doc/sphinx/uml/packet4.svg | 160 ++++++++++++ doc/sphinx/uml/packet4.uml | 92 +++++++ doc/sphinx/uml/request4-lease.png | Bin 0 -> 278529 bytes doc/sphinx/uml/request4-lease.svg | 203 ++++++++++++++++ doc/sphinx/uml/request4-lease.uml | 118 +++++++++ doc/sphinx/uml/request4.png | Bin 0 -> 89991 bytes doc/sphinx/uml/request4.svg | 107 ++++++++ doc/sphinx/uml/request4.uml | 59 +++++ doc/sphinx/uml/requestLease4.png | Bin 0 -> 248999 bytes doc/sphinx/uml/requestLease4.svg | 310 ++++++++++++++++++++++++ doc/sphinx/uml/requestLease4.uml | 150 ++++++++++++ doc/sphinx/uml/select4.png | Bin 0 -> 179451 bytes doc/sphinx/uml/select4.svg | 157 ++++++++++++ doc/sphinx/uml/select4.uml | 85 +++++++ doc/sphinx/uml/tkey.png | Bin 0 -> 11097 bytes doc/sphinx/uml/tkey.svg | 21 ++ doc/sphinx/uml/tkey.uml | 11 + doc/sphinx/uml/update.png | Bin 0 -> 13781 bytes doc/sphinx/uml/update.svg | 21 ++ doc/sphinx/uml/update.uml | 11 + 42 files changed, 2478 insertions(+) create mode 100644 doc/sphinx/uml/appendRequestedOptions.png create mode 100644 doc/sphinx/uml/appendRequestedOptions.svg create mode 100644 doc/sphinx/uml/appendRequestedOptions.uml create mode 100644 doc/sphinx/uml/appendRequestedVendorOptions.png create mode 100644 doc/sphinx/uml/appendRequestedVendorOptions.svg create mode 100644 doc/sphinx/uml/appendRequestedVendorOptions.uml create mode 100644 doc/sphinx/uml/assign-lease4.png create mode 100644 doc/sphinx/uml/assign-lease4.svg create mode 100644 doc/sphinx/uml/assign-lease4.uml create mode 100644 doc/sphinx/uml/buildCfgOptionList.png create mode 100644 doc/sphinx/uml/buildCfgOptionList.svg create mode 100644 doc/sphinx/uml/buildCfgOptionList.uml create mode 100644 doc/sphinx/uml/currentHost4.png create mode 100644 doc/sphinx/uml/currentHost4.svg create mode 100644 doc/sphinx/uml/currentHost4.uml create mode 100644 doc/sphinx/uml/lease-states.png create mode 100644 doc/sphinx/uml/lease-states.svg create mode 100644 doc/sphinx/uml/lease-states.uml create mode 100644 doc/sphinx/uml/main-loop.png create mode 100644 doc/sphinx/uml/main-loop.svg create mode 100644 doc/sphinx/uml/main-loop.uml create mode 100644 doc/sphinx/uml/packet4.png create mode 100644 doc/sphinx/uml/packet4.svg create mode 100644 doc/sphinx/uml/packet4.uml create mode 100644 doc/sphinx/uml/request4-lease.png create mode 100644 doc/sphinx/uml/request4-lease.svg create mode 100644 doc/sphinx/uml/request4-lease.uml create mode 100644 doc/sphinx/uml/request4.png create mode 100644 doc/sphinx/uml/request4.svg create mode 100644 doc/sphinx/uml/request4.uml create mode 100644 doc/sphinx/uml/requestLease4.png create mode 100644 doc/sphinx/uml/requestLease4.svg create mode 100644 doc/sphinx/uml/requestLease4.uml create mode 100644 doc/sphinx/uml/select4.png create mode 100644 doc/sphinx/uml/select4.svg create mode 100644 doc/sphinx/uml/select4.uml create mode 100644 doc/sphinx/uml/tkey.png create mode 100644 doc/sphinx/uml/tkey.svg create mode 100644 doc/sphinx/uml/tkey.uml create mode 100644 doc/sphinx/uml/update.png create mode 100644 doc/sphinx/uml/update.svg create mode 100644 doc/sphinx/uml/update.uml (limited to 'doc/sphinx/uml') diff --git a/doc/sphinx/uml/appendRequestedOptions.png b/doc/sphinx/uml/appendRequestedOptions.png new file mode 100644 index 0000000..8b217f8 Binary files /dev/null and b/doc/sphinx/uml/appendRequestedOptions.png differ diff --git a/doc/sphinx/uml/appendRequestedOptions.svg b/doc/sphinx/uml/appendRequestedOptions.svg new file mode 100644 index 0000000..93c17ff --- /dev/null +++ b/doc/sphinx/uml/appendRequestedOptions.svg @@ -0,0 +1,41 @@ +Append requested options algorithm (Kea 1.8.0)get configured option listget parameter request list (PRL) from queryget configured options in dhcp4 spacepush back option code to PRLfor each persistent optionfor each item from configured option listget configured options in dhcp4 spaceadd option to responsefirstfoundnot found or already foundfor each item from configured option listyesoption is not set in responsenofor each code in PRL \ No newline at end of file diff --git a/doc/sphinx/uml/appendRequestedOptions.uml b/doc/sphinx/uml/appendRequestedOptions.uml new file mode 100644 index 0000000..80a21d9 --- /dev/null +++ b/doc/sphinx/uml/appendRequestedOptions.uml @@ -0,0 +1,31 @@ +@startuml + +Title Append requested options algorithm (Kea 1.8.0) + +:get configured option list; + +:get parameter request list (PRL) from query; + +while (for each item from configured option list) + :get configured options in dhcp4 space; + while (for each persistent option) + :push back option code to PRL; + endwhile +endwhile + +while (for each code in PRL) + if (option is not set in response) then (yes) + while (for each item from configured option list) + :get configured options in dhcp4 space; + if (found) then (first) + :add option to response; + else (not found or already found) + endif + endwhile + else (no) + endif +endwhile +->done; +stop + +@enduml diff --git a/doc/sphinx/uml/appendRequestedVendorOptions.png b/doc/sphinx/uml/appendRequestedVendorOptions.png new file mode 100644 index 0000000..c00fcce Binary files /dev/null and b/doc/sphinx/uml/appendRequestedVendorOptions.png differ diff --git a/doc/sphinx/uml/appendRequestedVendorOptions.svg b/doc/sphinx/uml/appendRequestedVendorOptions.svg new file mode 100644 index 0000000..2fe289a --- /dev/null +++ b/doc/sphinx/uml/appendRequestedVendorOptions.svg @@ -0,0 +1,63 @@ +Append vendor requested options algorithm (Kea 1.8.0)get vendor id from query vivso optionget vendor id from response vivso optionreturnnovendor idyesget configured option listget option request list (ORO) from query DOCSIS vendor optionget configured options in vendor id spacepush back option code to OROfor each persistent optionfor each item from configured option listcreate vivso option for vendor idnoresponse vivso optionyesadded = falseget configured options in vendor id spaceadd sub-option to vivso optionadded = truefirstfoundnot found or already foundfor each item from configured option listyessub-option is not set in vivso optionnoadd vivso option in responsenovivso option in responseyesyesaddednofor each code in ORO \ No newline at end of file diff --git a/doc/sphinx/uml/appendRequestedVendorOptions.uml b/doc/sphinx/uml/appendRequestedVendorOptions.uml new file mode 100644 index 0000000..65d3d54 --- /dev/null +++ b/doc/sphinx/uml/appendRequestedVendorOptions.uml @@ -0,0 +1,53 @@ +@startuml + +Title Append vendor requested options algorithm (Kea 1.8.0) + +:get vendor id from query vivso option; +:get vendor id from response vivso option; +if (vendor id) then (no) + :return; + stop +else (yes) +endif + +:get configured option list; + +:get option request list (ORO) from query DOCSIS vendor option; + +while (for each item from configured option list) + :get configured options in vendor id space; + while (for each persistent option) + :push back option code to ORO; + endwhile +endwhile + +if (response vivso option) then (no) + :create vivso option for vendor id; +else (yes) +endif + +:added = false; +while (for each code in ORO) + if (sub-option is not set in vivso option) then (yes) + while (for each item from configured option list) + :get configured options in vendor id space; + if (found) then (first) + :add sub-option to vivso option; + :added = true; + else (not found or already found) + endif + endwhile + else (no) + endif + if (added) then (yes) + if (vivso option in response) then (no) + :add vivso option in response; + else (yes) + endif + else (no) + endif +endwhile +->done; +stop + +@enduml diff --git a/doc/sphinx/uml/assign-lease4.png b/doc/sphinx/uml/assign-lease4.png new file mode 100644 index 0000000..29e099b Binary files /dev/null and b/doc/sphinx/uml/assign-lease4.png differ diff --git a/doc/sphinx/uml/assign-lease4.svg b/doc/sphinx/uml/assign-lease4.svg new file mode 100644 index 0000000..0a51934 --- /dev/null +++ b/doc/sphinx/uml/assign-lease4.svg @@ -0,0 +1,113 @@ +DHCPv4 Assign Lease (Kea 1.8.0)INIT-REBOOT stateLease allocatedGet existing lease by client idGet existing lease by hardware addressGet authoritativeupdate DDNSSend ACKCheck Subnetentry pointGet server idGet hintGet hardware address and client idProcess hostnameRequest leaseNo lease allocatedexit pointSend NAKexit pointNo responseexit pointno subnetuse requested address optionuse client addressno hintrequested address and no server idhas a client idno client idfoundnot foundnot authoritative and no owned leaseowned lease with hint mismatchauthoritative and no owned leaseother caseslease allocatedno lease allocated \ No newline at end of file diff --git a/doc/sphinx/uml/assign-lease4.uml b/doc/sphinx/uml/assign-lease4.uml new file mode 100644 index 0000000..de19ed7 --- /dev/null +++ b/doc/sphinx/uml/assign-lease4.uml @@ -0,0 +1,64 @@ +@startuml + +title DHCPv4 Assign Lease (Kea 1.8.0) + +agent "Check Subnet" as subnet +note left : entry point + +agent "Get server id" as server_id + +agent "Get hint" as hint + +agent "Get hardware address and client id" as ident + +rectangle "INIT-REBOOT state" as init_reboot { + agent "Get existing lease by client id" as by_client_id + + agent "Get existing lease by hardware address" as by_hw_addr + + agent "Get authoritative" as authoritative +} + +agent "Process hostname" as hostname + +agent "Request lease" as allocate + +rectangle "Lease allocated" as allocated { + agent "update DDNS" as ddns + agent "Send ACK" as ack +} + +agent "No lease allocated" as failed +note right : exit point + +agent "Send NAK" as nak +note right : exit point + +agent "No response" as no_response +note right : exit point + +subnet --> server_id +subnet ---> nak : no subnet +server_id --> hint +hint --> ident : use requested address option +hint --> ident : use client address +hint --> ident : no hint +ident --> init_reboot : requested address and no server id +ident ---> hostname +init_reboot --> by_client_id : has a client id +init_reboot --> by_hw_addr : no client id +by_client_id ---> authoritative : found +by_client_id --> by_hw_addr : not found +by_hw_addr --> authoritative +authoritative ---> no_response : not authoritative and no owned lease +authoritative --> nak : owned lease with hint mismatch +authoritative --> nak : authoritative and no owned lease +authoritative --> hostname : other cases +hostname --> allocate +allocate --> allocated : lease allocated +allocated --> ddns +ddns --> ack +allocate --> failed : no lease allocated +failed --> nak + +@enduml diff --git a/doc/sphinx/uml/buildCfgOptionList.png b/doc/sphinx/uml/buildCfgOptionList.png new file mode 100644 index 0000000..262b10e Binary files /dev/null and b/doc/sphinx/uml/buildCfgOptionList.png differ diff --git a/doc/sphinx/uml/buildCfgOptionList.svg b/doc/sphinx/uml/buildCfgOptionList.svg new file mode 100644 index 0000000..c42e8d7 --- /dev/null +++ b/doc/sphinx/uml/buildCfgOptionList.svg @@ -0,0 +1,62 @@ +buildCfgOptionList: build configured option list algorithm (Kea 1.8.0)Get (empty) configured option listreturnyesno subnetnopush back host configured optionsyescurrent host reservationnoget pool of assigned addresspush back pool configured optionsyespoolnoyesassigned addressnopush back subnet configured optionsget shared network from subnetpush back shared network configured optionsyesshared networknoget client class definition from current configurationfoundnoyeslog debug "class unconfigured"nobuilt-in client classyespush back client class definition configured optionsfor each query client classpush back global configured optionsreturn \ No newline at end of file diff --git a/doc/sphinx/uml/buildCfgOptionList.uml b/doc/sphinx/uml/buildCfgOptionList.uml new file mode 100644 index 0000000..1df19f8 --- /dev/null +++ b/doc/sphinx/uml/buildCfgOptionList.uml @@ -0,0 +1,52 @@ +@startuml + +title buildCfgOptionList: build configured option list algorithm (Kea 1.8.0) + +start +:Get (empty) configured option list; + +if (no subnet) then (yes) + :return; + stop +else (no) +endif + +if (current host reservation) then (yes) + :push back host configured options; +else (no) +endif + +if (assigned address) then (yes) + :get pool of assigned address; + if (pool) then (yes) + :push back pool configured options; + else (no) + endif +else (no) +endif + +:push back subnet configured options; + +:get shared network from subnet; +if (shared network) then (yes) + :push back shared network configured options; +else (no) +endif + +while (for each query client class) + :get client class definition from current configuration; + if (found) then (no) + if (built-in client class) then (yes) + else (no) + :log debug "class unconfigured"; + endif + else (yes) + :push back client class definition configured options; + endif +endwhile + +:push back global configured options; +:return; +stop + +@enduml diff --git a/doc/sphinx/uml/currentHost4.png b/doc/sphinx/uml/currentHost4.png new file mode 100644 index 0000000..e8aa59e Binary files /dev/null and b/doc/sphinx/uml/currentHost4.png differ diff --git a/doc/sphinx/uml/currentHost4.svg b/doc/sphinx/uml/currentHost4.svg new file mode 100644 index 0000000..1db758c --- /dev/null +++ b/doc/sphinx/uml/currentHost4.svg @@ -0,0 +1,147 @@ +currentHost DHCPv4 (Kea 1.8.0)Subnet SelectionSet subnet to the selected subnetHas client a lease for its client id?Iterate on allowed subnets for client idSet subnet to the by client id leaseHas client a matching lease?Iterate on allowed subnets for hardware addressSet subnet to the matching leaseHas an address reservation?Set subnet to address reservation subnetIs the address in an allowed pool?Iterate on allowed subnets with poolSet subnet to address pool subnetAllocate a new leaseIterate on allowed subnetsSet subnet to allocated lease subnetGet subnet host reservation modeIs subnet host reservation mode global?Get global host reservationGet subnet host reservationReturn current host reservationno client id optionmatch-client-id is false or no leasefound a leasenot found by client id, try by hardware addressno hardware addressno lease or client id mismatchfound a leasenot foundyesno or not check in the taken branchpool check is not in all branchesaddress not in an allowed pooladdress in an allowed poolno allowed poolstart from preferred (last used) subnetallocation is not in all branchesno free addressfound a free addressyesnoreturn global host reservationreturn subnet host reservationOnly the initial lookup is always performed: other occasions to change the subnet so the current host are only in some branches \ No newline at end of file diff --git a/doc/sphinx/uml/currentHost4.uml b/doc/sphinx/uml/currentHost4.uml new file mode 100644 index 0000000..1e9ef4d --- /dev/null +++ b/doc/sphinx/uml/currentHost4.uml @@ -0,0 +1,83 @@ +@startuml + +title currentHost DHCPv4 (Kea 1.8.0) + +agent "Subnet Selection" as entry + +agent "Set subnet to the selected subnet" as setSelected + +agent "Has client a lease for its client id?" as clientid_lookup + +agent "Iterate on allowed subnets for client id" as clientid_iterate + +agent "Set subnet to the by client id lease" as found_clientid + +agent "Has client a matching lease?" as hwaddr_lookup + +agent "Iterate on allowed subnets for hardware address" as hwaddr_iterate + +agent "Set subnet to the matching lease" as found_hwaddr + +agent "Has an address reservation?" as hasAddressReservation + +agent "Set subnet to address reservation subnet" as setAddressReservation + +agent "Is the address in an allowed pool?" as pool + +agent "Iterate on allowed subnets with pool" as pool_iterate + +agent "Set subnet to address pool subnet" as inAllowedPool + +agent "Allocate a new lease" as allocate + +agent "Iterate on allowed subnets" as allocate_iterate + +agent "Set subnet to allocated lease subnet" as allocated + +agent "Get subnet host reservation mode" as getHRmode + +agent "Is subnet host reservation mode global?" as checkHRmode + +agent "Get global host reservation" as global + +agent "Get subnet host reservation" as bySubnet + +agent "Return current host reservation" as return + +entry --> setSelected +setSelected --> clientid_lookup +clientid_lookup ---> hwaddr_lookup : no client id option +clientid_lookup --> clientid_iterate +clientid_iterate -> clientid_iterate : match-client-id is false or no lease +clientid_iterate --> found_clientid : found a lease +found_clientid ----> hasAddressReservation +clientid_iterate --> hwaddr_lookup : not found by client id, try by hardware address +hwaddr_lookup ---> hasAddressReservation : no hardware address +hwaddr_lookup --> hwaddr_iterate +hwaddr_iterate -> hwaddr_iterate : no lease or client id mismatch +hwaddr_iterate --> found_hwaddr : found a lease +found_hwaddr ----> hasAddressReservation +hwaddr_iterate --> hasAddressReservation : not found +hasAddressReservation --> setAddressReservation : yes +hasAddressReservation --> pool : no or not check in the taken branch +setAddressReservation --> pool +pool --> pool_iterate +pool ---> allocate : pool check is not in all branches +pool_iterate -> pool_iterate : address not in an allowed pool +pool_iterate --> inAllowedPool : address in an allowed pool +pool_iterate ---> allocate : no allowed pool +inAllowedPool --> allocate +allocate --> allocate_iterate : start from preferred (last used) subnet +allocate ---> getHRmode : allocation is not in all branches +allocate_iterate -> allocate_iterate : no free address +allocate_iterate --> allocated : found a free address +allocated --> getHRmode +getHRmode --> checkHRmode +checkHRmode --> global : yes +checkHRmode --> bySubnet : no +global --> return : return global host reservation +bySubnet --> return : return subnet host reservation + +footer Only the initial lookup is always performed: other occasions to change the subnet so the current host are only in some branches + +@enduml \ No newline at end of file diff --git a/doc/sphinx/uml/lease-states.png b/doc/sphinx/uml/lease-states.png new file mode 100644 index 0000000..76fc762 Binary files /dev/null and b/doc/sphinx/uml/lease-states.png differ diff --git a/doc/sphinx/uml/lease-states.svg b/doc/sphinx/uml/lease-states.svg new file mode 100644 index 0000000..ae70b45 --- /dev/null +++ b/doc/sphinx/uml/lease-states.svg @@ -0,0 +1,67 @@ +lease states (Kea 1.8.0)Freenot in the lease databaseAssignedAssigned expiredDeclinedDeclined expiredExpired-Reclaimedassignmentrelease queryafter valid lifetimereuserenew querydecline queryafter probation periodreusereclaimremovereuseremove \ No newline at end of file diff --git a/doc/sphinx/uml/lease-states.uml b/doc/sphinx/uml/lease-states.uml new file mode 100644 index 0000000..66de2bb --- /dev/null +++ b/doc/sphinx/uml/lease-states.uml @@ -0,0 +1,38 @@ +@startuml + +title lease states (Kea 1.8.0) + +agent "Free" as free +note left : not in the lease database + +agent "Assigned" as assigned + +agent "Assigned expired" as assigned_expired + +agent "Declined" as declined + +agent "Declined expired" as declined_expired + +agent "Expired-Reclaimed" as reclaimed + +free ---> assigned : assignment + +assigned -> assigned_expired : after valid lifetime +assigned -> assigned : renew query +assigned ---> declined : decline query +assigned -up-> free : release query + +declined --> declined_expired : after probation period + +assigned_expired -up-> assigned : reuse +declined_expired -up-> assigned : reuse + +assigned_expired ---> reclaimed : reclaim +declined_expired ---> free : remove + +reclaimed -up-> assigned : reuse +reclaimed -up--> free : remove + +declined_expired -[hidden]-> reclaimed + +@enduml diff --git a/doc/sphinx/uml/main-loop.png b/doc/sphinx/uml/main-loop.png new file mode 100644 index 0000000..8734007 Binary files /dev/null and b/doc/sphinx/uml/main-loop.png differ diff --git a/doc/sphinx/uml/main-loop.svg b/doc/sphinx/uml/main-loop.svg new file mode 100644 index 0000000..9ad33e1 --- /dev/null +++ b/doc/sphinx/uml/main-loop.svg @@ -0,0 +1,99 @@ +DHCP server main loop (Kea 1.8.0)Main LoopEvent LoopWait for next eventCheck ShutdownTimeoutSignalHandle SignalExternal SocketHandle External SocketDHCP QueryProcess QueryI/O ServiceExecute ready handlerget next eventtimeout expiredno ready handlerdashed arrow means priority \ No newline at end of file diff --git a/doc/sphinx/uml/main-loop.uml b/doc/sphinx/uml/main-loop.uml new file mode 100644 index 0000000..9e29c9f --- /dev/null +++ b/doc/sphinx/uml/main-loop.uml @@ -0,0 +1,60 @@ +@startuml + +title DHCP server main loop (Kea 1.8.0) + +skinparam linetype ortho + +rectangle "Main Loop" { + agent "Wait for next event" as run + + rectangle "Event Loop" as run_one { + together { + agent "Signal" as signal + + agent "Handle Signal" as handleSignal + } + + together { + agent "External Socket" as external_socket + + agent "Handle External Socket" as handleExternalSocket + } + + together { + agent "DHCP Query" as query + + agent "Process Query" as processQuery + } + + agent "Timeout" as timeout + } + + together { + agent "I/O Service" as poll + + agent "Execute ready handler" as ready + } + + agent "Check Shutdown" as shutdown +} + +run --> run_one : get next event +run_one --> signal +signal -right-> handleSignal : got signal +handleSignal --> poll +signal -[dashed]-> external_socket +external_socket -right-> handleExternalSocket : external socket ready +handleExternalSocket --> poll +external_socket -[dashed]-> query +query -right-> processQuery : DHCP socket ready +processQuery --> poll +query -[dashed]-> timeout +timeout --> poll : timeout expired +poll -> ready : handler ready +poll ---> shutdown : no ready handler +ready -> ready : execute ready handler +shutdown -u-> run + +footer dashed arrow means priority + +@enduml \ No newline at end of file diff --git a/doc/sphinx/uml/packet4.png b/doc/sphinx/uml/packet4.png new file mode 100644 index 0000000..6fef4e2 Binary files /dev/null and b/doc/sphinx/uml/packet4.png differ diff --git a/doc/sphinx/uml/packet4.svg b/doc/sphinx/uml/packet4.svg new file mode 100644 index 0000000..2e37ed9 --- /dev/null +++ b/doc/sphinx/uml/packet4.svg @@ -0,0 +1,160 @@ +DHCPv4 packet processing (Kea 1.8.0)Process Query on its Message TypeProcess DiscoverProcess RequestProcess ReleaseProcess DeclineProcess InformReceive queryinputService EnabledCallout buffer4_receivehookUnpack queryClassify queryCallout pkt4_receivehookCheck DROP classAvoid same client race in multi-threaded modepostpone processing or dropCallout leases4_committedhookParkCallout pkt4_sendSend responsePack responseCallout buffer4_sendoutputDrop packeterrorservice is enabledservice is disabledCONTINUESKIPDROPon errorCONTINUEDROPquery in DROP classqueries from the same client possible raceunknown message typeon erroron erroron erroron erroron errorCONTINUEDROPPARKunparkCONTINUESKIPDROPCONTINUEDROPdashed arrow means asynchronous processing diff --git a/doc/sphinx/uml/packet4.uml b/doc/sphinx/uml/packet4.uml new file mode 100644 index 0000000..15263c7 --- /dev/null +++ b/doc/sphinx/uml/packet4.uml @@ -0,0 +1,92 @@ +@startuml + +title DHCPv4 packet processing (Kea 1.8.0) + +agent "Receive query" as receivePacket +note left : input + +agent "Service Enabled" as isServiceEnabled + +agent "Callout buffer4_receive" as buffer4_receive +note right : hook + +agent "Unpack query" as unpack + +agent "Classify query" as classify + +agent "Callout pkt4_receive" as pkt4_receive +note right : hook + +agent "Check DROP class" as drop_class + +agent "Avoid same client race in multi-threaded mode" as same_client +note right : postpone processing or drop + +rectangle "Process Query on its Message Type" as process { + agent "Process Discover" as processDiscover + agent "Process Request" as processRequest + agent "Process Release" as processRelease + agent "Process Decline" as processDecline + agent "Process Inform" as processInform +} + +agent "Callout leases4_committed" as leases4_committed +note right : hook + +agent "Park" as park + +agent "Callout pkt4_send" as pkt4_send + +agent "Send response" as send + +agent "Pack response" as pack + +agent "Callout buffer4_send" as buffer4_send + +agent "Send response" as send +note left : output + +agent "Drop packet" as drop +note left : error + +receivePacket --> isServiceEnabled +isServiceEnabled --> buffer4_receive : service is enabled +isServiceEnabled ----> drop : service is disabled +buffer4_receive --> unpack : CONTINUE +buffer4_receive --> classify : SKIP +buffer4_receive ----> drop : DROP +unpack --> classify +unpack ---> drop : on error +classify --> pkt4_receive +pkt4_receive --> drop_class : CONTINUE +pkt4_receive ---> drop : DROP +drop_class --> same_client +drop_class ---> drop : query in DROP class +same_client ---> process +same_client ---> drop : queries from the same client possible race +process ---> drop : unknown message type +processDiscover --> leases4_committed +processDiscover ---> drop : on error +processRequest --> leases4_committed +processRequest ---> drop : on error +processRelease --> leases4_committed +processRelease ---> drop : on error +processDecline --> leases4_committed +processDecline ---> drop : on error +processInform --> leases4_committed +processInform ---> drop : on error +leases4_committed --> pkt4_send : CONTINUE +leases4_committed ---> drop : DROP +leases4_committed --> park : PARK +park -[dashed]-> pkt4_send : unpark +pkt4_send --> pack : CONTINUE +pkt4_send --> buffer4_send : SKIP +pkt4_send ---> drop : DROP +pack --> buffer4_send +buffer4_send --> send : CONTINUE +buffer4_send ---> drop : DROP +send -[hidden]-> drop + +footer dashed arrow means asynchronous processing + +@enduml diff --git a/doc/sphinx/uml/request4-lease.png b/doc/sphinx/uml/request4-lease.png new file mode 100644 index 0000000..23b95cd Binary files /dev/null and b/doc/sphinx/uml/request4-lease.png differ diff --git a/doc/sphinx/uml/request4-lease.svg b/doc/sphinx/uml/request4-lease.svg new file mode 100644 index 0000000..28b47de --- /dev/null +++ b/doc/sphinx/uml/request4-lease.svg @@ -0,0 +1,203 @@ +Allocate a lease for DHCPREQUEST (Kea 1.8.0)Check requested addressGet lease for requested addressCheck client leaseAllocate a new leaseAllocate or reuse leaseAllocate unreserved leaseCheck lease for reserved addressCheck out-of-pool addressCheck requested leaseCheck renewCreate a new leaseDelete old leaseGet candidate leaseReuse expired leaseReclaim expired leaseupdate lease informationCallout lease4_selecthookUpdate leaseIterate pools and subnetsPick addressCheck reserved addressedCheck already in use by another threadCheck leaseFind client leaseentry pointCheck requested reservationGet reservationUpdate requested addressReturn no leaseexit pointReturn renewed leaseexit pointReturn leaseexit pointhas requested address (hint)no requested address (hint)no conflicting reservationreservation owned by another clienthas a reservationrequest reserved addressno reservationhas requested leasenot expired lease owned by another clientno reservationhas requested reservationhas reservation for another addressno active reserved leaseowned reservation for the requested addressrequested address is in allowed an pooladdress not reserved and not in allowed poolhas a client leaserequested address was already assigned to the clienthas a requested addressno requested addressexpired candidate leaseconflicting candidate leaseno candidate leaseSKIPaddress reserved to another clientaddress already in use by another threadactive leaseexpired leaseno lease \ No newline at end of file diff --git a/doc/sphinx/uml/request4-lease.uml b/doc/sphinx/uml/request4-lease.uml new file mode 100644 index 0000000..54f0c81 --- /dev/null +++ b/doc/sphinx/uml/request4-lease.uml @@ -0,0 +1,118 @@ +@startuml + +title Allocate a lease for DHCPREQUEST (Kea 1.8.0) + +agent "Find client lease" as findClientLease +note right : entry point + +agent "Check requested reservation" as addressReserved + +agent "Get reservation" as hasAddressReservation + +agent "Update requested address" as update_hint + +rectangle "Check requested address" as check_hint { + rectangle "Get lease for requested address" as get_existing { + agent "Check requested lease" as existing + } + + agent "Check lease for reserved address" as getReservedLease + + agent "Check out-of-pool address" as out_of_pool +} + +rectangle "Check client lease" as check_done { + agent "Check renew" as client_lease +} + +rectangle "Allocate a new lease" as new_lease { + together { + rectangle "Allocate or reuse lease" as allocateOrReuseLease4 { + agent "Get candidate lease" as candidate + + agent "Reuse expired lease" as reuseExpiredLease4 + + agent "Reclaim expired lease" as reclaimExpiredLease + + agent "update lease information" as updateLease4Information + + agent "Callout lease4_select" as lease4_select + note right : hook + + agent "Update lease" as updateLease4 + } + + rectangle "Allocate unreserved lease" as allocateUnreservedLease4 { + agent "Iterate pools and subnets" as iterate + + agent "Pick address" as pick + + agent "Check reserved addressed" as pick_reserved + + agent "Check already in use by another thread" as mt_in_use + + agent "Check lease" as pick_lease + } + } + + agent "Create a new lease" as create + + agent "Delete old lease" as old_lease +} + +agent "Return no lease" as no_lease +note right : exit point + +agent "Return renewed lease" as renew +note right : exit point + +agent "Return lease" as return +note right : exit point + +findClientLease --> addressReserved : has requested address (hint) +findClientLease --> hasAddressReservation : no requested address (hint) +addressReserved --> check_hint : no conflicting reservation +addressReserved --> no_lease : reservation owned by another client +hasAddressReservation -> update_hint : has a reservation +update_hint --> check_hint : request reserved address +hasAddressReservation --> check_done : no reservation +check_hint --> get_existing +get_existing --> existing : has requested lease +existing ---> no_lease : not expired lease owned by another client +get_existing --> out_of_pool : no reservation +get_existing --> out_of_pool : has requested reservation +get_existing --> getReservedLease : has reservation for another address +getReservedLease ---> no_lease : no active reserved lease +getReservedLease --> out_of_pool +out_of_pool --> check_done : owned reservation for the requested address +out_of_pool --> check_done : requested address is in allowed an pool +out_of_pool --> no_lease : address not reserved and not in allowed pool +check_done --> client_lease : has a client lease +client_lease -> renew : requested address was already assigned to the client +client_lease --> new_lease +new_lease --> allocateOrReuseLease4 : has a requested address +new_lease --> allocateUnreservedLease4 : no requested address +allocateOrReuseLease4 --> candidate +candidate --> reuseExpiredLease4 : expired candidate lease +candidate --> no_lease : conflicting candidate lease +candidate --> create : no candidate lease +reuseExpiredLease4 --> reclaimExpiredLease +reclaimExpiredLease --> updateLease4Information +updateLease4Information --> lease4_select +lease4_select ---> no_lease : SKIP +lease4_select --> updateLease4 +updateLease4 --> old_lease +allocateUnreservedLease4 --> iterate +iterate --> pick +pick --> pick_reserved +pick_reserved -up-> iterate : address reserved to another client +pick_reserved --> mt_in_use +mt_in_use -up-> iterate : address already in use by another thread +mt_in_use --> pick_lease +pick_lease -up-> iterate : active lease +pick_lease --> reuseExpiredLease4 : expired lease +pick_lease --> create : no lease +create --> old_lease +old_lease --> return + +@enduml diff --git a/doc/sphinx/uml/request4.png b/doc/sphinx/uml/request4.png new file mode 100644 index 0000000..6818c2c Binary files /dev/null and b/doc/sphinx/uml/request4.png differ diff --git a/doc/sphinx/uml/request4.svg b/doc/sphinx/uml/request4.svg new file mode 100644 index 0000000..527f2ef --- /dev/null +++ b/doc/sphinx/uml/request4.svg @@ -0,0 +1,107 @@ +DHCPREQUEST processing (Kea 1.8.0)A lease was assignedAdd reserved classesClassify required classesBuild configured option listAppend requested optionsAppend requested vendor optionsAppend basic optionsSet fixed fieldsEntry pointSelect subnethook pointFind host reservationAdd either KNOWN or UNKNOWN classClassify (2nd pass)Process client nameAssign a leaseAdjust interface dataAppend server IDon success exit pointReturn no responseon error exit pointhook set DROPDHCPACKDHCPNAKon error \ No newline at end of file diff --git a/doc/sphinx/uml/request4.uml b/doc/sphinx/uml/request4.uml new file mode 100644 index 0000000..a5878b9 --- /dev/null +++ b/doc/sphinx/uml/request4.uml @@ -0,0 +1,59 @@ +@startuml + +title DHCPREQUEST processing (Kea 1.8.0) + +agent "Entry point" as entry + +agent "Select subnet" as selectSubnet +note right : hook point + +agent "Find host reservation" as findReservation + +agent "Add either KNOWN or UNKNOWN class" as known + +agent "Classify (2nd pass)" as classify2 + +agent "Process client name" as processClientName + +agent "Assign a lease" as assignLease + +rectangle "A lease was assigned" as ack { + agent "Add reserved classes" as setReservedClasses + agent "Classify required classes" as requiredClassify + agent "Build configured option list" as buildCfgOptionList + agent "Append requested options" as appendRequestedOptions + agent "Append requested vendor options" as appendRequestedVendorOptions + agent "Append basic options" as appendBasicOptions + agent "Set fixed fields" as setFixedFields +} + +agent "Adjust interface data" as common + +agent "Append server ID" as appendServerID +note left : on success exit point + +agent "Return no response" as drop +note left : on error exit point + +entry --> selectSubnet +selectSubnet --> findReservation +selectSubnet ---> drop : hook set DROP +findReservation --> known +known --> classify2 +classify2 --> processClientName +processClientName --> assignLease +assignLease --> ack : DHCPACK +assignLease --> common : DHCPNAK +assignLease ---> drop : on error +ack --> setReservedClasses +setReservedClasses --> requiredClassify +requiredClassify --> buildCfgOptionList +buildCfgOptionList --> appendRequestedOptions +appendRequestedOptions --> appendRequestedVendorOptions +appendRequestedVendorOptions --> appendBasicOptions +appendBasicOptions --> setFixedFields +setFixedFields --> common +common --> appendServerID +appendServerID -[hidden]-> drop + +@enduml \ No newline at end of file diff --git a/doc/sphinx/uml/requestLease4.png b/doc/sphinx/uml/requestLease4.png new file mode 100644 index 0000000..52ff01f Binary files /dev/null and b/doc/sphinx/uml/requestLease4.png differ diff --git a/doc/sphinx/uml/requestLease4.svg b/doc/sphinx/uml/requestLease4.svg new file mode 100644 index 0000000..800e77d --- /dev/null +++ b/doc/sphinx/uml/requestLease4.svg @@ -0,0 +1,310 @@ +requestLease4 algorithm (Kea 1.8.0)get lease for the clientreserved addressyesnorequested addressnoyesrequested address = reserved addressreturn no leaseyesrequested address is reserved for another clientnoreturn no leaseyesactive and owned by another clientnoyeslease for requested addressnoreturn no leaseyesactivenoyeslease for requested addressnoreturn no leasenorequested address in allowed poolyesnorequested address == reserved addressyesrequested addressyesnoreturn no leaseyesrequested address is reserved for another clientnoreturn no leaseyesactive and owned by another clientnoyeslease for requested addressnoreturn no leasenorequested address in allowed poolyespick candidate addresslease for candidatenoyescreate and return new leasereclaim expired leaseupdate lease informationcallout lease4_selectcallout returnSKIPCONTINUEreturn no leaseupdate leasereturn reused leaseyesexpirednonocandidate is used by another threadyesnocandidate is reserved for another clientyesiterate over pools and subnetsmaximum attemptsreturn no leasenoclient lease and lease address in allowed poolyesupdate lease informationreclaim expired leaseyesold lease expirednocallout lease4_renewcallout returnSKIPCONTINUEreturn old client leaseupdate leasereturn renewed client leaseyeshas reserved address or client lease address in allowed poolnoyesno requested address or requested address == client lease addressnoyesclient leasenoget lease for requested addressrequested leaseyesnoexpirednoyesreturn no leasereclaim expired leaseupdate lease informationcallout lease4_selectcallout returnSKIPCONTINUEreturn no leaseupdate leasereturn reused leasecreate and return new lease \ No newline at end of file diff --git a/doc/sphinx/uml/requestLease4.uml b/doc/sphinx/uml/requestLease4.uml new file mode 100644 index 0000000..4cb55b5 --- /dev/null +++ b/doc/sphinx/uml/requestLease4.uml @@ -0,0 +1,150 @@ +@startuml + +title requestLease4 algorithm (Kea 1.8.0) + +start +:get lease for the client; + +if (reserved address) then (yes) + if (requested address) then (no) + :requested address = reserved address; + else (yes) + if (requested address is reserved for another client) then (yes) + :return no lease; + stop + else (no) + endif + endif + if (lease for requested address) then (yes) + if (active and owned by another client) then (yes) + :return no lease; + stop + else (no) + endif + else (no) + endif + if (requested address == reserved address) then (no) + if (lease for requested address) then (yes) + if (active) then (yes) + :return no lease; + stop + else (no) + endif + else (no) + endif + if (requested address in allowed pool) then (no) + :return no lease; + stop + else (yes) + endif + else (yes) + endif + +else (no) + + if (requested address) then (yes) + if (requested address is reserved for another client) then (yes) + :return no lease; + stop + else (no) + endif + if (lease for requested address) then (yes) + if (active and owned by another client) then (yes) + :return no lease; + stop + else (no) + endif + else (no) + endif + if (requested address in allowed pool) then (no) + :return no lease; + stop + else (yes) + endif + else (no) + if (client lease and lease address in allowed pool) then (no) + while (iterate over pools and subnets) + :pick candidate address; + if (candidate is reserved for another client) then (no) + if (candidate is used by another thread) then (no) + if (lease for candidate) then (no) + :create and return new lease; + stop + else (yes) + if (expired) then (yes) + :reclaim expired lease; + :update lease information; + :callout lease4_select; + if (callout return) then (SKIP) + :return no lease; + stop + else (CONTINUE) + :update lease; + :return reused lease; + stop + endif + else (no) + endif + endif + else (yes) + endif + else (yes) + endif + endwhile + :maximum attempts; + :return no lease; + stop + else (yes) + endif + endif +endif + +' after check +if (client lease) then (yes) + if (no requested address or requested address == client lease address) then (yes) + if (has reserved address or client lease address in allowed pool) then (yes) + :update lease information; + if (old lease expired) then (yes) + :reclaim expired lease; + else (no) + endif + :callout lease4_renew; + if (callout return) then (SKIP) + :return old client lease; + stop + else (CONTINUE) + :update lease; + :return renewed client lease; + stop + endif + else (no) + endif + else (no) + endif +else (no) +endif + +:get lease for requested address; +if (requested lease) then (yes) + if (expired) then (no) + :return no lease; + stop + else (yes) + :reclaim expired lease; + :update lease information; + :callout lease4_select; + if (callout return) then (SKIP) + :return no lease; + stop + else (CONTINUE) + :update lease; + :return reused lease; + stop + endif + endif +else (no) + :create and return new lease; + stop +endif + +@enduml diff --git a/doc/sphinx/uml/select4.png b/doc/sphinx/uml/select4.png new file mode 100644 index 0000000..a89f54c Binary files /dev/null and b/doc/sphinx/uml/select4.png differ diff --git a/doc/sphinx/uml/select4.svg b/doc/sphinx/uml/select4.svg new file mode 100644 index 0000000..a2b5ed6 --- /dev/null +++ b/doc/sphinx/uml/select4.svg @@ -0,0 +1,157 @@ +DHCPv4 subnet selection (Kea 1.8.0)RelayedSet address for lookupTry incoming interfaceTry addressRelay address matches subnetRelay address matches shared networkCheck client classSet relay addressSet client addressSet source addressInterface matches subnetInterface matches shared networkCheck client classSet interface addressCheck subnet prefixCheck client classEntry pointTry RAI link selectTry subnet selection optionFound a subnetFound no subnetCallout subnet4_selectReturn a subnetReturn no subnetDrop queryrelayednot relayedno matchmatchno matchmatchcompatiblenot compatibletry the relay addresshas no relay addresshas no client addressno suitable addresshas a relay addresshas a client addresshas source address and use unicastno interfacematchno matchmarchno matchcompatiblenot compatiblehas an interface addressno interface addressmatchno matchcompatiblenot compatibleCONTINUE and subnet setSKIP or subnet not setDROP \ No newline at end of file diff --git a/doc/sphinx/uml/select4.uml b/doc/sphinx/uml/select4.uml new file mode 100644 index 0000000..ed8b65c --- /dev/null +++ b/doc/sphinx/uml/select4.uml @@ -0,0 +1,85 @@ +@startuml + +title DHCPv4 subnet selection (Kea 1.8.0) + +agent "Entry point" as entry + +agent "Try RAI link select" as rai_link_select + +agent "Try subnet selection option" as subnet_select + +rectangle "Relayed" as relayed { + agent "Relay address matches subnet" as relay_subnet + agent "Relay address matches shared network" as relay_network + agent "Check client class" as relay_class +} + +rectangle "Set address for lookup" as set_address { + agent "Set relay address" as relay_address + agent "Set client address" as client_address + agent "Set source address" as source_address +} + +rectangle "Try incoming interface" as interface { + agent "Interface matches subnet" as interface_subnet + agent "Interface matches shared network" as interface_network + agent "Check client class" as interface_class + agent "Set interface address" as interface_address +} + +rectangle "Try address" as address { + agent "Check subnet prefix" as inRange + agent "Check client class" as address_class +} + +agent "Found a subnet" as found + +agent "Found no subnet" as not_found + +agent "Callout subnet4_select" as subnet4_select + +agent "Return a subnet" as success + +agent "Return no subnet" as no_subnet + +agent "Drop query" as drop + +entry --> rai_link_select +rai_link_select --> subnet_select +subnet_select --> relayed : relayed +subnet_select --> set_address : not relayed +relayed --> relay_subnet +relay_subnet --> relay_network : no match +relay_subnet --> relay_class : match +relay_network --> set_address : no match +relay_network --> relay_class : match +relay_class ---> found : compatible +relay_class --> set_address : not compatible +set_address --> relay_address : try the relay address +relay_address -r-> client_address : has no relay address +client_address -r-> source_address : has no client address +source_address --> interface_subnet : no suitable address +relay_address --> inRange : has a relay address +client_address --> inRange : has a client address +source_address --> inRange : has source address and use unicast +interface_subnet ---> not_found : no interface +interface_subnet --> interface_class : match +interface_subnet --> interface_network : no match +interface_network --> interface_class : march +interface_network ---> not_found : no match +interface_class ---> found : compatible +interface_class ---> interface_address : not compatible +interface_address --> inRange : has an interface address +interface_address ---> not_found : no interface address +inRange ---> address_class : match +inRange ---> not_found : no match +address_class ---> found : compatible +address_class ---> not_found : not compatible +found --> subnet4_select +not_found --> subnet4_select +found -[hidden]> not_found +subnet4_select --> success : CONTINUE and subnet set +subnet4_select --> no_subnet : SKIP or subnet not set +subnet4_select --> drop : DROP + +@enduml diff --git a/doc/sphinx/uml/tkey.png b/doc/sphinx/uml/tkey.png new file mode 100644 index 0000000..c10ec7c Binary files /dev/null and b/doc/sphinx/uml/tkey.png differ diff --git a/doc/sphinx/uml/tkey.svg b/doc/sphinx/uml/tkey.svg new file mode 100644 index 0000000..6bfb43f --- /dev/null +++ b/doc/sphinx/uml/tkey.svg @@ -0,0 +1,21 @@ +TKEY Exchange (GSS-TSIG hook)Kea D2 serverKea D2 serverDNS serverDNS serverTKEY requestTKEY response (signed) \ No newline at end of file diff --git a/doc/sphinx/uml/tkey.uml b/doc/sphinx/uml/tkey.uml new file mode 100644 index 0000000..4cc33e5 --- /dev/null +++ b/doc/sphinx/uml/tkey.uml @@ -0,0 +1,11 @@ +@startuml + +title TKEY Exchange (GSS-TSIG hook) + +participant "Kea D2 server" as Kea +participant "DNS server" as DNS + +Kea -> DNS: TKEY request +DNS -> Kea: TKEY response (signed) + +@enduml diff --git a/doc/sphinx/uml/update.png b/doc/sphinx/uml/update.png new file mode 100644 index 0000000..9b0520e Binary files /dev/null and b/doc/sphinx/uml/update.png differ diff --git a/doc/sphinx/uml/update.svg b/doc/sphinx/uml/update.svg new file mode 100644 index 0000000..7fb4947 --- /dev/null +++ b/doc/sphinx/uml/update.svg @@ -0,0 +1,21 @@ +DNS Update Exchange (GSS-TSIG hook)Kea D2 serverKea D2 serverDNS serverDNS serverDNS update request (signed)DNS update response (signed) \ No newline at end of file diff --git a/doc/sphinx/uml/update.uml b/doc/sphinx/uml/update.uml new file mode 100644 index 0000000..9738f30 --- /dev/null +++ b/doc/sphinx/uml/update.uml @@ -0,0 +1,11 @@ +@startuml + +title DNS Update Exchange (GSS-TSIG hook) + +participant "Kea D2 server" as Kea +participant "DNS server" as DNS + +Kea -> DNS: DNS update request (signed) +DNS -> Kea: DNS update response (signed) + +@enduml -- cgit v1.2.3