Coverage Report

Created: 2026-04-09 07:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/frr/zebra/zebra_vxlan.h
Line
Count
Source
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
/*
3
 * Zebra VxLAN (EVPN) Data structures and definitions
4
 * These are public definitions referenced by other files.
5
 * Copyright (C) 2016, 2017 Cumulus Networks, Inc.
6
 */
7
8
#ifndef _ZEBRA_VXLAN_H
9
#define _ZEBRA_VXLAN_H
10
11
#include <zebra.h>
12
#include <zebra/zebra_router.h>
13
14
#include "linklist.h"
15
#include "if.h"
16
#include "vlan.h"
17
#include "vxlan.h"
18
19
#include "lib/json.h"
20
#include "zebra/zebra_vrf.h"
21
#include "zebra/zserv.h"
22
#include "zebra/zebra_dplane.h"
23
#include "zebra/interface.h"
24
25
#ifdef __cplusplus
26
extern "C" {
27
#endif
28
29
/* Is EVPN enabled? */
30
4
#define EVPN_ENABLED(zvrf)  (zvrf)->advertise_all_vni
31
static inline int is_evpn_enabled(void)
32
1
{
33
1
  return EVPN_ENABLED(zebra_vrf_get_evpn());
34
1
}
Unexecuted instantiation: if_netlink.c:is_evpn_enabled
Unexecuted instantiation: interface.c:is_evpn_enabled
Unexecuted instantiation: main.c:is_evpn_enabled
Unexecuted instantiation: redistribute.c:is_evpn_enabled
Unexecuted instantiation: rt_netlink.c:is_evpn_enabled
Unexecuted instantiation: zapi_msg.c:is_evpn_enabled
Unexecuted instantiation: zebra_dplane.c:is_evpn_enabled
Unexecuted instantiation: zebra_l2.c:is_evpn_enabled
Unexecuted instantiation: zebra_l2_bridge_if.c:is_evpn_enabled
Unexecuted instantiation: zebra_evpn.c:is_evpn_enabled
Unexecuted instantiation: zebra_evpn_mac.c:is_evpn_enabled
Unexecuted instantiation: zebra_evpn_neigh.c:is_evpn_enabled
Unexecuted instantiation: zebra_nb_config.c:is_evpn_enabled
Unexecuted instantiation: zebra_nb_rpcs.c:is_evpn_enabled
Unexecuted instantiation: zebra_nb_state.c:is_evpn_enabled
Unexecuted instantiation: zebra_nhg.c:is_evpn_enabled
Unexecuted instantiation: zebra_ns.c:is_evpn_enabled
Unexecuted instantiation: zebra_rib.c:is_evpn_enabled
Unexecuted instantiation: zebra_router.c:is_evpn_enabled
Unexecuted instantiation: zebra_vrf.c:is_evpn_enabled
Unexecuted instantiation: zebra_vty.c:is_evpn_enabled
zebra_vxlan.c:is_evpn_enabled
Line
Count
Source
32
1
{
33
1
  return EVPN_ENABLED(zebra_vrf_get_evpn());
34
1
}
Unexecuted instantiation: zebra_vxlan_if.c:is_evpn_enabled
Unexecuted instantiation: zebra_evpn_mh.c:is_evpn_enabled
35
36
static inline int
37
is_vxlan_flooding_head_end(void)
38
0
{
39
0
  struct zebra_vrf *zvrf = zebra_vrf_get_evpn();
40
0
  return (zvrf->vxlan_flood_ctrl == VXLAN_FLOOD_HEAD_END_REPL);
41
0
}
Unexecuted instantiation: if_netlink.c:is_vxlan_flooding_head_end
Unexecuted instantiation: interface.c:is_vxlan_flooding_head_end
Unexecuted instantiation: main.c:is_vxlan_flooding_head_end
Unexecuted instantiation: redistribute.c:is_vxlan_flooding_head_end
Unexecuted instantiation: rt_netlink.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zapi_msg.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_dplane.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_l2.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_l2_bridge_if.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_evpn.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_evpn_mac.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_evpn_neigh.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_nb_config.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_nb_rpcs.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_nb_state.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_nhg.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_ns.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_rib.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_router.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_vrf.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_vty.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_vxlan.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_vxlan_if.c:is_vxlan_flooding_head_end
Unexecuted instantiation: zebra_evpn_mh.c:is_vxlan_flooding_head_end
42
43
/* VxLAN interface change flags of interest. */
44
0
#define ZEBRA_VXLIF_LOCAL_IP_CHANGE     (1 << 0)
45
0
#define ZEBRA_VXLIF_MASTER_CHANGE       (1 << 1)
46
0
#define ZEBRA_VXLIF_VLAN_CHANGE         (1 << 2)
47
0
#define ZEBRA_VXLIF_MCAST_GRP_CHANGE    (1 << 3)
48
0
#define ZEBRA_VXLIF_MASTER_MAC_CHANGE (1 << 4)
49
50
#define ZEBRA_VXLIF_VNI_UPDATE(__flags)                                        \
51
  ((__flags) & (ZEBRA_VXLIF_VLAN_CHANGE | ZEBRA_VXLIF_MCAST_GRP_CHANGE))
52
#define ZEBRA_VXLIF_UPDATE(__flags)                                            \
53
  ((__flags) & (ZEBRA_VXLIF_LOCAL_IP_CHANGE | ZEBRA_VXLIF_MASTER_CHANGE))
54
55
0
#define VNI_STR_LEN 32
56
57
/* ZAPI message handlers */
58
extern void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS);
59
extern void zebra_vxlan_remote_macip_del(ZAPI_HANDLER_ARGS);
60
extern void zebra_vxlan_remote_vtep_add_zapi(ZAPI_HANDLER_ARGS);
61
extern void zebra_vxlan_remote_vtep_del_zapi(ZAPI_HANDLER_ARGS);
62
void zebra_vxlan_remote_vtep_add(vrf_id_t vrf_id, vni_t vni,
63
         struct in_addr vtep_ip, int flood_control);
