]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_vty.c
pimd: Fix c_oil->pim set spot
[mirror_frr.git] / pimd / pim_vty.c
CommitLineData
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#include <zebra.h>
21
22#include "if.h"
23#include "linklist.h"
dfe43e25
DW
24#include "prefix.h"
25#include "vty.h"
469351b3 26#include "vrf.h"
dfe43e25 27#include "plist.h"
12e41d03
DL
28
29#include "pimd.h"
30#include "pim_vty.h"
31#include "pim_iface.h"
32#include "pim_cmd.h"
33#include "pim_str.h"
34#include "pim_ssmpingd.h"
dedccda6 35#include "pim_pim.h"
9867746a 36#include "pim_oil.h"
f91f89bc 37#include "pim_static.h"
75a26779 38#include "pim_rp.h"
3c72d654 39#include "pim_msdp.h"
15a5dafe 40#include "pim_ssm.h"
ba4eb1bc 41#include "pim_bfd.h"
12e41d03 42
d62a17ae 43int pim_debug_config_write(struct vty *vty)
12e41d03 44{
d62a17ae 45 int writes = 0;
46
47 if (PIM_DEBUG_MSDP_EVENTS) {
48 vty_out(vty, "debug msdp events\n");
49 ++writes;
50 }
51 if (PIM_DEBUG_MSDP_PACKETS) {
52 vty_out(vty, "debug msdp packets\n");
53 ++writes;
54 }
55 if (PIM_DEBUG_MSDP_INTERNAL) {
56 vty_out(vty, "debug msdp internal\n");
57 ++writes;
58 }
59 if (PIM_DEBUG_IGMP_EVENTS) {
60 vty_out(vty, "debug igmp events\n");
61 ++writes;
62 }
63 if (PIM_DEBUG_IGMP_PACKETS) {
64 vty_out(vty, "debug igmp packets\n");
65 ++writes;
66 }
67 if (PIM_DEBUG_IGMP_TRACE) {
68 vty_out(vty, "debug igmp trace\n");
69 ++writes;
70 }
71 if (PIM_DEBUG_IGMP_TRACE_DETAIL) {
72 vty_out(vty, "debug igmp trace detail\n");
73 ++writes;
74 }
75
76 if (PIM_DEBUG_MROUTE) {
77 vty_out(vty, "debug mroute\n");
78 ++writes;
79 }
80
81 if (PIM_DEBUG_MROUTE_DETAIL) {
82 vty_out(vty, "debug mroute detail\n");
83 ++writes;
84 }
85
86 if (PIM_DEBUG_PIM_EVENTS) {
87 vty_out(vty, "debug pim events\n");
88 ++writes;
89 }
90 if (PIM_DEBUG_PIM_PACKETS) {
91 vty_out(vty, "debug pim packets\n");
92 ++writes;
93 }
94 if (PIM_DEBUG_PIM_PACKETDUMP_SEND) {
95 vty_out(vty, "debug pim packet-dump send\n");
96 ++writes;
97 }
98 if (PIM_DEBUG_PIM_PACKETDUMP_RECV) {
99 vty_out(vty, "debug pim packet-dump receive\n");
100 ++writes;
101 }
102
103 if (PIM_DEBUG_PIM_TRACE) {
104 vty_out(vty, "debug pim trace\n");
105 ++writes;
106 }
107 if (PIM_DEBUG_PIM_TRACE_DETAIL) {
108 vty_out(vty, "debug pim trace detail\n");
109 ++writes;
110 }
111
112 if (PIM_DEBUG_ZEBRA) {
113 vty_out(vty, "debug pim zebra\n");
114 ++writes;
115 }
116
117 if (PIM_DEBUG_SSMPINGD) {
118 vty_out(vty, "debug ssmpingd\n");
119 ++writes;
120 }
121
122 if (PIM_DEBUG_PIM_HELLO) {
123 vty_out(vty, "debug pim packets hello\n");
124 ++writes;
125 }
126
127 if (PIM_DEBUG_PIM_J_P) {
128 vty_out(vty, "debug pim packets joins\n");
129 ++writes;
130 }
131
132 if (PIM_DEBUG_PIM_REG) {
133 vty_out(vty, "debug pim packets register\n");
134 ++writes;
135 }
136
137 if (PIM_DEBUG_STATIC) {
138 vty_out(vty, "debug pim static\n");
139 ++writes;
140 }
141
142 return writes;
12e41d03
DL
143}
144
145int pim_global_config_write(struct vty *vty)
146{
d62a17ae 147 int writes = 0;
148 struct pim_ssm *ssm = pimg->ssm_info;
12e41d03 149
d62a17ae 150 writes += pim_msdp_config_write(vty);
151
152 if (!pimg->send_v6_secondary) {
153 vty_out(vty, "no ip pim send-v6-secondary\n");
154 ++writes;
6b775f61 155 }
12e41d03 156
d62a17ae 157 writes += pim_rp_config_write(vty);
158
159 if (qpim_register_suppress_time
160 != PIM_REGISTER_SUPPRESSION_TIME_DEFAULT) {
161 vty_out(vty, "ip pim register-suppress-time %d\n",
162 qpim_register_suppress_time);
163 ++writes;
6b775f61 164 }
d62a17ae 165 if (qpim_t_periodic != PIM_DEFAULT_T_PERIODIC) {
166 vty_out(vty, "ip pim join-prune-interval %d\n",
167 qpim_t_periodic);
168 ++writes;
169 }
170 if (qpim_keep_alive_time != PIM_KEEPALIVE_PERIOD) {
171 vty_out(vty, "ip pim keep-alive-timer %d\n",
172 qpim_keep_alive_time);
173 ++writes;
174 }
175 if (qpim_packet_process != PIM_DEFAULT_PACKET_PROCESS) {
176 vty_out(vty, "ip pim packets %d\n", qpim_packet_process);
177 ++writes;
178 }
179 if (ssm->plist_name) {
180 vty_out(vty, "ip pim ssm prefix-list %s\n", ssm->plist_name);
181 ++writes;
182 }
183 if (pimg->spt.switchover == PIM_SPT_INFINITY) {
184 if (pimg->spt.plist)
185 vty_out(vty,
186 "ip pim spt-switchover infinity-and-beyond prefix-list %s\n",
187 pimg->spt.plist);
188 else
189 vty_out(vty,
190 "ip pim spt-switchover infinity-and-beyond\n");
191 ++writes;
192 }
193 if (qpim_ecmp_rebalance_enable) {
194 vty_out(vty, "ip pim ecmp rebalance\n");
195 ++writes;
196 } else if (qpim_ecmp_enable) {
197 vty_out(vty, "ip pim ecmp\n");
198 ++writes;
199 }
200 if (qpim_ssmpingd_list) {
201 struct listnode *node;
202 struct ssmpingd_sock *ss;
203 vty_out(vty, "!\n");
204 ++writes;
205 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list, node, ss)) {
206 char source_str[INET_ADDRSTRLEN];
207 pim_inet4_dump("<src?>", ss->source_addr, source_str,
208 sizeof(source_str));
209 vty_out(vty, "ip ssmpingd %s\n", source_str);
210 ++writes;
211 }
212 }
213
214 return writes;
215}
12e41d03 216
d62a17ae 217int pim_interface_config_write(struct vty *vty)
218{
024d6a75 219 struct pim_instance *pim;
12e41d03 220 struct listnode *node;
d62a17ae 221 struct interface *ifp;
024d6a75
DS
222 struct vrf *vrf;
223 int writes = 0;
d62a17ae 224
024d6a75
DS
225 RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
226 {
227 pim = vrf->info;
228 if (!pim)
229 continue;
d62a17ae 230
024d6a75 231 for (ALL_LIST_ELEMENTS_RO(vrf_iflist(pim->vrf_id), node, ifp)) {
d62a17ae 232
024d6a75
DS
233 /* IF name */
234 if (vrf->vrf_id == VRF_DEFAULT)
235 vty_out(vty, "interface %s\n", ifp->name);
236 else
237 vty_out(vty, "interface %s vrf %s\n", ifp->name,
238 vrf->name);
239 ++writes;
d62a17ae 240
024d6a75
DS
241 if (ifp->info) {
242 struct pim_interface *pim_ifp = ifp->info;
d62a17ae 243
024d6a75
DS
244 if (PIM_IF_TEST_PIM(pim_ifp->options)) {
245 vty_out(vty, " ip pim sm\n");
246 ++writes;
247 }
d62a17ae 248
024d6a75
DS
249 /* IF ip pim drpriority */
250 if (pim_ifp->pim_dr_priority
251 != PIM_DEFAULT_DR_PRIORITY) {
252 vty_out(vty, " ip pim drpriority %u\n",
253 pim_ifp->pim_dr_priority);
254 ++writes;
255 }
d62a17ae 256
024d6a75
DS
257 /* IF ip pim hello */
258 if (pim_ifp->pim_hello_period
259 != PIM_DEFAULT_HELLO_PERIOD) {
260 vty_out(vty, " ip pim hello %d",
261 pim_ifp->pim_hello_period);
262 if (pim_ifp->pim_default_holdtime != -1)
263 vty_out(vty, " %d",
264 pim_ifp->pim_default_holdtime);
265 vty_out(vty, "\n");
266 }
d62a17ae 267
024d6a75
DS
268 /* update source */
269 if (PIM_INADDR_ISNOT_ANY(
270 pim_ifp->update_source)) {
271 char src_str[INET_ADDRSTRLEN];
272 pim_inet4_dump("<src?>",
273 pim_ifp->update_source,
274 src_str,
275 sizeof(src_str));
276 vty_out(vty, " ip pim use-source %s\n",
277 src_str);
278 ++writes;
279 }
d62a17ae 280
024d6a75
DS
281 /* IF ip igmp */
282 if (PIM_IF_TEST_IGMP(pim_ifp->options)) {
283 vty_out(vty, " ip igmp\n");
284 ++writes;
285 }
d62a17ae 286
024d6a75
DS
287 /* ip igmp version */
288 if (pim_ifp->igmp_version
289 != IGMP_DEFAULT_VERSION) {
290 vty_out(vty, " ip igmp version %d\n",
291 pim_ifp->igmp_version);
292 ++writes;
293 }
d62a17ae 294
024d6a75
DS
295 /* IF ip igmp query-interval */
296 if (pim_ifp->igmp_default_query_interval
297 != IGMP_GENERAL_QUERY_INTERVAL) {
298 vty_out(vty,
299 " ip igmp query-interval %d\n",
300 pim_ifp->igmp_default_query_interval);
301 ++writes;
302 }
d62a17ae 303
024d6a75
DS
304 /* IF ip igmp query-max-response-time */
305 if (pim_ifp->igmp_query_max_response_time_dsec
306 != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC) {
307 vty_out(vty,
308 " ip igmp query-max-response-time %d\n",
309 pim_ifp->igmp_query_max_response_time_dsec);
d62a17ae 310 ++writes;
311 }
d62a17ae 312
024d6a75
DS
313 /* IF ip igmp join */
314 if (pim_ifp->igmp_join_list) {
315 struct listnode *node;
316 struct igmp_join *ij;
317 for (ALL_LIST_ELEMENTS_RO(
318 pim_ifp->igmp_join_list,
319 node, ij)) {
320 char group_str[INET_ADDRSTRLEN];
321 char source_str
322 [INET_ADDRSTRLEN];
323 pim_inet4_dump(
324 "<grp?>",
325 ij->group_addr,
326 group_str,
327 sizeof(group_str));
328 inet_ntop(AF_INET,
329 &ij->source_addr,
330 source_str,
331 sizeof(source_str));
332 vty_out(vty,
333 " ip igmp join %s %s\n",
334 group_str, source_str);
335 ++writes;
336 }
337 }
338
339 writes += pim_static_write_mroute(vty, ifp);
340 pim_bfd_write_config(vty, ifp);
341 }
342 vty_out(vty, "!\n");
343 ++writes;
d62a17ae 344 }
12e41d03 345 }
12e41d03 346
d62a17ae 347 return writes;
12e41d03 348}