diff --git a/src/plugins/unittest/lisp_cp_test.c b/src/plugins/unittest/lisp_cp_test.c
index cda2c52..3480b8c 100644
--- a/src/plugins/unittest/lisp_cp_test.c
+++ b/src/plugins/unittest/lisp_cp_test.c
@@ -82,11 +82,11 @@
 
   la.type = GID_ADDR_IP_PREFIX;
   la.ippref.addr.ip.v4.as_u32 = 0xa1b2c3d4;
-  la.ippref.addr.version = IP4;
+  la.ippref.addr.version = AF_IP4;
 
   ra.type = GID_ADDR_IP_PREFIX;
   ra.ippref.addr.ip.v4.as_u32 = 0x90817263;
-  ra.ippref.addr.version = IP4;
+  ra.ippref.addr.version = AF_IP4;
 
   ecm_hdr_t *lh = lisp_msg_push_ecm (vm, b, lp, rp, &la, &ra);
 
@@ -206,12 +206,12 @@
   gid_address_type (seid) = GID_ADDR_IP_PREFIX;
   ip_address_t *ip_addr = &gid_address_ip (seid);
   ip_addr_v4 (ip_addr).as_u32 = 0x12345678;
-  seid->ippref.addr.version = IP4;
+  seid->ippref.addr.version = AF_IP4;
 
   gid_address_type (deid) = GID_ADDR_IP_PREFIX;
   ip_address_t *ip_addr2 = &gid_address_ip (deid);
   ip_addr_v4 (ip_addr2).as_u32 = 0x9abcdef0;
-  deid->ippref.addr.version = IP4;
+  deid->ippref.addr.version = AF_IP4;
   gid_address_ippref_len (deid) = 24;
 
   h = lisp_msg_put_mreq (lcm, b, seid, deid, rlocs,
@@ -229,7 +229,7 @@
 
   gid_address_type (gid_addr) = GID_ADDR_IP_PREFIX;
 
-  ip_addr_version (addr) = IP4;
+  ip_addr_version (addr) = AF_IP4;
   ip_addr_v4 (addr).data_u32 = 0x10203040;
   vec_add1 (rlocs[0], gid_addr[0]);
 
@@ -237,7 +237,7 @@
   ip_addr_v6 (addr).as_u32[1] = 0xbbaa9988;
   ip_addr_v6 (addr).as_u32[2] = 0x77665544;
   ip_addr_v6 (addr).as_u32[3] = 0x33221100;
-  ip_addr_version (addr) = IP6;
+  ip_addr_version (addr) = AF_IP6;
   vec_add1 (rlocs[0], gid_addr[0]);
 }
 
@@ -265,24 +265,24 @@
   _assert (len == 2 + 4
 	   /* Source-EID-AFI field lenght + IPv4 address length */ );
   _assert (gid.ippref.addr.ip.v4.as_u32 == 0x12345678);
-  _assert (gid.ippref.addr.version == IP4);
+  _assert (gid.ippref.addr.version == AF_IP4);
 
   u8 rloc_count = MREQ_ITR_RLOC_COUNT (h) + 1;
   lisp_msg_parse_itr_rlocs (b, &rlocs, rloc_count);
 
   _assert (vec_len (rlocs) == 2);
   _assert (rlocs[0].ippref.addr.ip.v4.as_u32 == 0x10203040);
-  _assert (rlocs[0].ippref.addr.version == IP4);
+  _assert (rlocs[0].ippref.addr.version == AF_IP4);
 
   _assert (rlocs[1].ippref.addr.ip.v6.as_u32[0] == 0xffeeddcc);
   _assert (rlocs[1].ippref.addr.ip.v6.as_u32[1] == 0xbbaa9988);
   _assert (rlocs[1].ippref.addr.ip.v6.as_u32[2] == 0x77665544);
   _assert (rlocs[1].ippref.addr.ip.v6.as_u32[3] == 0x33221100);
-  _assert (rlocs[1].ippref.addr.version == IP6);
+  _assert (rlocs[1].ippref.addr.version == AF_IP6);
 
   lisp_msg_parse_eid_rec (b, &eid);
   _assert (eid.ippref.addr.ip.v4.as_u32 == 0x9abcdef0);
-  _assert (eid.ippref.addr.version == IP4);
+  _assert (eid.ippref.addr.version == AF_IP4);
   _assert (eid.ippref.len == 24);
 
 done:
@@ -301,7 +301,7 @@
   gid_address_t *rlocs = 0;
 
   ip_prefix_t ippref;
-  ip_prefix_version (&ippref) = IP4;
+  ip_prefix_version (&ippref) = AF_IP4;
   ip4_address_t *ip = &ip_prefix_v4 (&ippref);
   ip->as_u32 = 0x11223344;
   ippref.len = 32;
@@ -434,7 +434,7 @@
       .ippref = {
         .addr = {
           .ip.v4.as_u32 = 0x99887766,
-          .version = IP4
+          .version = AF_IP4
         }
       }
     }
@@ -663,7 +663,7 @@
   _assert (gid_address_type (&locs[0].address) == GID_ADDR_IP_PREFIX);
   _assert (gid_address_vni (&locs[0].address) == 0x09);
   ip_prefix_t *ip_pref = &gid_address_ippref (&locs[0].address);
-  _assert (IP4 == ip_prefix_version (ip_pref));
+  _assert (AF_IP4 == ip_prefix_version (ip_pref));
 
   /* 2nd locator - LCAF entry with ipv6 address */
   _assert (locs[1].local == 0);
@@ -675,7 +675,7 @@
   _assert (gid_address_type (&locs[1].address) == GID_ADDR_IP_PREFIX);
   _assert (0x22446688 == gid_address_vni (&locs[1].address));
   ip_pref = &gid_address_ippref (&locs[1].address);
-  _assert (IP6 == ip_prefix_version (ip_pref));
+  _assert (AF_IP6 == ip_prefix_version (ip_pref));
 
   /* 3rd locator - simple ipv4 address */
   _assert (gid_address_type (&locs[2].address) == GID_ADDR_IP_PREFIX);
@@ -727,7 +727,7 @@
   gid_address_type (gid) = GID_ADDR_IP_PREFIX;
   gid_address_ippref_len (gid) = 24;
   ippref = &gid_address_ippref (gid);
-  ip_prefix_version (ippref) = IP4;
+  ip_prefix_version (ippref) = AF_IP4;
   ip_prefix_len (ippref) = 0;
   ip4_address_t *ip4 = &ip_prefix_v4 (ippref);
   ip4->as_u32 = 0x20304050;
@@ -749,7 +749,7 @@
   loc2.local = 0;
 
   ip_prefix_t nested_ippref;
-  ip_prefix_version (&nested_ippref) = IP4;
+  ip_prefix_version (&nested_ippref) = AF_IP4;
   ip_prefix_len (&nested_ippref) = 0;
   ip4 = &ip_prefix_v4 (&nested_ippref);
   ip4->as_u32 = 0x33882299;
@@ -1030,7 +1030,7 @@
   _assert (ip6->as_u32[1] == 0xddccbb10);
   _assert (ip6->as_u32[2] == 0xddccbb10);
   _assert (ip6->as_u32[3] == 0xddccbb10);
-  _assert (ip_prefix_version (ip_pref) == IP6);
+  _assert (ip_prefix_version (ip_pref) == AF_IP6);
 
 done:
   gid_address_free (gid_addr);
@@ -1127,7 +1127,7 @@
           .len = 24,
           .addr =
             {
-              .version = IP4,
+              .version = AF_IP4,
               .ip.v4.data = { 0x1, 0x2, 0x3, 0x0 }
             }
         }
@@ -1141,7 +1141,7 @@
           .len = 16,
           .addr =
             {
-              .version = IP4,
+              .version = AF_IP4,
               .ip.v4.data = { 0x9, 0x8, 0x0, 0x0 }
             }
         }
@@ -1302,7 +1302,7 @@
   u8 *b = clib_mem_alloc (500);
   clib_memset (b, 0, 500);
 
