Implementation of the DHCPv6 protocol.
More...
#include <freeradius-devel/util/dict.h>
#include <freeradius-devel/protocol/dhcpv6/dictionary.h>
Go to the source code of this file.
|
#define | da_is_dns_label(_da) (!(_da)->flags.extra && (((_da)->flags.subtype == FLAG_ENCODE_DNS_LABEL) || ((_da)->flags.subtype == FLAG_ENCODE_PARTIAL_DNS_LABEL))) |
|
#define | DHCPV6_DATE_OFFSET (946684800) |
|
#define | DHCPV6_GET_OPTION_LEN(_x) fr_nbo_to_uint16((_x) + 2) |
|
#define | DHCPV6_GET_OPTION_NUM(_x) fr_nbo_to_uint16(_x) |
|
#define | DHCPV6_HDR_LEN (DHCPV6_MSG_TYPE_LEN + DHCPV6_TRANSACTION_ID_LEN) |
|
#define | DHCPV6_HOP_COUNT_LEN 1U |
|
#define | DHCPV6_LINK_ADDRESS_LEN 16U |
|
#define | DHCPV6_MAX_ATTRIBUTES 1024 |
|
#define | DHCPV6_MAX_RELAY_NESTING 10 |
|
#define | DHCPV6_MSG_TYPE_LEN 1U |
|
#define | DHCPV6_OPT_HDR_LEN (sizeof(uint16_t) * 2) |
|
#define | DHCPV6_PEER_ADDRESS_LEN 16U |
|
#define | DHCPV6_RELAY_HDR_LEN (DHCPV6_MSG_TYPE_LEN + DHCPV6_HOP_COUNT_LEN + DHCPV6_LINK_ADDRESS_LEN + DHCPV6_PEER_ADDRESS_LEN) |
|
#define | DHCPV6_TRANSACTION_ID_LEN 3U |
|
#define | FR_DHCPV6_PACKET_CODE_VALID(_code) (((_code) > 0) && ((_code) < FR_DHCPV6_CODE_MAX)) |
|
#define | IN6ADDR_ALL_DHCP_RELAY_AGENTS_AND_SERVERS "FF02::1:2" |
|
#define | IN6ADDR_ALL_DHCP_RELAY_AGENTS_AND_SERVERS_INIT {{{ 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,1,2}}} |
|
#define | IN6ADDR_ALL_DHCP_SERVERS "FF05::1:3" |
|
#define | IN6ADDR_ALL_DHCP_SERVERS_INIT {{{ 0xff,0x05,0,0,0,0,0,0,0,0,0,0,0,0,1,3}}} |
|
|
enum | {
FLAG_ENCODE_NONE = 0
,
FLAG_ENCODE_DNS_LABEL
,
FLAG_ENCODE_PARTIAL_DNS_LABEL
} |
| subtype values for DHCPv4 and DHCPv6 More...
|
|
enum | fr_dhcpv6_packet_code_t {
FR_DHCPV6_INVALID = 0
,
FR_DHCPV6_SOLICIT = 1
,
FR_DHCPV6_ADVERTISE = 2
,
FR_DHCPV6_REQUEST = 3
,
FR_DHCPV6_CONFIRM = 4
,
FR_DHCPV6_RENEW = 5
,
FR_DHCPV6_REBIND = 6
,
FR_DHCPV6_REPLY = 7
,
FR_DHCPV6_RELEASE = 8
,
FR_DHCPV6_DECLINE = 9
,
FR_DHCPV6_RECONFIGURE = 10
,
FR_DHCPV6_INFORMATION_REQUEST = 11
,
FR_DHCPV6_RELAY_FORWARD = 12
,
FR_DHCPV6_RELAY_REPLY = 13
,
FR_DHCPV6_LEASE_QUERY = 14
,
FR_DHCPV6_LEASE_QUERY_REPLY = 15
,
FR_DHCPV6_LEASE_QUERY_DONE = 16
,
FR_DHCPV6_LEASE_QUERY_DATA = 17
,
FR_DHCPV6_RECONFIGURE_REQUEST = 18
,
FR_DHCPV6_RECONFIGURE_REPLY = 19
,
FR_DHCPV6_DHCPV4_QUERY = 20
,
FR_DHCPV6_DHCPV4_RESPONSE = 21
,
FR_DHCPV6_ACTIVE_LEASE_QUERY = 22
,
FR_DHCPV6_START_TLS = 23
,
FR_DHCPV6_BIND_UPDATE = 24
,
FR_DHCPV6_BIND_REPLY = 25
,
FR_DHCPV6_POOL_REQUEST = 26
,
FR_DHCPV6_POOL_RESPONSE = 27
,
FR_DHCPV6_UPDATE_REQUEST = 28
,
FR_DHCPV6_UPDATE_REQUEST_ALL = 29
,
FR_DHCPV6_UPDATE_DONE = 30
,
FR_DHCPV6_CONNECT = 31
,
FR_DHCPV6_CONNECT_REPLY = 32
,
FR_DHCPV6_DISCONNECT = 33
,
FR_DHCPV6_STATE = 34
,
FR_DHCPV6_CONTACT = 35
,
FR_DHCPV6_CODE_MAX = 36
,
FR_DHCPV6_DO_NOT_RESPOND = 256
} |
|
|
ssize_t | fr_dhcpv6_decode (TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *packet, size_t packet_len) |
| Decode a DHCPv6 packet. More...
|
|
ssize_t | fr_dhcpv6_decode_foreign (TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *data, size_t data_len) |
|
ssize_t | fr_dhcpv6_decode_option (TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *data, size_t data_len, void *decode_ctx) |
| Create a "normal" fr_pair_t from the given data. More...
|
|
ssize_t | fr_dhcpv6_encode (fr_dbuff_t *dbuff, uint8_t const *original, size_t length, int msg_type, fr_pair_list_t *vps) |
| Encode a DHCPv6 packet. More...
|
|
ssize_t | fr_dhcpv6_encode_foreign (fr_dbuff_t *dbuff, fr_pair_list_t const *list) |
|
ssize_t | fr_dhcpv6_encode_option (fr_dbuff_t *dbuff, fr_dcursor_t *cursor, void *encode_ctx) |
| Encode a DHCPv6 option and any sub-options. More...
|
|
void | fr_dhcpv6_global_free (void) |
|
int | fr_dhcpv6_global_init (void) |
|
bool | fr_dhcpv6_ok (uint8_t const *packet, size_t packet_len, uint32_t max_attributes) |
| See if the data pointed to by PTR is a valid DHCPv6 packet. More...
|
|
uint8_t const * | fr_dhcpv6_option_find (uint8_t const *start, uint8_t const *end, unsigned int option) |
|
void | fr_dhcpv6_print_hex (FILE *fp, uint8_t const *packet, size_t packet_len) |
| Print a raw DHCP packet as hex. More...
|
|
bool | fr_dhcpv6_verify (uint8_t const *packet, size_t packet_len, fr_dhcpv6_decode_ctx_t const *packet_ctx, bool from_server) |
| Verify the packet under some various circumstances. More...
|
|
Implementation of the DHCPv6 protocol.
- Id
- b9484cc5a4e2504dd813a9a2752e75f4a880e9e4
- Author
- Arran Cudbard-Bell (a.cud.nosp@m.bard.nosp@m.b@fre.nosp@m.erad.nosp@m.ius.o.nosp@m.rg)
- Copyright
- 2018 The FreeRADIUS server project
-
2018 NetworkRADIUS SARL (legal.nosp@m.@net.nosp@m.workr.nosp@m.adiu.nosp@m.s.com)
Definition in file dhcpv6.h.
◆ fr_dhcpv6_decode_ctx_t
struct fr_dhcpv6_decode_ctx_t |
Definition at line 140 of file dhcpv6.h.
Data Fields |
uint8_t * |
duid |
the expected DUID, in wire format |
size_t |
duid_len |
length of the expected DUID |
TALLOC_CTX * |
tmp_ctx |
for temporary things cleaned up during decoding |
uint32_t |
transaction_id |
previous transaction ID |
◆ fr_dhcpv6_encode_ctx_t
struct fr_dhcpv6_encode_ctx_t |
Definition at line 134 of file dhcpv6.h.
Data Fields |
uint8_t const * |
original |
original packet |
size_t |
original_length |
length of the original packet |
fr_dict_attr_t const * |
root |
Root attribute of the dictionary. |
◆ fr_dhcpv6_packet_t
struct fr_dhcpv6_packet_t |
◆ da_is_dns_label
◆ DHCPV6_DATE_OFFSET
#define DHCPV6_DATE_OFFSET (946684800) |
◆ DHCPV6_GET_OPTION_LEN
◆ DHCPV6_GET_OPTION_NUM
◆ DHCPV6_HDR_LEN
◆ DHCPV6_HOP_COUNT_LEN
#define DHCPV6_HOP_COUNT_LEN 1U |
◆ DHCPV6_LINK_ADDRESS_LEN
#define DHCPV6_LINK_ADDRESS_LEN 16U |
◆ DHCPV6_MAX_ATTRIBUTES
#define DHCPV6_MAX_ATTRIBUTES 1024 |
◆ DHCPV6_MAX_RELAY_NESTING
#define DHCPV6_MAX_RELAY_NESTING 10 |
◆ DHCPV6_MSG_TYPE_LEN
#define DHCPV6_MSG_TYPE_LEN 1U |
◆ DHCPV6_OPT_HDR_LEN
◆ DHCPV6_PEER_ADDRESS_LEN
#define DHCPV6_PEER_ADDRESS_LEN 16U |
◆ DHCPV6_RELAY_HDR_LEN
◆ DHCPV6_TRANSACTION_ID_LEN
#define DHCPV6_TRANSACTION_ID_LEN 3U |
◆ FR_DHCPV6_PACKET_CODE_VALID
◆ IN6ADDR_ALL_DHCP_RELAY_AGENTS_AND_SERVERS
#define IN6ADDR_ALL_DHCP_RELAY_AGENTS_AND_SERVERS "FF02::1:2" |
◆ IN6ADDR_ALL_DHCP_RELAY_AGENTS_AND_SERVERS_INIT
#define IN6ADDR_ALL_DHCP_RELAY_AGENTS_AND_SERVERS_INIT {{{ 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,1,2}}} |
◆ IN6ADDR_ALL_DHCP_SERVERS
#define IN6ADDR_ALL_DHCP_SERVERS "FF05::1:3" |
◆ IN6ADDR_ALL_DHCP_SERVERS_INIT
#define IN6ADDR_ALL_DHCP_SERVERS_INIT {{{ 0xff,0x05,0,0,0,0,0,0,0,0,0,0,0,0,1,3}}} |
◆ anonymous enum
subtype values for DHCPv4 and DHCPv6
Enumerator |
---|
FLAG_ENCODE_NONE | no particular encoding for DHCPv6 strings
|
FLAG_ENCODE_DNS_LABEL | encode as DNS label
|
FLAG_ENCODE_PARTIAL_DNS_LABEL | encode as a partial DNS label
|
Definition at line 114 of file dhcpv6.h.
◆ fr_dhcpv6_packet_code_t
Enumerator |
---|
FR_DHCPV6_INVALID | |
FR_DHCPV6_SOLICIT | |
FR_DHCPV6_ADVERTISE | |
FR_DHCPV6_REQUEST | |
FR_DHCPV6_CONFIRM | |
FR_DHCPV6_RENEW | |
FR_DHCPV6_REBIND | |
FR_DHCPV6_REPLY | |
FR_DHCPV6_RELEASE | |
FR_DHCPV6_DECLINE | |
FR_DHCPV6_RECONFIGURE | |
FR_DHCPV6_INFORMATION_REQUEST | |
FR_DHCPV6_RELAY_FORWARD | |
FR_DHCPV6_RELAY_REPLY | |
FR_DHCPV6_LEASE_QUERY | |
FR_DHCPV6_LEASE_QUERY_REPLY | |
FR_DHCPV6_LEASE_QUERY_DONE | |
FR_DHCPV6_LEASE_QUERY_DATA | |
FR_DHCPV6_RECONFIGURE_REQUEST | |
FR_DHCPV6_RECONFIGURE_REPLY | |
FR_DHCPV6_DHCPV4_QUERY | |
FR_DHCPV6_DHCPV4_RESPONSE | |
FR_DHCPV6_ACTIVE_LEASE_QUERY | |
FR_DHCPV6_START_TLS | |
FR_DHCPV6_BIND_UPDATE | |
FR_DHCPV6_BIND_REPLY | |
FR_DHCPV6_POOL_REQUEST | |
FR_DHCPV6_POOL_RESPONSE | |
FR_DHCPV6_UPDATE_REQUEST | |
FR_DHCPV6_UPDATE_REQUEST_ALL | |
FR_DHCPV6_UPDATE_DONE | |
FR_DHCPV6_CONNECT | |
FR_DHCPV6_CONNECT_REPLY | |
FR_DHCPV6_DISCONNECT | |
FR_DHCPV6_STATE | |
FR_DHCPV6_CONTACT | |
FR_DHCPV6_CODE_MAX | |
FR_DHCPV6_DO_NOT_RESPOND | |
Definition at line 66 of file dhcpv6.h.
◆ fr_dhcpv6_decode()
Decode a DHCPv6 packet.
Definition at line 578 of file base.c.
◆ fr_dhcpv6_decode_foreign()
◆ fr_dhcpv6_decode_option()
Create a "normal" fr_pair_t from the given data.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | option-code | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Definition at line 421 of file decode.c.
◆ fr_dhcpv6_encode()
Encode a DHCPv6 packet.
Definition at line 717 of file base.c.
◆ fr_dhcpv6_encode_foreign()
◆ fr_dhcpv6_encode_option()
Encode a DHCPv6 option and any sub-options.
- Parameters
-
[out] | dbuff | Where to write encoded DHCP attributes. |
[in] | cursor | with current VP set to the option to be encoded. Will be advanced to the next option to encode. |
[in] | encode_ctx | containing parameters for the encoder. |
- Returns
- > 0 length of data written.
- < 0 error.
Definition at line 670 of file encode.c.
◆ fr_dhcpv6_global_free()
void fr_dhcpv6_global_free |
( |
void |
| ) |
|
◆ fr_dhcpv6_global_init()
int fr_dhcpv6_global_init |
( |
void |
| ) |
|
◆ fr_dhcpv6_ok()
See if the data pointed to by PTR is a valid DHCPv6 packet.
- Parameters
-
[in] | packet | to check. |
[in] | packet_len | The size of the packet data. |
[in] | max_attributes | to allow in the packet. |
- Returns
- True on success.
- False on failure.
Definition at line 227 of file base.c.
◆ fr_dhcpv6_option_find()
◆ fr_dhcpv6_print_hex()
void fr_dhcpv6_print_hex |
( |
FILE * |
fp, |
|
|
uint8_t const * |
packet, |
|
|
size_t |
packet_len |
|
) |
| |
Print a raw DHCP packet as hex.
Definition at line 891 of file base.c.
◆ fr_dhcpv6_verify()
Verify the packet under some various circumstances.
- Parameters
-
[in] | packet | to check. |
[in] | packet_len | The size of the packet data. |
[in] | packet_ctx | The expected packet_ctx |
[in] | from_server | true for packets from a server, false for packets from a client. |
- Returns
- True on success.
- False on failure.
fr_dhcpv6_ok() SHOULD be called before calling this function.
Definition at line 544 of file base.c.
◆ fr_dhcpv6_packet_names