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