64
extern void zebra_vxlan_remote_vtep_del(vrf_id_t vrf_id, vni_t vni,
65
          struct in_addr vtep_ip);
66
extern void zebra_vxlan_flood_control(ZAPI_HANDLER_ARGS);
67
extern void zebra_vxlan_advertise_subnet(ZAPI_HANDLER_ARGS);
68
extern void zebra_vxlan_advertise_svi_macip(ZAPI_HANDLER_ARGS);
69
extern void zebra_vxlan_advertise_gw_macip(ZAPI_HANDLER_ARGS);
70
extern void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS);
71
extern void zebra_vxlan_dup_addr_detection(ZAPI_HANDLER_ARGS);
72
extern void zebra_vxlan_sg_replay(ZAPI_HANDLER_ARGS);
73
74
extern int is_l3vni_for_prefix_routes_only(vni_t vni);
75
extern ifindex_t get_l3vni_svi_ifindex(vrf_id_t vrf_id);
76
extern ifindex_t get_l3vni_vxlan_ifindex(vrf_id_t vrf_id);
77
extern vni_t get_l3vni_vni(vrf_id_t vrf_id);
78
extern bool is_vrf_l3vni_svd_backed(vrf_id_t vrf_id);
79
extern int zebra_vxlan_vrf_delete(struct zebra_vrf *zvrf);
80
extern int zebra_vxlan_vrf_enable(struct zebra_vrf *zvrf);
81
extern int zebra_vxlan_vrf_disable(struct zebra_vrf *zvrf);
82
extern int zebra_vxlan_vrf_delete(struct zebra_vrf *zvrf);
83
extern void zebra_vxlan_print_specific_nh_l3vni(struct vty *vty, vni_t l3vni,
84
            struct ipaddr *ip, bool uj);
85
extern void zebra_vxlan_print_evpn(struct vty *vty, bool uj);
86
extern void zebra_vxlan_print_specific_rmac_l3vni(struct vty *vty, vni_t l3vni,
87
              struct ethaddr *rmac,
88
              bool use_json);
89
extern void zebra_vxlan_print_macs_vni(struct vty *vty, struct zebra_vrf *zvrf,
90
               vni_t vni, bool use_json, bool detail);
