]> git.proxmox.com Git - mirror_frr.git/blob - zebra/rt.h
2e3495a03731e3fdc2e2c08b7ac90b48822d9b76
[mirror_frr.git] / zebra / rt.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * kernel routing table update prototype.
4 * Copyright (C) 1998 Kunihiro Ishiguro
5 */
6
7 #ifndef _ZEBRA_RT_H
8 #define _ZEBRA_RT_H
9
10 #include "prefix.h"
11 #include "if.h"
12 #include "vlan.h"
13 #include "vxlan.h"
14 #include "zebra/rib.h"
15 #include "zebra/zebra_ns.h"
16 #include "zebra/zebra_mpls.h"
17 #include "zebra/zebra_dplane.h"
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 #define ROUTE_INSTALLATION_METRIC 20
24
25 #define RKERNEL_ROUTE(type) ((type) == ZEBRA_ROUTE_KERNEL)
26
27 #define RSYSTEM_ROUTE(type) \
28 ((RKERNEL_ROUTE(type)) || (type) == ZEBRA_ROUTE_CONNECT)
29
30 #ifndef HAVE_NETLINK
31 /*
32 * Update or delete a route, nexthop, LSP, pseudowire, or vxlan MAC from the
33 * kernel, using info from a dataplane context.
34 */
35 extern enum zebra_dplane_result kernel_route_update(
36 struct zebra_dplane_ctx *ctx);
37
38 extern enum zebra_dplane_result
39 kernel_nexthop_update(struct zebra_dplane_ctx *ctx);
40
41 extern enum zebra_dplane_result kernel_lsp_update(
42 struct zebra_dplane_ctx *ctx);
43
44 enum zebra_dplane_result kernel_pw_update(struct zebra_dplane_ctx *ctx);
45
46 enum zebra_dplane_result kernel_address_update_ctx(
47 struct zebra_dplane_ctx *ctx);
48
49 enum zebra_dplane_result kernel_mac_update_ctx(struct zebra_dplane_ctx *ctx);
50
51 enum zebra_dplane_result kernel_neigh_update_ctx(struct zebra_dplane_ctx *ctx);
52
53 extern enum zebra_dplane_result
54 kernel_pbr_rule_update(struct zebra_dplane_ctx *ctx);
55
56 extern enum zebra_dplane_result
57 kernel_intf_update(struct zebra_dplane_ctx *ctx);
58
59 extern enum zebra_dplane_result
60 kernel_intf_netconf_update(struct zebra_dplane_ctx *ctx);
61 extern enum zebra_dplane_result kernel_tc_update(struct zebra_dplane_ctx *ctx);
62
63 #endif /* !HAVE_NETLINK */
64
65 extern int kernel_neigh_update(int cmd, int ifindex, void *addr, char *lla,
66 int llalen, ns_id_t ns_id, uint8_t family,
67 bool permanent);
68 extern int kernel_neigh_register(vrf_id_t vrf_id, struct zserv *client,
69 bool reg);
70 extern int kernel_interface_set_master(struct interface *master,
71 struct interface *slave);
72
73 extern int mpls_kernel_init(void);
74
75 /* Global init and deinit for platform-/OS-specific things */
76 void kernel_router_init(void);
77 void kernel_router_terminate(void);
78
79 extern uint32_t kernel_get_speed(struct interface *ifp, int *error);
80 extern int kernel_get_ipmr_sg_stats(struct zebra_vrf *zvrf, void *mroute);
81
82 /*
83 * Southbound Initialization routines to get initial starting
84 * state.
85 */
86 extern void interface_list(struct zebra_ns *zns);
87 extern void kernel_init(struct zebra_ns *zns);
88 extern void kernel_terminate(struct zebra_ns *zns, bool complete);
89 extern void macfdb_read(struct zebra_ns *zns);
90 extern void macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp,
91 struct interface *br_if, vlanid_t vid);
92 extern void macfdb_read_mcast_entry_for_vni(struct zebra_ns *zns,
93 struct interface *ifp, vni_t vni);
94 extern void macfdb_read_specific_mac(struct zebra_ns *zns,
95 struct interface *br_if,
96 const struct ethaddr *mac, vlanid_t vid);
97 extern void neigh_read(struct zebra_ns *zns);
98 extern void neigh_read_for_vlan(struct zebra_ns *zns, struct interface *ifp);
99 extern void neigh_read_specific_ip(const struct ipaddr *ip,
100 struct interface *vlan_if);
101 extern void route_read(struct zebra_ns *zns);
102 extern int kernel_upd_mac_nh(uint32_t nh_id, struct in_addr vtep_ip);
103 extern int kernel_del_mac_nh(uint32_t nh_id);
104 extern int kernel_upd_mac_nhg(uint32_t nhg_id, uint32_t nh_cnt,
105 struct nh_grp *nh_ids);
106 extern int kernel_del_mac_nhg(uint32_t nhg_id);
107
108 /*
109 * Message batching interface.
110 */
111 extern void kernel_update_multi(struct dplane_ctx_list_head *ctx_list);
112
113 /*
114 * Called by the dplane pthread to read incoming OS messages and dispatch them.
115 */
116 int kernel_dplane_read(struct zebra_dplane_info *info);
117 extern void vlan_read(struct zebra_ns *zns);
118
119 #ifdef __cplusplus
120 }
121 #endif
122
123 #endif /* _ZEBRA_RT_H */