aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip_types_api.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/vnet/ip/ip_types_api.c b/src/vnet/ip/ip_types_api.c
index 2e92e723772..d201d387f02 100644
--- a/src/vnet/ip/ip_types_api.c
+++ b/src/vnet/ip/ip_types_api.c
@@ -253,8 +253,24 @@ void
ip_prefix_encode (const fib_prefix_t * in, vl_api_prefix_t * out)
{
out->len = in->fp_len;
- ip_address_encode (&in->fp_addr,
- fib_proto_to_ip46 (in->fp_proto), &out->address);
+ ip46_type_t ip46_type;
+
+ switch (in->fp_proto)
+ {
+ case FIB_PROTOCOL_IP4:
+ ip46_type = (IP46_TYPE_IP4);
+ break;
+ case FIB_PROTOCOL_IP6:
+ ip46_type = (IP46_TYPE_IP6);
+ break;
+ case FIB_PROTOCOL_MPLS:
+ ip46_type = (IP46_TYPE_ANY);
+ break;
+ default:
+ ip46_type = (IP46_TYPE_ANY);
+ }
+
+ ip_address_encode (&in->fp_addr, ip46_type, &out->address);
}
void