91
extern void zebra_vxlan_print_macs_all_vni(struct vty *vty,
92
             struct zebra_vrf *zvrf,
93
             bool print_dup,
94
             bool use_json);
95
extern void zebra_vxlan_print_macs_all_vni_detail(struct vty *vty,
96
              struct zebra_vrf *zvrf,
97
              bool print_dup,
98
              bool use_json);
99
extern void zebra_vxlan_print_macs_all_vni_vtep(struct vty *vty,
100
            struct zebra_vrf *zvrf,
101
            struct in_addr vtep_ip,
102
            bool use_json);
103
extern void zebra_vxlan_print_specific_mac_vni(struct vty *vty,
104
                 struct zebra_vrf *zvrf,
105
                 vni_t vni, struct ethaddr *mac,
106
                 bool use_json);
107
extern void zebra_vxlan_print_macs_vni_vtep(struct vty *vty,
108
              struct zebra_vrf *zvrf, vni_t vni,
109
              struct in_addr vtep_ip,
110
              bool use_json);
111
extern void zebra_vxlan_print_macs_vni_dad(struct vty *vty,
112
             struct zebra_vrf *zvrf, vni_t vni,
113
             bool use_json);
114
extern void zebra_vxlan_print_neigh_vni(struct vty *vty, struct zebra_vrf *zvrf,
115
          vni_t vni, bool use_json);
116
extern void zebra_vxlan_print_neigh_all_vni(struct vty *vty,
117
              struct zebra_vrf *zvrf,
118
              bool print_dup,
119
              bool use_json);
120
extern void zebra_vxlan_print_neigh_all_vni_detail(struct vty *vty,
121
               struct zebra_vrf *zvrf,
122
               bool print_dup,
123
               bool use_json);
124
extern void zebra_vxlan_print_specific_neigh_vni(struct vty *vty,
125
             struct zebra_vrf *zvrf,
126
             vni_t vni, struct ipaddr *ip,
127
             bool use_json);
128
extern void zebra_vxlan_print_neigh_vni_vtep(struct vty *vty,
129
               struct zebra_vrf *zvrf, vni_t vni,
130
               struct in_addr vtep_ip,
131
               bool use_json);
132
extern void zebra_vxlan_print_neigh_vni_dad(struct vty *vty,
133
          struct zebra_vrf *zvrf, vni_t vni,
134
          bool use_json);
135
extern void zebra_vxlan_print_vni(struct vty *vty, struct zebra_vrf *zvrf,
136
          vni_t vni, bool use_json,
137
          json_object *json_array);
138
extern void zebra_vxlan_print_vnis(struct vty *vty, struct zebra_vrf *zvrf,
139
           bool use_json);
140
extern void zebra_vxlan_print_vnis_detail(struct vty *vty,
141
            struct zebra_vrf *zvrf,
142
            bool use_json);
143
extern void zebra_vxlan_print_rmacs_l3vni(struct vty *vty, vni_t vni,
144
            bool use_json);
145
extern void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty, bool use_json);
146
extern void zebra_vxlan_print_nh_l3vni(struct vty *vty, vni_t vni,
147
               bool use_json);
148
extern void zebra_vxlan_print_nh_svd(struct vty *vty, bool use_json);
149
extern void zebra_vxlan_print_nh_all_l3vni(struct vty *vty, bool use_json);
150
extern void zebra_vxlan_print_l3vni(struct vty *vty, vni_t vni, bool use_json);
151
extern void zebra_vxlan_print_vrf_vni(struct vty *vty, struct zebra_vrf *zvrf,
152
              json_object *json_vrfs);
153
extern int zebra_vxlan_add_del_gw_macip(struct interface *ifp,
154
          const struct prefix *p, int add);
155
extern int zebra_vxlan_svi_up(struct interface *ifp, struct interface *link_if);
156
extern int zebra_vxlan_svi_down(struct interface *ifp,
157
        struct interface *link_if);
