]>
Commit | Line | Data |
---|---|---|
12e41d03 | 1 | /* |
896014f4 DL |
2 | * PIM for Quagga |
3 | * Copyright (C) 2008 Everton da Silva Marques | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation; either version 2 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, but | |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License along | |
16 | * with this program; see the file COPYING; if not, write to the Free Software | |
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | */ | |
12e41d03 DL |
19 | |
20 | #ifndef PIMD_H | |
21 | #define PIMD_H | |
22 | ||
23 | #include <stdint.h> | |
1bc98276 CS |
24 | #include "zebra.h" |
25 | #include "libfrr.h" | |
15a5dafe | 26 | #include "prefix.h" |
27 | #include "vty.h" | |
28 | #include "plist.h" | |
12e41d03 | 29 | |
c2cf4b02 | 30 | #include "pim_instance.h" |
8bfb8b67 | 31 | #include "pim_str.h" |
4a1ab8e4 | 32 | #include "pim_memory.h" |
12e41d03 DL |
33 | #include "pim_assert.h" |
34 | ||
35 | #define PIMD_PROGNAME "pimd" | |
36 | #define PIMD_DEFAULT_CONFIG "pimd.conf" | |
37 | #define PIMD_VTY_PORT 2611 | |
12e41d03 | 38 | |
12e41d03 DL |
39 | #define PIM_IP_PROTO_IGMP (2) |
40 | #define PIM_IP_PROTO_PIM (103) | |
41 | #define PIM_IGMP_MIN_LEN (8) | |
09778298 | 42 | |
35a3c3c1 DL |
43 | #define PIM_ENFORCE_LOOPFREE_MFC |
44 | ||
09778298 DS |
45 | /* |
46 | * PIM MSG Header Format | |
47 | * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
48 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
49 | * |PIM Ver| Type | Reserved | Checksum | | |
50 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
51 | */ | |
12e41d03 DL |
52 | #define PIM_MSG_HEADER_LEN (4) |
53 | #define PIM_PIM_MIN_LEN PIM_MSG_HEADER_LEN | |
811ed42a DS |
54 | |
55 | #define PIM_ENCODED_IPV4_UCAST_SIZE (6) | |
56 | #define PIM_ENCODED_IPV4_GROUP_SIZE (8) | |
57 | #define PIM_ENCODED_IPV4_SOURCE_SIZE (8) | |
09778298 DS |
58 | |
59 | /* | |
60 | * J/P Message Format, Group Header | |
61 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
62 | * | Upstream Neighbor Address (Encoded-Unicast format) | | |
63 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
64 | * | Reserved | Num groups | Holdtime | | |
65 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
66 | * | Multicast Group Address 1 (Encoded-Group format) | | |
67 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
68 | * | Number of Joined Sources | Number of Pruned Sources | | |
69 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
70 | */ | |
d62a17ae | 71 | #define PIM_JP_GROUP_HEADER_SIZE \ |
72 | (PIM_ENCODED_IPV4_UCAST_SIZE + 1 + 1 + 2 + PIM_ENCODED_IPV4_GROUP_SIZE \ | |
73 | + 2 + 2) | |
09778298 | 74 | |
12e41d03 DL |
75 | #define PIM_PROTO_VERSION (2) |
76 | ||
77 | #define MCAST_ALL_SYSTEMS "224.0.0.1" | |
78 | #define MCAST_ALL_ROUTERS "224.0.0.2" | |
79 | #define MCAST_ALL_PIM_ROUTERS "224.0.0.13" | |
80 | #define MCAST_ALL_IGMP_ROUTERS "224.0.0.22" | |
81 | ||
82 | #define PIM_FORCE_BOOLEAN(expr) ((expr) != 0) | |
83 | ||
84 | #define PIM_NET_INADDR_ANY (htonl(INADDR_ANY)) | |
df696e3f | 85 | #define PIM_INADDR_IS_ANY(addr) (addr).s_addr == PIM_NET_INADDR_ANY |
12e41d03 DL |
86 | #define PIM_INADDR_ISNOT_ANY(addr) ((addr).s_addr != PIM_NET_INADDR_ANY) /* struct in_addr addr */ |
87 | ||
15ad0c71 | 88 | #define max(x,y) ((x) > (y) ? (x) : (y)) |
89 | ||
12e41d03 | 90 | #define PIM_MASK_PIM_EVENTS (1 << 0) |
3010e99a DS |
91 | #define PIM_MASK_PIM_EVENTS_DETAIL (1 << 1) |
92 | #define PIM_MASK_PIM_PACKETS (1 << 2) | |
93 | #define PIM_MASK_PIM_PACKETDUMP_SEND (1 << 3) | |
94 | #define PIM_MASK_PIM_PACKETDUMP_RECV (1 << 4) | |
95 | #define PIM_MASK_PIM_TRACE (1 << 5) | |
96 | #define PIM_MASK_PIM_TRACE_DETAIL (1 << 6) | |
97 | #define PIM_MASK_IGMP_EVENTS (1 << 7) | |
98 | #define PIM_MASK_IGMP_PACKETS (1 << 8) | |
99 | #define PIM_MASK_IGMP_TRACE (1 << 9) | |
d3a8a0f5 DS |
100 | #define PIM_MASK_IGMP_TRACE_DETAIL (1 << 10) |
101 | #define PIM_MASK_ZEBRA (1 << 11) | |
102 | #define PIM_MASK_SSMPINGD (1 << 12) | |
103 | #define PIM_MASK_MROUTE (1 << 13) | |
6c7197b1 DS |
104 | #define PIM_MASK_MROUTE_DETAIL (1 << 14) |
105 | #define PIM_MASK_PIM_HELLO (1 << 15) | |
106 | #define PIM_MASK_PIM_J_P (1 << 16) | |
107 | #define PIM_MASK_STATIC (1 << 17) | |
108 | #define PIM_MASK_PIM_REG (1 << 18) | |
2a333e0f | 109 | #define PIM_MASK_MSDP_EVENTS (1 << 19) |
110 | #define PIM_MASK_MSDP_PACKETS (1 << 20) | |
111 | #define PIM_MASK_MSDP_INTERNAL (1 << 21) | |
40f1f31b DS |
112 | #define PIM_MASK_PIM_NHT (1 << 22) |
113 | #define PIM_MASK_PIM_NHT_DETAIL (1 << 23) | |
3d225d48 | 114 | #define PIM_MASK_PIM_NHT_RP (1 << 24) |
4d9ad5dc | 115 | #define PIM_MASK_MTRACE (1 << 25) |
3d225d48 | 116 | /* Remember 32 bits!!! */ |
12e41d03 | 117 | |
dfe43e25 DW |
118 | /* PIM error codes */ |
119 | #define PIM_SUCCESS 0 | |
dfe43e25 DW |
120 | #define PIM_GROUP_BAD_ADDRESS -2 |
121 | #define PIM_GROUP_OVERLAP -3 | |
122 | #define PIM_GROUP_PFXLIST_OVERLAP -4 | |
123 | #define PIM_RP_BAD_ADDRESS -5 | |
124 | #define PIM_RP_NO_PATH -6 | |
125 | #define PIM_RP_NOT_FOUND -7 | |
126 | #define PIM_RP_PFXLIST_IN_USE -8 | |
4763cd0e | 127 | #define PIM_IFACE_NOT_FOUND -9 |
128 | #define PIM_UPDATE_SOURCE_DUP -10 | |
dfe43e25 | 129 | |
12e41d03 DL |
130 | const char *const PIM_ALL_SYSTEMS; |
131 | const char *const PIM_ALL_ROUTERS; | |
132 | const char *const PIM_ALL_PIM_ROUTERS; | |
133 | const char *const PIM_ALL_IGMP_ROUTERS; | |
134 | ||
d62a17ae | 135 | extern struct thread_master *master; |
0b6817c5 | 136 | extern struct zebra_privs_t pimd_privs; |
d62a17ae | 137 | uint32_t qpim_debugs; |
d62a17ae | 138 | struct in_addr qpim_all_pim_routers_addr; |
139 | int qpim_t_periodic; /* Period between Join/Prune Messages */ | |
140 | struct pim_assert_metric qpim_infinite_assert_metric; | |
141 | long qpim_rpf_cache_refresh_delay_msec; | |
d62a17ae | 142 | extern int qpim_packet_process; |
143 | extern uint8_t qpim_ecmp_enable; | |
144 | extern uint8_t qpim_ecmp_rebalance_enable; | |
cba44481 | 145 | |
8e4c9ef3 | 146 | #define PIM_DEFAULT_PACKET_PROCESS 3 |
12e41d03 DL |
147 | |
148 | #define PIM_JP_HOLDTIME (qpim_t_periodic * 7 / 2) | |
149 | ||
4a4c4a07 DS |
150 | /* |
151 | * Register-Stop Timer (RST(S,G)) | |
152 | * Default values | |
153 | */ | |
154 | extern int32_t qpim_register_suppress_time; | |
155 | extern int32_t qpim_register_probe_time; | |
156 | #define PIM_REGISTER_SUPPRESSION_TIME_DEFAULT (60) | |
157 | #define PIM_REGISTER_PROBE_TIME_DEFAULT (5) | |
158 | ||
12e41d03 | 159 | #define PIM_DEBUG_PIM_EVENTS (qpim_debugs & PIM_MASK_PIM_EVENTS) |
3010e99a | 160 | #define PIM_DEBUG_PIM_EVENTS_DETAIL (qpim_debugs & PIM_MASK_PIM_EVENTS_DETAIL) |
12e41d03 DL |
161 | #define PIM_DEBUG_PIM_PACKETS (qpim_debugs & PIM_MASK_PIM_PACKETS) |
162 | #define PIM_DEBUG_PIM_PACKETDUMP_SEND (qpim_debugs & PIM_MASK_PIM_PACKETDUMP_SEND) | |
163 | #define PIM_DEBUG_PIM_PACKETDUMP_RECV (qpim_debugs & PIM_MASK_PIM_PACKETDUMP_RECV) | |
164 | #define PIM_DEBUG_PIM_TRACE (qpim_debugs & PIM_MASK_PIM_TRACE) | |
3010e99a | 165 | #define PIM_DEBUG_PIM_TRACE_DETAIL (qpim_debugs & PIM_MASK_PIM_TRACE_DETAIL) |
12e41d03 DL |
166 | #define PIM_DEBUG_IGMP_EVENTS (qpim_debugs & PIM_MASK_IGMP_EVENTS) |
167 | #define PIM_DEBUG_IGMP_PACKETS (qpim_debugs & PIM_MASK_IGMP_PACKETS) | |
168 | #define PIM_DEBUG_IGMP_TRACE (qpim_debugs & PIM_MASK_IGMP_TRACE) | |
d3a8a0f5 | 169 | #define PIM_DEBUG_IGMP_TRACE_DETAIL (qpim_debugs & PIM_MASK_IGMP_TRACE_DETAIL) |
12e41d03 DL |
170 | #define PIM_DEBUG_ZEBRA (qpim_debugs & PIM_MASK_ZEBRA) |
171 | #define PIM_DEBUG_SSMPINGD (qpim_debugs & PIM_MASK_SSMPINGD) | |
172 | #define PIM_DEBUG_MROUTE (qpim_debugs & PIM_MASK_MROUTE) | |
6c7197b1 | 173 | #define PIM_DEBUG_MROUTE_DETAIL (qpim_debugs & PIM_MASK_MROUTE_DETAIL) |
6250610a JAG |
174 | #define PIM_DEBUG_PIM_HELLO (qpim_debugs & PIM_MASK_PIM_HELLO) |
175 | #define PIM_DEBUG_PIM_J_P (qpim_debugs & PIM_MASK_PIM_J_P) | |
9add3b88 | 176 | #define PIM_DEBUG_PIM_REG (qpim_debugs & PIM_MASK_PIM_REG) |
6250610a | 177 | #define PIM_DEBUG_STATIC (qpim_debugs & PIM_MASK_STATIC) |
2a333e0f | 178 | #define PIM_DEBUG_MSDP_EVENTS (qpim_debugs & PIM_MASK_MSDP_EVENTS) |
179 | #define PIM_DEBUG_MSDP_PACKETS (qpim_debugs & PIM_MASK_MSDP_PACKETS) | |
180 | #define PIM_DEBUG_MSDP_INTERNAL (qpim_debugs & PIM_MASK_MSDP_INTERNAL) | |
40f1f31b DS |
181 | #define PIM_DEBUG_PIM_NHT (qpim_debugs & PIM_MASK_PIM_NHT) |
182 | #define PIM_DEBUG_PIM_NHT_DETAIL (qpim_debugs & PIM_MASK_PIM_NHT_DETAIL) | |
3d225d48 | 183 | #define PIM_DEBUG_PIM_NHT_RP (qpim_debugs & PIM_MASK_PIM_NHT_RP) |
4d9ad5dc | 184 | #define PIM_DEBUG_MTRACE (qpim_debugs & PIM_MASK_MTRACE) |
12e41d03 | 185 | |
2a333e0f | 186 | #define PIM_DEBUG_EVENTS (qpim_debugs & (PIM_MASK_PIM_EVENTS | PIM_MASK_IGMP_EVENTS | PIM_MASK_MSDP_EVENTS)) |
187 | #define PIM_DEBUG_PACKETS (qpim_debugs & (PIM_MASK_PIM_PACKETS | PIM_MASK_IGMP_PACKETS | PIM_MASK_MSDP_PACKETS)) | |
12e41d03 DL |
188 | #define PIM_DEBUG_TRACE (qpim_debugs & (PIM_MASK_PIM_TRACE | PIM_MASK_IGMP_TRACE)) |
189 | ||
190 | #define PIM_DO_DEBUG_PIM_EVENTS (qpim_debugs |= PIM_MASK_PIM_EVENTS) | |
191 | #define PIM_DO_DEBUG_PIM_PACKETS (qpim_debugs |= PIM_MASK_PIM_PACKETS) | |
192 | #define PIM_DO_DEBUG_PIM_PACKETDUMP_SEND (qpim_debugs |= PIM_MASK_PIM_PACKETDUMP_SEND) | |
193 | #define PIM_DO_DEBUG_PIM_PACKETDUMP_RECV (qpim_debugs |= PIM_MASK_PIM_PACKETDUMP_RECV) | |
194 | #define PIM_DO_DEBUG_PIM_TRACE (qpim_debugs |= PIM_MASK_PIM_TRACE) | |
56c238c9 | 195 | #define PIM_DO_DEBUG_PIM_TRACE_DETAIL (qpim_debugs |= PIM_MASK_PIM_TRACE_DETAIL) |
12e41d03 DL |
196 | #define PIM_DO_DEBUG_IGMP_EVENTS (qpim_debugs |= PIM_MASK_IGMP_EVENTS) |
197 | #define PIM_DO_DEBUG_IGMP_PACKETS (qpim_debugs |= PIM_MASK_IGMP_PACKETS) | |
198 | #define PIM_DO_DEBUG_IGMP_TRACE (qpim_debugs |= PIM_MASK_IGMP_TRACE) | |
d3a8a0f5 | 199 | #define PIM_DO_DEBUG_IGMP_TRACE_DETAIL (qpim_debugs |= PIM_MASK_IGMP_TRACE_DETAIL) |
12e41d03 DL |
200 | #define PIM_DO_DEBUG_ZEBRA (qpim_debugs |= PIM_MASK_ZEBRA) |
201 | #define PIM_DO_DEBUG_SSMPINGD (qpim_debugs |= PIM_MASK_SSMPINGD) | |
202 | #define PIM_DO_DEBUG_MROUTE (qpim_debugs |= PIM_MASK_MROUTE) | |
6c7197b1 | 203 | #define PIM_DO_DEBUG_MROUTE_DETAIL (qpim_debugs |= PIM_MASK_MROUTE_DETAIL) |
12e41d03 DL |
204 | #define PIM_DO_DEBUG_PIM_HELLO (qpim_debugs |= PIM_MASK_PIM_HELLO) |
205 | #define PIM_DO_DEBUG_PIM_J_P (qpim_debugs |= PIM_MASK_PIM_J_P) | |
9add3b88 | 206 | #define PIM_DO_DEBUG_PIM_REG (qpim_debugs |= PIM_MASK_PIM_REG) |
6250610a | 207 | #define PIM_DO_DEBUG_STATIC (qpim_debugs |= PIM_MASK_STATIC) |
2a333e0f | 208 | #define PIM_DO_DEBUG_MSDP_EVENTS (qpim_debugs |= PIM_MASK_MSDP_EVENTS) |
209 | #define PIM_DO_DEBUG_MSDP_PACKETS (qpim_debugs |= PIM_MASK_MSDP_PACKETS) | |
210 | #define PIM_DO_DEBUG_MSDP_INTERNAL (qpim_debugs |= PIM_MASK_MSDP_INTERNAL) | |
40f1f31b | 211 | #define PIM_DO_DEBUG_PIM_NHT (qpim_debugs |= PIM_MASK_PIM_NHT) |
3d225d48 | 212 | #define PIM_DO_DEBUG_PIM_NHT_RP (qpim_debugs |= PIM_MASK_PIM_NHT_RP) |
4d9ad5dc | 213 | #define PIM_DO_DEBUG_MTRACE (qpim_debugs |= PIM_MASK_MTRACE) |
12e41d03 DL |
214 | |
215 | #define PIM_DONT_DEBUG_PIM_EVENTS (qpim_debugs &= ~PIM_MASK_PIM_EVENTS) | |
216 | #define PIM_DONT_DEBUG_PIM_PACKETS (qpim_debugs &= ~PIM_MASK_PIM_PACKETS) | |
217 | #define PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND (qpim_debugs &= ~PIM_MASK_PIM_PACKETDUMP_SEND) | |
218 | #define PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV (qpim_debugs &= ~PIM_MASK_PIM_PACKETDUMP_RECV) | |
219 | #define PIM_DONT_DEBUG_PIM_TRACE (qpim_debugs &= ~PIM_MASK_PIM_TRACE) | |
56c238c9 | 220 | #define PIM_DONT_DEBUG_PIM_TRACE_DETAIL (qpim_debugs &= ~PIM_MASK_PIM_TRACE_DETAIL) |
12e41d03 DL |
221 | #define PIM_DONT_DEBUG_IGMP_EVENTS (qpim_debugs &= ~PIM_MASK_IGMP_EVENTS) |
222 | #define PIM_DONT_DEBUG_IGMP_PACKETS (qpim_debugs &= ~PIM_MASK_IGMP_PACKETS) | |
223 | #define PIM_DONT_DEBUG_IGMP_TRACE (qpim_debugs &= ~PIM_MASK_IGMP_TRACE) | |
d3a8a0f5 | 224 | #define PIM_DONT_DEBUG_IGMP_TRACE_DETAIL (qpim_debugs &= ~PIM_MASK_IGMP_TRACE_DETAIL) |
12e41d03 DL |
225 | #define PIM_DONT_DEBUG_ZEBRA (qpim_debugs &= ~PIM_MASK_ZEBRA) |
226 | #define PIM_DONT_DEBUG_SSMPINGD (qpim_debugs &= ~PIM_MASK_SSMPINGD) | |
227 | #define PIM_DONT_DEBUG_MROUTE (qpim_debugs &= ~PIM_MASK_MROUTE) | |
6c7197b1 | 228 | #define PIM_DONT_DEBUG_MROUTE_DETAIL (qpim_debugs &= ~PIM_MASK_MROUTE_DETAIL) |
12e41d03 DL |
229 | #define PIM_DONT_DEBUG_PIM_HELLO (qpim_debugs &= ~PIM_MASK_PIM_HELLO) |
230 | #define PIM_DONT_DEBUG_PIM_J_P (qpim_debugs &= ~PIM_MASK_PIM_J_P) | |
9add3b88 | 231 | #define PIM_DONT_DEBUG_PIM_REG (qpim_debugs &= ~PIM_MASK_PIM_REG) |
6250610a | 232 | #define PIM_DONT_DEBUG_STATIC (qpim_debugs &= ~PIM_MASK_STATIC) |
2a333e0f | 233 | #define PIM_DONT_DEBUG_MSDP_EVENTS (qpim_debugs &= ~PIM_MASK_MSDP_EVENTS) |
234 | #define PIM_DONT_DEBUG_MSDP_PACKETS (qpim_debugs &= ~PIM_MASK_MSDP_PACKETS) | |
235 | #define PIM_DONT_DEBUG_MSDP_INTERNAL (qpim_debugs &= ~PIM_MASK_MSDP_INTERNAL) | |
40f1f31b | 236 | #define PIM_DONT_DEBUG_PIM_NHT (qpim_debugs &= ~PIM_MASK_PIM_NHT) |
3d225d48 | 237 | #define PIM_DONT_DEBUG_PIM_NHT_RP (qpim_debugs &= ~PIM_MASK_PIM_NHT_RP) |
4d9ad5dc | 238 | #define PIM_DONT_DEBUG_MTRACE (qpim_debugs &= ~PIM_MASK_MTRACE) |
12e41d03 DL |
239 | |
240 | void pim_init(void); | |
241 | void pim_terminate(void); | |
242 | ||
d62a17ae | 243 | extern void pim_route_map_init(void); |
28b0c6b3 | 244 | extern void pim_route_map_terminate(void); |
d62a17ae | 245 | void pim_prefix_list_update(struct prefix_list *plist); |
0e8ce7e6 | 246 | |
12e41d03 | 247 | #endif /* PIMD_H */ |