summaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-gpe
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-11-12 17:16:47 +0000
committerFlorin Coras <florin.coras@gmail.com>2019-11-12 18:56:04 +0000
commitea93e48cf6e918937422638cb574964b88a146b6 (patch)
treec35f8c921a8a9175b0dbf89e3e0775abc433e521 /src/vnet/lisp-gpe
parentc046d709e1e493d20fee80f8c23b4106be67a98e (diff)
ip: IP address and prefix types (moved from LISP)
Type: refactor Change-Id: I2c6b59013bfd21136a2955442c779685f951932b Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/lisp-gpe')
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe.c10
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_adjacency.c8
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_api.c12
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c8
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_sub_interface.h4
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_tunnel.c2
6 files changed, 22 insertions, 22 deletions
diff --git a/src/vnet/lisp-gpe/lisp_gpe.c b/src/vnet/lisp-gpe/lisp_gpe.c
index 9a10836707c..c75ad6b87cd 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.c
+++ b/src/vnet/lisp-gpe/lisp_gpe.c
@@ -406,9 +406,9 @@ gpe_show_native_fwd_rpath_command_fn (vlib_main_t * vm,
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 @@ gpe_show_native_fwd_rpath_command_fn (vlib_main_t * vm,
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 @@ vnet_gpe_add_del_native_fwd_rpath (vnet_gpe_native_fwd_rpath_args_t * a)
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 1b53e4dd9fe..4b5ca17dad5 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
@@ -99,9 +99,9 @@ lisp_gpe_adj_get_fib_chain_type (const lisp_gpe_adjacency_t * ladj)
{
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 @@ ip46_address_to_ip_address (const ip46_address_t * a, ip_address_t * b)
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 515f4844a02..16c1128c131 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_api.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_api.c
@@ -75,7 +75,7 @@ unformat_gpe_loc_pairs (void *locs, u32 rloc_num)
/* 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 @@ unformat_gpe_loc_pairs (void *locs, u32 rloc_num)
/* 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 @@ unformat_lisp_eid_api (gid_address_t * dst, u32 vni, u8 type, void *src,
{
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 @@ lisp_api_set_locator (vl_api_gpe_locator_t * loc,
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 @@ gpe_fwd_entries_copy (vl_api_gpe_fwd_entry_t * dst,
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 2d6cd013941..45246955248 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 @@ ip_dst_fib_add_route (u32 dst_fib_index, const ip_prefix_t * dst_prefix)
*/
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 @@ create_fib_entries (lisp_gpe_fwd_entry_t * lfe)
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 @@ add_ip_fwd_entry (lisp_gpe_main_t * lgm,
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 @@ del_ip_fwd_entry_i (lisp_gpe_main_t * lgm, lisp_gpe_fwd_entry_t * lfe)
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 1abb314fbb3..457db93e910 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 @@ lisp_gpe_sub_interface_find_ip6 (const ip6_address_t * addr, u32 vni)
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 @@ lisp_gpe_sub_interface_find_ip4 (const ip4_address_t * addr, u32 vni)
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 d0e9bc268dc..0373542ba34 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_tunnel.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_tunnel.c
@@ -52,7 +52,7 @@ lisp_gpe_tunnel_build_rewrite (const lisp_gpe_tunnel_t * lgt,
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;