158
extern int zebra_vxlan_handle_kernel_neigh_update(
159
  struct interface *ifp, struct interface *link_if, struct ipaddr *ip,
160
  struct ethaddr *macaddr, uint16_t state, bool is_ext,
161
  bool is_router, bool local_inactive, bool dp_static);
162
extern int zebra_vxlan_handle_kernel_neigh_del(struct interface *ifp,
163
               struct interface *link_if,
164
               struct ipaddr *ip);
165
extern int zebra_vxlan_local_mac_add_update(struct interface *ifp,
166
              struct interface *br_if,
167
              struct ethaddr *mac, vlanid_t vid,
168
              bool sticky, bool local_inactive,
169
            bool dp_static);
170
extern int zebra_vxlan_local_mac_del(struct interface *ifp,
171
             struct interface *br_if,
172
             struct ethaddr *mac, vlanid_t vid);
173
extern int zebra_vxlan_check_readd_vtep(struct interface *ifp, vni_t vni,
174
          struct in_addr vtep_ip);
175
extern int zebra_vxlan_if_up(struct interface *ifp);
176
extern int zebra_vxlan_if_down(struct interface *ifp);
177
extern int zebra_vxlan_if_add(struct interface *ifp);
178
extern int zebra_vxlan_if_update(struct interface *ifp,
179
         struct zebra_vxlan_if_update_ctx *ctx);
180
extern int zebra_vxlan_if_del(struct interface *ifp);
181
extern int zebra_vxlan_process_vrf_vni_cmd(struct zebra_vrf *zvrf, vni_t vni,
182
             char *err, int err_str_sz,
183
             int filter, int add);
184
extern void zebra_vxlan_init_tables(struct zebra_vrf *zvrf);
185
extern void zebra_vxlan_close_tables(struct zebra_vrf *);
186
extern void zebra_vxlan_cleanup_tables(struct zebra_vrf *);
187
extern void zebra_vxlan_init(void);
188
extern void zebra_vxlan_disable(void);
189
extern void zebra_vxlan_evpn_vrf_route_add(vrf_id_t vrf_id,
190
             const struct ethaddr *rmac,
191
             const struct ipaddr *ip,
192
             const struct prefix *host_prefix);
193
extern void zebra_vxlan_evpn_vrf_route_del(vrf_id_t vrf_id,
194
             struct ipaddr *vtep_ip,
195
             struct prefix *host_prefix);
196
extern int zebra_vxlan_clear_dup_detect_vni_mac(struct zebra_vrf *zvrf,
197
            vni_t vni,
198
            struct ethaddr *macaddr,
199
            char *errmsg,
200
            size_t errmsg_len);
201
extern int zebra_vxlan_clear_dup_detect_vni_ip(struct zebra_vrf *zvrf,
202
                 vni_t vni, struct ipaddr *ip,
203
                 char *errmsg, size_t errmsg_len);
204
extern int zebra_vxlan_clear_dup_detect_vni_all(struct zebra_vrf *zvrf);
205
extern int zebra_vxlan_clear_dup_detect_vni(struct zebra_vrf *zvrf, vni_t vni);
206
extern void zebra_vxlan_handle_result(struct zebra_dplane_ctx *ctx);
207
208
extern void zebra_evpn_init(void);
209
extern void zebra_vxlan_macvlan_up(struct interface *ifp);
210
extern void zebra_vxlan_macvlan_down(struct interface *ifp);
211
extern int vni_list_cmp(void *p1, void *p2);
212
extern int zebra_vxlan_dp_network_mac_add(struct interface *ifp,
213
            struct interface *br_if,
214
            struct ethaddr *macaddr, vlanid_t vid,
215
            vni_t vni, uint32_t nhg_id,
216
            bool sticky, bool dp_static);
217
extern int zebra_vxlan_dp_network_mac_del(struct interface *ifp,
218
            struct interface *br_if,
219
            struct ethaddr *macaddr, vlanid_t vid,
220
            vni_t vni);
221
222
extern void zebra_vxlan_set_accept_bgp_seq(bool set);
223
extern bool zebra_vxlan_get_accept_bgp_seq(void);
224
225
#ifdef __cplusplus
226
}
227
#endif
228
229
#endif /* _ZEBRA_VXLAN_H */