]>
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 | |
19 | ||
20 | $QuaggaId: $Format:%an, %ai, %h$ $ | |
21 | */ | |
22 | ||
23 | #include <zebra.h> | |
24 | ||
25 | #include "if.h" | |
26 | #include "linklist.h" | |
469351b3 | 27 | #include "vrf.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" |
12e41d03 DL |
36 | |
37 | int pim_debug_config_write(struct vty *vty) | |
38 | { | |
39 | int writes = 0; | |
40 | ||
41 | if (PIM_DEBUG_IGMP_EVENTS) { | |
42 | vty_out(vty, "debug igmp events%s", VTY_NEWLINE); | |
43 | ++writes; | |
44 | } | |
45 | if (PIM_DEBUG_IGMP_PACKETS) { | |
46 | vty_out(vty, "debug igmp packets%s", VTY_NEWLINE); | |
47 | ++writes; | |
48 | } | |
49 | if (PIM_DEBUG_IGMP_TRACE) { | |
50 | vty_out(vty, "debug igmp trace%s", VTY_NEWLINE); | |
51 | ++writes; | |
52 | } | |
53 | ||
54 | if (PIM_DEBUG_MROUTE) { | |
55 | vty_out(vty, "debug mroute%s", VTY_NEWLINE); | |
56 | ++writes; | |
57 | } | |
58 | ||
59 | if (PIM_DEBUG_PIM_EVENTS) { | |
60 | vty_out(vty, "debug pim events%s", VTY_NEWLINE); | |
61 | ++writes; | |
62 | } | |
63 | if (PIM_DEBUG_PIM_PACKETS) { | |
64 | vty_out(vty, "debug pim packets%s", VTY_NEWLINE); | |
65 | ++writes; | |
66 | } | |
67 | if (PIM_DEBUG_PIM_PACKETDUMP_SEND) { | |
68 | vty_out(vty, "debug pim packet-dump send%s", VTY_NEWLINE); | |
69 | ++writes; | |
70 | } | |
71 | if (PIM_DEBUG_PIM_PACKETDUMP_RECV) { | |
72 | vty_out(vty, "debug pim packet-dump receive%s", VTY_NEWLINE); | |
73 | ++writes; | |
74 | } | |
75 | if (PIM_DEBUG_PIM_TRACE) { | |
76 | vty_out(vty, "debug pim trace%s", VTY_NEWLINE); | |
77 | ++writes; | |
78 | } | |
79 | ||
80 | if (PIM_DEBUG_ZEBRA) { | |
81 | vty_out(vty, "debug pim zebra%s", VTY_NEWLINE); | |
82 | ++writes; | |
83 | } | |
84 | ||
85 | if (PIM_DEBUG_SSMPINGD) { | |
86 | vty_out(vty, "debug ssmpingd%s", VTY_NEWLINE); | |
87 | ++writes; | |
88 | } | |
89 | ||
90 | return writes; | |
91 | } | |
92 | ||
93 | int pim_global_config_write(struct vty *vty) | |
94 | { | |
95 | int writes = 0; | |
981d6c7a | 96 | char buffer[32]; |
12e41d03 DL |
97 | |
98 | if (PIM_MROUTE_IS_ENABLED) { | |
99 | vty_out(vty, "%s%s", PIM_CMD_IP_MULTICAST_ROUTING, VTY_NEWLINE); | |
100 | ++writes; | |
101 | } | |
c8ae3ce8 DS |
102 | if (qpim_rp.rpf_addr.s_addr != INADDR_NONE) { |
103 | vty_out(vty, "ip pim rp %s%s", inet_ntop(AF_INET, &qpim_rp.rpf_addr, buffer, 32), VTY_NEWLINE); | |
981d6c7a DS |
104 | ++writes; |
105 | } | |
12e41d03 DL |
106 | |
107 | if (qpim_ssmpingd_list) { | |
108 | struct listnode *node; | |
109 | struct ssmpingd_sock *ss; | |
110 | vty_out(vty, "!%s", VTY_NEWLINE); | |
111 | ++writes; | |
112 | for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list, node, ss)) { | |
113 | char source_str[100]; | |
114 | pim_inet4_dump("<src?>", ss->source_addr, source_str, sizeof(source_str)); | |
115 | vty_out(vty, "ip ssmpingd %s%s", source_str, VTY_NEWLINE); | |
116 | ++writes; | |
117 | } | |
118 | } | |
119 | ||
120 | return writes; | |
121 | } | |
122 | ||
123 | int pim_interface_config_write(struct vty *vty) | |
124 | { | |
125 | int writes = 0; | |
126 | struct listnode *node; | |
127 | struct interface *ifp; | |
128 | ||
469351b3 | 129 | for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { |
12e41d03 DL |
130 | |
131 | /* IF name */ | |
132 | vty_out(vty, "interface %s%s", ifp->name, VTY_NEWLINE); | |
133 | ++writes; | |
134 | ||
135 | if (ifp->info) { | |
136 | struct pim_interface *pim_ifp = ifp->info; | |
137 | ||
138 | /* IF ip pim ssm */ | |
139 | if (PIM_IF_TEST_PIM(pim_ifp->options)) { | |
981d6c7a DS |
140 | if (pim_ifp->itype == PIM_INTERFACE_SSM) |
141 | vty_out(vty, " ip pim ssm%s", VTY_NEWLINE); | |
142 | else | |
143 | vty_out(vty, " ip pim sm%s", VTY_NEWLINE); | |
12e41d03 DL |
144 | ++writes; |
145 | } | |
146 | ||
dedccda6 DS |
147 | /* IF ip pim drpriority */ |
148 | if (pim_ifp->pim_dr_priority != PIM_DEFAULT_DR_PRIORITY) { | |
149 | vty_out(vty, " ip pim drpriority %d%s", pim_ifp->pim_dr_priority, | |
150 | VTY_NEWLINE); | |
151 | ++writes; | |
152 | } | |
153 | ||
7960fa8f DS |
154 | /* IF ip pim hello */ |
155 | if (pim_ifp->pim_hello_period != PIM_DEFAULT_HELLO_PERIOD) { | |
156 | vty_out(vty, " ip pim hello %d", pim_ifp->pim_hello_period); | |
157 | if (pim_ifp->pim_default_holdtime != -1) | |
158 | vty_out(vty, " %d", pim_ifp->pim_default_holdtime); | |
159 | vty_out(vty, "%s", VTY_NEWLINE); | |
160 | } | |
161 | ||
12e41d03 DL |
162 | /* IF ip igmp */ |
163 | if (PIM_IF_TEST_IGMP(pim_ifp->options)) { | |
164 | vty_out(vty, " ip igmp%s", VTY_NEWLINE); | |
165 | ++writes; | |
166 | } | |
167 | ||
168 | /* IF ip igmp query-interval */ | |
6b775f61 DS |
169 | if (pim_ifp->igmp_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL) |
170 | { | |
171 | vty_out(vty, " %s %d%s", | |
172 | PIM_CMD_IP_IGMP_QUERY_INTERVAL, | |
173 | pim_ifp->igmp_default_query_interval, | |
174 | VTY_NEWLINE); | |
175 | ++writes; | |
176 | } | |
12e41d03 DL |
177 | |
178 | /* IF ip igmp query-max-response-time */ | |
6b775f61 DS |
179 | if (pim_ifp->igmp_query_max_response_time_dsec != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC) |
180 | { | |
181 | vty_out(vty, " %s %d%s", | |
182 | PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC, | |
183 | pim_ifp->igmp_query_max_response_time_dsec, | |
184 | VTY_NEWLINE); | |
185 | ++writes; | |
186 | } | |
12e41d03 DL |
187 | |
188 | /* IF ip igmp join */ | |
189 | if (pim_ifp->igmp_join_list) { | |
190 | struct listnode *node; | |
191 | struct igmp_join *ij; | |
192 | for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_join_list, node, ij)) { | |
193 | char group_str[100]; | |
194 | char source_str[100]; | |
195 | pim_inet4_dump("<grp?>", ij->group_addr, group_str, sizeof(group_str)); | |
196 | pim_inet4_dump("<src?>", ij->source_addr, source_str, sizeof(source_str)); | |
197 | vty_out(vty, " ip igmp join %s %s%s", | |
198 | group_str, source_str, | |
199 | VTY_NEWLINE); | |
200 | ++writes; | |
201 | } | |
202 | } | |
203 | } | |
204 | vty_out(vty, "!%s", VTY_NEWLINE); | |
205 | ++writes; | |
206 | } | |
207 | ||
208 | return writes; | |
209 | } |