summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-01-14 10:04:44 +0000
committerOle Tr�an <otroan@employees.org>2021-01-21 11:00:14 +0000
commit1523c96deb2bc2f03e7823be4545342309da18fc (patch)
treee6e3f0fc5da11ff81aa08653fed6be33f99b5408
parentf2984bbb013acb0d6872e8fbb2f9d57d3e4f49b9 (diff)
ip: Use correct enum type in ip_address_set
Type: refactor Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: Ice2bc42838e6d5ba579f449c3f8b0feffebeb719
-rw-r--r--src/plugins/ikev2/ikev2.c4
-rw-r--r--src/plugins/lisp/lisp-cp/control.c7
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_types.c2
-rw-r--r--src/vnet/ip/ip_types.c7
-rw-r--r--src/vnet/ip/ip_types.h3
5 files changed, 12 insertions, 11 deletions
diff --git a/src/plugins/ikev2/ikev2.c b/src/plugins/ikev2/ikev2.c
index c9a86475ac6..d6ee8f592e2 100644
--- a/src/plugins/ikev2/ikev2.c
+++ b/src/plugins/ikev2/ikev2.c
@@ -2784,8 +2784,8 @@ ikev2_rewrite_v4_addrs (ikev2_sa_t * sa, ip4_header_t * ih)
}
static_always_inline void
-ikev2_set_ip_address (ikev2_sa_t * sa, const void *iaddr,
- const void *raddr, const int af)
+ikev2_set_ip_address (ikev2_sa_t *sa, const void *iaddr, const void *raddr,
+ const ip_address_family_t af)
{
ip_address_set (&sa->raddr, raddr, af);
ip_address_set (&sa->iaddr, iaddr, af);
diff --git a/src/plugins/lisp/lisp-cp/control.c b/src/plugins/lisp/lisp-cp/control.c
index 446a8d7e2cb..695d6ff039b 100644
--- a/src/plugins/lisp/lisp-cp/control.c
+++ b/src/plugins/lisp/lisp-cp/control.c
@@ -106,8 +106,9 @@ ip_interface_get_first_address (ip_lookup_main_t * lm, u32 sw_if_index,
}
int
-ip_interface_get_first_ip_address (lisp_cp_main_t * lcm, u32 sw_if_index,
- u8 version, ip_address_t * result)
+ip_interface_get_first_ip_address (lisp_cp_main_t *lcm, u32 sw_if_index,
+ ip_address_family_t version,
+ ip_address_t *result)
{
ip_lookup_main_t *lm;
void *addr;
@@ -149,7 +150,7 @@ ip_fib_get_first_egress_ip_for_dst (lisp_cp_main_t * lcm, ip_address_t * dst,
u32 si;
ip_lookup_main_t *lm;
void *addr = 0;
- u8 ipver;
+ ip_address_family_t ipver;
ASSERT (result != 0);
diff --git a/src/plugins/lisp/lisp-cp/lisp_types.c b/src/plugins/lisp/lisp-cp/lisp_types.c
index 0356949b757..5e2be77a537 100644
--- a/src/plugins/lisp/lisp-cp/lisp_types.c
+++ b/src/plugins/lisp/lisp-cp/lisp_types.c
@@ -1265,7 +1265,7 @@ gid_address_parse (u8 * offset, gid_address_t * a)
}
void
-gid_address_ip_set (gid_address_t * dst, void *src, u8 version)
+gid_address_ip_set (gid_address_t *dst, void *src, ip_address_family_t version)
{
gid_address_ippref_len (dst) = ip_address_max_len (version);
ip_address_set (&gid_address_ip (dst), src, version);
diff --git a/src/vnet/ip/ip_types.c b/src/vnet/ip/ip_types.c
index 8f9f012ad77..3e5ecebf142 100644
--- a/src/vnet/ip/ip_types.c
+++ b/src/vnet/ip/ip_types.c
@@ -203,13 +203,12 @@ ip_address_family_to_link_type (ip_address_family_t af)
return (VNET_LINK_IP4);
}
-
void
-ip_address_set (ip_address_t * dst, const void *src, u8 version)
+ip_address_set (ip_address_t *dst, const void *src, ip_address_family_t af)
{
- ip_addr_version (dst) = version;
+ ip_addr_version (dst) = af;
- switch (version)
+ switch (af)
{
case AF_IP4:
ip_addr_v4 (dst) = *(ip4_address_t *) src;
diff --git a/src/vnet/ip/ip_types.h b/src/vnet/ip/ip_types.h
index fa1f0fe0952..83a0f6adc72 100644
--- a/src/vnet/ip/ip_types.h
+++ b/src/vnet/ip/ip_types.h
@@ -99,7 +99,8 @@ 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 void ip_address_set (ip_address_t *dst, const void *src,
+ ip_address_family_t version);
extern u16 ip_address_size (const ip_address_t * a);
extern u16 ip_version_to_size (ip_address_family_t af);
extern u8 *format_ip_address (u8 * s, va_list * args);