- if (!is_ipv6)
- {
- clib_memcpy (rmp->src_address, &(t->tunnel_src.ip4.as_u8), 4);
- clib_memcpy (rmp->dst_address, &(t->tunnel_dst.fp_addr.ip4.as_u8), 4);
- ft = fib_table_get (t->outer_fib_index, FIB_PROTOCOL_IP4);
- rmp->outer_fib_id = htonl (ft->ft_table_id);
- }
- else
- {
- clib_memcpy (rmp->src_address, &(t->tunnel_src.ip6.as_u8), 16);
- clib_memcpy (rmp->dst_address, &(t->tunnel_dst.fp_addr.ip6.as_u8), 16);
- ft = fib_table_get (t->outer_fib_index, FIB_PROTOCOL_IP6);
- rmp->outer_fib_id = htonl (ft->ft_table_id);
- }
- rmp->tunnel_type = t->type;
- rmp->instance = htonl (t->user_instance);
- rmp->sw_if_index = htonl (t->sw_if_index);
- rmp->session_id = htons (t->session_id);
+
+ ip_address_encode (&t->tunnel_src, IP46_TYPE_ANY, &rmp->tunnel.src);
+ ip_address_encode (&t->tunnel_dst.fp_addr, IP46_TYPE_ANY, &rmp->tunnel.dst);
+
+ rmp->tunnel.outer_table_id =
+ htonl (fib_table_get_table_id
+ (t->outer_fib_index, t->tunnel_dst.fp_proto));
+
+ rmp->tunnel.type = gre_tunnel_type_encode (t->type);
+ rmp->tunnel.mode = tunnel_mode_encode (t->mode);
+ rmp->tunnel.instance = htonl (t->user_instance);
+ rmp->tunnel.sw_if_index = htonl (t->sw_if_index);
+ rmp->tunnel.session_id = htons (t->session_id);
+