Line data Source code
1 : /*
2 : * Zebra neighbor table management
3 : *
4 : * Copyright (C) 2021 Nvidia
5 : * Anuradha Karuppiah
6 : *
7 : * This file is part of FRR.
8 : *
9 : * FRR is free software; you can redistribute it and/or modify it
10 : * under the terms of the GNU General Public License as published by the
11 : * Free Software Foundation; either version 2, or (at your option) any
12 : * later version.
13 : *
14 : * FRR is distributed in the hope that it will be useful, but
15 : * WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 : * General Public License for more details.
18 : */
19 :
20 : #ifndef _ZEBRA_NEIGH_H
21 : #define _ZEBRA_NEIGH_H
22 :
23 : #include <zebra.h>
24 :
25 : #include "if.h"
26 :
27 : #define zneigh_info zrouter.neigh_info
28 :
29 : struct zebra_neigh_ent {
30 : ifindex_t ifindex;
31 : struct ipaddr ip;
32 :
33 : struct ethaddr mac;
34 :
35 : uint32_t flags;
36 : #define ZEBRA_NEIGH_ENT_ACTIVE (1 << 0) /* can be used for traffic */
37 :
38 : /* memory used for adding the neigt entry to zneigh_info->es_rb_tree */
39 : RB_ENTRY(zebra_neigh_ent) rb_node;
40 :
41 : /* list of pbr rules associated with this neigh */
42 : struct list *pbr_rule_list;
43 : };
44 : RB_HEAD(zebra_neigh_rb_head, zebra_neigh_ent);
45 28 : RB_PROTOTYPE(zebra_neigh_rb_head, zebra_neigh_ent, rb_node, zebra_es_rb_cmp);
46 :
47 : struct zebra_neigh_info {
48 : /* RB tree of neighbor entries */
49 : struct zebra_neigh_rb_head neigh_rb_tree;
50 : };
51 :
52 :
53 : /****************************************************************************/
54 : extern void zebra_neigh_add(struct interface *ifp, struct ipaddr *ip,
55 : struct ethaddr *mac);
56 : extern void zebra_neigh_del(struct interface *ifp, struct ipaddr *ip);
57 : extern void zebra_neigh_show(struct vty *vty);
58 : extern void zebra_neigh_init(void);
59 : extern void zebra_neigh_terminate(void);
60 : extern void zebra_neigh_deref(struct zebra_pbr_rule *rule);
61 : extern void zebra_neigh_ref(int ifindex, struct ipaddr *ip,
62 : struct zebra_pbr_rule *rule);
63 :
64 : #endif /* _ZEBRA_NEIGH_H */
|