A Protocol Independent Hierarchical FIB (VPP-352)
[vpp.git] / vnet / vnet / dhcpv6 / proxy_node.c
index 01f5965..323bdf9 100644 (file)
@@ -18,6 +18,7 @@
 #include <vlib/vlib.h>
 #include <vnet/pg/pg.h>
 #include <vnet/dhcpv6/proxy.h>
+#include <vnet/fib/ip6_fib.h>
 
 static char * dhcpv6_proxy_error_strings[] = {
 #define dhcpv6_proxy_error(n,s) s,
@@ -201,8 +202,7 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm,
          b0 = vlib_get_buffer (vm, bi0);
        
           h0 = vlib_buffer_get_current (b0);
-          e_h0 = (ethernet_header_t *)b0->data;
-          clib_memcpy(client_src_mac, e_h0->src_address, 6);
+
           /* Send to DHCPV6 server via the configured FIB */
           vnet_buffer(b0)->sw_if_index[VLIB_TX] =
               dpm->server_fib_index;
@@ -212,6 +212,9 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm,
            */
           u0 = (void *)h0 -(sizeof(*u0));
           ip0 = (void *)u0 -(sizeof(*ip0));
+          e_h0 = (void *)ip0 - ethernet_buffer_header_size(b0);
+
+          clib_memcpy(client_src_mac, e_h0->src_address, 6);
 
           switch (h0->u.msg_type) {
             case DHCPV6_MSG_SOLICIT:
@@ -321,7 +324,7 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm,
 
           fib_index = im->fib_index_by_sw_if_index 
               [vnet_buffer(b0)->sw_if_index[VLIB_RX]];
-          fib = vec_elt_at_index (im->fibs, fib_index);
+          fib = ip6_fib_get (fib_index);
           fib_id = fib->table_id;
 
           p_vss = hash_get (dpm->vss_index_by_vrf_id,
@@ -571,7 +574,7 @@ dhcpv6_proxy_to_client_input (vlib_main_t * vm,
 
       svr_fib_index = im->fib_index_by_sw_if_index
           [vnet_buffer(b0)->sw_if_index[VLIB_RX]];
-      svr_fib = vec_elt_at_index (im->fibs, svr_fib_index);
+      svr_fib = ip6_fib_get (svr_fib_index);
       svr_fib_id = svr_fib->table_id;
 
       if (svr_fib_id != dpm->server_fib_index ||
@@ -829,8 +832,7 @@ u8 * format_dhcpv6_proxy_server (u8 * s, va_list * args)
       return s;
     }
 
-  f = find_ip6_fib_by_table_index_or_id (&ip6_main, dm->server_fib_index,
-                                         IP6_ROUTE_FLAG_FIB_INDEX);
+  f = ip6_fib_get (dm->server_fib_index);
   if (f)
     fib_id = f->table_id;