45 #define foreach_lcaf_type \ 60 #define _(cond, name) \ 61 u16 name ## _write (u8 * p, void * a); \ 62 u16 name ## _parse (u8 * p, void * a); \ 63 u16 name ## _size_to_write (void * a); \ 64 void name ## _free (void * a); \ 65 void name ## _copy (void * dst, void * src); \ 66 u8 name ## _length (void * a); \ 67 int name ## _cmp (void *, void *); 70 #define CONCAT(a,b) a##_##b 71 #define IF(c, t, e) CONCAT(IF, c)(t, e) 74 #define EXPAND_FCN(cond, fcn) \ 78 #define _(cond, name) \ 79 EXPAND_FCN(cond, name##_cmp), 85 #define _(cond, name) \ 86 EXPAND_FCN(cond, name##_length), 92 #define _(cond, name) \ 93 EXPAND_FCN(cond, name##_copy), 99 #define _(cond, name) \ 100 EXPAND_FCN(cond, name##_free), 106 #define _(cond, name) \ 107 EXPAND_FCN(cond, name##_size_to_write), 113 #define _(cond, name) \ 114 EXPAND_FCN(cond, name##_write), 120 #define _(cond, name) \ 121 EXPAND_FCN(cond, name##_parse), 129 ip_address_t *
a = va_arg (*args, ip_address_t *);
149 ip_address_t *
a = va_arg (*args, ip_address_t *);
151 memset (a, 0,
sizeof (*a));
164 ip_prefix_t *
a = va_arg (*args, ip_prefix_t *);
172 ip_prefix_t *
a = va_arg (*args, ip_prefix_t *);
192 u8 *
a = va_arg (*args,
u8 *);
193 return unformat (input,
"%x:%x:%x:%x:%x:%x", &a[0], &a[1], &a[2], &a[3],
200 u8 *
a = va_arg (*args,
u8 *);
201 return format (s,
"%02x:%02x:%02x:%02x:%02x:%02x",
202 a[0], a[1], a[2], a[3], a[4], a[5]);
275 u32 *key_id = va_arg (*args,
u32 *);
280 if (!strcmp ((
char *) s,
"sha1"))
282 else if (!strcmp ((
char *) s,
"sha256"))
305 memset (&ippref, 0,
sizeof (ippref));
306 memset (&sim1, 0,
sizeof (sim1));
307 memset (&sim2, 0,
sizeof (sim2));
335 u32 *action = va_arg (*args,
u32 *);
340 if (!strcmp ((
char *) s,
"no-action"))
342 else if (!strcmp ((
char *) s,
"natively-forward"))
344 else if (!strcmp ((
char *) s,
"send-map-request"))
346 else if (!strcmp ((
char *) s,
"drop"))
369 return format (0,
"sha1");
371 return format (0,
"sha256");
387 s =
format (s,
"no-action");
390 s =
format (s,
"natively-forward");
393 s =
format (s,
"send-map-request");
493 return version ==
IP4 ? 32 : 128;
514 u8 *p = b +
sizeof (
u16);
523 u8 *p = b +
sizeof (
u16);
533 u8 *p = b +
sizeof (
u16);
535 return (len +
sizeof (
u16));
544 return (
sizeof (
u16) + size);
551 lcaf->
type = lh->type;
559 return sizeof (lh[0]);
580 u16 afi = clib_net_to_host_u16 (*(
u16 *) p);
607 size +=
sizeof (sd_hdr[0]);
648 size +=
sizeof (
u32);
653 u16 afi = clib_net_to_host_u16 (*((
u16 *) (p + size)));
657 if ((
u16) ~ 0 == len)
678 offset +=
sizeof (
u16);
690 return sizeof (
u16) + size;
727 memset (g, 0,
sizeof (g[0]));
755 memset (dst, 0,
sizeof (*dst));
756 dst->ip.v4 = src->ip.v4;
790 a->ip6 = addr->ip.v6;
810 mask =
pow2_mask (preflen) << (32 - preflen);
811 mask = clib_host_to_net_u32 (mask);
824 memset (mask_6, 0,
sizeof (mask_6));
833 m = (
u32 *) & mask_6[0];
835 for (j = 0; j < i0; j++)
842 m[i0] = clib_host_to_net_u32 (
pow2_mask (i1) << (32 - i1));
845 for (j = 0; j <
sizeof (mask_6); j++)
847 ip6->
as_u8[j] &= mask_6[j];
880 ip_prefix_t *
a = (ip_prefix_t *) pref;
1023 return (
sizeof (
u32)
1036 size +=
sizeof (
u16);
1037 memset (h, 0,
sizeof (h[0]));
1040 LCAF_LENGTH (h) = clib_host_to_net_u16 (lcaf_len);
1043 size +=
sizeof (h[0]);
1046 if ((
u16) ~ 0 == len)
1099 size +=
sizeof (
u16);
1100 memset (h, 0,
sizeof (h[0]));
1105 LCAF_LENGTH (h) = clib_host_to_net_u16 (lcaf_len);
1108 size +=
sizeof (h[0]);
1110 memset (&sd_hdr, 0,
sizeof (sd_hdr));
1114 size +=
sizeof (sd_hdr);
1117 if ((
u16) ~ 0 == len)
1122 if ((
u16) ~ 0 == len)
1138 size +=
sizeof (
u16);
1139 memset (h, 0,
sizeof (h[0]));
1141 u16 lcaf_len =
sizeof (
u32)
1143 LCAF_LENGTH (h) = clib_host_to_net_u16 (lcaf_len);
1148 size +=
sizeof (h[0]);
1150 u32 *afip = (
u32 *) (p + size);
1152 size +=
sizeof (
u32);
1158 if ((
u16) ~ 0 == len)
1165 if ((
u16) ~ 0 == len)
1175 return sizeof (
u16);
1181 return sizeof (
u16);
1206 u16 lcaf_size =
sizeof (
u32) +
sizeof (
u16)
1223 size +=
sizeof (
u16);
1246 return sizeof (
u16) + 6;
1308 offset +=
sizeof (
u16);
1311 return sizeof (
u16) + 6;
1325 afi = clib_net_to_host_u16 (*((
u16 *) offset));
1389 return memcmp (a1, a2, 6);
1496 loc->
state = status;
1543 memset (sd, 0,
sizeof (*sd));
1565 clib_warning (
"Unsupported gid type %d while conversion!",
size_to_write_fct size_to_write_fcts[GID_ADDR_TYPES]
void vni_copy(void *dst, void *src)
static u16 gid_address_size_to_put_no_vni(gid_address_t *gid)
u8 * format_hmac_key_id(u8 *s, va_list *args)
sll srl srl sll sra u16x4 i
#define gid_address_type(_a)
cast_fct cast_fcts[GID_ADDR_TYPES]
u16 no_addr_parse(u8 *p, void *a)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
addr_len_fct lcaf_body_length_fcts[LCAF_TYPES]
static lisp_afi_e ip_version_to_iana_afi(u16 version)
static void ip_prefix_normalize_ip6(ip6_address_t *ip6, u8 preflen)
void sd_copy(void *dst, void *src)
void * ip_prefix_cast(gid_address_t *a)
static int mac_cmp(void *a1, void *a2)
u16 vni_parse(u8 *p, void *a)
u16 ip_prefix_write(u8 *p, void *gid)
#define gid_address_sd_src_mac(_a)
#define ip_prefix_len(_a)
#define gid_address_sd(_a)
uword unformat_ip_address(unformat_input_t *input, va_list *args)
int no_addr_cmp(void *a1, void *a2)
#define gid_address_sd_src_ippref(_a)
u16 sd_parse(u8 *p, void *a)
#define gid_address_lcaf(_a)
static u16 fid_addr_write(u8 *p, fid_address_t *a)
#define gid_address_sd_dst_mac(_a)
int sd_cmp(void *a1, void *a2)
void ip_address_copy(ip_address_t *dst, const ip_address_t *src)
#define LCAF_SD_DST_ML(_h)
void ip_address_set(ip_address_t *dst, const void *src, u8 version)
static void ip_prefix_normalize_ip4(ip4_address_t *ip4, u8 preflen)
void * sd_cast(gid_address_t *a)
uword unformat_hmac_key_id(unformat_input_t *input, va_list *args)
#define ip_prefix_version(_a)
void gid_address_from_ip(gid_address_t *g, ip_address_t *ip)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
void lcaf_copy(void *dst, void *src)
#define LOC_REACHABLE(h_)
uword unformat_negative_mapping_action(unformat_input_t *input, va_list *args)
serdes_fct lcaf_write_fcts[LCAF_TYPES]
u32 locator_parse(void *b, locator_t *loc)
void * lcaf_cast(gid_address_t *a)
u16 gid_address_put(u8 *b, gid_address_t *gid)
u16 gid_address_size_to_put(gid_address_t *gid)
void no_addr_free(void *a)
u32 ip6_address_put(u8 *b, ip6_address_t *a)
u16 sd_size_to_write(void *a)
u8 * format_mac_address(u8 *s, va_list *args)
free_fct lcaf_free_fcts[LCAF_TYPES]
static uword pow2_mask(uword x)
void locator_copy(locator_t *dst, locator_t *src)
int vni_cmp(void *a1, void *a2)
u8 ip_version_to_max_plen(u8 ver)
u32 ip_address_parse(void *offset, u16 iana_afi, ip_address_t *dst)
#define gid_address_sd_src(_a)
#define clib_warning(format, args...)
u16 ip_version_to_size(u8 ver)
#define ip_addr_version(_a)
void *(* cast_fct)(gid_address_t *)
u16 try_parse_src_dst_lcaf(u8 *p, gid_address_t *a)
static u8 fid_address_length(fid_address_t *a)
u16 vni_size_to_write(void *a)
void ip_address_copy_addr(void *dst, const ip_address_t *src)
u8 * format_negative_mapping_action(u8 *s, va_list *args)
u8(* addr_len_fct)(void *)
#define gid_address_mac(_a)
u16(* serdes_fct)(u8 *, void *)
struct _lcaf_src_dst_hdr_t lcaf_src_dst_hdr_t
u32 lcaf_hdr_parse(void *offset, lcaf_t *lcaf)
void gid_address_free(gid_address_t *a)
u16 ip_address_size(const ip_address_t *a)
#define gid_address_sd_dst_type(_a)
uword unformat_gid_address(unformat_input_t *input, va_list *args)
u8 * format_gid_address(u8 *s, va_list *args)
u16 mac_size_to_write(void *a)
serdes_fct lcaf_parse_fcts[LCAF_TYPES]
u32 ip_address_put(u8 *b, ip_address_t *a)
void ip_prefix_normalize(ip_prefix_t *a)
void ip_address_to_46(const ip_address_t *addr, ip46_address_t *a, fib_protocol_t *proto)
u16 ip4_address_size_to_put()
#define gid_address_ippref(_a)
u16 lcaf_size_to_write(void *a)
u16(* size_to_write_fct)(void *)
cmp_fct lcaf_cmp_fcts[LCAF_TYPES]
int gid_address_cmp(gid_address_t *a1, gid_address_t *a2)
void gid_address_ip_set(gid_address_t *dst, void *src, u8 version)
#define vec_free(V)
Free vector's memory (no header).
#define gid_address_ippref_len(_a)
u16 sd_write(u8 *p, void *a)
#define clib_memcpy(a, b, c)
u32 locator_cmp(locator_t *l1, locator_t *l2)
static u16 fid_addr_size_to_write(fid_address_t *a)
addr_len_fct addr_len_fcts[GID_ADDR_TYPES]
u8 no_addr_length(void *a)
static int fid_addr_cmp(fid_address_t *a1, fid_address_t *a2)
#define fid_addr_ippref(_a)
size_to_write_fct lcaf_size_to_write_fcts[LCAF_TYPES]
struct _gid_address_t gid_address_t
uword unformat_mac_address(unformat_input_t *input, va_list *args)
struct _lcaf_hdr_t lcaf_hdr_t
void(* copy_fct)(void *, void *)
#define fid_addr_type(_a)
u8 * format_ip_address(u8 *s, va_list *args)
#define gid_address_sd_dst(_a)
#define ip46_address_set_ip4(ip46, ip)
u16 no_addr_write(u8 *p, void *a)
void * mac_cast(gid_address_t *a)
static u16 gid_address_put_no_vni(u8 *b, gid_address_t *gid)
static void clib_mem_free(void *p)
int ip_prefix_cmp(ip_prefix_t *p1, ip_prefix_t *p2)
void * gid_address_cast(gid_address_t *gid, gid_address_type_t type)
struct _locator_hdr locator_hdr_t
#define gid_address_sd_dst_ippref(_a)
uword unformat_ip_prefix(unformat_input_t *input, va_list *args)
static void * clib_mem_alloc(uword size)
u32 ip4_address_put(u8 *b, ip4_address_t *a)
u8 * format_ip_prefix(u8 *s, va_list *args)
u16 no_addr_size_to_write(void *a)
#define foreach_lcaf_type
template key/value backing page structure
#define gid_address_ip(_a)
#define gid_address_vni(_a)
u32 mac_parse(u8 *offset, u8 *a)
void locator_free(locator_t *l)
u16 ip_address_size_to_write(ip_address_t *a)
u8 gid_address_len(gid_address_t *a)
copy_fct lcaf_copy_fcts[LCAF_TYPES]
u8 ip_address_max_len(u8 version)
#define LOC_MPRIORITY(h_)
void gid_address_copy(gid_address_t *dst, gid_address_t *src)
void mac_copy(void *dst, void *src)
u16 vni_write(u8 *p, void *a)
struct clib_bihash_value offset
template key/value backing page structure
int(* cmp_fct)(void *, void *)
static u8 iana_afi_to_fid_addr_type(u16 type)
u16 ip_address_iana_afi(ip_address_t *a)
void no_addr_copy(void *dst, void *src)
#define gid_address_sd_src_type(_a)
u32 gid_address_parse(u8 *offset, gid_address_t *a)
#define gid_address_vni_mask(_a)
u16 mac_write(u8 *p, void *a)
copy_fct copy_fcts[GID_ADDR_TYPES]
u16 lcaf_write(u8 *p, void *a)
static u8 ip_iana_afi_to_version(lisp_afi_e afi)
u8 ip_prefix_length(void *a)
u8 * format_fid_address(u8 *s, va_list *args)
void build_src_dst(gid_address_t *sd, gid_address_t *src, gid_address_t *dst)
static u16 fid_addr_parse(u8 *p, fid_address_t *a)
#define LCAF_SD_SRC_ML(_h)
void ip_prefix_copy(void *dst, void *src)
u16 ip_prefix_size_to_write(void *pref)
u16 ip6_address_size_to_put()
#define ip_prefix_addr(_a)
int ip_address_cmp(const ip_address_t *ip1, const ip_address_t *ip2)
u32 lcaf_parse(void *offset, gid_address_t *addr)
serdes_fct write_fcts[GID_ADDR_TYPES]
uword unformat_fid_address(unformat_input_t *i, va_list *args)