Difference between revisions of "VPP/DHCPv6"
| (6 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
== DHCPv6 IA_NA ==  | == DHCPv6 IA_NA ==  | ||
| + | |||
| + | === Control Plane ===  | ||
To enable/disable DHCPv6 IA_NA client on an interface:  | To enable/disable DHCPv6 IA_NA client on an interface:  | ||
   dhcp6 client <interface> [disable]  |    dhcp6 client <interface> [disable]  | ||
| − | Binary API:  | + | To show the state of clients and addresses:  | 
| + |   show dhcp6 clients  | ||
| + |   show dhcp6 addresses  | ||
| + | |||
| + | ==== Binary API: ====  | ||
   /** \brief Enable/disable DHCPv6 client on interface  |    /** \brief Enable/disable DHCPv6 client on interface  | ||
       @param client_index - opaque cookie to identify the sender  |        @param client_index - opaque cookie to identify the sender  | ||
| Line 20: | Line 26: | ||
     u32 sw_if_index;  |      u32 sw_if_index;  | ||
     u8 enable;  |      u8 enable;  | ||
| + |   };  | ||
| + | |||
| + | === Data Plane ===  | ||
| + | ==== Binary API: ====  | ||
| + | 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 address  | ||
| + |       @param address - address  | ||
| + |       @param valid_time - valid lifetime  | ||
| + |       @param preferred_time - preferred lifetime  | ||
| + |   */  | ||
| + |   typeonly define dhcp6_address_info  | ||
| + |   {  | ||
| + |     u8 address[16];  | ||
| + |     u32 valid_time;  | ||
| + |     u32 preferred_time;  | ||
| + |   };  | ||
| + | |||
| + |   /** \brief Send DHCPv6 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_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_NA option  | ||
| + |       @param T2 - value of T2 in IA_NA option  | ||
| + |       @param n_addresses - number of addresses in IA_NA option  | ||
| + |       @param addresses - list of addresses in IA_NA option  | ||
| + |   */  | ||
| + |   autoreply define dhcp6_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_addresses;  | ||
| + |     vl_api_dhcp6_address_info_t addresses[n_addresses];  | ||
| + |   };  | ||
| + | |||
| + | Subscribe for notifications of DHCPv6 messages from server:  | ||
| + | |||
| + |   /** \brief Register for DHCPv6 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_reply_events  | ||
| + |   {  | ||
| + |     u32 client_index;  | ||
| + |     u32 context;  | ||
| + |     u8 enable_disable;  | ||
| + |     u32 pid;  | ||
| + |   };  | ||
| + | |||
| + |   /** \brief Tell client about a DHCPv6 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_NA option  | ||
| + |       @param T2 - value of T2 in IA_NA option  | ||
| + |       @param inner_status_code - value of status code inside IA_NA option  | ||
| + |       @param status_code - value of status code  | ||
| + |       @param preference - value of preference option in reply message  | ||
| + |       @param n_addresses - number of addresses in IA_NA option  | ||
| + |       @param addresses - list of addresses in IA_NA option  | ||
| + |   */  | ||
| + |   define dhcp6_reply_event  | ||
| + |   {  | ||
| + |     u32 client_index;  | ||
| + |     u32 pid;  | ||
| + |     u32 sw_if_index;  | ||
| + |     u32 server_index;  | ||
| + |     u8 msg_type;  | ||
| + |     u32 T1;  | ||
| + |     u32 T2;  | ||
| + |     u16 inner_status_code;  | ||
| + |     u16 status_code;  | ||
| + |     u8 preference;  | ||
| + |     u32 n_addresses;  | ||
| + |     vl_api_dhcp6_address_info_t addresses[n_addresses];  | ||
   };  |    };  | ||