-  ip_prefix_version (ippref) = IP4;
+  ip_prefix_version (ippref) = AF_IP4;
   ip_prefix_len (ippref) = 9;
   ip4_address_t *ip4 = &ip_prefix_v4 (ippref);
   ip4->as_u32 = 0xaabbccdd;
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 482575a..e1e8bfe 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -16278,13 +16278,13 @@
 	if (unformat (input, "%U", unformat_ip4_address, &ip_addr_v4 (&ip)))
 	{
 	  is_add = 1;
-	  ip_addr_version (&ip) = IP4;
+	  ip_addr_version (&ip) = AF_IP4;
 	}
       else
 	if (unformat (input, "%U", unformat_ip6_address, &ip_addr_v6 (&ip)))
 	{
 	  is_add = 1;
-	  ip_addr_version (&ip) = IP6;
+	  ip_addr_version (&ip) = AF_IP6;
 	}
       else
 	{
@@ -16298,7 +16298,7 @@
   mp->is_add = is_add;
   if (is_add)
     {
-      mp->is_ip4 = ip_addr_version (&ip) == IP4 ? 1 : 0;
+      mp->is_ip4 = ip_addr_version (&ip) == AF_IP4 ? 1 : 0;
       if (mp->is_ip4)
 	clib_memcpy (mp->address, &ip, 4);
       else
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index b4ea14e..620af8f 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -453,6 +453,7 @@
   ip/ip_init.c
   ip/ip_in_out_acl.c
   ip/ip_punt_drop.c
+  ip/ip_types.c
   ip/lookup.c
   ip/punt_api.c
   ip/punt.c
@@ -495,6 +496,7 @@
   ip/ip_packet.h
   ip/ip_source_and_port_range_check.h
   ip/ip_neighbor.h
+  ip/ip_types.h
   ip/lookup.h
   ip/ports.def
   ip/protocols.def
diff --git a/src/vnet/ip/ip.h b/src/vnet/ip/ip.h
index 65ccaef..22daaab 100644
--- a/src/vnet/ip/ip.h
+++ b/src/vnet/ip/ip.h
@@ -46,6 +46,7 @@
 
 #include <vnet/vnet.h>
 
+#include <vnet/ip/ip_types.h>
 #include <vnet/ip/format.h>
 #include <vnet/ip/ip_packet.h>
 #include <vnet/ip/lookup.h>
@@ -65,22 +66,6 @@
 #include <vnet/ip/icmp6.h>
 #include <vnet/classify/vnet_classify.h>
 
-typedef enum ip_address_family_t_
-{
-  AF_IP4,
-  AF_IP6,
-} ip_address_family_t;
-
-extern uword unformat_ip_address_family (unformat_input_t * input,
-					 va_list * args);
-extern u8 *format_ip_address_family (u8 * s, va_list * args);
-
-#define FOR_EACH_IP_ADDRESS_FAMILY(_af) \
-  for (_af = AF_IP4; _af <= AF_IP6; _af++)
-
-#define u8_ptr_add(ptr, index) (((u8 *)ptr) + index)
-#define u16_net_add(u, val) clib_host_to_net_u16(clib_net_to_host_u16(u) + (val))
-
 /* Per protocol info. */
 typedef struct
 {
diff --git a/src/vnet/ip/ip_types.c b/src/vnet/ip/ip_types.c
new file mode 100644
index 0000000..3378da6
--- /dev/null
+++ b/src/vnet/ip/ip_types.c
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <vnet/ip/ip_types.h>
+#include <vnet/ip/format.h>
+
+u8 *
+format_ip_address (u8 * s, va_list * args)
+{
+  ip_address_t *a = va_arg (*args, ip_address_t *);
+  u8 ver = ip_addr_version (a);
+  if (ver == AF_IP4)
+    {
+      return format (s, "%U", format_ip4_address, &ip_addr_v4 (a));
+    }
+  else if (ver == AF_IP6)
+    {
+      return format (s, "%U", format_ip6_address, &ip_addr_v6 (a));
+    }
+  else
+    {
+      clib_warning ("Can't format IP version %d!", ver);
+      return 0;
+    }
+}
+
+uword
+unformat_ip_address (unformat_input_t * input, va_list * args)
+{
+  ip_address_t *a = va_arg (*args, ip_address_t *);
+
+  clib_memset (a, 0, sizeof (*a));
+  if (unformat (input, "%U", unformat_ip4_address, &ip_addr_v4 (a)))
+    ip_addr_version (a) = AF_IP4;
+  else if (unformat_user (input, unformat_ip6_address, &ip_addr_v6 (a)))
+    ip_addr_version (a) = AF_IP6;
+  else
+    return 0;
+  return 1;
+}
+
+u8 *
+format_ip_prefix (u8 * s, va_list * args)
+{
+  ip_prefix_t *a = va_arg (*args, ip_prefix_t *);
+  return format (s, "%U/%d", format_ip_address, &ip_prefix_addr (a),
+		 ip_prefix_len (a));
+}
+
+uword
+unformat_ip_prefix (unformat_input_t * input, va_list * args)
+{
+  ip_prefix_t *a = va_arg (*args, ip_prefix_t *);
+  if (unformat (input, "%U/%d", unformat_ip_address, &ip_prefix_addr (a),
+		&ip_prefix_len (a)))
+    {
+      if ((ip_prefix_version (a) == AF_IP4 && 32 < ip_prefix_len (a)) ||
+	  (ip_prefix_version (a) == AF_IP6 && 128 < ip_prefix_len (a)))
+	{
+	  clib_warning ("Prefix length to big: %d!", ip_prefix_len (a));
+	  return 0;
+	}
+      ip_prefix_normalize (a);
+    }
+  else
+    return 0;
+  return 1;
+}
+
+u16
+ip_address_size (const ip_address_t * a)
+{
+  switch (ip_addr_version (a))
+    {
+    case AF_IP4:
+      return sizeof (ip4_address_t);
+      break;
+    case AF_IP6:
+      return sizeof (ip6_address_t);
+      break;
+    }
+  return 0;
+}
+
+int
+ip_address_cmp (const ip_address_t * ip1, const ip_address_t * ip2)
+{
+  int res = 0;
+  if (ip_addr_version (ip1) != ip_addr_version (ip2))
+    return -1;
+  res =
+    memcmp (&ip_addr_addr (ip1), &ip_addr_addr (ip2), ip_address_size (ip1));
+
+  if (res < 0)
+    res = 2;
+  else if (res > 0)
+    res = 1;
+
+  return res;
+}
+
+void
+ip_address_copy (ip_address_t * dst, const ip_address_t * src)
+{
+  if (AF_IP4 == ip_addr_version (src))
+    {
+      /* don't copy any garbage from the union */
+      clib_memset (dst, 0, sizeof (*dst));
+      dst->ip.v4 = src->ip.v4;
+      dst->version = AF_IP4;
+    }
+  else
+    {
+      clib_memcpy (dst, src, sizeof (ip_address_t));
+    }
+}
+
+void
+ip_address_copy_addr (void *dst, const ip_address_t * src)
+{
+  clib_memcpy (dst, src, ip_address_size (src));
+}
+
+u16
+ip_version_to_size (u8 ver)
+{
+  switch (ver)
+    {
+    case AF_IP4:
+      return sizeof (ip4_address_t);
+      break;
+    case AF_IP6:
+      return sizeof (ip6_address_t);
+      break;
+    }
+  return 0;
+}
+
+void
+ip_address_set (ip_address_t * dst, const void *src, u8 version)
+{
+  clib_memcpy (dst, src, ip_version_to_size (version));
+  ip_addr_version (dst) = version;
+}
+
+void
+ip_address_to_46 (const ip_address_t * addr,
+		  ip46_address_t * a, fib_protocol_t * proto)
+{
+  *proto = (AF_IP4 == ip_addr_version (addr) ?
+	    FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
+  switch (*proto)
+    {
+    case FIB_PROTOCOL_IP4:
+      ip46_address_set_ip4 (a, &addr->ip.v4);
+      break;
+    case FIB_PROTOCOL_IP6:
+      a->ip6 = addr->ip.v6;
+      break;
+    default:
+      ASSERT (0);
+      break;
+    }
+}
+
+static void
+ip_prefix_normalize_ip4 (ip4_address_t * ip4, u8 preflen)
+{
+  u32 mask = ~0;
+
+  ASSERT (ip4);
+
+  if (32 <= preflen)
+    {
+      return;
+    }
+
+  mask = pow2_mask (preflen) << (32 - preflen);
+  mask = clib_host_to_net_u32 (mask);
+  ip4->data_u32 &= mask;
+}
+
+static void
+ip_prefix_normalize_ip6 (ip6_address_t * ip6, u8 preflen)
+{
+  u8 mask_6[16];
+  u32 *m;
+  u8 j, i0, i1;
+
+  ASSERT (ip6);
+
+  clib_memset (mask_6, 0, sizeof (mask_6));
+
+  if (128 <= preflen)
+    {
+      return;
+    }
+
+  i1 = preflen % 32;
+  i0 = preflen / 32;
+  m = (u32 *) & mask_6[0];
+
+  for (j = 0; j < i0; j++)
+    {
+      m[j] = ~0;
+    }
+
+  if (i1)
+    {
+      m[i0] = clib_host_to_net_u32 (pow2_mask (i1) << (32 - i1));
+    }
+
+  for (j = 0; j < sizeof (mask_6); j++)
+    {
+      ip6->as_u8[j] &= mask_6[j];
+    }
+}
+
+void
+ip_prefix_normalize (ip_prefix_t * a)
+{
+  u8 preflen = ip_prefix_len (a);
+
+  switch (ip_prefix_version (a))
+    {
+    case AF_IP4:
+      ip_prefix_normalize_ip4 (&ip_prefix_v4 (a), preflen);
+      break;
+
+    case AF_IP6:
+      ip_prefix_normalize_ip6 (&ip_prefix_v6 (a), preflen);
+      break;
+
+    default:
+      ASSERT (0);
+    }
+}
+
+void
+ip_prefix_copy (void *dst, void *src)
+{
+  clib_memcpy (dst, src, sizeof (ip_prefix_t));
+}
+
+int
+ip_prefix_cmp (ip_prefix_t * p1, ip_prefix_t * p2)
+{
+  int cmp = 0;
+
+  ip_prefix_normalize (p1);
+  ip_prefix_normalize (p2);
+
+  cmp = ip_address_cmp (&ip_prefix_addr (p1), &ip_prefix_addr (p2));
+  if (cmp == 0)
+    {
+      if (ip_prefix_len (p1) < ip_prefix_len (p2))
+	{
+	  cmp = 1;
+	}
+      else
+	{
+	  if (ip_prefix_len (p1) > ip_prefix_len (p2))
+	    cmp = 2;
+	}
+    }
+  return cmp;
+}
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/ip/ip_types.h b/src/vnet/ip/ip_types.h
new file mode 100644
index 0000000..d292725
--- /dev/null
+++ b/src/vnet/ip/ip_types.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2019 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __IP_TYPES_H__
+#define __IP_TYPES_H__
+
+#include <vnet/fib/fib_types.h>
+
+typedef enum ip_address_family_t_
+{
+  AF_IP4,
+  AF_IP6,
+} ip_address_family_t;
+
+extern uword unformat_ip_address_family (unformat_input_t * input,
+					 va_list * args);
+extern u8 *format_ip_address_family (u8 * s, va_list * args);
+
+#define FOR_EACH_IP_ADDRESS_FAMILY(_af) \
+  for (_af = AF_IP4; _af <= AF_IP6; _af++)
+
+#define u8_ptr_add(ptr, index) (((u8 *)ptr) + index)
+#define u16_net_add(u, val) clib_host_to_net_u16(clib_net_to_host_u16(u) + (val))
+
+/* *INDENT-OFF* */
+typedef struct ip_address
+{
+  union
+  {
+    ip4_address_t v4;
+    ip6_address_t v6;
+  } ip;
+  ip_address_family_t version;
+} __clib_packed ip_address_t;
+/* *INDENT-ON* */
+
+#define ip_addr_addr(_a) (_a)->ip
+#define ip_addr_v4(_a) (_a)->ip.v4
+#define ip_addr_v6(_a) (_a)->ip.v6
+#define ip_addr_version(_a) (_a)->version
+
+extern int ip_address_cmp (const ip_address_t * ip1,
+			   const ip_address_t * ip2);
+extern void ip_address_copy (ip_address_t * dst, const ip_address_t * src);
+extern void ip_address_copy_addr (void *dst, const ip_address_t * src);
+extern void ip_address_set (ip_address_t * dst, const void *src, u8 version);
+extern u16 ip_address_size (const ip_address_t * a);
+extern u16 ip_version_to_size (u8 ver);
+extern u8 *format_ip_address (u8 * s, va_list * args);
+extern uword unformat_ip_address (unformat_input_t * input, va_list * args);
+extern void ip_address_to_46 (const ip_address_t * addr,
+			      ip46_address_t * a, fib_protocol_t * proto);
+
+/* *INDENT-OFF* */
+typedef struct ip_prefix
+{
+  ip_address_t addr;
+  u8 len;
+} __clib_packed ip_prefix_t;
+/* *INDENT-ON* */
+
+#define ip_prefix_addr(_a) (_a)->addr
+#define ip_prefix_version(_a) ip_addr_version(&ip_prefix_addr(_a))
+#define ip_prefix_len(_a) (_a)->len
+#define ip_prefix_v4(_a) ip_addr_v4(&ip_prefix_addr(_a))
+#define ip_prefix_v6(_a) ip_addr_v6(&ip_prefix_addr(_a))
+
+extern int ip_prefix_cmp (ip_prefix_t * p1, ip_prefix_t * p2);
+extern void ip_prefix_normalize (ip_prefix_t * a);
+
+extern void ip_address_to_fib_prefix (const ip_address_t * addr,
+				      fib_prefix_t * prefix);
+extern void ip_prefix_to_fib_prefix (const ip_prefix_t * ipp,
+				     fib_prefix_t * fibp);
+extern u8 *format_ip_prefix (u8 * s, va_list * args);
+extern uword unformat_ip_prefix (unformat_input_t * input, va_list * args);
+
+#endif /* __IP_TYPES_H__ */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/lisp-cp/control.c b/src/vnet/lisp-cp/control.c
index 774eae7..420a6db 100644
--- a/src/vnet/lisp-cp/control.c
+++ b/src/vnet/lisp-cp/control.c
@@ -114,7 +114,7 @@
   ip_lookup_main_t *lm;
   void *addr;
 
-  lm = (version == IP4) ? &lcm->im4->lookup_main : &lcm->im6->lookup_main;
+  lm = (version == AF_IP4) ? &lcm->im4->lookup_main : &lcm->im6->lookup_main;
   addr = ip_interface_get_first_address (lm, sw_if_index, version);
   if (!addr)
     return 0;
@@ -129,7 +129,7 @@
 void
 ip_address_to_fib_prefix (const ip_address_t * addr, fib_prefix_t * prefix)
 {
-  if (addr->version == IP4)
+  if (addr->version == AF_IP4)
     {
       prefix->fp_len = 32;
       prefix->fp_proto = FIB_PROTOCOL_IP4;
@@ -189,7 +189,7 @@
 
   ipver = ip_addr_version (dst);
 
-  lm = (ipver == IP4) ? &lcm->im4->lookup_main : &lcm->im6->lookup_main;
+  lm = (ipver == AF_IP4) ? &lcm->im4->lookup_main : &lcm->im6->lookup_main;
   si = ip_fib_get_egress_iface_for_dst (lcm, dst);
 
   if ((u32) ~ 0 == si)
@@ -904,7 +904,7 @@
 {
   u32 **ht = arg;
   u32 version = (u32) kvp->key[0];
-  if (IP6 == version)
+  if (AF_IP6 == version)
     return;
 
   u32 bd = (u32) (kvp->key[0] >> 32);
@@ -927,7 +927,7 @@
 {
   u32 **ht = arg;
   u32 version = (u32) kvp->key[0];
-  if (IP4 == version)
+  if (AF_IP4 == version)
     return;
 
   u32 bd = (u32) (kvp->key[0] >> 32);
@@ -958,7 +958,7 @@
   lisp_api_l2_arp_entry_t **vector = a->vector, e;
 
   u32 version = (u32) kvp->key[0];
-  if (IP6 == version)
+  if (AF_IP6 == version)
     return;
 
   u32 bd = (u32) (kvp->key[0] >> 32);
@@ -993,7 +993,7 @@
   lisp_api_ndp_entry_t **vector = a->vector, e;
 
   u32 version = (u32) kvp->key[0];
-  if (IP4 == version)
+  if (AF_IP4 == version)
     return;
 
   u32 bd = (u32) (kvp->key[0] >> 32);
@@ -2513,7 +2513,7 @@
 				    loc->sw_if_index, 1 /* unnumbered */,
       ({
 	addr = ip_interface_address_get_address (&lcm->im4->lookup_main, ia);
-	ip_address_set (rloc, addr, IP4);
+	ip_address_set (rloc, addr, AF_IP4);
         ip_prefix_len (ippref) = 32;
         ip_prefix_normalize (ippref);
         vec_add1 (rlocs, gid[0]);
@@ -2524,7 +2524,7 @@
 				    loc->sw_if_index, 1 /* unnumbered */,
       ({
         addr = ip_interface_address_get_address (&lcm->im6->lookup_main, ia);
-        ip_address_set (rloc, addr, IP6);
+        ip_address_set (rloc, addr, AF_IP6);
         ip_prefix_len (ippref) = 128;
         ip_prefix_normalize (ippref);
         vec_add1 (rlocs, gid[0]);
@@ -2687,7 +2687,7 @@
           ({
             addr = ip_interface_address_get_address (&lcm->im4->lookup_main,
                                                      ia);
-            ip_address_set (new_ip, addr, IP4);
+            ip_address_set (new_ip, addr, AF_IP4);
           }));
 
           /* Add ipv6 locators */
@@ -2696,7 +2696,7 @@
           ({
             addr = ip_interface_address_get_address (&lcm->im6->lookup_main,
                                                      ia);
-            ip_address_set (new_ip, addr, IP6);
+            ip_address_set (new_ip, addr, AF_IP6);
           }));
           /* *INDENT-ON* */
 
@@ -2919,7 +2919,7 @@
 
   vnet_buffer (b)->sw_if_index[VLIB_TX] = 0;
 
-  next_index = (ip_addr_version (rloc) == IP4) ?
+  next_index = (ip_addr_version (rloc) == AF_IP4) ?
     ip4_lookup_node.index : ip6_lookup_node.index;
 
   f = vlib_get_frame_to_node (lcm->vlib_main, next_index);
@@ -3031,7 +3031,7 @@
 
     vnet_buffer (b)->sw_if_index[VLIB_TX] = 0;
 
-    next_index = (ip_addr_version (&lcm->active_map_server) == IP4) ?
+    next_index = (ip_addr_version (&lcm->active_map_server) == AF_IP4) ?
       ip4_lookup_node.index : ip6_lookup_node.index;
 
     f = vlib_get_frame_to_node (lcm->vlib_main, next_index);
@@ -3178,7 +3178,7 @@
 
   /* set fib index to default and lookup node */
   vnet_buffer (b)->sw_if_index[VLIB_TX] = 0;
-  next_index = (ip_addr_version (&lcm->active_map_resolver) == IP4) ?
+  next_index = (ip_addr_version (&lcm->active_map_resolver) == AF_IP4) ?
     ip4_lookup_node.index : ip6_lookup_node.index;
 
   f = vlib_get_frame_to_node (lcm->vlib_main, next_index);
@@ -3233,14 +3233,14 @@
 
   if ((ip4->ip_version_and_header_length & 0xF0) == 0x40)
     {
-      ip_address_set (src, &ip4->src_address, IP4);
-      ip_address_set (dst, &ip4->dst_address, IP4);
+      ip_address_set (src, &ip4->src_address, AF_IP4);
+      ip_address_set (dst, &ip4->dst_address, AF_IP4);
     }
   else
     {
       ip6 = hdr;
-      ip_address_set (src, &ip6->src_address, IP6);
-      ip_address_set (dst, &ip6->dst_address, IP6);
+      ip_address_set (src, &ip6->src_address, AF_IP6);
+      ip_address_set (dst, &ip6->dst_address, AF_IP6);
     }
 }
 
@@ -3252,7 +3252,8 @@
   u32 vni = ~0, table_id = ~0;
 
   table_id = fib_table_get_table_id_for_sw_if_index ((version ==
-						      IP4 ? FIB_PROTOCOL_IP4 :
+						      AF_IP4 ?
+						      FIB_PROTOCOL_IP4 :
 						      FIB_PROTOCOL_IP6),
 						     vnet_buffer
 						     (b)->sw_if_index
@@ -3350,7 +3351,7 @@
 	    {
 	      clib_memset (&gid_address_arp_ndp_ip (dst), 0,
 			   sizeof (ip_address_t));
-	      ip_addr_version (&gid_address_arp_ndp_ip (dst)) = IP4;
+	      ip_addr_version (&gid_address_arp_ndp_ip (dst)) = AF_IP4;
 	      gid_address_arp_ndp_bd (dst) = ~0;
 	      return;
 	    }
@@ -3383,7 +3384,7 @@
 			  clib_memset (&gid_address_arp_ndp_ip (dst), 0,
 				       sizeof (ip_address_t));
 			  ip_addr_version (&gid_address_arp_ndp_ip (dst)) =
-			    IP6;
+			    AF_IP6;
 			  gid_address_arp_ndp_bd (dst) = ~0;
 			  gid_address_type (src) = GID_ADDR_NO_ADDRESS;
 			  return;
@@ -3392,7 +3393,7 @@
 		      gid_address_ndp_bd (dst) =
 			lisp_get_bd_from_buffer_eth (b);
 		      ip_address_set (&gid_address_arp_ndp_ip (dst),
-				      &ndh->target_address, IP6);
+				      &ndh->target_address, AF_IP6);
 		      return;
 		    }
 		}
@@ -4228,7 +4229,7 @@
   free_map_register_records (records);
 
   vnet_buffer (b)->sw_if_index[VLIB_TX] = 0;
-  next_index = (ip_addr_version (&lcm->active_map_resolver) == IP4) ?
+  next_index = (ip_addr_version (&lcm->active_map_resolver) == AF_IP4) ?
     ip4_lookup_node.index : ip6_lookup_node.index;
 
   f = vlib_get_frame_to_node (lcm->vlib_main, next_index);
diff --git a/src/vnet/lisp-cp/gid_dictionary.c b/src/vnet/lisp-cp/gid_dictionary.c
index b2060a6..3fd98c7 100644
--- a/src/vnet/lisp-cp/gid_dictionary.c
+++ b/src/vnet/lisp-cp/gid_dictionary.c
@@ -126,7 +126,7 @@
 {
   ip_prefix_t *ippref = &gid_address_sd_dst_ippref (eid);
 
-  if (IP4 == ip_prefix_version (ippref))
+  if (AF_IP4 == ip_prefix_version (ippref))
     gid_dict_foreach_ip4_subprefix (db, gid_address_vni (eid),
 				    &gid_address_sd_src_ippref (eid),
 				    &gid_address_sd_dst_ippref (eid), cb,
@@ -295,7 +295,7 @@
 
   switch (ip_prefix_version (dst))
     {
-    case IP4:
+    case AF_IP4:
       sfi = ip4_lookup (&db->dst_ip4_table, vni, dst);
       if (GID_LOOKUP_MISS != sfi)
 	sfib4 = pool_elt_at_index (db->src_ip4_table_pool, sfi);
@@ -312,7 +312,7 @@
 	return ip4_lookup (sfib4, 0, src);
 
       break;
-    case IP6:
+    case AF_IP6:
       sfi = ip6_lookup (&db->dst_ip6_table, vni, dst);
       if (GID_LOOKUP_MISS != sfi)
 	sfib6 = pool_elt_at_index (db->src_ip6_table_pool, sfi);
@@ -323,7 +323,7 @@
 	{
 	  ip_prefix_t sp;
 	  clib_memset (&sp, 0, sizeof (sp));
-	  ip_prefix_version (&sp) = IP6;
+	  ip_prefix_version (&sp) = AF_IP6;
 	  return ip6_lookup_exact_match (sfib6, 0, &sp);
 	}
       else
@@ -342,7 +342,7 @@
 make_arp_ndp_key (BVT (clib_bihash_kv) * kv, u32 bd, ip_address_t * addr)
 {
   kv->key[0] = ((u64) bd << 32) | (u32) ip_addr_version (addr);
-  if (ip_addr_version (addr) == IP4)
+  if (ip_addr_version (addr) == AF_IP4)
     {
       kv->key[1] = (u64) addr->ip.v4.as_u32;
       kv->key[2] = (u64) 0;
@@ -830,7 +830,7 @@
 	    {
 	      ip_prefix_t sp;
 	      clib_memset (&sp, 0, sizeof (sp));
-	      ip_prefix_version (&sp) = IP6;
+	      ip_prefix_version (&sp) = AF_IP6;
 	      add_del_ip6_key (sfib, 0 /* vni */ , &sp, val, is_add);
 	    }
 	}
@@ -847,7 +847,7 @@
 	    {
 	      ip_prefix_t sp;
 	      clib_memset (&sp, 0, sizeof (sp));
-	      ip_prefix_version (&sp) = IP6;
+	      ip_prefix_version (&sp) = AF_IP6;
 	      old_val =
 		add_del_ip6_key (sfib, 0 /* vni */ , &sp, val, is_add);
 	    }
@@ -864,7 +864,7 @@
 	    {
 	      ip_prefix_t sp;
 	      clib_memset (&sp, 0, sizeof (sp));
-	      ip_prefix_version (&sp) = IP6;
+	      ip_prefix_version (&sp) = AF_IP6;
 	      old_val = add_del_ip6_key (sfib, 0, &sp, 0, is_add);
 	    }
 
@@ -884,10 +884,10 @@
 {
   switch (ip_prefix_version (dst_key))
     {
-    case IP4:
+    case AF_IP4:
       return add_del_sd_ip4_key (db, vni, dst_key, src_key, value, is_add);
       break;
-    case IP6:
+    case AF_IP6:
       return add_del_sd_ip6_key (db, vni, dst_key, src_key, value, is_add);
       break;
     default:
diff --git a/src/vnet/lisp-cp/lisp_api.c b/src/vnet/lisp-cp/lisp_api.c
index 8a0ffff..3f18a5d 100644
--- a/src/vnet/lisp-cp/lisp_api.c
+++ b/src/vnet/lisp-cp/lisp_api.c
@@ -99,7 +99,8 @@
       /* remote locators */
       r = &rmt_locs[i];
       clib_memset (&loc, 0, sizeof (loc));
-      gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6);
+      gid_address_ip_set (&loc.address, &r->addr,
+			  r->is_ip4 ? AF_IP4 : AF_IP6);
 
       loc.priority = r->priority;
       loc.weight = r->weight;
@@ -205,13 +206,13 @@
     {
     case 0:			/* ipv4 */
       gid_address_type (dst) = GID_ADDR_IP_PREFIX;
-      gid_address_ip_set (dst, src, IP4);
+      gid_address_ip_set (dst, src, AF_IP4);
       gid_address_ippref_len (dst) = len;
       ip_prefix_normalize (&gid_address_ippref (dst));
       break;
     case 1:			/* ipv6 */
       gid_address_type (dst) = GID_ADDR_IP_PREFIX;
-      gid_address_ip_set (dst, src, IP6);
+      gid_address_ip_set (dst, src, AF_IP6);
       gid_address_ippref_len (dst) = len;
       ip_prefix_normalize (&gid_address_ippref (dst));
       break;
@@ -301,7 +302,7 @@
 
   clib_memset (&addr, 0, sizeof (addr));
 
-  ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
+  ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? AF_IP6 : AF_IP4);
   rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
 
   REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_SERVER_REPLY);
@@ -318,7 +319,7 @@
   clib_memset (a, 0, sizeof (a[0]));
 
   a->is_add = mp->is_add;
-  ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
+  ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? AF_IP6 : AF_IP4);
 
   rv = vnet_lisp_add_del_map_resolver (a);
 
@@ -407,7 +408,7 @@
   int rv = 0;
   ip_address_t addr;
 
-  ip_address_set (&addr, &mp->address, mp->is_ip4 ? IP4 : IP6);
+  ip_address_set (&addr, &mp->address, mp->is_ip4 ? AF_IP4 : AF_IP6);
   rv = vnet_lisp_use_petr (&addr, mp->is_add);
 
   REPLY_MACRO (VL_API_LISP_USE_PETR_REPLY);
@@ -446,12 +447,12 @@
     ip_address_t *ip = &gid_address_ip (&addr);
     switch (ip_addr_version (ip))
       {
-      case IP4:
+      case AF_IP4:
         clib_memcpy (rmp->address, &ip_addr_v4 (ip),
                      sizeof (ip_addr_v4 (ip)));
         break;
 
-      case IP6:
+      case AF_IP6:
         clib_memcpy (rmp->address, &ip_addr_v6 (ip),
                      sizeof (ip_addr_v6 (ip)));
         break;
@@ -459,7 +460,7 @@
       default:
         ASSERT (0);
       }
-    rmp->is_ip4 = (gid_address_ip_version (&addr) == IP4);
+    rmp->is_ip4 = (gid_address_ip_version (&addr) == AF_IP4);
   });
   /* *INDENT-ON* */
 }
@@ -708,7 +709,7 @@
   switch (fid_addr_type (src))
     {
     case FID_ADDR_IP_PREF:
-      if (ip_prefix_version (ippref) == IP4)
+      if (ip_prefix_version (ippref) == AF_IP4)
 	clib_memcpy (dst, &ip_prefix_v4 (ippref), 4);
       else
 	clib_memcpy (dst, &ip_prefix_v6 (ippref), 16);
@@ -735,9 +736,9 @@
     {
     case FID_ADDR_IP_PREF:
       ippref = &fid_addr_ippref (fid);
-      if (ip_prefix_version (ippref) == IP4)
+      if (ip_prefix_version (ippref) == AF_IP4)
 	return 0;
-      else if (ip_prefix_version (ippref) == IP6)
+      else if (ip_prefix_version (ippref) == AF_IP6)
 	return 1;
       else
 	return ~0;
@@ -818,7 +819,7 @@
       break;
     case GID_ADDR_IP_PREFIX:
       rmp->eid_prefix_len = ip_prefix_len (ip_prefix);
-      if (ip_prefix_version (ip_prefix) == IP4)
+      if (ip_prefix_version (ip_prefix) == AF_IP4)
 	{
 	  rmp->eid_type = 0;	/* ipv4 type */
 	  clib_memcpy (rmp->eid, &ip_prefix_v4 (ip_prefix),
@@ -897,13 +898,13 @@
 
   switch (ip_addr_version (ip))
     {
-    case IP4:
+    case AF_IP4:
       rmp->is_ipv6 = 0;
       clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
 		   sizeof (ip_addr_v4 (ip)));
       break;
 
-    case IP6:
+    case AF_IP6:
       rmp->is_ipv6 = 1;
       clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
 		   sizeof (ip_addr_v6 (ip)));
@@ -946,13 +947,13 @@
 
   switch (ip_addr_version (ip))
     {
-    case IP4:
+    case AF_IP4:
       rmp->is_ipv6 = 0;
       clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
 		   sizeof (ip_addr_v4 (ip)));
       break;
 
-    case IP6:
+    case AF_IP6:
       rmp->is_ipv6 = 1;
       clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
 		   sizeof (ip_addr_v6 (ip)));
@@ -1059,7 +1060,7 @@
 	case GID_ADDR_IP_PREFIX:
 	  a.reid_prefix_len = gid_address_ippref_len (&adj->reid);
 	  a.leid_prefix_len = gid_address_ippref_len (&adj->leid);
-	  if (gid_address_ip_version (&adj->reid) == IP4)
+	  if (gid_address_ip_version (&adj->reid) == AF_IP4)
 	    {
 	      a.eid_type = 0;	/* ipv4 type */
 	      clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 4);
diff --git a/src/vnet/lisp-cp/lisp_types.c b/src/vnet/lisp-cp/lisp_types.c
index cc2b1b2..9087865 100644
--- a/src/vnet/lisp-cp/lisp_types.c
+++ b/src/vnet/lisp-cp/lisp_types.c
@@ -141,69 +141,6 @@
 #undef _
 };
 
-u8 *
-format_ip_address (u8 * s, va_list * args)
-{
-  ip_address_t *a = va_arg (*args, ip_address_t *);
-  u8 ver = ip_addr_version (a);
-  if (ver == IP4)
-    {
-      return format (s, "%U", format_ip4_address, &ip_addr_v4 (a));
-    }
-  else if (ver == IP6)
-    {
-      return format (s, "%U", format_ip6_address, &ip_addr_v6 (a));
-    }
-  else
-    {
-      clib_warning ("Can't format IP version %d!", ver);
-      return 0;
-    }
-}
-
-uword
-unformat_ip_address (unformat_input_t * input, va_list * args)
-{
-  ip_address_t *a = va_arg (*args, ip_address_t *);
-
-  clib_memset (a, 0, sizeof (*a));
-  if (unformat (input, "%U", unformat_ip4_address, &ip_addr_v4 (a)))
-    ip_addr_version (a) = IP4;
-  else if (unformat_user (input, unformat_ip6_address, &ip_addr_v6 (a)))
-    ip_addr_version (a) = IP6;
-  else
-    return 0;
-  return 1;
-}
-
-u8 *
-format_ip_prefix (u8 * s, va_list * args)
-{
-  ip_prefix_t *a = va_arg (*args, ip_prefix_t *);
-  return format (s, "%U/%d", format_ip_address, &ip_prefix_addr (a),
-		 ip_prefix_len (a));
-}
-
-uword
-unformat_ip_prefix (unformat_input_t * input, va_list * args)
-{
-  ip_prefix_t *a = va_arg (*args, ip_prefix_t *);
-  if (unformat (input, "%U/%d", unformat_ip_address, &ip_prefix_addr (a),
-		&ip_prefix_len (a)))
-    {
-      if ((ip_prefix_version (a) == IP4 && 32 < ip_prefix_len (a)) ||
-	  (ip_prefix_version (a) == IP6 && 128 < ip_prefix_length (a)))
-	{
-	  clib_warning ("Prefix length to big: %d!", ip_prefix_len (a));
-	  return 0;
-	}
-      ip_prefix_normalize (a);
-    }
-  else
-    return 0;
-  return 1;
-}
-
 uword
 unformat_nsh_address (unformat_input_t * input, va_list * args)
 {
@@ -443,49 +380,10 @@
   return (s);
 }
 
-u16
-ip_address_size (const ip_address_t * a)
-{
-  switch (ip_addr_version (a))
-    {
-    case IP4:
-      return sizeof (ip4_address_t);
-      break;
-    case IP6:
-      return sizeof (ip6_address_t);
-      break;
-    }
-  return 0;
-}
-
-u16
-ip_version_to_size (u8 ver)
-{
-  switch (ver)
-    {
-    case IP4:
-      return sizeof (ip4_address_t);
-      break;
-    case IP6:
-      return sizeof (ip6_address_t);
-      break;
-    }
-  return 0;
-}
-
 u8
-ip_version_to_max_plen (u8 ver)
+ip_prefix_length (void *a)
 {
-  switch (ver)
-    {
-    case IP4:
-      return 32;
-      break;
-    case IP6:
-      return 128;
-      break;
-    }
-  return 0;
+  return ip_prefix_len ((ip_prefix_t *) a);
 }
 
 always_inline lisp_afi_e
@@ -493,9 +391,9 @@
 {
   switch (version)
     {
-    case IP4:
+    case AF_IP4:
       return LISP_AFI_IP;
-    case IP6:
+    case AF_IP6:
       return LISP_AFI_IP6;
     default:
       return 0;
@@ -509,9 +407,9 @@
   switch (afi)
     {
     case LISP_AFI_IP:
-      return IP4;
+      return AF_IP4;
     case LISP_AFI_IP6:
-      return IP6;
+      return AF_IP6;
     default:
       return 0;
     }
@@ -533,7 +431,7 @@
 u8
 ip_address_max_len (u8 version)
 {
-  return version == IP4 ? 32 : 128;
+  return version == AF_IP4 ? 32 : 128;
 }
 
 u16
@@ -553,7 +451,7 @@
 u32
 ip4_address_put (u8 * b, ip4_address_t * a)
 {
-  *(u16 *) b = clib_host_to_net_u16 (ip_version_to_iana_afi (IP4));
+  *(u16 *) b = clib_host_to_net_u16 (ip_version_to_iana_afi (AF_IP4));
   u8 *p = b + sizeof (u16);
   clib_memcpy (p, a, sizeof (*a));
   return ip4_address_size_to_put ();
@@ -562,7 +460,7 @@
 u32
 ip6_address_put (u8 * b, ip6_address_t * a)
 {
-  *(u16 *) b = clib_host_to_net_u16 (ip_version_to_iana_afi (IP6));
+  *(u16 *) b = clib_host_to_net_u16 (ip_version_to_iana_afi (AF_IP6));
   u8 *p = b + sizeof (u16);
   clib_memcpy (p, a, sizeof (*a));
   return ip6_address_size_to_put ();
@@ -850,145 +748,6 @@
   gid_address_ippref_len (g) = 32;
 }
 
-int
-ip_address_cmp (const ip_address_t * ip1, const ip_address_t * ip2)
-{
-  int res = 0;
-  if (ip_addr_version (ip1) != ip_addr_version (ip2))
-    return -1;
-  res =
-    memcmp (&ip_addr_addr (ip1), &ip_addr_addr (ip2), ip_address_size (ip1));
-
-  if (res < 0)
-    res = 2;
-  else if (res > 0)
-    res = 1;
-
-  return res;
-}
-
-void
-ip_address_copy (ip_address_t * dst, const ip_address_t * src)
-{
-  if (IP4 == ip_addr_version (src))
-    {
-      /* don't copy any garbage from the union */
-      clib_memset (dst, 0, sizeof (*dst));
-      dst->ip.v4 = src->ip.v4;
-      dst->version = IP4;
-    }
-  else
-    {
-      clib_memcpy (dst, src, sizeof (ip_address_t));
-    }
-}
-
-void
-ip_address_copy_addr (void *dst, const ip_address_t * src)
-{
-  clib_memcpy (dst, src, ip_address_size (src));
-}
-
-void
-ip_address_set (ip_address_t * dst, const void *src, u8 version)
-{
-  clib_memcpy (dst, src, ip_version_to_size (version));
-  ip_addr_version (dst) = version;
-}
-
-void
-ip_address_to_46 (const ip_address_t * addr,
-		  ip46_address_t * a, fib_protocol_t * proto)
-{
-  *proto = (IP4 == ip_addr_version (addr) ?
-	    FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
-  switch (*proto)
-    {
-    case FIB_PROTOCOL_IP4:
-      ip46_address_set_ip4 (a, &addr->ip.v4);
-      break;
-    case FIB_PROTOCOL_IP6:
-      a->ip6 = addr->ip.v6;
-      break;
-    default:
-      ASSERT (0);
-      break;
-    }
-}
-
-static void
-ip_prefix_normalize_ip4 (ip4_address_t * ip4, u8 preflen)
-{
-  u32 mask = ~0;
-
-  ASSERT (ip4);
-
-  if (32 <= preflen)
-    {
-      return;
-    }
-
-  mask = pow2_mask (preflen) << (32 - preflen);
-  mask = clib_host_to_net_u32 (mask);
-  ip4->data_u32 &= mask;
-}
-
-static void
-ip_prefix_normalize_ip6 (ip6_address_t * ip6, u8 preflen)
-{
-  u8 mask_6[16];
-  u32 *m;
-  u8 j, i0, i1;
-
-  ASSERT (ip6);
-
-  clib_memset (mask_6, 0, sizeof (mask_6));
-
-  if (128 <= preflen)
-    {
-      return;
-    }
-
-  i1 = preflen % 32;
-  i0 = preflen / 32;
-  m = (u32 *) & mask_6[0];
-
-  for (j = 0; j < i0; j++)
-    {
-      m[j] = ~0;
-    }
-
-  if (i1)
-    {
-      m[i0] = clib_host_to_net_u32 (pow2_mask (i1) << (32 - i1));
-    }
-
-  for (j = 0; j < sizeof (mask_6); j++)
-    {
-      ip6->as_u8[j] &= mask_6[j];
-    }
-}
-
-void
-ip_prefix_normalize (ip_prefix_t * a)
-{
-  u8 preflen = ip_prefix_len (a);
-
-  switch (ip_prefix_version (a))
-    {
-    case IP4:
-      ip_prefix_normalize_ip4 (&ip_prefix_v4 (a), preflen);
-      break;
-
-    case IP6:
-      ip_prefix_normalize_ip6 (&ip_prefix_v6 (a), preflen);
-      break;
-
-    default:
-      ASSERT (0);
-    }
-}
-
 void *
 ip_prefix_cast (gid_address_t * a)
 {
@@ -1010,28 +769,16 @@
 
   switch (ip_prefix_version (a))
     {
-    case IP4:
+    case AF_IP4:
       return ip4_address_put (p, &ip_prefix_v4 (a));
       break;
-    case IP6:
+    case AF_IP6:
       return ip6_address_put (p, &ip_prefix_v6 (a));
       break;
     }
   return 0;
 }
 
-u8
-ip_prefix_length (void *a)
-{
-  return ip_prefix_len ((ip_prefix_t *) a);
-}
-
-void
-ip_prefix_copy (void *dst, void *src)
-{
-  clib_memcpy (dst, src, sizeof (ip_prefix_t));
-}
-
 void
 mac_copy (void *dst, void *src)
 {
@@ -1050,30 +797,6 @@
   clib_memcpy (dst, src, sizeof (nsh_t));
 }
 
-int
-ip_prefix_cmp (ip_prefix_t * p1, ip_prefix_t * p2)
-{
-  int cmp = 0;
-
-  ip_prefix_normalize (p1);
-  ip_prefix_normalize (p2);
-
-  cmp = ip_address_cmp (&ip_prefix_addr (p1), &ip_prefix_addr (p2));
-  if (cmp == 0)
-    {
-      if (ip_prefix_len (p1) < ip_prefix_len (p2))
-	{
-	  cmp = 1;
-	}
-      else
-	{
-	  if (ip_prefix_len (p1) > ip_prefix_len (p2))
-	    cmp = 2;
-	}
-    }
-  return cmp;
-}
-
 void
 no_addr_copy (void *dst, void *src)
 {
diff --git a/src/vnet/lisp-cp/lisp_types.h b/src/vnet/lisp-cp/lisp_types.h
index ff7880b..f041e0f 100644
--- a/src/vnet/lisp-cp/lisp_types.h
+++ b/src/vnet/lisp-cp/lisp_types.h
@@ -34,55 +34,6 @@
 
 typedef enum
 {
-  IP4,
-  IP6
-} ip_address_type_t;
-
-/* *INDENT-OFF* */
-typedef CLIB_PACKED(struct ip_address
-{
-  union
-  {
-    ip4_address_t v4;
-    ip6_address_t v6;
-  } ip;
-  u8 version;
-}) ip_address_t;
-/* *INDENT-ON* */
-
-#define ip_addr_addr(_a) (_a)->ip
-#define ip_addr_v4(_a) (_a)->ip.v4
-#define ip_addr_v6(_a) (_a)->ip.v6
-#define ip_addr_version(_a) (_a)->version
-
-int ip_address_cmp (const ip_address_t * ip1, const ip_address_t * ip2);
-void ip_address_copy (ip_address_t * dst, const ip_address_t * src);
-void ip_address_copy_addr (void *dst, const ip_address_t * src);
-void ip_address_set (ip_address_t * dst, const void *src, u8 version);
-
-/* *INDENT-OFF* */
-typedef CLIB_PACKED(struct ip_prefix
-{
-  ip_address_t addr;
-  u8 len;
-}) ip_prefix_t;
-/* *INDENT-ON* */
-
-#define ip_prefix_addr(_a) (_a)->addr
-#define ip_prefix_version(_a) ip_addr_version(&ip_prefix_addr(_a))
-#define ip_prefix_len(_a) (_a)->len
-#define ip_prefix_v4(_a) ip_addr_v4(&ip_prefix_addr(_a))
-#define ip_prefix_v6(_a) ip_addr_v6(&ip_prefix_addr(_a))
-
-void ip_prefix_normalize (ip_prefix_t * a);
-
-extern void ip_address_to_fib_prefix (const ip_address_t * addr,
-				      fib_prefix_t * prefix);
-extern void ip_prefix_to_fib_prefix (const ip_prefix_t * ipp,
-				     fib_prefix_t * fibp);
-
-typedef enum
-{
   /* NOTE: ip addresses are left out on purpose. Use max masked ip-prefixes
    * instead */
   GID_ADDR_IP_PREFIX,
@@ -216,11 +167,6 @@
   u8 vni_mask;
 } gid_address_t;
 
-u8 *format_ip_address (u8 * s, va_list * args);
-uword unformat_ip_address (unformat_input_t * input, va_list * args);
-u8 *format_ip_prefix (u8 * s, va_list * args);
-uword unformat_ip_prefix (unformat_input_t * input, va_list * args);
-
 u16 ip4_address_size_to_put ();
 u16 ip6_address_size_to_put ();
 u32 ip4_address_put (u8 * b, ip4_address_t * a);
@@ -230,8 +176,6 @@
 u16 ip_address_iana_afi (ip_address_t * a);
 u8 ip_address_max_len (u8 ver);
 u32 ip_address_put (u8 * b, ip_address_t * a);
-void ip_address_to_46 (const ip_address_t * addr,
-		       ip46_address_t * a, fib_protocol_t * proto);
 
 /* LISP AFI codes  */
 typedef enum
diff --git a/src/vnet/lisp-cp/one_api.c b/src/vnet/lisp-cp/one_api.c
index 447b68f..17d4afc 100644
--- a/src/vnet/lisp-cp/one_api.c
+++ b/src/vnet/lisp-cp/one_api.c
@@ -146,7 +146,8 @@
       /* remote locators */
       r = &rmt_locs[i];
       clib_memset (&loc, 0, sizeof (loc));
-      gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6);
+      gid_address_ip_set (&loc.address, &r->addr,
+			  r->is_ip4 ? AF_IP4 : AF_IP6);
 
       loc.priority = r->priority;
       loc.weight = r->weight;
@@ -289,13 +290,13 @@
     {
     case 0:			/* ipv4 */
       gid_address_type (dst) = GID_ADDR_IP_PREFIX;
-      gid_address_ip_set (dst, src, IP4);
+      gid_address_ip_set (dst, src, AF_IP4);
       gid_address_ippref_len (dst) = len;
       ip_prefix_normalize (&gid_address_ippref (dst));
       break;
     case 1:			/* ipv6 */
       gid_address_type (dst) = GID_ADDR_IP_PREFIX;
-      gid_address_ip_set (dst, src, IP6);
+      gid_address_ip_set (dst, src, AF_IP6);
       gid_address_ippref_len (dst) = len;
       ip_prefix_normalize (&gid_address_ippref (dst));
       break;
@@ -396,7 +397,7 @@
 
   clib_memset (&addr, 0, sizeof (addr));
 
-  ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
+  ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? AF_IP6 : AF_IP4);
   rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
 
   REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_SERVER_REPLY);
@@ -413,7 +414,7 @@
   clib_memset (a, 0, sizeof (a[0]));
 
   a->is_add = mp->is_add;
-  ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
+  ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? AF_IP6 : AF_IP4);
 
   rv = vnet_lisp_add_del_map_resolver (a);
 
@@ -519,7 +520,7 @@
   int rv = 0;
   ip_address_t addr;
 
-  ip_address_set (&addr, &mp->address, mp->is_ip4 ? IP4 : IP6);
+  ip_address_set (&addr, &mp->address, mp->is_ip4 ? AF_IP4 : AF_IP6);
   rv = vnet_lisp_use_petr (&addr, mp->is_add);
 
   REPLY_MACRO (VL_API_ONE_USE_PETR_REPLY);
@@ -558,12 +559,12 @@
     ip_address_t *ip = &gid_address_ip (&addr);
     switch (ip_addr_version (ip))
       {
-      case IP4:
+      case AF_IP4:
         clib_memcpy (rmp->address, &ip_addr_v4 (ip),
                      sizeof (ip_addr_v4 (ip)));
         break;
 
-      case IP6:
+      case AF_IP6:
         clib_memcpy (rmp->address, &ip_addr_v6 (ip),
                      sizeof (ip_addr_v6 (ip)));
         break;
@@ -571,7 +572,7 @@
       default:
         ASSERT (0);
       }
-    rmp->is_ip4 = (gid_address_ip_version (&addr) == IP4);
+    rmp->is_ip4 = (gid_address_ip_version (&addr) == AF_IP4);
   });
   /* *INDENT-ON* */
 }
@@ -818,7 +819,7 @@
   switch (fid_addr_type (src))
     {
     case FID_ADDR_IP_PREF:
-      if (ip_prefix_version (ippref) == IP4)
+      if (ip_prefix_version (ippref) == AF_IP4)
 	clib_memcpy (dst, &ip_prefix_v4 (ippref), 4);
       else
 	clib_memcpy (dst, &ip_prefix_v6 (ippref), 16);
@@ -845,9 +846,9 @@
     {
     case FID_ADDR_IP_PREF:
       ippref = &fid_addr_ippref (fid);
-      if (ip_prefix_version (ippref) == IP4)
+      if (ip_prefix_version (ippref) == AF_IP4)
 	return 0;
-      else if (ip_prefix_version (ippref) == IP6)
+      else if (ip_prefix_version (ippref) == AF_IP6)
 	return 1;
       else
 	return ~0;
@@ -927,7 +928,7 @@
       break;
     case GID_ADDR_IP_PREFIX:
       rmp->eid_prefix_len = ip_prefix_len (ip_prefix);
-      if (ip_prefix_version (ip_prefix) == IP4)
+      if (ip_prefix_version (ip_prefix) == AF_IP4)
 	{
 	  rmp->eid_type = 0;	/* ipv4 type */
 	  clib_memcpy (rmp->eid, &ip_prefix_v4 (ip_prefix),
@@ -1013,13 +1014,13 @@
 
   switch (ip_addr_version (ip))
     {
-    case IP4:
+    case AF_IP4:
       rmp->is_ipv6 = 0;
       clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
 		   sizeof (ip_addr_v4 (ip)));
       break;
 
-    case IP6:
+    case AF_IP6:
       rmp->is_ipv6 = 1;
       clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
 		   sizeof (ip_addr_v6 (ip)));
@@ -1062,13 +1063,13 @@
 
   switch (ip_addr_version (ip))
     {
-    case IP4:
+    case AF_IP4:
       rmp->is_ipv6 = 0;
       clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
 		   sizeof (ip_addr_v4 (ip)));
       break;
 
-    case IP6:
+    case AF_IP6:
       rmp->is_ipv6 = 1;
       clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
 		   sizeof (ip_addr_v6 (ip)));
@@ -1175,7 +1176,7 @@
 	case GID_ADDR_IP_PREFIX:
 	  a.reid_prefix_len = gid_address_ippref_len (&adj->reid);
 	  a.leid_prefix_len = gid_address_ippref_len (&adj->leid);
-	  if (gid_address_ip_version (&adj->reid) == IP4)
+	  if (gid_address_ip_version (&adj->reid) == AF_IP4)
 	    {
 	      a.eid_type = 0;	/* ipv4 type */
 	      clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 4);
@@ -1460,7 +1461,7 @@
     {
     case FID_ADDR_IP_PREF:
       *prefix_length = fid_addr_prefix_length (fid);
-      if (fid_addr_ip_version (fid) == IP4)
+      if (fid_addr_ip_version (fid) == AF_IP4)
 	{
 	  *api_eid_type = 0;	/* ipv4 type */
 	  clib_memcpy (dst, &fid_addr_ippref (fid), 4);
@@ -1509,7 +1510,7 @@
                               &rmp->seid_pref_len);
         rmp->vni = clib_host_to_net_u32 (stat->vni);
 
-        rmp->is_ip4 = ip_addr_version (&stat->rmt_rloc) == IP4 ? 1 : 0;
+        rmp->is_ip4 = ip_addr_version (&stat->rmt_rloc) == AF_IP4 ? 1 : 0;
         ip_address_copy_addr (rmp->rloc, &stat->rmt_rloc);
         ip_address_copy_addr (rmp->lloc, &stat->loc_rloc);
 
@@ -1533,7 +1534,7 @@
   gid_address_arp_bd (arp) = clib_net_to_host_u32 (mp->bd);
 
   /* vpp keeps ip4 addresses in network byte order */
-  ip_address_set (&gid_address_arp_ndp_ip (arp), &mp->ip4, IP4);
+  ip_address_set (&gid_address_arp_ndp_ip (arp), &mp->ip4, AF_IP4);
 
   rv = vnet_lisp_add_del_l2_arp_ndp_entry (arp, mp->mac, mp->is_add);
 
@@ -1550,7 +1551,7 @@
 
   gid_address_type (g) = GID_ADDR_NDP;
   gid_address_ndp_bd (g) = clib_net_to_host_u32 (mp->bd);
-  ip_address_set (&gid_address_arp_ndp_ip (g), mp->ip6, IP6);
+  ip_address_set (&gid_address_arp_ndp_ip (g), mp->ip6, AF_IP6);
 
   rv = vnet_lisp_add_del_l2_arp_ndp_entry (g, mp->mac, mp->is_add);
 
diff --git a/src/vnet/lisp-cp/one_cli.c b/src/vnet/lisp-cp/one_cli.c
index e000c02..d5a0ee0 100644
--- a/src/vnet/lisp-cp/one_cli.c
+++ b/src/vnet/lisp-cp/one_cli.c
@@ -323,7 +323,7 @@
     }
 
   /* build GID address */
-  ip_address_set (&gid_address_arp_ndp_ip (g), &ip6, IP6);
+  ip_address_set (&gid_address_arp_ndp_ip (g), &ip6, AF_IP6);
   gid_address_ndp_bd (g) = bd;
   gid_address_type (g) = GID_ADDR_NDP;
   rc = vnet_lisp_add_del_l2_arp_ndp_entry (g, hw_addr, is_add);
diff --git a/src/vnet/lisp-cp/packets.c b/src/vnet/lisp-cp/packets.c
index 5cb2cfa..bbc3ad6 100644
--- a/src/vnet/lisp-cp/packets.c
+++ b/src/vnet/lisp-cp/packets.c
@@ -115,11 +115,11 @@
 {
   switch (version)
     {
-    case IP4:
+    case AF_IP4:
       return (udp_ip4_checksum (uh, udp_len,
 				((ip4_header_t *) ih)->src_address.as_u8,
 				((ip4_header_t *) ih)->dst_address.as_u8));
-    case IP6:
+    case AF_IP6:
       return (udp_ip6_checksum (ih, uh, udp_len));
     default:
       return ~0;
@@ -154,11 +154,11 @@
 
   switch (ip_addr_version (src))
     {
-    case IP4:
+    case AF_IP4:
       return vlib_buffer_push_ip4 (vm, b, &ip_addr_v4 (src),
 				   &ip_addr_v4 (dst), proto, csum_offload);
       break;
-    case IP6:
+    case AF_IP6:
       return vlib_buffer_push_ip6 (vm, b, &ip_addr_v6 (src),
 				   &ip_addr_v6 (dst), proto);
       break;
diff --git a/src/vnet/lisp-gpe/lisp_gpe.c b/src/vnet/lisp-gpe/lisp_gpe.c
index 9a10836..c75ad6b 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.c
+++ b/src/vnet/lisp-gpe/lisp_gpe.c
@@ -406,9 +406,9 @@
   lisp_gpe_main_t *lgm = &lisp_gpe_main;
   fib_route_path_t *rpath;
 
-  if (vec_len (lgm->native_fwd_rpath[IP4]))
+  if (vec_len (lgm->native_fwd_rpath[AF_IP4]))
     {
-      vec_foreach (rpath, lgm->native_fwd_rpath[IP4])
+      vec_foreach (rpath, lgm->native_fwd_rpath[AF_IP4])
       {
 	vlib_cli_output (vm, "nh: %U fib_index %u sw_if_index %u",
 			 format_ip46_address, &rpath->frp_addr,
@@ -416,9 +416,9 @@
 			 rpath->frp_sw_if_index);
       }
     }
-  if (vec_len (lgm->native_fwd_rpath[IP6]))
+  if (vec_len (lgm->native_fwd_rpath[AF_IP6]))
     {
-      vec_foreach (rpath, lgm->native_fwd_rpath[IP6])
+      vec_foreach (rpath, lgm->native_fwd_rpath[AF_IP6])
       {
 	vlib_cli_output (vm, "nh: %U fib_index %u sw_if_index %u",
 			 format_ip46_address, &rpath->frp_addr, IP46_TYPE_IP6,
@@ -461,7 +461,7 @@
   fib_route_path_t *rpath;
   u8 ip_version;
 
-  ip_version = a->rpath.frp_proto == DPO_PROTO_IP4 ? IP4 : IP6;
+  ip_version = a->rpath.frp_proto == DPO_PROTO_IP4 ? AF_IP4 : AF_IP6;
 
   if (a->is_add)
     {
diff --git a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c b/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
index 1b53e4d..4b5ca17 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
@@ -99,9 +99,9 @@
 {
   switch (ip_addr_version (&ladj->remote_rloc))
     {
-    case IP4:
+    case AF_IP4:
       return (FIB_FORW_CHAIN_TYPE_UNICAST_IP4);
-    case IP6:
+    case AF_IP6:
       return (FIB_FORW_CHAIN_TYPE_UNICAST_IP6);
     default:
       ASSERT (0);
@@ -116,11 +116,11 @@
   if (ip46_address_is_ip4 (a))
     {
       clib_memset (b, 0, sizeof (*b));
-      ip_address_set (b, &a->ip4, IP4);
+      ip_address_set (b, &a->ip4, AF_IP4);
     }
   else
     {
-      ip_address_set (b, &a->ip6, IP6);
+      ip_address_set (b, &a->ip6, AF_IP6);
     }
 }
 
diff --git a/src/vnet/lisp-gpe/lisp_gpe_api.c b/src/vnet/lisp-gpe/lisp_gpe_api.c
index 515f484..16c1128 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_api.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_api.c
@@ -75,7 +75,7 @@
       /* local locator */
       r = &((vl_api_gpe_locator_t *) locs)[i];
       clib_memset (&pair, 0, sizeof (pair));
-      ip_address_set (&pair.lcl_loc, &r->addr, r->is_ip4 ? IP4 : IP6);
+      ip_address_set (&pair.lcl_loc, &r->addr, r->is_ip4 ? AF_IP4 : AF_IP6);
 
       pair.weight = r->weight;
       vec_add1 (pairs, pair);
@@ -86,7 +86,7 @@
       /* remote locators */
       r = &((vl_api_gpe_locator_t *) locs)[i];
       p = &pairs[i - rloc_num];
-      ip_address_set (&p->rmt_loc, &r->addr, r->is_ip4 ? IP4 : IP6);
+      ip_address_set (&p->rmt_loc, &r->addr, r->is_ip4 ? AF_IP4 : AF_IP6);
     }
   return pairs;
 }
@@ -99,13 +99,13 @@
     {
     case 0:			/* ipv4 */
       gid_address_type (dst) = GID_ADDR_IP_PREFIX;
-      gid_address_ip_set (dst, src, IP4);
+      gid_address_ip_set (dst, src, AF_IP4);
       gid_address_ippref_len (dst) = len;
       ip_prefix_normalize (&gid_address_ippref (dst));
       break;
     case 1:			/* ipv6 */
       gid_address_type (dst) = GID_ADDR_IP_PREFIX;
-      gid_address_ip_set (dst, src, IP6);
+      gid_address_ip_set (dst, src, AF_IP6);
       gid_address_ippref_len (dst) = len;
       ip_prefix_normalize (&gid_address_ippref (dst));
       break;
@@ -135,7 +135,7 @@
 		      const ip_address_t * addr, u8 weight)
 {
   loc->weight = weight;
-  if (IP4 == ip_addr_version (addr))
+  if (AF_IP4 == ip_addr_version (addr))
     {
       loc->is_ip4 = 1;
       memcpy (loc->addr, addr, 4);
@@ -208,7 +208,7 @@
     switch (fid_addr_type (&e->leid))
       {
       case FID_ADDR_IP_PREF:
-	if (IP4 == ip_prefix_version (&fid_addr_ippref (&e->leid)))
+	if (AF_IP4 == ip_prefix_version (&fid_addr_ippref (&e->leid)))
 	  {
 	    memcpy (&dst[i].leid, &fid_addr_ippref (&e->leid), 4);
 	    memcpy (&dst[i].reid, &fid_addr_ippref (&e->reid), 4);
diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
index 2d6cd01..4524695 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
@@ -87,7 +87,7 @@
        */
       lookup_dpo_add_or_lock_w_fib_index (src_fib_index,
 					  (ip_prefix_version (dst_prefix) ==
-					   IP6 ? DPO_PROTO_IP6 :
+					   AF_IP6 ? DPO_PROTO_IP6 :
 					   DPO_PROTO_IP4),
 					  LOOKUP_UNICAST,
 					  LOOKUP_INPUT_SRC_ADDR,
@@ -329,7 +329,7 @@
   ip_prefix_t ippref;
   fib_prefix_t fib_prefix;
   u8 ip_version = ip_prefix_version (&lfe->key->rmt.ippref);
-  dproto = (ip_version == IP4 ? DPO_PROTO_IP4 : DPO_PROTO_IP6);
+  dproto = (ip_version == AF_IP4 ? DPO_PROTO_IP4 : DPO_PROTO_IP6);
 
   if (lfe->is_src_dst)
     {
@@ -539,7 +539,7 @@
 		lfe - lgm->lisp_fwd_entry_pool);
   a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
 
-  fproto = (IP4 == ip_prefix_version (&fid_addr_ippref (&lfe->key->rmt)) ?
+  fproto = (AF_IP4 == ip_prefix_version (&fid_addr_ippref (&lfe->key->rmt)) ?
 	    FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
 
   lfe->type = (a->is_negative ?
@@ -581,7 +581,7 @@
 
   delete_fib_entries (lfe);
 
-  fproto = (IP4 == ip_prefix_version (&fid_addr_ippref (&lfe->key->rmt)) ?
+  fproto = (AF_IP4 == ip_prefix_version (&fid_addr_ippref (&lfe->key->rmt)) ?
 	    FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
   fib_table_unlock (lfe->eid_fib_index, fproto, FIB_SOURCE_LISP);
 
diff --git a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.h b/src/vnet/lisp-gpe/lisp_gpe_sub_interface.h
index 1abb314..457db93 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.h
+++ b/src/vnet/lisp-gpe/lisp_gpe_sub_interface.h
@@ -112,7 +112,7 @@
 
   key.local_rloc.ip.v6.as_u64[0] = addr->as_u64[0];
   key.local_rloc.ip.v6.as_u64[1] = addr->as_u64[1];
-  key.local_rloc.version = IP6;
+  key.local_rloc.version = AF_IP6;
   key.vni = vni;
 
   p = hash_get_mem (&lisp_gpe_sub_interfaces_sw_if_index, &key);
@@ -135,7 +135,7 @@
   const uword *p;
 
   key.local_rloc.ip.v4.as_u32 = addr->as_u32;
-  key.local_rloc.version = IP4;
+  key.local_rloc.version = AF_IP4;
   key.vni = vni;
 
   p = hash_get_mem (&lisp_gpe_sub_interfaces_sw_if_index, &key);
diff --git a/src/vnet/lisp-gpe/lisp_gpe_tunnel.c b/src/vnet/lisp-gpe/lisp_gpe_tunnel.c
index d0e9bc2..0373542 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_tunnel.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_tunnel.c
@@ -52,7 +52,7 @@
   int len;
   gpe_encap_mode_t encap_mode = vnet_gpe_get_encap_mode ();
 
-  if (IP4 == ip_addr_version (&lgt->key->lcl))
+  if (AF_IP4 == ip_addr_version (&lgt->key->lcl))
     {
       ip4_udp_lisp_gpe_header_t *h0;
       ip4_header_t *ip0;
diff --git a/test/test_lisp.py b/test/test_lisp.py
index e0b8208..596df8c 100644
--- a/test/test_lisp.py
+++ b/test/test_lisp.py
@@ -189,5 +189,25 @@
         self.test_driver.run(self.deid_ip4)
 
 
+class TestLispUT(VppTestCase):
+    """ Lisp UT """
+
+    @classmethod
+    def setUpClass(cls):
+        super(TestLispUT, cls).setUpClass()
+
+    @classmethod
+    def tearDownClass(cls):
+        super(TestLispUT, cls).tearDownClass()
+
+    def test_fib(self):
+        """ LISP Unit Tests """
+        error = self.vapi.cli("test lisp cp")
+
+        if error:
+            self.logger.critical(error)
+        self.assertNotIn("Failed", error)
+
+
 if __name__ == '__main__':
     unittest.main(testRunner=VppTestRunner)
