2 * Copyright (c) 2016 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <vnet/lisp-cp/gid_dictionary.h>
22 foreach_subprefix_match_cb_t cb;
25 gid_ip4_table_t *ip4_table;
26 gid_ip6_table_t *ip6_table;
30 static u32 ip4_lookup (gid_ip4_table_t * db, u32 vni, ip_prefix_t * key);
32 static u32 ip6_lookup (gid_ip6_table_t * db, u32 vni, ip_prefix_t * key);
35 foreach_sfib4_subprefix (BVT (clib_bihash_kv) * kvp, void *arg)
37 sfib_entry_arg_t *a = arg;
38 u32 ip = (u32) kvp->key[0];
40 u8 plen = ip_prefix_len (&a->src);
43 mask = &a->ip4_table->ip4_fib_masks[plen];
45 u32 src_ip = ip_prefix_v4 (&a->src).as_u32;
46 src_ip &= mask->as_u32;
51 /* found sub-prefix of src prefix */
52 (a->cb) (kvp->value, a->arg);
57 gid_dict_foreach_ip4_subprefix (gid_dictionary_t * db, u32 vni,
58 ip_prefix_t * src, ip_prefix_t * dst,
59 foreach_subprefix_match_cb_t cb, void *arg)
62 gid_ip4_table_t *sfib4;
65 sfi = ip4_lookup (&db->dst_ip4_table, vni, dst);
66 if (GID_LOOKUP_MISS == sfi)
69 sfib4 = pool_elt_at_index (db->src_ip4_table_pool, sfi);
76 BV (clib_bihash_foreach_key_value_pair) (&sfib4->ip4_lookup_table,
77 foreach_sfib4_subprefix, &a);
81 foreach_sfib6_subprefix (BVT (clib_bihash_kv) * kvp, void *arg)
83 sfib_entry_arg_t *a = arg;
86 u8 plen = ip_prefix_len (&a->src);
88 mask = &a->ip6_table->ip6_fib_masks[plen];
89 ip.as_u64[0] = kvp->key[0];
90 ip.as_u64[1] = kvp->key[1];
92 if (ip6_address_is_equal_masked (&ip_prefix_v6 (&a->src), &ip, mask))
94 /* found sub-prefix of src prefix */
95 (a->cb) (kvp->value, a->arg);
100 gid_dict_foreach_ip6_subprefix (gid_dictionary_t * db, u32 vni,
101 ip_prefix_t * src, ip_prefix_t * dst,
102 foreach_subprefix_match_cb_t cb, void *arg)
105 gid_ip6_table_t *sfib6;
108 sfi = ip6_lookup (&db->dst_ip6_table, vni, dst);
109 if (GID_LOOKUP_MISS == sfi)
112 sfib6 = pool_elt_at_index (db->src_ip6_table_pool, sfi);
119 BV (clib_bihash_foreach_key_value_pair) (&sfib6->ip6_lookup_table,
120 foreach_sfib6_subprefix, &a);
124 gid_dict_foreach_subprefix (gid_dictionary_t * db, gid_address_t * eid,
125 foreach_subprefix_match_cb_t cb, void *arg)
127 ip_prefix_t *ippref = &gid_address_sd_dst_ippref (eid);
129 if (IP4 == ip_prefix_version (ippref))
130 gid_dict_foreach_ip4_subprefix (db, gid_address_vni (eid),
131 &gid_address_sd_src_ippref (eid),
132 &gid_address_sd_dst_ippref (eid), cb,
135 gid_dict_foreach_ip6_subprefix (db, gid_address_vni (eid),
136 &gid_address_sd_src_ippref (eid),
137 &gid_address_sd_dst_ippref (eid), cb,
142 make_mac_sd_key (BVT (clib_bihash_kv) * kv, u32 vni, u8 src_mac[6],
145 kv->key[0] = (u64) vni;
146 kv->key[1] = mac_to_u64 (dst_mac);
147 kv->key[2] = src_mac ? mac_to_u64 (src_mac) : (u64) 0;
151 mac_sd_lookup (gid_mac_table_t * db, u32 vni, u8 * dst, u8 * src)
154 BVT (clib_bihash_kv) kv, value;
156 make_mac_sd_key (&kv, vni, src, dst);
157 rv = BV (clib_bihash_search_inline_2) (&db->mac_lookup_table, &kv, &value);
159 /* no match, try with src 0, catch all for dst */
163 rv = BV (clib_bihash_search_inline_2) (&db->mac_lookup_table, &kv,
171 return GID_LOOKUP_MISS;
175 ip4_lookup_exact_match (gid_ip4_table_t * db, u32 vni, ip_prefix_t * key)
178 BVT (clib_bihash_kv) kv, value;
182 mask = &db->ip4_fib_masks[ip_prefix_len (key)];
184 kv.key[0] = ((u64) vni << 32) | (ip_prefix_v4 (key).as_u32 & mask->as_u32);
188 rv = BV (clib_bihash_search_inline_2) (&db->ip4_lookup_table, &kv, &value);
192 return GID_LOOKUP_MISS;
196 ip4_lookup (gid_ip4_table_t * db, u32 vni, ip_prefix_t * key)
200 BVT (clib_bihash_kv) kv, value;
202 len = vec_len (db->ip4_prefix_lengths_in_search_order);
204 for (i = 0; i < len; i++)
206 int dst_address_length = db->ip4_prefix_lengths_in_search_order[i];
209 ASSERT (dst_address_length >= 0 && dst_address_length <= 32);
211 mask = &db->ip4_fib_masks[dst_address_length];
214 ((u64) vni << 32) | (ip_prefix_v4 (key).as_u32 & mask->as_u32);
219 BV (clib_bihash_search_inline_2) (&db->ip4_lookup_table, &kv, &value);
224 return GID_LOOKUP_MISS;
228 ip6_lookup_exact_match (gid_ip6_table_t * db, u32 vni, ip_prefix_t * key)
231 BVT (clib_bihash_kv) kv, value;
234 mask = &db->ip6_fib_masks[ip_prefix_len (key)];
236 kv.key[0] = ip_prefix_v6 (key).as_u64[0] & mask->as_u64[0];
237 kv.key[1] = ip_prefix_v6 (key).as_u64[1] & mask->as_u64[1];
238 kv.key[2] = (u64) vni;
240 rv = BV (clib_bihash_search_inline_2) (&db->ip6_lookup_table, &kv, &value);
244 return GID_LOOKUP_MISS;
248 ip6_lookup (gid_ip6_table_t * db, u32 vni, ip_prefix_t * key)
252 BVT (clib_bihash_kv) kv, value;
254 len = vec_len (db->ip6_prefix_lengths_in_search_order);
256 for (i = 0; i < len; i++)
258 int dst_address_length = db->ip6_prefix_lengths_in_search_order[i];
261 ASSERT (dst_address_length >= 0 && dst_address_length <= 128);
263 mask = &db->ip6_fib_masks[dst_address_length];
265 kv.key[0] = ip_prefix_v6 (key).as_u64[0] & mask->as_u64[0];
266 kv.key[1] = ip_prefix_v6 (key).as_u64[1] & mask->as_u64[1];
267 kv.key[2] = (u64) vni;
270 BV (clib_bihash_search_inline_2) (&db->ip6_lookup_table, &kv, &value);
275 return GID_LOOKUP_MISS;
279 ip_sd_lookup (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst,
283 gid_ip4_table_t *sfib4;
284 gid_ip6_table_t *sfib6;
286 switch (ip_prefix_version (dst))
289 sfi = ip4_lookup (&db->dst_ip4_table, vni, dst);
290 if (GID_LOOKUP_MISS != sfi)
291 sfib4 = pool_elt_at_index (db->src_ip4_table_pool, sfi);
293 return GID_LOOKUP_MISS;
298 memset (&sp, 0, sizeof (sp));
299 return ip4_lookup_exact_match (sfib4, 0, &sp);
302 return ip4_lookup (sfib4, 0, src);
306 sfi = ip6_lookup (&db->dst_ip6_table, vni, dst);
307 if (GID_LOOKUP_MISS != sfi)
308 sfib6 = pool_elt_at_index (db->src_ip6_table_pool, sfi);
310 return GID_LOOKUP_MISS;
315 memset (&sp, 0, sizeof (sp));
316 ip_prefix_version (&sp) = IP6;
317 return ip6_lookup_exact_match (sfib6, 0, &sp);
320 return ip6_lookup (sfib6, 0, src);
324 clib_warning ("address type %d not supported!",
325 ip_prefix_version (dst));
328 return GID_LOOKUP_MISS;
332 gid_dictionary_lookup (gid_dictionary_t * db, gid_address_t * key)
334 switch (gid_address_type (key))
336 case GID_ADDR_IP_PREFIX:
337 return ip_sd_lookup (db, gid_address_vni (key),
338 &gid_address_ippref (key), 0);
340 return mac_sd_lookup (&db->sd_mac_table, gid_address_vni (key),
341 gid_address_mac (key), 0);
342 case GID_ADDR_SRC_DST:
343 switch (gid_address_sd_dst_type (key))
345 case FID_ADDR_IP_PREF:
346 return ip_sd_lookup (db, gid_address_vni (key),
347 &gid_address_sd_dst_ippref (key),
348 &gid_address_sd_src_ippref (key));
351 return mac_sd_lookup (&db->sd_mac_table, gid_address_vni (key),
352 gid_address_sd_dst_mac (key),
353 gid_address_sd_src_mac (key));
356 clib_warning ("Source/Dest address type %d not supported!",
357 gid_address_sd_dst_type (key));
362 clib_warning ("address type %d not supported!", gid_address_type (key));
365 return GID_LOOKUP_MISS;
369 gid_dictionary_sd_lookup (gid_dictionary_t * db, gid_address_t * dst,
372 switch (gid_address_type (dst))
374 case GID_ADDR_IP_PREFIX:
375 return ip_sd_lookup (db, gid_address_vni (dst),
376 &gid_address_ippref (dst),
377 &gid_address_ippref (src));
379 return mac_sd_lookup (&db->sd_mac_table, gid_address_vni (dst),
380 gid_address_mac (dst), gid_address_mac (src));
381 case GID_ADDR_SRC_DST:
382 switch (gid_address_sd_dst_type (dst))
384 case FID_ADDR_IP_PREF:
385 return ip_sd_lookup (db, gid_address_vni (dst),
386 &gid_address_sd_dst_ippref (dst),
387 &gid_address_sd_src_ippref (dst));
390 return mac_sd_lookup (&db->sd_mac_table, gid_address_vni (dst),
391 gid_address_sd_dst_mac (dst),
392 gid_address_sd_src_mac (dst));
395 clib_warning ("Source/Dest address type %d not supported!",
396 gid_address_sd_dst_type (dst));
401 clib_warning ("address type %d not supported!", gid_address_type (dst));
404 return GID_LOOKUP_MISS;
408 ip4_compute_prefix_lengths_in_search_order (gid_ip4_table_t * db)
411 vec_reset_length (db->ip4_prefix_lengths_in_search_order);
412 /* Note: bitmap reversed so this is in fact a longest prefix match */
415 clib_bitmap_foreach (i, db->ip4_non_empty_dst_address_length_bitmap,
417 int dst_address_length = 32 - i;
418 vec_add1 (db->ip4_prefix_lengths_in_search_order, dst_address_length);
425 add_del_ip4_key (gid_ip4_table_t * db, u32 vni, ip_prefix_t * pref, u32 val,
428 BVT (clib_bihash_kv) kv, value;
431 u8 plen = ip_prefix_len (pref);
433 clib_memcpy (&key, &ip_prefix_v4 (pref), sizeof (key));
434 key.as_u32 &= db->ip4_fib_masks[plen].as_u32;
437 db->ip4_non_empty_dst_address_length_bitmap =
438 clib_bitmap_set (db->ip4_non_empty_dst_address_length_bitmap,
440 ip4_compute_prefix_lengths_in_search_order (db);
442 db->ip4_prefix_len_refcount[plen]++;
446 ASSERT (db->ip4_prefix_len_refcount[plen] != 0);
448 db->ip4_prefix_len_refcount[plen]--;
450 if (db->ip4_prefix_len_refcount[plen] == 0)
452 db->ip4_non_empty_dst_address_length_bitmap =
453 clib_bitmap_set (db->ip4_non_empty_dst_address_length_bitmap,
455 ip4_compute_prefix_lengths_in_search_order (db);
459 kv.key[0] = ((u64) vni << 32) | key.as_u32;
463 if (BV (clib_bihash_search) (&db->ip4_lookup_table, &kv, &value) == 0)
464 old_val = value.value;
468 BV (clib_bihash_add_del) (&db->ip4_lookup_table, &kv, 0 /* is_add */ );
474 BV (clib_bihash_add_del) (&db->ip4_lookup_table, &kv, 1 /* is_add */ );
481 ip4_lookup_init (gid_ip4_table_t * db)
485 memset (db->ip4_prefix_len_refcount, 0,
486 sizeof (db->ip4_prefix_len_refcount));
488 for (i = 0; i < ARRAY_LEN (db->ip4_fib_masks); i++)
493 m = pow2_mask (i) << (32 - i);
496 db->ip4_fib_masks[i].as_u32 = clib_host_to_net_u32 (m);
498 if (db->ip4_lookup_table_nbuckets == 0)
499 db->ip4_lookup_table_nbuckets = IP4_LOOKUP_DEFAULT_HASH_NUM_BUCKETS;
501 db->ip4_lookup_table_nbuckets =
502 1 << max_log2 (db->ip4_lookup_table_nbuckets);
504 if (db->ip4_lookup_table_size == 0)
505 db->ip4_lookup_table_size = IP4_LOOKUP_DEFAULT_HASH_MEMORY_SIZE;
507 BV (clib_bihash_init) (&db->ip4_lookup_table, "ip4 lookup table",
508 db->ip4_lookup_table_nbuckets,
509 db->ip4_lookup_table_size);
513 add_del_sd_ip4_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref,
514 ip_prefix_t * src_pref, u32 val, u8 is_add)
516 u32 sfi, old_val = ~0;
517 gid_ip4_table_t *sfib;
519 sfi = ip4_lookup_exact_match (&db->dst_ip4_table, vni, dst_pref);
523 if (GID_LOOKUP_MISS == sfi)
525 pool_get (db->src_ip4_table_pool, sfib);
526 ip4_lookup_init (sfib);
527 add_del_ip4_key (&db->dst_ip4_table, vni, dst_pref,
528 sfib - db->src_ip4_table_pool, is_add);
530 add_del_ip4_key (sfib, 0 /* vni */ , src_pref, val, is_add);
534 memset (&sp, 0, sizeof (sp));
535 add_del_ip4_key (sfib, 0 /* vni */ , &sp, val, is_add);
540 ASSERT (!pool_is_free_index (db->src_ip4_table_pool, sfi));
541 sfib = pool_elt_at_index (db->src_ip4_table_pool, sfi);
544 old_val = ip4_lookup_exact_match (sfib, 0, src_pref);
545 add_del_ip4_key (sfib, 0 /* vni */ , src_pref, val, is_add);
550 memset (&sp, 0, sizeof (sp));
552 add_del_ip4_key (sfib, 0 /* vni */ , &sp, val, is_add);
558 if (GID_LOOKUP_MISS != sfi)
560 sfib = pool_elt_at_index (db->src_ip4_table_pool, sfi);
562 old_val = add_del_ip4_key (sfib, 0, src_pref, 0, is_add);
566 memset (&sp, 0, sizeof (sp));
567 old_val = add_del_ip4_key (sfib, 0, &sp, 0, is_add);
570 if (sfib->count == 0)
571 add_del_ip4_key (&db->dst_ip4_table, vni, dst_pref, 0, is_add);
574 clib_warning ("cannot delete dst mapping %U!", format_ip_prefix,
581 ip6_compute_prefix_lengths_in_search_order (gid_ip6_table_t * db)
584 vec_reset_length (db->ip6_prefix_lengths_in_search_order);
585 /* Note: bitmap reversed so this is in fact a longest prefix match */
588 clib_bitmap_foreach (i, db->ip6_non_empty_dst_address_length_bitmap,
590 int dst_address_length = 128 - i;
591 vec_add1 (db->ip6_prefix_lengths_in_search_order, dst_address_length);
597 add_del_ip6_key (gid_ip6_table_t * db, u32 vni, ip_prefix_t * pref, u32 val,
600 BVT (clib_bihash_kv) kv, value;
603 u8 plen = ip_prefix_len (pref);
605 clib_memcpy (&key, &ip_prefix_v6 (pref), sizeof (key));
606 ip6_address_mask (&key, &db->ip6_fib_masks[plen]);
609 db->ip6_non_empty_dst_address_length_bitmap =
610 clib_bitmap_set (db->ip6_non_empty_dst_address_length_bitmap,
612 ip6_compute_prefix_lengths_in_search_order (db);
613 db->ip6_prefix_len_refcount[plen]++;
617 ASSERT (db->ip6_prefix_len_refcount[plen] != 0);
619 db->ip6_prefix_len_refcount[plen]--;
621 if (db->ip6_prefix_len_refcount[plen] == 0)
623 db->ip6_non_empty_dst_address_length_bitmap =
624 clib_bitmap_set (db->ip6_non_empty_dst_address_length_bitmap,
626 ip6_compute_prefix_lengths_in_search_order (db);
630 kv.key[0] = key.as_u64[0];
631 kv.key[1] = key.as_u64[1];
632 kv.key[2] = (u64) vni;
633 // kv.key[2] = ((u64)((fib - im->fibs))<<32) | ip_prefix_len(key);
635 if (BV (clib_bihash_search) (&db->ip6_lookup_table, &kv, &value) == 0)
636 old_val = value.value;
640 BV (clib_bihash_add_del) (&db->ip6_lookup_table, &kv, 0 /* is_add */ );
646 BV (clib_bihash_add_del) (&db->ip6_lookup_table, &kv, 1 /* is_add */ );
653 add_del_mac (gid_mac_table_t * db, u32 vni, u8 * dst_mac, u8 * src_mac,
656 BVT (clib_bihash_kv) kv, value;
659 make_mac_sd_key (&kv, vni, src_mac, dst_mac);
661 if (BV (clib_bihash_search) (&db->mac_lookup_table, &kv, &value) == 0)
662 old_val = value.value;
666 BV (clib_bihash_add_del) (&db->mac_lookup_table, &kv, 0 /* is_add */ );
672 BV (clib_bihash_add_del) (&db->mac_lookup_table, &kv, 1 /* is_add */ );
679 ip6_lookup_init (gid_ip6_table_t * db)
683 memset (db->ip6_prefix_len_refcount, 0,
684 sizeof (db->ip6_prefix_len_refcount));
686 for (i = 0; i < ARRAY_LEN (db->ip6_fib_masks); i++)
693 for (j = 0; j < i0; j++)
694 db->ip6_fib_masks[i].as_u32[j] = ~0;
697 db->ip6_fib_masks[i].as_u32[i0] =
698 clib_host_to_net_u32 (pow2_mask (i1) << (32 - i1));
701 if (db->ip6_lookup_table_nbuckets == 0)
702 db->ip6_lookup_table_nbuckets = IP6_LOOKUP_DEFAULT_HASH_NUM_BUCKETS;
704 db->ip6_lookup_table_nbuckets =
705 1 << max_log2 (db->ip6_lookup_table_nbuckets);
707 if (db->ip6_lookup_table_size == 0)
708 db->ip6_lookup_table_size = IP6_LOOKUP_DEFAULT_HASH_MEMORY_SIZE;
710 BV (clib_bihash_init) (&db->ip6_lookup_table, "ip6 lookup table",
711 db->ip6_lookup_table_nbuckets,
712 db->ip6_lookup_table_size);
716 add_del_sd_ip6_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref,
717 ip_prefix_t * src_pref, u32 val, u8 is_add)
719 u32 sfi, old_val = ~0;
720 gid_ip6_table_t *sfib;
722 sfi = ip6_lookup_exact_match (&db->dst_ip6_table, vni, dst_pref);
726 if (GID_LOOKUP_MISS == sfi)
728 pool_get (db->src_ip6_table_pool, sfib);
729 ip6_lookup_init (sfib);
730 add_del_ip6_key (&db->dst_ip6_table, vni, dst_pref,
731 sfib - db->src_ip6_table_pool, is_add);
733 add_del_ip6_key (sfib, 0 /* vni */ , src_pref, val, is_add);
737 memset (&sp, 0, sizeof (sp));
738 ip_prefix_version (&sp) = IP6;
739 add_del_ip6_key (sfib, 0 /* vni */ , &sp, val, is_add);
744 ASSERT (!pool_is_free_index (db->src_ip6_table_pool, sfi));
745 sfib = pool_elt_at_index (db->src_ip6_table_pool, sfi);
748 old_val = ip6_lookup_exact_match (sfib, 0, src_pref);
749 add_del_ip6_key (sfib, 0 /* vni */ , src_pref, val, is_add);
754 memset (&sp, 0, sizeof (sp));
755 ip_prefix_version (&sp) = IP6;
757 add_del_ip6_key (sfib, 0 /* vni */ , &sp, val, is_add);
763 if (GID_LOOKUP_MISS != sfi)
765 sfib = pool_elt_at_index (db->src_ip6_table_pool, sfi);
767 old_val = add_del_ip6_key (sfib, 0, src_pref, 0, is_add);
771 memset (&sp, 0, sizeof (sp));
772 ip_prefix_version (&sp) = IP6;
773 old_val = add_del_ip6_key (sfib, 0, &sp, 0, is_add);
776 if (sfib->count == 0)
777 add_del_ip6_key (&db->dst_ip6_table, vni, dst_pref, 0, is_add);
780 clib_warning ("cannot delete dst mapping %U!", format_ip_prefix,
787 add_del_ip (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_key,
788 ip_prefix_t * src_key, u32 value, u8 is_add)
790 switch (ip_prefix_version (dst_key))
793 return add_del_sd_ip4_key (db, vni, dst_key, src_key, value, is_add);
796 return add_del_sd_ip6_key (db, vni, dst_key, src_key, value, is_add);
799 clib_warning ("address type %d not supported!",
800 ip_prefix_version (dst_key));
807 add_del_sd (gid_dictionary_t * db, u32 vni, source_dest_t * key, u32 value,
810 switch (sd_dst_type (key))
812 case FID_ADDR_IP_PREF:
813 add_del_ip (db, vni, &sd_dst_ippref (key), &sd_src_ippref (key),
817 return add_del_mac (&db->sd_mac_table, vni, sd_dst_mac (key),
818 sd_src_mac (key), value, is_add);
821 clib_warning ("SD address type %d not supprted!", sd_dst_type (key));
829 gid_dictionary_add_del (gid_dictionary_t * db, gid_address_t * key, u32 value,
832 switch (gid_address_type (key))
834 case GID_ADDR_IP_PREFIX:
835 return add_del_ip (db, gid_address_vni (key), &gid_address_ippref (key),
838 return add_del_mac (&db->sd_mac_table, gid_address_vni (key),
839 gid_address_mac (key), 0, value, is_add);
840 case GID_ADDR_SRC_DST:
841 return add_del_sd (db, gid_address_vni (key), &gid_address_sd (key),
844 clib_warning ("address type %d not supported!", gid_address_type (key));
851 mac_lookup_init (gid_mac_table_t * db)
853 if (db->mac_lookup_table_nbuckets == 0)
854 db->mac_lookup_table_nbuckets = MAC_LOOKUP_DEFAULT_HASH_NUM_BUCKETS;
856 db->mac_lookup_table_nbuckets =
857 1 << max_log2 (db->mac_lookup_table_nbuckets);
859 if (db->mac_lookup_table_size == 0)
860 db->mac_lookup_table_size = MAC_LOOKUP_DEFAULT_HASH_MEMORY_SIZE;
862 BV (clib_bihash_init) (&db->mac_lookup_table, "mac lookup table",
863 db->mac_lookup_table_nbuckets,
864 db->mac_lookup_table_size);
868 gid_dictionary_init (gid_dictionary_t * db)
870 ip4_lookup_init (&db->dst_ip4_table);
871 ip6_lookup_init (&db->dst_ip6_table);
872 mac_lookup_init (&db->sd_mac_table);
876 * fd.io coding-style-patch-verification: ON
879 * eval: (c-set-style "gnu")