| Line 27: | Line 147: | ||
To enable/disable DHCPv6 prefix delegation client on an interface:  | To enable/disable DHCPv6 prefix delegation client on an interface:  | ||
| − |    dhcp6 pd client <interface>   | + |    dhcp6 pd client <interface> (prefix group <string> | disable)  | 
| − | To show the state of clients   | + | To show the state of clients, prefixes and addresses:  | 
   show ip6 pd clients  |    show ip6 pd clients  | ||
   show ip6 prefixes  |    show ip6 prefixes  | ||
| + |   show ip6 addresses  | ||
To add/delete IPv6 address potentially using available prefix from specified prefix group:  | To add/delete IPv6 address potentially using available prefix from specified prefix group:  | ||
| − |    set ip6   | + |    set ip6 address <interface> [prefix group <string>] <address> [del]  | 
==== Binary API: ====  | ==== Binary API: ====  | ||
| Line 41: | Line 162: | ||
       @param context - sender context, to match reply w/ request  |        @param context - sender context, to match reply w/ request  | ||
       @param sw_if_index - interface to enable/disable client on  |        @param sw_if_index - interface to enable/disable client on  | ||
| + |       @param prefix_group - name of prefix group (relevant when 'enable' is 1)  | ||
       @param enable - 1 to enable, 0 to disable  |        @param enable - 1 to enable, 0 to disable  | ||
   */  |    */  | ||
| Line 48: | Line 170: | ||
     u32 context;  |      u32 context;  | ||
     u32 sw_if_index;  |      u32 sw_if_index;  | ||
| + |     u8 prefix_group[64];  | ||
     u8 enable;  |      u8 enable;  | ||
   };  |    };  | ||
| Line 56: | Line 179: | ||
       @param sw_if_index - software interface index of interface  |        @param sw_if_index - software interface index of interface  | ||
                            to add/delete address to/from  |                             to add/delete address to/from  | ||
| − |        @param prefix_group - prefix group,  | + |        @param prefix_group - name of prefix group,  | 
| − | + |                              prefix_group[0] == '\0' means no prefix should be used  | |
| + |       @param address - address or suffix to be used with a prefix  | ||
| + |                        from selected group  | ||
| + |       @param prefix_length - subnet prefix for the address  | ||
| + |       @param is_add - 1 for add, 0 for remove  | ||
   */  |    */  | ||
| − |    autoreply define   | + |    autoreply define ip6_add_del_address_using_prefix  | 
   {  |    {  | ||
     u32 client_index;  |      u32 client_index;  | ||
     u32 context;  |      u32 context;  | ||
     u32 sw_if_index;  |      u32 sw_if_index;  | ||
| − | + |      u8 prefix_group[64];  | |
     u8 address[16];  |      u8 address[16];  | ||
     u8 prefix_length;  |      u8 prefix_length;  | ||
| Line 103: | Line 230: | ||
       @param client_index - opaque cookie to identify the sender  |        @param client_index - opaque cookie to identify the sender  | ||
       @param context - sender context, to match reply w/ request  |        @param context - sender context, to match reply w/ request  | ||
| − |        @param sw_if_index - index of TX interface  | + |        @param sw_if_index - index of TX interface  | 
       @param server_index - used to dentify DHCPv6 server,  |        @param server_index - used to dentify DHCPv6 server,  | ||
                             unique for each DHCPv6 server on the link,  |                              unique for each DHCPv6 server on the link,  | ||
| Line 158: | Line 285: | ||
       @param client_index - opaque cookie to identify the sender  |        @param client_index - opaque cookie to identify the sender  | ||
       @param pid - client pid registered to receive notification  |        @param pid - client pid registered to receive notification  | ||
| − |        @param sw_if_index - index of RX interface  | + |        @param sw_if_index - index of RX interface  | 
       @param server_index - used to dentify DHCPv6 server,  |        @param server_index - used to dentify DHCPv6 server,  | ||
                             unique for each DHCPv6 server on the link  |                              unique for each DHCPv6 server on the link  | ||
| Line 164: | Line 291: | ||
       @param T1 - value of T1 in IA_PD option  |        @param T1 - value of T1 in IA_PD option  | ||
       @param T2 - value of T2 in IA_PD option  |        @param T2 - value of T2 in IA_PD option  | ||
| + |       @param inner_status_code - value of status code inside IA_PD option  | ||
       @param status_code - value of status code  |        @param status_code - value of status code  | ||
       @param preference - value of preference option in reply message  |        @param preference - value of preference option in reply message  | ||
| Line 178: | Line 306: | ||
     u32 T1;  |      u32 T1;  | ||
     u32 T2;  |      u32 T2;  | ||
| + |     u16 inner_status_code;  | ||
     u16 status_code;  |      u16 status_code;  | ||
     u8 preference;  |      u8 preference;  | ||
Latest revision as of 19:50, 21 June 2018
Contents
DHCPv6
DHCPv6 IA_NA
Control Plane
To enable/disable DHCPv6 IA_NA client on an interface:
dhcp6 client <interface> [disable]
To show the state of clients and addresses:
show dhcp6 clients show dhcp6 addresses
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;
 };
Data Plane
Binary API:
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 address
     @param address - address
     @param valid_time - valid lifetime
     @param preferred_time - preferred lifetime
 */
 typeonly define dhcp6_address_info
 {
   u8 address[16];
   u32 valid_time;
   u32 preferred_time;
 };
 
 /** \brief Send DHCPv6 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_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_NA option
     @param T2 - value of T2 in IA_NA option
     @param n_addresses - number of addresses in IA_NA option
     @param addresses - list of addresses in IA_NA option
 */
 autoreply define dhcp6_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_addresses;
   vl_api_dhcp6_address_info_t addresses[n_addresses];
 };
