]> git.proxmox.com Git - mirror_frr.git/blame - zebra/rt_netlink.h
*: manual SPDX License ID conversions
[mirror_frr.git] / zebra / rt_netlink.h
CommitLineData
78deec45
AS
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 *
896014f4
DL
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
78deec45
AS
19 */
20
21#ifndef _ZEBRA_RT_NETLINK_H
22#define _ZEBRA_RT_NETLINK_H
23
24#ifdef HAVE_NETLINK
25
be0dba35 26#include "zebra/zebra_mpls.h"
16c628de 27#include "zebra/zebra_dplane.h"
be0dba35 28
51e94aa7
EDP
29#ifdef __cplusplus
30extern "C" {
31#endif
32
78deec45 33
6977eb91
DS
34/*
35 * Additional protocol strings to push into routes
36 * If we add anything new here please make sure
37 * to update:
38 * zebra2proto Function
39 * proto2zebra Function
40 * is_selfroute Function
41 * tools/frr To flush the route upon exit
42 *
43 * Finally update this file to allow iproute2 to
44 * know about this new route.
45 * tools/etc/iproute2/rt_protos.d
46 */
23b1f334
DD
47#define RTPROT_BGP 186
48#define RTPROT_ISIS 187
49#define RTPROT_OSPF 188
50#define RTPROT_RIP 189
51#define RTPROT_RIPNG 190
fb533f22 52#if !defined(RTPROT_BABEL)
6977eb91 53#define RTPROT_BABEL 42
fb533f22 54#endif
1f047d8d
DS
55#define RTPROT_NHRP 191
56#define RTPROT_EIGRP 192
57#define RTPROT_LDP 193
8a71d93d 58#define RTPROT_SHARP 194
0761368a 59#define RTPROT_PBR 195
d4d71f11 60#define RTPROT_ZSTATIC 196
da82f6b4 61#define RTPROT_OPENFABRIC 197
31f937fb 62#define RTPROT_SRTE 198
23b1f334 63
d62a17ae 64void rt_netlink_init(void);
23b1f334 65
16c628de 66/* MPLS label forwarding table change, using dataplane context information. */
0be6e7d7
JU
67extern ssize_t netlink_mpls_multipath_msg_encode(int cmd,
68 struct zebra_dplane_ctx *ctx,
69 void *buf, size_t buflen);
16c628de 70
0be6e7d7
JU
71extern ssize_t netlink_route_multipath_msg_encode(int cmd,
72 struct zebra_dplane_ctx *ctx,
73 uint8_t *data, size_t datalen,
74 bool fpm, bool force_nhg);
d4d4ec1c 75extern ssize_t netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx,
67e3369e 76 void *data, size_t datalen);
f78fe8f3 77
2414abd3 78extern int netlink_route_change(struct nlmsghdr *h, ns_id_t ns_id, int startup);
d62a17ae 79extern int netlink_route_read(struct zebra_ns *zns);
78deec45 80
d9f5b2f5
SW
81extern int netlink_nexthop_change(struct nlmsghdr *h, ns_id_t ns_id,
82 int startup);
83extern int netlink_nexthop_read(struct zebra_ns *zns);
0be6e7d7
JU
84extern ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
85 const struct zebra_dplane_ctx *ctx,
45c12994 86 void *buf, size_t buflen, bool fpm);
d9f5b2f5 87
b300c8bb
DE
88extern ssize_t netlink_lsp_msg_encoder(struct zebra_dplane_ctx *ctx, void *buf,
89 size_t buflen);
90
2414abd3 91extern int netlink_neigh_change(struct nlmsghdr *h, ns_id_t ns_id);
d62a17ae 92extern int netlink_macfdb_read(struct zebra_ns *zns);
93extern int netlink_macfdb_read_for_bridge(struct zebra_ns *zns,
94 struct interface *ifp,
95 struct interface *br_if);
96extern int netlink_neigh_read(struct zebra_ns *zns);
97extern int netlink_neigh_read_for_vlan(struct zebra_ns *zns,
98 struct interface *vlan_if);
67fb9374
CS
99extern int netlink_macfdb_read_specific_mac(struct zebra_ns *zns,
100 struct interface *br_if,
1a3bd37f
MS
101 const struct ethaddr *mac,
102 uint16_t vid);
103extern int netlink_neigh_read_specific_ip(const struct ipaddr *ip,
67fb9374 104 struct interface *vlan_if);
9d866c07 105extern vrf_id_t vrf_lookup_by_table(uint32_t table_id, ns_id_t ns_id);
2232a77c 106
67e3369e
JU
107struct nl_batch;
108extern enum netlink_msg_status
109netlink_put_route_update_msg(struct nl_batch *bth,
110 struct zebra_dplane_ctx *ctx);
111extern enum netlink_msg_status
112netlink_put_nexthop_update_msg(struct nl_batch *bth,
113 struct zebra_dplane_ctx *ctx);
114extern enum netlink_msg_status
115netlink_put_mac_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx);
116extern enum netlink_msg_status
117netlink_put_neigh_update_msg(struct nl_batch *bth,
118 struct zebra_dplane_ctx *ctx);
119extern enum netlink_msg_status
120netlink_put_lsp_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx);
121extern enum netlink_msg_status
122netlink_put_pw_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx);
123
45f0a10b
DS
124int netlink_route_change_read_unicast_internal(struct nlmsghdr *h,
125 ns_id_t ns_id, int startup,
126 struct zebra_dplane_ctx *ctx);
127
eead0bc4
RZ
128#ifdef NETLINK_DEBUG
129const char *nlmsg_type2str(uint16_t type);
130const char *af_type2str(int type);
131const char *ifi_type2str(int type);
132const char *rta_type2str(int type);
133const char *rtm_type2str(int type);
5d414138
SW
134const char *ifla_pdr_type2str(int type);
135const char *ifla_info_type2str(int type);
eead0bc4
RZ
136const char *rtm_protocol2str(int type);
137const char *rtm_scope2str(int type);
138const char *rtm_rta2str(int type);
139const char *neigh_rta2str(int type);
140const char *ifa_rta2str(int type);
141const char *nhm_rta2str(int type);
95fe3288
TA
142const char *frh_rta2str(int type);
143const char *frh_action2str(uint8_t action);
eead0bc4
RZ
144const char *nlmsg_flags2str(uint16_t flags, char *buf, size_t buflen);
145const char *if_flags2str(uint32_t flags, char *buf, size_t buflen);
146const char *rtm_flags2str(uint32_t flags, char *buf, size_t buflen);
147const char *neigh_state2str(uint32_t flags, char *buf, size_t buflen);
148const char *neigh_flags2str(uint32_t flags, char *buf, size_t buflen);
149const char *ifa_flags2str(uint32_t flags, char *buf, size_t buflen);
150const char *nh_flags2str(uint32_t flags, char *buf, size_t buflen);
151
152void nl_dump(void *msg, size_t msglen);
4a563f27
S
153
154extern int zebra2proto(int proto);
155
eead0bc4
RZ
156#endif /* NETLINK_DEBUG */
157
51e94aa7
EDP
158#ifdef __cplusplus
159}
160#endif
161
78deec45
AS
162#endif /* HAVE_NETLINK */
163
164#endif /* _ZEBRA_RT_NETLINK_H */