summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_neigh.h
blob: 953f2e300a401849999675969aef8584d010eba6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * Zebra neighbor table management
 *
 * Copyright (C) 2021 Nvidia
 * Anuradha Karuppiah
 *
 * This file is part of FRR.
 *
 * FRR is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * FRR is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 */

#ifndef _ZEBRA_NEIGH_H
#define _ZEBRA_NEIGH_H

#include <zebra.h>

#include "if.h"

#define zneigh_info zrouter.neigh_info

struct zebra_neigh_ent {
	ifindex_t ifindex;
	struct ipaddr ip;

	struct ethaddr mac;

	uint32_t flags;
#define ZEBRA_NEIGH_ENT_ACTIVE (1 << 0) /* can be used for traffic */

	/* memory used for adding the neigt entry to zneigh_info->es_rb_tree */
	RB_ENTRY(zebra_neigh_ent) rb_node;

	/* list of pbr rules associated with this neigh */
	struct list *pbr_rule_list;
};
RB_HEAD(zebra_neigh_rb_head, zebra_neigh_ent);
RB_PROTOTYPE(zebra_neigh_rb_head, zebra_neigh_ent, rb_node, zebra_es_rb_cmp);

struct zebra_neigh_info {
	/* RB tree of neighbor entries  */
	struct zebra_neigh_rb_head neigh_rb_tree;
};


/****************************************************************************/
extern void zebra_neigh_add(struct interface *ifp, struct ipaddr *ip,
			    struct ethaddr *mac);
extern void zebra_neigh_del(struct interface *ifp, struct ipaddr *ip);
extern void zebra_neigh_show(struct vty *vty);
extern void zebra_neigh_init(void);
extern void zebra_neigh_terminate(void);
extern void zebra_neigh_deref(struct zebra_pbr_rule *rule);
extern void zebra_neigh_ref(int ifindex, struct ipaddr *ip,
			    struct zebra_pbr_rule *rule);

#endif /* _ZEBRA_NEIGH_H */