octeon: add support for mac address update
[vpp.git] / src / plugins / dhcp / dhcp6_ia_na_client_cp.c
1 /*
2  * Copyright (c) 2018 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #include <vnet/vnet.h>
17 #include <vlibmemory/api.h>
18 #include <dhcp/dhcp6_packet.h>
19 #include <dhcp/dhcp6_ia_na_client_dp.h>
20 #include <vnet/ip/ip.h>
21 #include <vnet/ip/ip6.h>
22 #include <vnet/ip/ip6_link.h>
23 #include <float.h>
24 #include <math.h>
25
26 typedef struct
27 {
28   u32 sw_if_index;
29   ip6_address_t address;
30   u32 preferred_lt;
31   u32 valid_lt;
32   f64 due_time;
33 } address_info_t;
34
35 typedef struct
36 {
37   u8 enabled;
38   u32 server_index;
39   u32 T1;
40   u32 T2;
41   f64 T1_due_time;
42   f64 T2_due_time;
43   u32 address_count;
44   u8 rebinding;
45 } client_state_t;
46
47 typedef struct
48 {
49   address_info_t *address_pool;
50   client_state_t *client_state_by_sw_if_index;
51   u32 n_clients;
52   f64 max_valid_due_time;
53
54   /* convenience */
55   vlib_main_t *vlib_main;
56   vnet_main_t *vnet_main;
57   api_main_t *api_main;
58   u32 node_index;
59 } dhcp6_client_cp_main_t;
60
61 static dhcp6_client_cp_main_t dhcp6_client_cp_main;
62
63 enum
64 {
65   RD_CP_EVENT_INTERRUPT,
66   RD_CP_EVENT_DISABLE,
67 };
68
69 static void
70 send_client_message_start_stop (u32 sw_if_index, u32 server_index,
71                                 u8 msg_type, address_info_t * address_list,
72                                 u8 start)
73 {
74   dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
75   dhcp6_send_client_message_params_t params = { 0, };
76   dhcp6_send_client_message_params_address_t *addresses = 0, *addr;
77   u32 i;
78
79   ASSERT (sw_if_index < vec_len (rm->client_state_by_sw_if_index) &&
80           rm->client_state_by_sw_if_index[sw_if_index].enabled);
81   client_state_t *client_state =
82     &rm->client_state_by_sw_if_index[sw_if_index];
83
84   params.sw_if_index = sw_if_index;
85   params.server_index = server_index;
86   params.msg_type = msg_type;
87   if (start)
88     {
89       if (msg_type == DHCPV6_MSG_SOLICIT)
90         {
91           params.irt = 1;
92           params.mrt = 120;
93         }
94       else if (msg_type == DHCPV6_MSG_REQUEST)
95         {
96           params.irt = 1;
97           params.mrt = 30;
98           params.mrc = 10;
99         }
100       else if (msg_type == DHCPV6_MSG_RENEW)
101         {
102           params.irt = 10;
103           params.mrt = 600;
104           f64 current_time = vlib_time_now (rm->vlib_main);
105           i32 diff_time = client_state->T2 - current_time;
106           if (diff_time < 0)
107             diff_time = 0;
108           params.mrd = diff_time;
109         }
110       else if (msg_type == DHCPV6_MSG_REBIND)
111         {
112           params.irt = 10;
113           params.mrt = 600;
114           f64 current_time = vlib_time_now (rm->vlib_main);
115           i32 diff_time = rm->max_valid_due_time - current_time;
116           if (diff_time < 0)
117             diff_time = 0;
118           params.mrd = diff_time;
119         }
120       else if (msg_type == DHCPV6_MSG_RELEASE)
121         {
122           params.mrc = 1;
123         }
124     }
125
126   params.T1 = 0;
127   params.T2 = 0;
128   if (vec_len (address_list) != 0)
129     vec_validate (addresses, vec_len (address_list) - 1);
130   for (i = 0; i < vec_len (address_list); i++)
131     {
132       address_info_t *address = &address_list[i];
133       addr = &addresses[i];
134       addr->valid_lt = address->valid_lt;
135       addr->preferred_lt = address->preferred_lt;
136       addr->address = address->address;
137     }
138   params.addresses = addresses;
139
140   dhcp6_send_client_message (rm->vlib_main, sw_if_index, !start, &params);
141
142   vec_free (params.addresses);
143 }
144
145 static void interrupt_process (void);
146
147 static u8
148 ip6_addresses_equal (ip6_address_t * address1, ip6_address_t * address2)
149 {
150   if (address1->as_u64[0] != address2->as_u64[0])
151     return 0;
152   return address1->as_u64[1] == address2->as_u64[1];
153 }
154
155 static clib_error_t *
156 dhcp6_reply_event_handler (vl_api_dhcp6_reply_event_t * mp)
157 {
158   dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
159   vlib_main_t *vm = rm->vlib_main;
160   client_state_t *client_state;
161   ip6_address_t *address;
162   u32 sw_if_index;
163   u32 n_addresses;
164   vl_api_dhcp6_address_info_t *api_address;
165   u32 inner_status_code;
166   u32 status_code;
167   u32 server_index;
168   f64 current_time;
169   clib_error_t *error = 0;
170   u32 i;
171
172   current_time = vlib_time_now (vm);
173
174   sw_if_index = ntohl (mp->sw_if_index);
175
176   if (sw_if_index >= vec_len (rm->client_state_by_sw_if_index))
177     return 0;
178
179   client_state = &rm->client_state_by_sw_if_index[sw_if_index];
180
181   if (!client_state->enabled)
182     return 0;
183
184   server_index = ntohl (mp->server_index);
185
186   n_addresses = ntohl (mp->n_addresses);
187
188   inner_status_code = ntohs (mp->inner_status_code);
189   status_code = ntohs (mp->status_code);
190
191   if (mp->msg_type == DHCPV6_MSG_API_ADVERTISE
192       && client_state->server_index == ~0)
193     {
194       address_info_t *address_list = 0, *address_info;
195
196       if (inner_status_code == DHCPV6_STATUS_NOADDRS_AVAIL)
197         {
198           clib_warning
199             ("Advertise message arrived with NoAddrsAvail status code");
200           return 0;
201         }
202
203       if (n_addresses > 0)
204         vec_validate (address_list, n_addresses - 1);
205       for (i = 0; i < n_addresses; i++)
206         {
207           api_address = &mp->addresses[i];
208           address = (ip6_address_t *) api_address->address;
209
210           address_info = &address_list[i];
211           address_info->address = *address;
212           address_info->preferred_lt = 0;
213           address_info->valid_lt = 0;
214         }
215
216       client_state->server_index = server_index;
217
218       send_client_message_start_stop (sw_if_index, server_index,
219                                       DHCPV6_MSG_REQUEST, address_list, 1);
220       vec_free (address_list);
221     }
222
223   if (mp->msg_type != DHCPV6_MSG_API_REPLY)
224     return 0;
225
226   if (!client_state->rebinding && client_state->server_index != server_index)
227     {
228       clib_warning ("Reply message arrived with Server ID different "
229                     "from that in Request or Renew message");
230       return 0;
231     }
232
233   if (inner_status_code == DHCPV6_STATUS_NOADDRS_AVAIL)
234     {
235       clib_warning ("Reply message arrived with NoAddrsAvail status code");
236       if (n_addresses > 0)
237         {
238           clib_warning
239             ("Invalid Reply message arrived: It contains NoAddrsAvail "
240              "status code but also contains addresses");
241           return 0;
242         }
243     }
244
245   if (status_code == DHCPV6_STATUS_UNSPEC_FAIL)
246     {
247       clib_warning ("Reply message arrived with UnspecFail status code");
248       return 0;
249     }
250
251   send_client_message_start_stop (sw_if_index, server_index,
252                                   mp->msg_type, 0, 0);
253
254   for (i = 0; i < n_addresses; i++)
255     {
256       address_info_t *address_info = 0;
257       u32 valid_time;
258       u32 preferred_time;
259
260       api_address = &mp->addresses[i];
261
262       address = (ip6_address_t *) api_address->address;
263
264       if (ip6_address_is_link_local_unicast (address))
265         continue;
266
267       valid_time = ntohl (api_address->valid_time);
268       preferred_time = ntohl (api_address->preferred_time);
269
270       if (preferred_time > valid_time)
271         continue;
272
273       u8 address_already_present = 0;
274       pool_foreach (address_info, rm->address_pool)
275        {
276         if (address_info->sw_if_index != sw_if_index)
277           ;
278         else if (!ip6_addresses_equal (&address_info->address, address))
279           ;
280         else
281           {
282             address_already_present = 1;
283             goto address_pool_foreach_out;
284           }
285       }
286     address_pool_foreach_out:
287
288       if (address_already_present)
289         {
290           address_info->preferred_lt = preferred_time;
291           address_info->valid_lt = valid_time;
292           address_info->due_time = current_time;
293           /* Renew the lease at the preferred time, if non-zero */
294           address_info->due_time += (preferred_time > 0) ?
295             preferred_time : valid_time;
296
297           if (address_info->due_time > rm->max_valid_due_time)
298             rm->max_valid_due_time = address_info->due_time;
299           continue;
300         }
301
302       if (valid_time == 0)
303         continue;
304
305       pool_get (rm->address_pool, address_info);
306       address_info->sw_if_index = sw_if_index;
307       address_info->address = *address;
308       address_info->preferred_lt = preferred_time;
309       address_info->valid_lt = valid_time;
310       address_info->due_time = current_time;
311       /* Renew the lease at the preferred time, if non-zero */
312       address_info->due_time += (preferred_time > 0) ?
313         preferred_time : valid_time;
314
315       if (address_info->due_time > rm->max_valid_due_time)
316         rm->max_valid_due_time = address_info->due_time;
317       rm->client_state_by_sw_if_index[sw_if_index].address_count++;
318
319       error = ip6_add_del_interface_address (vm, sw_if_index,
320                                              &address_info->address, 64, 0);
321       if (error)
322         clib_warning ("Failed to add interface address");
323     }
324
325   client_state->server_index = server_index;
326   client_state->T1 = ntohl (mp->T1);
327   client_state->T2 = ntohl (mp->T2);
328   if (client_state->T1 != 0)
329     client_state->T1_due_time = current_time + client_state->T1;
330   if (client_state->T2 != 0)
331     client_state->T2_due_time = current_time + client_state->T2;
332   client_state->rebinding = 0;
333
334   interrupt_process ();
335
336   return error;
337 }
338
339 static address_info_t *
340 create_address_list (u32 sw_if_index)
341 {
342   dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
343   address_info_t *address_info, *address_list = 0;;
344
345   pool_foreach (address_info, rm->address_pool)
346    {
347     if (address_info->sw_if_index == sw_if_index)
348       {
349         u32 pos = vec_len (address_list);
350         vec_validate (address_list, pos);
351         clib_memcpy (&address_list[pos], address_info, sizeof (*address_info));
352       }
353   }
354
355   return address_list;
356 }
357
358 VNET_DHCP6_REPLY_EVENT_FUNCTION (dhcp6_reply_event_handler);
359
360 static uword
361 dhcp6_client_cp_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
362                          vlib_frame_t * f)
363 {
364   dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
365   address_info_t *address_info;
366   client_state_t *client_state;
367   f64 sleep_time = 1e9;
368   clib_error_t *error;
369   f64 current_time;
370   f64 due_time;
371   uword event_type;
372   uword *event_data = 0;
373   int i;
374
375   while (1)
376     {
377       vlib_process_wait_for_event_or_clock (vm, sleep_time);
378       event_type = vlib_process_get_events (vm, &event_data);
379       vec_reset_length (event_data);
380
381       if (event_type == RD_CP_EVENT_DISABLE)
382         {
383           vlib_node_set_state (vm, rm->node_index, VLIB_NODE_STATE_DISABLED);
384           sleep_time = 1e9;
385           continue;
386         }
387
388       current_time = vlib_time_now (vm);
389       do
390         {
391           due_time = current_time + 1e9;
392           pool_foreach (address_info, rm->address_pool)
393            {
394             if (address_info->due_time > current_time)
395               {
396                 if (address_info->due_time < due_time)
397                   due_time = address_info->due_time;
398               }
399             else
400               {
401                 u32 sw_if_index = address_info->sw_if_index;
402                 error = ip6_add_del_interface_address (vm, sw_if_index,
403                                                        &address_info->address,
404                                                        64, 1);
405                 if (error)
406                     clib_warning ("Failed to delete interface address");
407                 pool_put (rm->address_pool, address_info);
408                 /* make sure ip6 stays enabled */
409                 ip6_link_enable (sw_if_index, NULL);
410                 client_state = &rm->client_state_by_sw_if_index[sw_if_index];
411                 if (--client_state->address_count == 0)
412                   {
413                     client_state->rebinding = 0;
414                     client_state->server_index = ~0;
415                     send_client_message_start_stop (sw_if_index, ~0,
416                                                     DHCPV6_MSG_SOLICIT,
417                                                     0, 1);
418                   }
419               }
420           }
421           for (i = 0; i < vec_len (rm->client_state_by_sw_if_index); i++)
422             {
423               client_state_t *cs = &rm->client_state_by_sw_if_index[i];
424               if (cs->enabled && cs->server_index != ~0)
425                 {
426                   if (cs->T2_due_time > current_time)
427                     {
428                       if (cs->T2_due_time < due_time)
429                         due_time = cs->T2_due_time;
430                       if (cs->T1_due_time > current_time)
431                         {
432                           if (cs->T1_due_time < due_time)
433                             due_time = cs->T1_due_time;
434                         }
435                       else
436                         {
437                           cs->T1_due_time = DBL_MAX;
438                           address_info_t *address_list;
439                           address_list = create_address_list (i);
440                           cs->rebinding = 1;
441                           send_client_message_start_stop (i, cs->server_index,
442                                                           DHCPV6_MSG_RENEW,
443                                                           address_list, 1);
444                           vec_free (address_list);
445                         }
446                     }
447                   else
448                     {
449                       cs->T2_due_time = DBL_MAX;
450                       address_info_t *address_list;
451                       address_list = create_address_list (i);
452                       cs->rebinding = 1;
453                       send_client_message_start_stop (i, ~0,
454                                                       DHCPV6_MSG_REBIND,
455                                                       address_list, 1);
456                       vec_free (address_list);
457                     }
458                 }
459             }
460           current_time = vlib_time_now (vm);
461         }
462       while (due_time < current_time);
463
464       sleep_time = due_time - current_time;
465     }
466
467   return 0;
468 }
469
470 VLIB_REGISTER_NODE (dhcp6_client_cp_process_node) = {
471     .function = dhcp6_client_cp_process,
472     .type = VLIB_NODE_TYPE_PROCESS,
473     .name = "dhcp6-client-cp-process",
474 };
475
476 static void
477 interrupt_process (void)
478 {
479   dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
480   vlib_main_t *vm = rm->vlib_main;
481
482   vlib_process_signal_event (vm, dhcp6_client_cp_process_node.index,
483                              RD_CP_EVENT_INTERRUPT, 0);
484 }
485
486 static void
487 disable_process (void)
488 {
489   dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
490   vlib_main_t *vm = rm->vlib_main;
491
492   vlib_process_signal_event (vm, dhcp6_client_cp_process_node.index,
493                              RD_CP_EVENT_DISABLE, 0);
494 }
495
496 static void
497 enable_process (void)
498 {
499   dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
500   vlib_main_t *vm = rm->vlib_main;
501   vlib_node_t *node;
502
503   node = vec_elt (vm->node_main.nodes, rm->node_index);
504
505   vlib_node_set_state (vm, rm->node_index, VLIB_NODE_STATE_POLLING);
506   vlib_start_process (vm, node->runtime_index);
507 }
508
509 static clib_error_t *
510 dhcp6_addresses_show_command_function (vlib_main_t * vm,
511                                        unformat_input_t * input,
512                                        vlib_cli_command_t * cmd)
513 {
514   dhcp6_client_cp_main_t *dm = &dhcp6_client_cp_main;
515   clib_error_t *error = 0;
516   address_info_t *address_info;
517   f64 current_time = vlib_time_now (vm);
518
519   pool_foreach (address_info, dm->address_pool)
520    {
521     vlib_cli_output (vm, "address: %U, "
522                      "preferred lifetime: %u, valid lifetime: %u "
523                      "(%f remaining)",
524                      format_ip6_address, &address_info->address,
525                      address_info->preferred_lt, address_info->valid_lt,
526                      address_info->due_time - current_time);
527   }
528
529   return error;
530 }
531
532 VLIB_CLI_COMMAND (dhcp6_addresses_show_command, static) = {
533   .path = "show dhcp6 addresses",
534   .short_help = "show dhcp6 addresses",
535   .function = dhcp6_addresses_show_command_function,
536 };
537
538 static clib_error_t *
539 dhcp6_clients_show_command_function (vlib_main_t * vm,
540                                      unformat_input_t * input,
541                                      vlib_cli_command_t * cmd)
542 {
543   dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
544   clib_error_t *error = 0;
545   client_state_t *cs;
546   f64 current_time = vlib_time_now (vm);
547   u8 *buf1 = 0;
548   u8 *buf2 = 0;
549   const char *rebinding;
550   u32 i;
551
552   for (i = 0; i < vec_len (rm->client_state_by_sw_if_index); i++)
553     {
554       cs = &rm->client_state_by_sw_if_index[i];
555       if (cs->enabled)
556         {
557           vec_reset_length (buf1);
558           vec_reset_length (buf2);
559           if (cs->T1_due_time != DBL_MAX && cs->T1_due_time > current_time)
560             {
561               buf1 = format (buf1, "%u remaining",
562                              (u32) round (cs->T1_due_time - current_time));
563             }
564           else
565             buf1 = format (buf1, "timeout");
566           if (cs->T2_due_time != DBL_MAX && cs->T2_due_time > current_time)
567             buf2 = format (buf2, "%u remaining",
568                            (u32) round (cs->T2_due_time - current_time));
569           else
570             buf2 = format (buf2, "timeout");
571           if (cs->rebinding)
572             rebinding = ", REBINDING";
573           else
574             rebinding = "";
575           if (cs->T1)
576             vlib_cli_output (vm,
577                              "sw_if_index: %u, T1: %u (%v), "
578                              "T2: %u (%v), server index: %d%s", i,
579                              cs->T1, buf1, cs->T2, buf2,
580                              cs->server_index, rebinding);
581           else
582             vlib_cli_output (vm, "sw_if_index: %u%s", i, rebinding);
583         }
584     }
585
586   vec_free (buf1);
587   vec_free (buf2);
588
589   return error;
590 }
591
592 VLIB_CLI_COMMAND (dhcp6_clients_show_command, static) = {
593   .path = "show dhcp6 clients",
594   .short_help = "show dhcp6 clients",
595   .function = dhcp6_clients_show_command_function,
596 };
597
598 int
599 dhcp6_client_enable_disable (u32 sw_if_index, u8 enable)
600 {
601   dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
602   vnet_main_t *vnm = rm->vnet_main;
603   vlib_main_t *vm = rm->vlib_main;
604   client_state_t *client_state;
605   client_state_t empty_config = { 0 };
606   address_info_t *address_info;
607   clib_error_t *error;
608
609   if (!vnet_sw_interface_is_api_valid (vnm, sw_if_index))
610     {
611       clib_warning ("Invalid sw_if_index");
612       return 1;
613     }
614
615   vec_validate_init_empty (rm->client_state_by_sw_if_index, sw_if_index,
616                            empty_config);
617   client_state = &rm->client_state_by_sw_if_index[sw_if_index];
618
619   u8 old_enabled = client_state->enabled;
620   if (enable)
621     client_state->enabled = 1;
622   client_state->server_index = ~0;
623
624   if (!old_enabled && enable)
625     {
626       rm->n_clients++;
627       if (rm->n_clients == 1)
628         {
629           enable_process ();
630           dhcp6_clients_enable_disable (1);
631         }
632
633       ip6_link_enable (sw_if_index, NULL);
634       send_client_message_start_stop (sw_if_index, ~0, DHCPV6_MSG_SOLICIT,
635                                       0, 1);
636     }
637   else if (old_enabled && !enable)
638     {
639       send_client_message_start_stop (sw_if_index, ~0, ~0, 0, 0);
640
641       rm->n_clients--;
642       if (rm->n_clients == 0)
643         {
644           dhcp6_clients_enable_disable (0);
645           disable_process ();
646         }
647
648       pool_foreach (address_info, rm->address_pool)
649        {
650         if (address_info->sw_if_index == sw_if_index)
651           {
652             ASSERT (sw_if_index < vec_len (rm->client_state_by_sw_if_index) &&
653                     rm->client_state_by_sw_if_index[sw_if_index].enabled);
654             client_state_t *client_state =
655               &rm->client_state_by_sw_if_index[sw_if_index];
656             send_client_message_start_stop (sw_if_index,
657                                             client_state->server_index,
658                                             DHCPV6_MSG_RELEASE, address_info,
659                                             1);
660             error = ip6_add_del_interface_address (vm, sw_if_index,
661                                                    &address_info->address,
662                                                    64, 1);
663             if (error)
664                 clib_warning ("Failed to delete interface address");
665             pool_put (rm->address_pool, address_info);
666           }
667       }
668     }
669
670   if (!enable)
671     client_state->enabled = 0;
672
673   return 0;
674 }
675
676 static clib_error_t *
677 dhcp6_client_enable_disable_command_fn (vlib_main_t * vm,
678                                         unformat_input_t * input,
679                                         vlib_cli_command_t * cmd)
680 {
681   dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
682   vnet_main_t *vnm = rm->vnet_main;
683   clib_error_t *error = 0;
684   u32 sw_if_index = ~0;
685   u8 enable = 1;
686   unformat_input_t _line_input, *line_input = &_line_input;
687
688   if (!unformat_user (input, unformat_line_input, line_input))
689     return 0;
690
691   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
692     {
693       if (unformat
694           (line_input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
695         ;
696       else if (unformat (line_input, "disable"))
697         enable = 0;
698       else
699         {
700           error = clib_error_return (0, "unexpected input `%U'",
701                                      format_unformat_error, line_input);
702           goto done;
703         }
704     }
705
706   unformat_free (line_input);
707
708   if (sw_if_index != ~0)
709     {
710       if (dhcp6_client_enable_disable (sw_if_index, enable) != 0)
711         error = clib_error_return (0, "Invalid sw_if_index");
712     }
713   else
714     error = clib_error_return (0, "Missing sw_if_index");
715
716 done:
717   return error;
718 }
719
720 /*?
721  * This command is used to enable/disable DHCPv6 client
722  * on particular interface.
723  *
724  * @cliexpar
725  * @parblock
726  * Example of how to enable DHCPv6 client:
727  * @cliexcmd{dhcp6 client GigabitEthernet2/0/0}
728  * Example of how to disable DHCPv6 client:
729  * @cliexcmd{dhcp6 client GigabitEthernet2/0/0 disable}
730  * @endparblock
731 ?*/
732 VLIB_CLI_COMMAND (dhcp6_client_enable_disable_command, static) = {
733   .path = "dhcp6 client",
734   .short_help = "dhcp6 client <interface> [disable]",
735   .function = dhcp6_client_enable_disable_command_fn,
736 };
737
738 static clib_error_t *
739 dhcp_ia_na_client_cp_init (vlib_main_t * vm)
740 {
741   dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
742
743   rm->vlib_main = vm;
744   rm->vnet_main = vnet_get_main ();
745   rm->api_main = vlibapi_get_main ();
746   rm->node_index = dhcp6_client_cp_process_node.index;
747
748   return NULL;
749 }
750
751 VLIB_INIT_FUNCTION (dhcp_ia_na_client_cp_init);
752
753 /*
754  * fd.io coding-style-patch-verification: ON
755  *
756  * Local Variables:
757  * eval: (c-set-style "gnu")
758  * End:
759  */