Subscribe for notifications of DHCPv6 messages from server:
 /** \brief Register for DHCPv6 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_reply_events
 {
   u32 client_index;
   u32 context;
   u8 enable_disable;
   u32 pid;
 };
 
 /** \brief Tell client about a DHCPv6 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_NA option
     @param T2 - value of T2 in IA_NA option
     @param inner_status_code - value of status code inside IA_NA option
     @param status_code - value of status code
     @param preference - value of preference option in reply message
     @param n_addresses - number of addresses in IA_NA option
     @param addresses - list of addresses in IA_NA option
 */
 define dhcp6_reply_event
 {
   u32 client_index;
   u32 pid;
   u32 sw_if_index;
   u32 server_index;
   u8 msg_type;
   u32 T1;
   u32 T2;
   u16 inner_status_code;
   u16 status_code;
   u8 preference;
   u32 n_addresses;
   vl_api_dhcp6_address_info_t addresses[n_addresses];
 };
DHCPv6 prefix delegation
Control Plane
To enable/disable DHCPv6 prefix delegation client on an interface:
dhcp6 pd client <interface> (prefix group <string> | disable)
To show the state of clients, prefixes and addresses:
show ip6 pd clients show ip6 prefixes show ip6 addresses
To add/delete IPv6 address potentially using available prefix from specified prefix group:
set ip6 address <interface> [prefix group <string>] <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 prefix_group - name of prefix group (relevant when 'enable' is 1)
     @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 prefix_group[64];
   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 - name of prefix group,
                           prefix_group[0] == '\0' means no prefix should be used
     @param address - address or suffix to be used with a prefix
                      from selected group
     @param prefix_length - subnet prefix for the address
     @param is_add - 1 for add, 0 for remove
 */
 autoreply define ip6_add_del_address_using_prefix
 {
   u32 client_index;
   u32 context;
   u32 sw_if_index;
   u8 prefix_group[64];
   u8 address[16];
   u8 prefix_length;
   u8 is_add;
 };
Data Plane
Binary API:
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
     @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
     @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 inner_status_code - value of status code inside 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 inner_status_code;
   u16 status_code;
   u8 preference;
   u32 n_prefixes;
   vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes];
 };