- if (is_ipv6)
- {
- clib_memcpy (rmp->src_address, &t->tunnel_src.ip6.as_u8, 16);
- clib_memcpy (rmp->dst_address, &t->tunnel_dst.ip6.as_u8, 16);
- ft = fib_table_get (t->fib_index, FIB_PROTOCOL_IP6);
- rmp->fib_index = htonl (ft->ft_table_id);
- }
- else
- {
- clib_memcpy (rmp->src_address, &t->tunnel_src.ip4.as_u8, 4);
- clib_memcpy (rmp->dst_address, &t->tunnel_dst.ip4.as_u8, 4);
- ft = fib_table_get (t->fib_index, FIB_PROTOCOL_IP4);
- rmp->fib_index = htonl (ft->ft_table_id);
- }
- rmp->instance = htonl (t->user_instance);
- rmp->sw_if_index = htonl (t->sw_if_index);
+
+ ip_address_encode (&t->tunnel_src, IP46_TYPE_ANY, &rmp->tunnel.src);
+ ip_address_encode (&t->tunnel_dst, IP46_TYPE_ANY, &rmp->tunnel.dst);
+
+ ft = fib_table_get (t->fib_index, (is_ipv6 ? FIB_PROTOCOL_IP6 :
+ FIB_PROTOCOL_IP4));
+
+ rmp->tunnel.table_id = htonl (ft->ft_table_id);
+ rmp->tunnel.instance = htonl (t->user_instance);
+ rmp->tunnel.sw_if_index = htonl (t->sw_if_index);