@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