]> git.proxmox.com Git - mirror_frr.git/blob - zebra/rt_netlink.h
*: Add camelCase JSON keys in addition to PascalCase
[mirror_frr.git] / zebra / rt_netlink.h
1 /* Header file exported by rt_netlink.c to zebra.
2 * Copyright (C) 1997, 98, 99 Kunihiro Ishiguro
3 *
4 * This file is part of GNU Zebra.
5 *
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef _ZEBRA_RT_NETLINK_H
22 #define _ZEBRA_RT_NETLINK_H
23
24 #ifdef HAVE_NETLINK
25
26 #include "zebra/zebra_mpls.h"
27 #include "zebra/zebra_dplane.h"
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 #define NL_DEFAULT_ROUTE_METRIC 20
34
35 /*
36 * Additional protocol strings to push into routes
37 * If we add anything new here please make sure
38 * to update:
39 * zebra2proto Function
40 * proto2zebra Function
41 * is_selfroute Function
42 * tools/frr To flush the route upon exit
43 *
44 * Finally update this file to allow iproute2 to
45 * know about this new route.
46 * tools/etc/iproute2/rt_protos.d
47 */
48 #define RTPROT_BGP 186
49 #define RTPROT_ISIS 187
50 #define RTPROT_OSPF 188
51 #define RTPROT_RIP 189
52 #define RTPROT_RIPNG 190
53 #if !defined(RTPROT_BABEL)
54 #define RTPROT_BABEL 42
55 #endif
56 #define RTPROT_NHRP 191
57 #define RTPROT_EIGRP 192
58 #define RTPROT_LDP 193
59 #define RTPROT_SHARP 194
60 #define RTPROT_PBR 195
61 #define RTPROT_ZSTATIC 196
62 #define RTPROT_OPENFABRIC 197
63 #define RTPROT_SRTE 198
64
65 void rt_netlink_init(void);
66
67 /* MPLS label forwarding table change, using dataplane context information. */
68 extern ssize_t netlink_mpls_multipath_msg_encode(int cmd,
69 struct zebra_dplane_ctx *ctx,
70 void *buf, size_t buflen);
71
72 extern ssize_t netlink_route_multipath_msg_encode(int cmd,
73 struct zebra_dplane_ctx *ctx,
74 uint8_t *data, size_t datalen,
75 bool fpm, bool force_nhg);
76 extern ssize_t netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx,
77 void *data, size_t datalen);
78
79 extern int netlink_route_change(struct nlmsghdr *h, ns_id_t ns_id, int startup);
80 extern int netlink_route_read(struct zebra_ns *zns);
81
82 extern int netlink_nexthop_change(struct nlmsghdr *h, ns_id_t ns_id,
83 int startup);
84 extern int netlink_nexthop_read(struct zebra_ns *zns);
85 extern ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
86 const struct zebra_dplane_ctx *ctx,
87 void *buf, size_t buflen);
88
89 extern ssize_t netlink_lsp_msg_encoder(struct zebra_dplane_ctx *ctx, void *buf,
90 size_t buflen);
91
92 extern int netlink_neigh_change(struct nlmsghdr *h, ns_id_t ns_id);
93 extern int netlink_macfdb_read(struct zebra_ns *zns);
94 extern int netlink_macfdb_read_for_bridge(struct zebra_ns *zns,
95 struct interface *ifp,
96 struct interface *br_if);
97 extern int netlink_neigh_read(struct zebra_ns *zns);
98 extern int netlink_neigh_read_for_vlan(struct zebra_ns *zns,
99 struct interface *vlan_if);
100 extern int netlink_macfdb_read_specific_mac(struct zebra_ns *zns,
101 struct interface *br_if,
102 const struct ethaddr *mac,
103 uint16_t vid);
104 extern int netlink_neigh_read_specific_ip(const struct ipaddr *ip,
105 struct interface *vlan_if);
106 extern vrf_id_t vrf_lookup_by_table(uint32_t table_id, ns_id_t ns_id);
107
108 struct nl_batch;
109 extern enum netlink_msg_status
110 netlink_put_route_update_msg(struct nl_batch *bth,
111 struct zebra_dplane_ctx *ctx);
112 extern enum netlink_msg_status
113 netlink_put_nexthop_update_msg(struct nl_batch *bth,
114 struct zebra_dplane_ctx *ctx);
115 extern enum netlink_msg_status
116 netlink_put_mac_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx);
117 extern enum netlink_msg_status
118 netlink_put_neigh_update_msg(struct nl_batch *bth,
119 struct zebra_dplane_ctx *ctx);
120 extern enum netlink_msg_status
121 netlink_put_lsp_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx);
122 extern enum netlink_msg_status
123 netlink_put_pw_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx);
124
125 #ifdef NETLINK_DEBUG
126 const char *nlmsg_type2str(uint16_t type);
127 const char *af_type2str(int type);
128 const char *ifi_type2str(int type);
129 const char *rta_type2str(int type);
130 const char *rtm_type2str(int type);
131 const char *rtm_protocol2str(int type);
132 const char *rtm_scope2str(int type);
133 const char *rtm_rta2str(int type);
134 const char *neigh_rta2str(int type);
135 const char *ifa_rta2str(int type);
136 const char *nhm_rta2str(int type);
137 const char *nlmsg_flags2str(uint16_t flags, char *buf, size_t buflen);
138 const char *if_flags2str(uint32_t flags, char *buf, size_t buflen);
139 const char *rtm_flags2str(uint32_t flags, char *buf, size_t buflen);
140 const char *neigh_state2str(uint32_t flags, char *buf, size_t buflen);
141 const char *neigh_flags2str(uint32_t flags, char *buf, size_t buflen);
142 const char *ifa_flags2str(uint32_t flags, char *buf, size_t buflen);
143 const char *nh_flags2str(uint32_t flags, char *buf, size_t buflen);
144
145 void nl_dump(void *msg, size_t msglen);
146 #endif /* NETLINK_DEBUG */
147
148 #ifdef __cplusplus
149 }
150 #endif
151
152 #endif /* HAVE_NETLINK */
153
154 #endif /* _ZEBRA_RT_NETLINK_H */