]>
Commit | Line | Data |
---|---|---|
12e41d03 DL |
1 | /* |
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 | |
16 | along with this program; see the file COPYING; if not, write to the | |
17 | Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, | |
18 | MA 02110-1301 USA | |
b58ed1f8 | 19 | <<<<<<< HEAD |
12e41d03 | 20 | |
b58ed1f8 DS |
21 | ======= |
22 | >>>>>>> origin/master | |
12e41d03 DL |
23 | */ |
24 | ||
25 | #include <zebra.h> | |
26 | ||
27 | #include "if.h" | |
28 | #include "linklist.h" | |
dfe43e25 DW |
29 | #include "prefix.h" |
30 | #include "vty.h" | |
469351b3 | 31 | #include "vrf.h" |
dfe43e25 | 32 | #include "plist.h" |
12e41d03 DL |
33 | |
34 | #include "pimd.h" | |
35 | #include "pim_vty.h" | |
36 | #include "pim_iface.h" | |
37 | #include "pim_cmd.h" | |
38 | #include "pim_str.h" | |
39 | #include "pim_ssmpingd.h" | |
dedccda6 | 40 | #include "pim_pim.h" |
9867746a | 41 | #include "pim_oil.h" |
f91f89bc | 42 | #include "pim_static.h" |
75a26779 | 43 | #include "pim_rp.h" |
3c72d654 | 44 | #include "pim_msdp.h" |
12e41d03 | 45 | |
c823065d DS |
46 | int |
47 | pim_debug_config_write (struct vty *vty) | |
12e41d03 DL |
48 | { |
49 | int writes = 0; | |
50 | ||
2a333e0f | 51 | if (PIM_DEBUG_MSDP_EVENTS) { |
52 | vty_out(vty, "debug msdp events%s", VTY_NEWLINE); | |
53 | ++writes; | |
54 | } | |
55 | if (PIM_DEBUG_MSDP_PACKETS) { | |
56 | vty_out(vty, "debug msdp packets%s", VTY_NEWLINE); | |
57 | ++writes; | |
58 | } | |
977d71cc | 59 | if (PIM_DEBUG_MSDP_INTERNAL) { |
60 | vty_out(vty, "debug msdp internal%s", VTY_NEWLINE); | |
61 | ++writes; | |
62 | } | |
12e41d03 DL |
63 | if (PIM_DEBUG_IGMP_EVENTS) { |
64 | vty_out(vty, "debug igmp events%s", VTY_NEWLINE); | |
65 | ++writes; | |
66 | } | |
67 | if (PIM_DEBUG_IGMP_PACKETS) { | |
68 | vty_out(vty, "debug igmp packets%s", VTY_NEWLINE); | |
69 | ++writes; | |
70 | } | |
71 | if (PIM_DEBUG_IGMP_TRACE) { | |
72 | vty_out(vty, "debug igmp trace%s", VTY_NEWLINE); | |
73 | ++writes; | |
74 | } | |
c823065d DS |
75 | if (PIM_DEBUG_IGMP_TRACE_DETAIL) { |
76 | vty_out(vty, "debug igmp trace detail%s", VTY_NEWLINE); | |
77 | ++writes; | |
78 | } | |
12e41d03 DL |
79 | |
80 | if (PIM_DEBUG_MROUTE) { | |
81 | vty_out(vty, "debug mroute%s", VTY_NEWLINE); | |
82 | ++writes; | |
83 | } | |
84 | ||
6c7197b1 DS |
85 | if (PIM_DEBUG_MROUTE_DETAIL) { |
86 | vty_out (vty, "debug mroute detail%s", VTY_NEWLINE); | |
87 | ++writes; | |
88 | } | |
89 | ||
12e41d03 DL |
90 | if (PIM_DEBUG_PIM_EVENTS) { |
91 | vty_out(vty, "debug pim events%s", VTY_NEWLINE); | |
92 | ++writes; | |
93 | } | |
94 | if (PIM_DEBUG_PIM_PACKETS) { | |
95 | vty_out(vty, "debug pim packets%s", VTY_NEWLINE); | |
96 | ++writes; | |
97 | } | |
98 | if (PIM_DEBUG_PIM_PACKETDUMP_SEND) { | |
99 | vty_out(vty, "debug pim packet-dump send%s", VTY_NEWLINE); | |
100 | ++writes; | |
101 | } | |
102 | if (PIM_DEBUG_PIM_PACKETDUMP_RECV) { | |
103 | vty_out(vty, "debug pim packet-dump receive%s", VTY_NEWLINE); | |
104 | ++writes; | |
105 | } | |
c823065d | 106 | |
12e41d03 DL |
107 | if (PIM_DEBUG_PIM_TRACE) { |
108 | vty_out(vty, "debug pim trace%s", VTY_NEWLINE); | |
109 | ++writes; | |
110 | } | |
c823065d DS |
111 | if (PIM_DEBUG_PIM_TRACE_DETAIL) { |
112 | vty_out(vty, "debug pim trace detail%s", VTY_NEWLINE); | |
113 | ++writes; | |
114 | } | |
12e41d03 DL |
115 | |
116 | if (PIM_DEBUG_ZEBRA) { | |
117 | vty_out(vty, "debug pim zebra%s", VTY_NEWLINE); | |
118 | ++writes; | |
119 | } | |
120 | ||
121 | if (PIM_DEBUG_SSMPINGD) { | |
122 | vty_out(vty, "debug ssmpingd%s", VTY_NEWLINE); | |
123 | ++writes; | |
124 | } | |
125 | ||
c823065d DS |
126 | if (PIM_DEBUG_PIM_HELLO) { |
127 | vty_out (vty, "debug pim packets hello%s", VTY_NEWLINE); | |
128 | ++writes; | |
129 | } | |
130 | ||
131 | if (PIM_DEBUG_PIM_J_P) { | |
a23ee35b | 132 | vty_out (vty, "debug pim packets joins%s", VTY_NEWLINE); |
c823065d DS |
133 | ++writes; |
134 | } | |
135 | ||
9add3b88 DS |
136 | if (PIM_DEBUG_PIM_REG) { |
137 | vty_out (vty, "debug pim packets register%s", VTY_NEWLINE); | |
138 | ++writes; | |
139 | } | |
140 | ||
c823065d DS |
141 | if (PIM_DEBUG_STATIC) { |
142 | vty_out (vty, "debug pim static%s", VTY_NEWLINE); | |
143 | ++writes; | |
144 | } | |
145 | ||
12e41d03 DL |
146 | return writes; |
147 | } | |
148 | ||
149 | int pim_global_config_write(struct vty *vty) | |
150 | { | |
151 | int writes = 0; | |
152 | ||
3c72d654 | 153 | writes += pim_msdp_config_write (vty); |
154 | ||
12e41d03 | 155 | if (PIM_MROUTE_IS_ENABLED) { |
199d90a1 | 156 | vty_out(vty, "ip multicast-routing%s", VTY_NEWLINE); |
12e41d03 DL |
157 | ++writes; |
158 | } | |
75a26779 DS |
159 | |
160 | writes += pim_rp_config_write (vty); | |
12e41d03 | 161 | |
191f5695 | 162 | if (qpim_register_suppress_time != PIM_REGISTER_SUPPRESSION_TIME_DEFAULT) |
4304f95c | 163 | { |
191f5695 DS |
164 | vty_out (vty, "ip pim register-suppress-time %d%s", |
165 | qpim_register_suppress_time, VTY_NEWLINE); | |
4304f95c DS |
166 | ++writes; |
167 | } | |
ee1a0718 DS |
168 | if (qpim_t_periodic != PIM_DEFAULT_T_PERIODIC) |
169 | { | |
170 | vty_out (vty, "ip pim join-prune-interval %d%s", | |
171 | qpim_t_periodic, VTY_NEWLINE); | |
172 | ++writes; | |
173 | } | |
191f5695 | 174 | if (qpim_keep_alive_time != PIM_KEEPALIVE_PERIOD) |
01408ede | 175 | { |
191f5695 DS |
176 | vty_out (vty, "ip pim keep-alive-timer %d%s", |
177 | qpim_keep_alive_time, VTY_NEWLINE); | |
01408ede DS |
178 | ++writes; |
179 | } | |
8e4c9ef3 DS |
180 | if (qpim_packet_process != PIM_DEFAULT_PACKET_PROCESS) |
181 | { | |
182 | vty_out (vty, "ip pim packets %d%s", | |
183 | qpim_packet_process, VTY_NEWLINE); | |
184 | ++writes; | |
185 | } | |
01408ede | 186 | |
12e41d03 DL |
187 | if (qpim_ssmpingd_list) { |
188 | struct listnode *node; | |
189 | struct ssmpingd_sock *ss; | |
190 | vty_out(vty, "!%s", VTY_NEWLINE); | |
191 | ++writes; | |
192 | for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list, node, ss)) { | |
eaa54bdb | 193 | char source_str[INET_ADDRSTRLEN]; |
12e41d03 DL |
194 | pim_inet4_dump("<src?>", ss->source_addr, source_str, sizeof(source_str)); |
195 | vty_out(vty, "ip ssmpingd %s%s", source_str, VTY_NEWLINE); | |
196 | ++writes; | |
197 | } | |
198 | } | |
199 | ||
200 | return writes; | |
201 | } | |
202 | ||
203 | int pim_interface_config_write(struct vty *vty) | |
204 | { | |
205 | int writes = 0; | |
206 | struct listnode *node; | |
207 | struct interface *ifp; | |
208 | ||
469351b3 | 209 | for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { |
12e41d03 DL |
210 | |
211 | /* IF name */ | |
212 | vty_out(vty, "interface %s%s", ifp->name, VTY_NEWLINE); | |
213 | ++writes; | |
214 | ||
215 | if (ifp->info) { | |
216 | struct pim_interface *pim_ifp = ifp->info; | |
217 | ||
218 | /* IF ip pim ssm */ | |
219 | if (PIM_IF_TEST_PIM(pim_ifp->options)) { | |
981d6c7a DS |
220 | if (pim_ifp->itype == PIM_INTERFACE_SSM) |
221 | vty_out(vty, " ip pim ssm%s", VTY_NEWLINE); | |
222 | else | |
223 | vty_out(vty, " ip pim sm%s", VTY_NEWLINE); | |
12e41d03 DL |
224 | ++writes; |
225 | } | |
226 | ||
dedccda6 DS |
227 | /* IF ip pim drpriority */ |
228 | if (pim_ifp->pim_dr_priority != PIM_DEFAULT_DR_PRIORITY) { | |
94d95cde | 229 | vty_out(vty, " ip pim drpriority %u%s", pim_ifp->pim_dr_priority, |
dedccda6 DS |
230 | VTY_NEWLINE); |
231 | ++writes; | |
232 | } | |
233 | ||
7960fa8f DS |
234 | /* IF ip pim hello */ |
235 | if (pim_ifp->pim_hello_period != PIM_DEFAULT_HELLO_PERIOD) { | |
236 | vty_out(vty, " ip pim hello %d", pim_ifp->pim_hello_period); | |
237 | if (pim_ifp->pim_default_holdtime != -1) | |
238 | vty_out(vty, " %d", pim_ifp->pim_default_holdtime); | |
239 | vty_out(vty, "%s", VTY_NEWLINE); | |
240 | } | |
241 | ||
4763cd0e | 242 | /* update source */ |
243 | if (PIM_INADDR_ISNOT_ANY(pim_ifp->update_source)) { | |
244 | char src_str[INET_ADDRSTRLEN]; | |
245 | pim_inet4_dump("<src?>", pim_ifp->update_source, src_str, | |
246 | sizeof(src_str)); | |
247 | vty_out(vty, " ip pim use-source %s%s", src_str, VTY_NEWLINE); | |
248 | ++writes; | |
249 | } | |
250 | ||
12e41d03 DL |
251 | /* IF ip igmp */ |
252 | if (PIM_IF_TEST_IGMP(pim_ifp->options)) { | |
253 | vty_out(vty, " ip igmp%s", VTY_NEWLINE); | |
254 | ++writes; | |
255 | } | |
256 | ||
b05b72e8 DW |
257 | /* ip igmp version */ |
258 | if (pim_ifp->igmp_version != IGMP_DEFAULT_VERSION) | |
259 | { | |
260 | vty_out(vty, " ip igmp version %d%s", | |
261 | pim_ifp->igmp_version, | |
262 | VTY_NEWLINE); | |
263 | ++writes; | |
264 | } | |
265 | ||
12e41d03 | 266 | /* IF ip igmp query-interval */ |
6b775f61 DS |
267 | if (pim_ifp->igmp_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL) |
268 | { | |
199d90a1 | 269 | vty_out(vty, " ip igmp query-interval %d%s", |
6b775f61 DS |
270 | pim_ifp->igmp_default_query_interval, |
271 | VTY_NEWLINE); | |
272 | ++writes; | |
273 | } | |
12e41d03 DL |
274 | |
275 | /* IF ip igmp query-max-response-time */ | |
6b775f61 DS |
276 | if (pim_ifp->igmp_query_max_response_time_dsec != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC) |
277 | { | |
58344b65 | 278 | vty_out(vty, " ip igpm query-max-response-time %d%s", |
6b775f61 DS |
279 | pim_ifp->igmp_query_max_response_time_dsec, |
280 | VTY_NEWLINE); | |
281 | ++writes; | |
282 | } | |
12e41d03 DL |
283 | |
284 | /* IF ip igmp join */ | |
285 | if (pim_ifp->igmp_join_list) { | |
286 | struct listnode *node; | |
287 | struct igmp_join *ij; | |
288 | for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_join_list, node, ij)) { | |
eaa54bdb DW |
289 | char group_str[INET_ADDRSTRLEN]; |
290 | char source_str[INET_ADDRSTRLEN]; | |
12e41d03 | 291 | pim_inet4_dump("<grp?>", ij->group_addr, group_str, sizeof(group_str)); |
a277fb84 | 292 | inet_ntop(AF_INET, &ij->source_addr, source_str, sizeof(source_str)); |
12e41d03 DL |
293 | vty_out(vty, " ip igmp join %s %s%s", |
294 | group_str, source_str, | |
295 | VTY_NEWLINE); | |
296 | ++writes; | |
297 | } | |
298 | } | |
f91f89bc DS |
299 | |
300 | writes += pim_static_write_mroute (vty, ifp); | |
12e41d03 DL |
301 | } |
302 | vty_out(vty, "!%s", VTY_NEWLINE); | |
303 | ++writes; | |
304 | } | |
305 | ||
306 | return writes; | |
307 | } |