]> git.proxmox.com Git - mirror_frr.git/blame - zebra/rt_netlink.h
*: auto-convert to SPDX License IDs
[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,
80 struct interface *br_if);
81extern int netlink_neigh_read(struct zebra_ns *zns);
82extern int netlink_neigh_read_for_vlan(struct zebra_ns *zns,
83 struct interface *vlan_if);
67fb9374
CS
84extern int netlink_macfdb_read_specific_mac(struct zebra_ns *zns,
85 struct interface *br_if,
1a3bd37f
MS
86 const struct ethaddr *mac,
87 uint16_t vid);
88extern int netlink_neigh_read_specific_ip(const struct ipaddr *ip,
67fb9374 89 struct interface *vlan_if);
9d866c07 90extern vrf_id_t vrf_lookup_by_table(uint32_t table_id, ns_id_t ns_id);
2232a77c 91
67e3369e
JU
92struct nl_batch;
93extern enum netlink_msg_status
94netlink_put_route_update_msg(struct nl_batch *bth,
95 struct zebra_dplane_ctx *ctx);
96extern enum netlink_msg_status
97netlink_put_nexthop_update_msg(struct nl_batch *bth,
98 struct zebra_dplane_ctx *ctx);
99extern enum netlink_msg_status
100netlink_put_mac_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx);
101extern enum netlink_msg_status
102netlink_put_neigh_update_msg(struct nl_batch *bth,
103 struct zebra_dplane_ctx *ctx);
104extern enum netlink_msg_status
105netlink_put_lsp_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx);
106extern enum netlink_msg_status
107netlink_put_pw_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx);
108
45f0a10b
DS
109int netlink_route_change_read_unicast_internal(struct nlmsghdr *h,
110 ns_id_t ns_id, int startup,
111 struct zebra_dplane_ctx *ctx);
112
eead0bc4
RZ
113#ifdef NETLINK_DEBUG
114const char *nlmsg_type2str(uint16_t type);
115const char *af_type2str(int type);
116const char *ifi_type2str(int type);
117const char *rta_type2str(int type);
118const char *rtm_type2str(int type);
5d414138
SW
119const char *ifla_pdr_type2str(int type);
120const char *ifla_info_type2str(int type);
eead0bc4
RZ
121const char *rtm_protocol2str(int type);
122const char *rtm_scope2str(int type);
123const char *rtm_rta2str(int type);
124const char *neigh_rta2str(int type);
125const char *ifa_rta2str(int type);
126const char *nhm_rta2str(int type);
95fe3288
TA
127const char *frh_rta2str(int type);
128const char *frh_action2str(uint8_t action);
eead0bc4
RZ
129const char *nlmsg_flags2str(uint16_t flags, char *buf, size_t buflen);
130const char *if_flags2str(uint32_t flags, char *buf, size_t buflen);
131const char *rtm_flags2str(uint32_t flags, char *buf, size_t buflen);
132const char *neigh_state2str(uint32_t flags, char *buf, size_t buflen);
133const char *neigh_flags2str(uint32_t flags, char *buf, size_t buflen);
134const char *ifa_flags2str(uint32_t flags, char *buf, size_t buflen);
135const char *nh_flags2str(uint32_t flags, char *buf, size_t buflen);
136
137void nl_dump(void *msg, size_t msglen);
4a563f27
S
138
139extern int zebra2proto(int proto);
140
eead0bc4
RZ
141#endif /* NETLINK_DEBUG */
142
51e94aa7
EDP
143#ifdef __cplusplus
144}
145#endif
146
78deec45
AS
147#endif /* HAVE_NETLINK */
148
149#endif /* _ZEBRA_RT_NETLINK_H */