]>
Commit | Line | Data |
---|---|---|
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 |
30 | extern "C" { | |
31 | #endif | |
32 | ||
1f5705f0 | 33 | #define NL_DEFAULT_ROUTE_METRIC 20 |
78deec45 | 34 | |
6977eb91 DS |
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 | */ | |
23b1f334 DD |
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 | |
fb533f22 | 53 | #if !defined(RTPROT_BABEL) |
6977eb91 | 54 | #define RTPROT_BABEL 42 |
fb533f22 | 55 | #endif |
1f047d8d DS |
56 | #define RTPROT_NHRP 191 |
57 | #define RTPROT_EIGRP 192 | |
58 | #define RTPROT_LDP 193 | |
8a71d93d | 59 | #define RTPROT_SHARP 194 |
0761368a | 60 | #define RTPROT_PBR 195 |
d4d71f11 | 61 | #define RTPROT_ZSTATIC 196 |
da82f6b4 | 62 | #define RTPROT_OPENFABRIC 197 |
31f937fb | 63 | #define RTPROT_SRTE 198 |
23b1f334 | 64 | |
d62a17ae | 65 | void rt_netlink_init(void); |
23b1f334 | 66 | |
16c628de | 67 | /* MPLS label forwarding table change, using dataplane context information. */ |
0be6e7d7 JU |
68 | extern ssize_t netlink_mpls_multipath_msg_encode(int cmd, |
69 | struct zebra_dplane_ctx *ctx, | |
70 | void *buf, size_t buflen); | |
16c628de | 71 | |
0be6e7d7 JU |
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); | |
d4d4ec1c | 76 | extern ssize_t netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx, |
67e3369e | 77 | void *data, size_t datalen); |
f78fe8f3 | 78 | |
2414abd3 | 79 | extern int netlink_route_change(struct nlmsghdr *h, ns_id_t ns_id, int startup); |
d62a17ae | 80 | extern int netlink_route_read(struct zebra_ns *zns); |
78deec45 | 81 | |
d9f5b2f5 SW |
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); | |
0be6e7d7 JU |
85 | extern ssize_t netlink_nexthop_msg_encode(uint16_t cmd, |
86 | const struct zebra_dplane_ctx *ctx, | |
87 | void *buf, size_t buflen); | |
d9f5b2f5 | 88 | |
b300c8bb DE |
89 | extern ssize_t netlink_lsp_msg_encoder(struct zebra_dplane_ctx *ctx, void *buf, |
90 | size_t buflen); | |
91 | ||
2414abd3 | 92 | extern int netlink_neigh_change(struct nlmsghdr *h, ns_id_t ns_id); |
d62a17ae | 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); | |
67fb9374 CS |
100 | extern int netlink_macfdb_read_specific_mac(struct zebra_ns *zns, |
101 | struct interface *br_if, | |
1a3bd37f MS |
102 | const struct ethaddr *mac, |
103 | uint16_t vid); | |
104 | extern int netlink_neigh_read_specific_ip(const struct ipaddr *ip, | |
67fb9374 | 105 | struct interface *vlan_if); |
9d866c07 | 106 | extern vrf_id_t vrf_lookup_by_table(uint32_t table_id, ns_id_t ns_id); |
2232a77c | 107 | |
67e3369e JU |
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 | ||
eead0bc4 RZ |
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); | |
5d414138 SW |
131 | const char *ifla_pdr_type2str(int type); |
132 | const char *ifla_info_type2str(int type); | |
eead0bc4 RZ |
133 | const char *rtm_protocol2str(int type); |
134 | const char *rtm_scope2str(int type); | |
135 | const char *rtm_rta2str(int type); | |
136 | const char *neigh_rta2str(int type); | |
137 | const char *ifa_rta2str(int type); | |
138 | const char *nhm_rta2str(int type); | |
95fe3288 TA |
139 | const char *frh_rta2str(int type); |
140 | const char *frh_action2str(uint8_t action); | |
eead0bc4 RZ |
141 | const char *nlmsg_flags2str(uint16_t flags, char *buf, size_t buflen); |
142 | const char *if_flags2str(uint32_t flags, char *buf, size_t buflen); | |
143 | const char *rtm_flags2str(uint32_t flags, char *buf, size_t buflen); | |
144 | const char *neigh_state2str(uint32_t flags, char *buf, size_t buflen); | |
145 | const char *neigh_flags2str(uint32_t flags, char *buf, size_t buflen); | |
146 | const char *ifa_flags2str(uint32_t flags, char *buf, size_t buflen); | |
147 | const char *nh_flags2str(uint32_t flags, char *buf, size_t buflen); | |
148 | ||
149 | void nl_dump(void *msg, size_t msglen); | |
150 | #endif /* NETLINK_DEBUG */ | |
151 | ||
51e94aa7 EDP |
152 | #ifdef __cplusplus |
153 | } | |
154 | #endif | |
155 | ||
78deec45 AS |
156 | #endif /* HAVE_NETLINK */ |
157 | ||
158 | #endif /* _ZEBRA_RT_NETLINK_H */ |