Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 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" |
| 27 | |
| 28 | #include "pimd.h" |
| 29 | #include "pim_vty.h" |
| 30 | #include "pim_iface.h" |
| 31 | #include "pim_cmd.h" |
| 32 | #include "pim_str.h" |
Everton Marques | 824adbe | 2009-10-08 09:16:27 -0300 | [diff] [blame] | 33 | #include "pim_ssmpingd.h" |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 34 | |
| 35 | int pim_debug_config_write(struct vty *vty) |
| 36 | { |
| 37 | int writes = 0; |
| 38 | |
| 39 | if (PIM_DEBUG_IGMP_EVENTS) { |
| 40 | vty_out(vty, "debug igmp events%s", VTY_NEWLINE); |
| 41 | ++writes; |
| 42 | } |
| 43 | if (PIM_DEBUG_IGMP_PACKETS) { |
| 44 | vty_out(vty, "debug igmp packets%s", VTY_NEWLINE); |
| 45 | ++writes; |
| 46 | } |
| 47 | if (PIM_DEBUG_IGMP_TRACE) { |
| 48 | vty_out(vty, "debug igmp trace%s", VTY_NEWLINE); |
| 49 | ++writes; |
| 50 | } |
| 51 | |
Everton Marques | 67faabc | 2010-02-23 12:11:11 -0300 | [diff] [blame^] | 52 | if (PIM_DEBUG_MROUTE) { |
| 53 | vty_out(vty, "debug mroute%s", VTY_NEWLINE); |
| 54 | ++writes; |
| 55 | } |
| 56 | |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 57 | if (PIM_DEBUG_PIM_EVENTS) { |
| 58 | vty_out(vty, "debug pim events%s", VTY_NEWLINE); |
| 59 | ++writes; |
| 60 | } |
| 61 | if (PIM_DEBUG_PIM_PACKETS) { |
| 62 | vty_out(vty, "debug pim packets%s", VTY_NEWLINE); |
| 63 | ++writes; |
| 64 | } |
Everton Marques | 6273804 | 2009-11-18 10:44:13 -0200 | [diff] [blame] | 65 | if (PIM_DEBUG_PIM_PACKETDUMP_SEND) { |
| 66 | vty_out(vty, "debug pim packet-dump send%s", VTY_NEWLINE); |
| 67 | ++writes; |
| 68 | } |
| 69 | if (PIM_DEBUG_PIM_PACKETDUMP_RECV) { |
| 70 | vty_out(vty, "debug pim packet-dump receive%s", VTY_NEWLINE); |
| 71 | ++writes; |
| 72 | } |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 73 | if (PIM_DEBUG_PIM_TRACE) { |
| 74 | vty_out(vty, "debug pim trace%s", VTY_NEWLINE); |
| 75 | ++writes; |
| 76 | } |
| 77 | |
| 78 | if (PIM_DEBUG_ZEBRA) { |
| 79 | vty_out(vty, "debug pim zebra%s", VTY_NEWLINE); |
| 80 | ++writes; |
| 81 | } |
| 82 | |
Everton Marques | 824adbe | 2009-10-08 09:16:27 -0300 | [diff] [blame] | 83 | if (PIM_DEBUG_SSMPINGD) { |
| 84 | vty_out(vty, "debug ssmpingd%s", VTY_NEWLINE); |
| 85 | ++writes; |
| 86 | } |
| 87 | |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 88 | return writes; |
| 89 | } |
| 90 | |
| 91 | int pim_global_config_write(struct vty *vty) |
| 92 | { |
| 93 | int writes = 0; |
| 94 | |
| 95 | if (PIM_MROUTE_IS_ENABLED) { |
| 96 | vty_out(vty, "%s%s", PIM_CMD_IP_MULTICAST_ROUTING, VTY_NEWLINE); |
| 97 | ++writes; |
| 98 | } |
| 99 | |
Everton Marques | 824adbe | 2009-10-08 09:16:27 -0300 | [diff] [blame] | 100 | if (qpim_ssmpingd_list) { |
| 101 | struct listnode *node; |
| 102 | struct ssmpingd_sock *ss; |
| 103 | vty_out(vty, "!%s", VTY_NEWLINE); |
| 104 | ++writes; |
| 105 | for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list, node, ss)) { |
| 106 | char source_str[100]; |
| 107 | pim_inet4_dump("<src?>", ss->source_addr, source_str, sizeof(source_str)); |
| 108 | vty_out(vty, "ip ssmpingd %s%s", source_str, VTY_NEWLINE); |
| 109 | ++writes; |
| 110 | } |
| 111 | } |
| 112 | |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 113 | return writes; |
| 114 | } |
| 115 | |
| 116 | int pim_interface_config_write(struct vty *vty) |
| 117 | { |
| 118 | int writes = 0; |
| 119 | struct listnode *node; |
| 120 | struct interface *ifp; |
| 121 | |
| 122 | for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) { |
| 123 | |
| 124 | /* IF name */ |
| 125 | vty_out(vty, "interface %s%s", ifp->name, VTY_NEWLINE); |
Everton Marques | 824adbe | 2009-10-08 09:16:27 -0300 | [diff] [blame] | 126 | ++writes; |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 127 | |
| 128 | if (ifp->info) { |
| 129 | struct pim_interface *pim_ifp = ifp->info; |
| 130 | |
| 131 | /* IF ip pim ssm */ |
| 132 | if (PIM_IF_TEST_PIM(pim_ifp->options)) { |
| 133 | vty_out(vty, " ip pim ssm%s", VTY_NEWLINE); |
Everton Marques | 824adbe | 2009-10-08 09:16:27 -0300 | [diff] [blame] | 134 | ++writes; |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | /* IF ip igmp */ |
| 138 | if (PIM_IF_TEST_IGMP(pim_ifp->options)) { |
| 139 | vty_out(vty, " ip igmp%s", VTY_NEWLINE); |
Everton Marques | 824adbe | 2009-10-08 09:16:27 -0300 | [diff] [blame] | 140 | ++writes; |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | /* IF ip igmp query-interval */ |
| 144 | vty_out(vty, " %s %d%s", |
| 145 | PIM_CMD_IP_IGMP_QUERY_INTERVAL, |
| 146 | pim_ifp->igmp_default_query_interval, |
| 147 | VTY_NEWLINE); |
Everton Marques | 824adbe | 2009-10-08 09:16:27 -0300 | [diff] [blame] | 148 | ++writes; |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 149 | |
| 150 | /* IF ip igmp query-max-response-time */ |
| 151 | vty_out(vty, " %s %d%s", |
| 152 | PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC, |
| 153 | pim_ifp->igmp_query_max_response_time_dsec, |
| 154 | VTY_NEWLINE); |
Everton Marques | 824adbe | 2009-10-08 09:16:27 -0300 | [diff] [blame] | 155 | ++writes; |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 156 | |
| 157 | /* IF ip igmp join */ |
| 158 | if (pim_ifp->igmp_join_list) { |
| 159 | struct listnode *node; |
| 160 | struct igmp_join *ij; |
| 161 | for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_join_list, node, ij)) { |
| 162 | char group_str[100]; |
| 163 | char source_str[100]; |
| 164 | pim_inet4_dump("<grp?>", ij->group_addr, group_str, sizeof(group_str)); |
| 165 | pim_inet4_dump("<src?>", ij->source_addr, source_str, sizeof(source_str)); |
| 166 | vty_out(vty, " ip igmp join %s %s%s", |
| 167 | group_str, source_str, |
| 168 | VTY_NEWLINE); |
Everton Marques | 824adbe | 2009-10-08 09:16:27 -0300 | [diff] [blame] | 169 | ++writes; |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 170 | } |
| 171 | } |
| 172 | } |
| 173 | vty_out(vty, "!%s", VTY_NEWLINE); |
Everton Marques | 824adbe | 2009-10-08 09:16:27 -0300 | [diff] [blame] | 174 | ++writes; |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | return writes; |
| 178 | } |