]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_vty.c
pimd: add support for IGMPv2
[mirror_frr.git] / pimd / pim_vty.c
CommitLineData
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
19
12e41d03
DL
20*/
21
22#include <zebra.h>
23
24#include "if.h"
25#include "linklist.h"
dfe43e25
DW
26#include "prefix.h"
27#include "vty.h"
469351b3 28#include "vrf.h"
dfe43e25 29#include "plist.h"
12e41d03
DL
30
31#include "pimd.h"
32#include "pim_vty.h"
33#include "pim_iface.h"
34#include "pim_cmd.h"
35#include "pim_str.h"
36#include "pim_ssmpingd.h"
dedccda6 37#include "pim_pim.h"
9867746a 38#include "pim_oil.h"
f91f89bc 39#include "pim_static.h"
75a26779 40#include "pim_rp.h"
12e41d03 41
c823065d
DS
42int
43pim_debug_config_write (struct vty *vty)
12e41d03
DL
44{
45 int writes = 0;
46
47 if (PIM_DEBUG_IGMP_EVENTS) {
48 vty_out(vty, "debug igmp events%s", VTY_NEWLINE);
49 ++writes;
50 }
51 if (PIM_DEBUG_IGMP_PACKETS) {
52 vty_out(vty, "debug igmp packets%s", VTY_NEWLINE);
53 ++writes;
54 }
55 if (PIM_DEBUG_IGMP_TRACE) {
56 vty_out(vty, "debug igmp trace%s", VTY_NEWLINE);
57 ++writes;
58 }
c823065d
DS
59 if (PIM_DEBUG_IGMP_TRACE_DETAIL) {
60 vty_out(vty, "debug igmp trace detail%s", VTY_NEWLINE);
61 ++writes;
62 }
12e41d03
DL
63
64 if (PIM_DEBUG_MROUTE) {
65 vty_out(vty, "debug mroute%s", VTY_NEWLINE);
66 ++writes;
67 }
68
6c7197b1
DS
69 if (PIM_DEBUG_MROUTE_DETAIL) {
70 vty_out (vty, "debug mroute detail%s", VTY_NEWLINE);
71 ++writes;
72 }
73
12e41d03
DL
74 if (PIM_DEBUG_PIM_EVENTS) {
75 vty_out(vty, "debug pim events%s", VTY_NEWLINE);
76 ++writes;
77 }
78 if (PIM_DEBUG_PIM_PACKETS) {
79 vty_out(vty, "debug pim packets%s", VTY_NEWLINE);
80 ++writes;
81 }
82 if (PIM_DEBUG_PIM_PACKETDUMP_SEND) {
83 vty_out(vty, "debug pim packet-dump send%s", VTY_NEWLINE);
84 ++writes;
85 }
86 if (PIM_DEBUG_PIM_PACKETDUMP_RECV) {
87 vty_out(vty, "debug pim packet-dump receive%s", VTY_NEWLINE);
88 ++writes;
89 }
c823065d 90
12e41d03
DL
91 if (PIM_DEBUG_PIM_TRACE) {
92 vty_out(vty, "debug pim trace%s", VTY_NEWLINE);
93 ++writes;
94 }
c823065d
DS
95 if (PIM_DEBUG_PIM_TRACE_DETAIL) {
96 vty_out(vty, "debug pim trace detail%s", VTY_NEWLINE);
97 ++writes;
98 }
12e41d03
DL
99
100 if (PIM_DEBUG_ZEBRA) {
101 vty_out(vty, "debug pim zebra%s", VTY_NEWLINE);
102 ++writes;
103 }
104
105 if (PIM_DEBUG_SSMPINGD) {
106 vty_out(vty, "debug ssmpingd%s", VTY_NEWLINE);
107 ++writes;
108 }
109
c823065d
DS
110 if (PIM_DEBUG_PIM_HELLO) {
111 vty_out (vty, "debug pim packets hello%s", VTY_NEWLINE);
112 ++writes;
113 }
114
115 if (PIM_DEBUG_PIM_J_P) {
116 vty_out (vty, "debug pim packets join%s", VTY_NEWLINE);
117 ++writes;
118 }
119
9add3b88
DS
120 if (PIM_DEBUG_PIM_REG) {
121 vty_out (vty, "debug pim packets register%s", VTY_NEWLINE);
122 ++writes;
123 }
124
c823065d
DS
125 if (PIM_DEBUG_STATIC) {
126 vty_out (vty, "debug pim static%s", VTY_NEWLINE);
127 ++writes;
128 }
129
12e41d03
DL
130 return writes;
131}
132
133int pim_global_config_write(struct vty *vty)
134{
135 int writes = 0;
136
137 if (PIM_MROUTE_IS_ENABLED) {
199d90a1 138 vty_out(vty, "ip multicast-routing%s", VTY_NEWLINE);
12e41d03
DL
139 ++writes;
140 }
75a26779
DS
141
142 writes += pim_rp_config_write (vty);
12e41d03 143
4304f95c
DS
144 if (qpim_keep_alive_time != PIM_KEEPALIVE_PERIOD)
145 {
146 vty_out (vty, "ip pim keep-alive-timer %d%s",
147 qpim_keep_alive_time, VTY_NEWLINE);
148 ++writes;
149 }
01408ede
DS
150 if (qpim_rp_keep_alive_time != PIM_RP_KEEPALIVE_PERIOD)
151 {
152 vty_out (vty, "ip pim rp keep-alive-timer %d%s",
153 qpim_keep_alive_time, VTY_NEWLINE);
154 ++writes;
155 }
156
12e41d03
DL
157 if (qpim_ssmpingd_list) {
158 struct listnode *node;
159 struct ssmpingd_sock *ss;
160 vty_out(vty, "!%s", VTY_NEWLINE);
161 ++writes;
162 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list, node, ss)) {
163 char source_str[100];
164 pim_inet4_dump("<src?>", ss->source_addr, source_str, sizeof(source_str));
165 vty_out(vty, "ip ssmpingd %s%s", source_str, VTY_NEWLINE);
166 ++writes;
167 }
168 }
169
170 return writes;
171}
172
173int pim_interface_config_write(struct vty *vty)
174{
175 int writes = 0;
176 struct listnode *node;
177 struct interface *ifp;
178
469351b3 179 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) {
12e41d03
DL
180
181 /* IF name */
182 vty_out(vty, "interface %s%s", ifp->name, VTY_NEWLINE);
183 ++writes;
184
185 if (ifp->info) {
186 struct pim_interface *pim_ifp = ifp->info;
187
188 /* IF ip pim ssm */
189 if (PIM_IF_TEST_PIM(pim_ifp->options)) {
981d6c7a
DS
190 if (pim_ifp->itype == PIM_INTERFACE_SSM)
191 vty_out(vty, " ip pim ssm%s", VTY_NEWLINE);
192 else
193 vty_out(vty, " ip pim sm%s", VTY_NEWLINE);
12e41d03
DL
194 ++writes;
195 }
196
dedccda6
DS
197 /* IF ip pim drpriority */
198 if (pim_ifp->pim_dr_priority != PIM_DEFAULT_DR_PRIORITY) {
94d95cde 199 vty_out(vty, " ip pim drpriority %u%s", pim_ifp->pim_dr_priority,
dedccda6
DS
200 VTY_NEWLINE);
201 ++writes;
202 }
203
7960fa8f
DS
204 /* IF ip pim hello */
205 if (pim_ifp->pim_hello_period != PIM_DEFAULT_HELLO_PERIOD) {
206 vty_out(vty, " ip pim hello %d", pim_ifp->pim_hello_period);
207 if (pim_ifp->pim_default_holdtime != -1)
208 vty_out(vty, " %d", pim_ifp->pim_default_holdtime);
209 vty_out(vty, "%s", VTY_NEWLINE);
210 }
211
12e41d03
DL
212 /* IF ip igmp */
213 if (PIM_IF_TEST_IGMP(pim_ifp->options)) {
214 vty_out(vty, " ip igmp%s", VTY_NEWLINE);
215 ++writes;
216 }
217
b05b72e8
DW
218 /* ip igmp version */
219 if (pim_ifp->igmp_version != IGMP_DEFAULT_VERSION)
220 {
221 vty_out(vty, " ip igmp version %d%s",
222 pim_ifp->igmp_version,
223 VTY_NEWLINE);
224 ++writes;
225 }
226
12e41d03 227 /* IF ip igmp query-interval */
6b775f61
DS
228 if (pim_ifp->igmp_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL)
229 {
199d90a1 230 vty_out(vty, " ip igmp query-interval %d%s",
6b775f61
DS
231 pim_ifp->igmp_default_query_interval,
232 VTY_NEWLINE);
233 ++writes;
234 }
12e41d03
DL
235
236 /* IF ip igmp query-max-response-time */
6b775f61
DS
237 if (pim_ifp->igmp_query_max_response_time_dsec != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC)
238 {
199d90a1 239 vty_out(vty, " ip igmp query-max-response-time-dsec %d%s",
6b775f61
DS
240 pim_ifp->igmp_query_max_response_time_dsec,
241 VTY_NEWLINE);
242 ++writes;
243 }
12e41d03
DL
244
245 /* IF ip igmp join */
246 if (pim_ifp->igmp_join_list) {
247 struct listnode *node;
248 struct igmp_join *ij;
249 for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_join_list, node, ij)) {
250 char group_str[100];
251 char source_str[100];
252 pim_inet4_dump("<grp?>", ij->group_addr, group_str, sizeof(group_str));
253 pim_inet4_dump("<src?>", ij->source_addr, source_str, sizeof(source_str));
254 vty_out(vty, " ip igmp join %s %s%s",
255 group_str, source_str,
256 VTY_NEWLINE);
257 ++writes;
258 }
259 }
f91f89bc
DS
260
261 writes += pim_static_write_mroute (vty, ifp);
12e41d03
DL
262 }
263 vty_out(vty, "!%s", VTY_NEWLINE);
264 ++writes;
265 }
266
267 return writes;
268}