Difference between revisions of "VPP/DHCPv6"
From fd.io
< VPP
Line 34: | Line 34: | ||
set ip6 addresses <interface> [prefix group <n>] <address> [del] | set ip6 addresses <interface> [prefix group <n>] <address> [del] | ||
− | Binary API: | + | = Binary API: = |
/** \brief Enable/disable DHCPv6 PD client on interface | /** \brief Enable/disable DHCPv6 PD client on interface | ||
@param client_index - opaque cookie to identify the sender | @param client_index - opaque cookie to identify the sender | ||
Line 66: | Line 66: | ||
u8 prefix_length; | u8 prefix_length; | ||
u8 is_add; | u8 is_add; | ||
+ | }; | ||
+ | |||
+ | = Binary API of data plane: = | ||
+ | Enable DHCPv6 client subsystem to receive UDP messages containing DHCPv6 client port: | ||
+ | (This is to set the router to DHCPv6 client mode - so client subsystem gets the messages instead of DHCPv6 proxy subsystem) | ||
+ | /** \brief Enable/disable listening on DHCPv6 client port | ||
+ | @param client_index - opaque cookie to identify the sender | ||
+ | @param context - sender context, to match reply w/ request | ||
+ | */ | ||
+ | autoreply define dhcp6_clients_enable_disable | ||
+ | { | ||
+ | u32 client_index; | ||
+ | u32 context; | ||
+ | u8 enable; | ||
+ | }; | ||
+ | |||
+ | Send DHCPv6 messages to server: | ||
+ | /** \brief Struct representing DHCPv6 PD prefix | ||
+ | @param prefix - prefix | ||
+ | @param prefix_length - prefix length | ||
+ | @param valid_time - valid lifetime | ||
+ | @param preferred_time - preferred lifetime | ||
+ | */ | ||
+ | typeonly define dhcp6_pd_prefix_info | ||
+ | { | ||
+ | u8 prefix[16]; | ||
+ | u8 prefix_length; | ||
+ | u32 valid_time; | ||
+ | u32 preferred_time; | ||
+ | }; | ||
+ | |||
+ | /** \brief Send DHCPv6 PD client message of specified type | ||
+ | @param client_index - opaque cookie to identify the sender | ||
+ | @param context - sender context, to match reply w/ request | ||
+ | @param sw_if_index - index of TX interface, also identifies IAID | ||
+ | @param server_index - used to dentify DHCPv6 server, | ||
+ | unique for each DHCPv6 server on the link, | ||
+ | value obrtained from dhcp6_pd_reply_event API message, | ||
+ | use ~0 to send message to all DHCPv6 servers | ||
+ | @param irt - initial retransmission time | ||
+ | @param mrt - maximum retransmission time | ||
+ | @param mrc - maximum retransmission count | ||
+ | @param mrd - maximum retransmission duration | ||
+ | for sending the message | ||
+ | @param stop - if non-zero then stop resending the message, | ||
+ | otherwise start sending the message | ||
+ | @param msg_type - message type | ||
+ | @param T1 - value of T1 in IA_PD option | ||
+ | @param T2 - value of T2 in IA_PD option | ||
+ | @param n_prefixes - number of addresses in IA_PD option | ||
+ | @param prefixes - list of prefixes in IA_PD option | ||
+ | */ | ||
+ | autoreply define dhcp6_pd_send_client_message | ||
+ | { | ||
+ | u32 client_index; | ||
+ | u32 context; | ||
+ | u32 sw_if_index; | ||
+ | u32 server_index; | ||
+ | u32 irt; | ||
+ | u32 mrt; | ||
+ | u32 mrc; | ||
+ | u32 mrd; | ||
+ | u8 stop; | ||
+ | u8 msg_type; | ||
+ | u32 T1; | ||
+ | u32 T2; | ||
+ | u32 n_prefixes; | ||
+ | vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes]; | ||
+ | }; | ||
+ | |||
+ | Subscribe for notifications of DHCPv6 messages from server: | ||
+ | |||
+ | /** \brief Register for DHCPv6 PD reply events | ||
+ | @param client_index - opaque cookie to identify the sender | ||
+ | @param context - sender context, to match reply w/ request | ||
+ | @param enable_disable - 1 => register for events, 0 => cancel registration | ||
+ | @param pid - sender's pid | ||
+ | */ | ||
+ | autoreply define want_dhcp6_pd_reply_events | ||
+ | { | ||
+ | u32 client_index; | ||
+ | u32 context; | ||
+ | u8 enable_disable; | ||
+ | u32 pid; | ||
+ | }; | ||
+ | |||
+ | /** \brief Tell client about a DHCPv6 PD server reply event | ||
+ | @param client_index - opaque cookie to identify the sender | ||
+ | @param pid - client pid registered to receive notification | ||
+ | @param sw_if_index - index of RX interface, also identifies IAID | ||
+ | @param server_index - used to dentify DHCPv6 server, | ||
+ | unique for each DHCPv6 server on the link | ||
+ | @param msg_type - message type | ||
+ | @param T1 - value of T1 in IA_PD option | ||
+ | @param T2 - value of T2 in IA_PD option | ||
+ | @param status_code - value of status code | ||
+ | @param preference - value of preference option in reply message | ||
+ | @param n_prefixes - number of prefixes in IA_PD option | ||
+ | @param prefixes - list of prefixes in IA_PD option | ||
+ | */ | ||
+ | define dhcp6_pd_reply_event | ||
+ | { | ||
+ | u32 client_index; | ||
+ | u32 pid; | ||
+ | u32 sw_if_index; | ||
+ | u32 server_index; | ||
+ | u8 msg_type; | ||
+ | u32 T1; | ||
+ | u32 T2; | ||
+ | u16 status_code; | ||
+ | u8 preference; | ||
+ | u32 n_prefixes; | ||
+ | vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes]; | ||
}; | }; |
Revision as of 11:40, 30 May 2018
Contents
[hide]DHCPv6
DHCPv6 IA_NA
To enable/disable DHCPv6 IA_NA client on an interface:
dhcp6 client <interface> [disable]
Binary API:
/** \brief Enable/disable DHCPv6 client on interface @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param sw_if_index - interface to enable/disable client on @param enable - 1 to enable, 0 to disable */ autoreply define dhcp6_client_enable_disable { u32 client_index; u32 context; u32 sw_if_index; u8 enable; };
DHCPv6 prefix delegation
To enable/disable DHCPv6 prefix delegation client on an interface:
dhcp6 pd client <interface> [disable]
To show the state of clients and prefixes:
show ip6 pd clients show ip6 prefixes
To add/delete IPv6 address potentially using available prefix from specified prefix group:
set ip6 addresses <interface> [prefix group <n>] <address> [del]
Binary API:
/** \brief Enable/disable DHCPv6 PD client on interface @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param sw_if_index - interface to enable/disable client on @param enable - 1 to enable, 0 to disable */ autoreply define dhcp6_pd_client_enable_disable { u32 client_index; u32 context; u32 sw_if_index; u8 enable; }; /** \brief Add/delete IPv6 address optionally using available prefix @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param sw_if_index - software interface index of interface to add/delete address to/from @param prefix_group - prefix group, ~0 means no prefix should be used */ autoreply define control_plane_ip6_address_add_del { u32 client_index; u32 context; u32 sw_if_index; u32 prefix_group; u8 address[16]; u8 prefix_length; u8 is_add; };
Binary API of data plane:
Enable DHCPv6 client subsystem to receive UDP messages containing DHCPv6 client port: (This is to set the router to DHCPv6 client mode - so client subsystem gets the messages instead of DHCPv6 proxy subsystem)
/** \brief Enable/disable listening on DHCPv6 client port @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request */ autoreply define dhcp6_clients_enable_disable { u32 client_index; u32 context; u8 enable; };
Send DHCPv6 messages to server:
/** \brief Struct representing DHCPv6 PD prefix @param prefix - prefix @param prefix_length - prefix length @param valid_time - valid lifetime @param preferred_time - preferred lifetime */ typeonly define dhcp6_pd_prefix_info { u8 prefix[16]; u8 prefix_length; u32 valid_time; u32 preferred_time; }; /** \brief Send DHCPv6 PD client message of specified type @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param sw_if_index - index of TX interface, also identifies IAID @param server_index - used to dentify DHCPv6 server, unique for each DHCPv6 server on the link, value obrtained from dhcp6_pd_reply_event API message, use ~0 to send message to all DHCPv6 servers @param irt - initial retransmission time @param mrt - maximum retransmission time @param mrc - maximum retransmission count @param mrd - maximum retransmission duration for sending the message @param stop - if non-zero then stop resending the message, otherwise start sending the message @param msg_type - message type @param T1 - value of T1 in IA_PD option @param T2 - value of T2 in IA_PD option @param n_prefixes - number of addresses in IA_PD option @param prefixes - list of prefixes in IA_PD option */ autoreply define dhcp6_pd_send_client_message { u32 client_index; u32 context; u32 sw_if_index; u32 server_index; u32 irt; u32 mrt; u32 mrc; u32 mrd; u8 stop; u8 msg_type; u32 T1; u32 T2; u32 n_prefixes; vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes]; };
Subscribe for notifications of DHCPv6 messages from server:
/** \brief Register for DHCPv6 PD reply events @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param enable_disable - 1 => register for events, 0 => cancel registration @param pid - sender's pid */ autoreply define want_dhcp6_pd_reply_events { u32 client_index; u32 context; u8 enable_disable; u32 pid; }; /** \brief Tell client about a DHCPv6 PD server reply event @param client_index - opaque cookie to identify the sender @param pid - client pid registered to receive notification @param sw_if_index - index of RX interface, also identifies IAID @param server_index - used to dentify DHCPv6 server, unique for each DHCPv6 server on the link @param msg_type - message type @param T1 - value of T1 in IA_PD option @param T2 - value of T2 in IA_PD option @param status_code - value of status code @param preference - value of preference option in reply message @param n_prefixes - number of prefixes in IA_PD option @param prefixes - list of prefixes in IA_PD option */ define dhcp6_pd_reply_event { u32 client_index; u32 pid; u32 sw_if_index; u32 server_index; u8 msg_type; u32 T1; u32 T2; u16 status_code; u8 preference; u32 n_prefixes; vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes]; };