Kea 2.7.6
subnet_select_co.cc File Reference

Defines the subnet4_select and subnet6_select callout functions. More...

#include <config.h>
#include <hooks/hooks.h>
#include <dhcp/pkt4.h>
#include <dhcp/dhcp6.h>
#include <dhcp/pkt6.h>
#include <dhcpsrv/subnet.h>
#include <user_chk.h>
#include <user_chk_log.h>
+ Include dependency graph for subnet_select_co.cc:

Go to the source code of this file.

Functions

int subnet4_select (CalloutHandle &handle)
 This callout is called at the "subnet4_select" hook.
 
int subnet6_select (CalloutHandle &handle)
 This callout is called at the "subnet6_select" hook.
 

Detailed Description

Defines the subnet4_select and subnet6_select callout functions.

Definition in file subnet_select_co.cc.

Function Documentation

◆ subnet4_select()

int subnet4_select ( CalloutHandle & handle)

This callout is called at the "subnet4_select" hook.

This function alters the selected subnet based upon whether or not the requesting DHCP client is a "registered user". It fetches a pointer to the registered user from the callout context. This value is presumed to have been set upstream. If it is non-null that it points to the client's user entry in the UserRegistry. If it is null, the client is not registered.

If the client is registered, then replace the selected subnet with the restricted access subnet. By convention, it is assumed that last subnet in the list of available subnets is the restricted access subnet.

Parameters
handleCalloutHandle which provides access to context.
Returns
0 upon success, non-zero otherwise.

Definition at line 44 of file subnet_select_co.cc.

References isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getContext(), isc::hooks::CalloutHandle::getStatus(), LOG_ERROR, isc::hooks::CalloutHandle::NEXT_STEP_DROP, isc::hooks::CalloutHandle::NEXT_STEP_SKIP, registered_user_label, isc::hooks::CalloutHandle::setArgument(), user_chk::user_chk_logger, USER_CHK_SUBNET4_SELECT_ERROR, USER_CHK_SUBNET4_SELECT_REGISTRY_NULL, and user_registry.

+ Here is the call graph for this function:

◆ subnet6_select()

int subnet6_select ( CalloutHandle & handle)

This callout is called at the "subnet6_select" hook.

This function alters the selected subnet based upon whether or not the requesting DHCP client is a "registered user". It fetches a pointer to the registered user from the callout context. This value is presumed to have been set upstream. If it is non-null that it points to the client's user entry in the UserRegistry. If it is null, the client is not registered.

If the client is registered, then replace the selected subnet with the restricted access subnet. By convention, it is assumed that last subnet in the list of available subnets is the restricted access subnet.

Parameters
handleCalloutHandle which provides access to context.
Returns
0 upon success, non-zero otherwise.

Definition at line 104 of file subnet_select_co.cc.

References isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getContext(), isc::hooks::CalloutHandle::getStatus(), LOG_ERROR, isc::hooks::CalloutHandle::NEXT_STEP_DROP, isc::hooks::CalloutHandle::NEXT_STEP_SKIP, registered_user_label, isc::hooks::CalloutHandle::setArgument(), user_chk::user_chk_logger, USER_CHK_SUBNET6_SELECT_ERROR, USER_CHK_SUBNET6_SELECT_REGISTRY_NULL, and user_registry.

+ Here is the call graph for this function: