paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* Interface related function for RIP. |
| 2 | * Copyright (C) 1997, 98 Kunihiro Ishiguro <kunihiro@zebra.org> |
| 3 | * |
| 4 | * This file is part of GNU Zebra. |
| 5 | * |
| 6 | * GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the |
| 8 | * Free Software Foundation; either version 2, or (at your option) any |
| 9 | * later version. |
| 10 | * |
| 11 | * GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with GNU Zebra; see the file COPYING. If not, write to the Free |
| 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 19 | * 02111-1307, USA. |
| 20 | */ |
| 21 | |
| 22 | #include <zebra.h> |
| 23 | |
| 24 | #include "command.h" |
| 25 | #include "if.h" |
| 26 | #include "sockunion.h" |
| 27 | #include "prefix.h" |
| 28 | #include "memory.h" |
| 29 | #include "network.h" |
| 30 | #include "table.h" |
| 31 | #include "log.h" |
| 32 | #include "stream.h" |
| 33 | #include "thread.h" |
| 34 | #include "zclient.h" |
| 35 | #include "filter.h" |
| 36 | #include "sockopt.h" |
paul | edd7c24 | 2003-06-04 13:59:38 +0000 | [diff] [blame] | 37 | #include "privs.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 38 | |
| 39 | #include "zebra/connected.h" |
| 40 | |
| 41 | #include "ripd/ripd.h" |
| 42 | #include "ripd/rip_debug.h" |
| 43 | |
| 44 | void rip_enable_apply (struct interface *); |
| 45 | void rip_passive_interface_apply (struct interface *); |
| 46 | int rip_if_down(struct interface *ifp); |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 47 | int rip_enable_if_lookup (const char *ifname); |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 48 | int rip_enable_network_lookup2 (struct connected *connected); |
| 49 | void rip_enable_apply_all (); |
| 50 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 51 | |
| 52 | struct message ri_version_msg[] = |
| 53 | { |
| 54 | {RI_RIP_VERSION_1, "1"}, |
| 55 | {RI_RIP_VERSION_2, "2"}, |
| 56 | {RI_RIP_VERSION_1_AND_2, "1 2"}, |
| 57 | {0, NULL} |
| 58 | }; |
| 59 | |
paul | edd7c24 | 2003-06-04 13:59:38 +0000 | [diff] [blame] | 60 | extern struct zebra_privs_t ripd_privs; |
| 61 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 62 | /* RIP enabled network vector. */ |
| 63 | vector rip_enable_interface; |
| 64 | |
| 65 | /* RIP enabled interface table. */ |
| 66 | struct route_table *rip_enable_network; |
| 67 | |
| 68 | /* Vector to store passive-interface name. */ |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 69 | static int passive_default; /* are we in passive-interface default mode? */ |
| 70 | vector Vrip_passive_nondefault; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 71 | |
| 72 | /* Join to the RIP version 2 multicast group. */ |
| 73 | int |
| 74 | ipv4_multicast_join (int sock, |
| 75 | struct in_addr group, |
| 76 | struct in_addr ifa, |
| 77 | unsigned int ifindex) |
| 78 | { |
| 79 | int ret; |
| 80 | |
| 81 | ret = setsockopt_multicast_ipv4 (sock, |
| 82 | IP_ADD_MEMBERSHIP, |
| 83 | ifa, |
| 84 | group.s_addr, |
| 85 | ifindex); |
| 86 | |
| 87 | if (ret < 0) |
| 88 | zlog (NULL, LOG_INFO, "can't setsockopt IP_ADD_MEMBERSHIP %s", |
ajs | 6099b3b | 2004-11-20 02:06:59 +0000 | [diff] [blame] | 89 | safe_strerror (errno)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 90 | |
| 91 | return ret; |
| 92 | } |
| 93 | |
| 94 | /* Leave from the RIP version 2 multicast group. */ |
| 95 | int |
| 96 | ipv4_multicast_leave (int sock, |
| 97 | struct in_addr group, |
| 98 | struct in_addr ifa, |
| 99 | unsigned int ifindex) |
| 100 | { |
| 101 | int ret; |
| 102 | |
| 103 | ret = setsockopt_multicast_ipv4 (sock, |
| 104 | IP_DROP_MEMBERSHIP, |
| 105 | ifa, |
| 106 | group.s_addr, |
| 107 | ifindex); |
| 108 | |
| 109 | if (ret < 0) |
| 110 | zlog (NULL, LOG_INFO, "can't setsockopt IP_DROP_MEMBERSHIP"); |
| 111 | |
| 112 | return ret; |
| 113 | } |
| 114 | |
| 115 | /* Allocate new RIP's interface configuration. */ |
| 116 | struct rip_interface * |
| 117 | rip_interface_new () |
| 118 | { |
| 119 | struct rip_interface *ri; |
| 120 | |
| 121 | ri = XMALLOC (MTYPE_RIP_INTERFACE, sizeof (struct rip_interface)); |
| 122 | memset (ri, 0, sizeof (struct rip_interface)); |
| 123 | |
| 124 | /* Default authentication type is simple password for Cisco |
| 125 | compatibility. */ |
paul | 7755a8c | 2005-06-02 08:20:53 +0000 | [diff] [blame] | 126 | ri->auth_type = RIP_NO_AUTH; |
paul | ca5e516 | 2004-06-06 22:06:33 +0000 | [diff] [blame] | 127 | ri->md5_auth_len = RIP_AUTH_MD5_COMPAT_SIZE; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 128 | |
| 129 | /* Set default split-horizon behavior. If the interface is Frame |
| 130 | Relay or SMDS is enabled, the default value for split-horizon is |
| 131 | off. But currently Zebra does detect Frame Relay or SMDS |
| 132 | interface. So all interface is set to split horizon. */ |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 133 | ri->split_horizon_default = RIP_SPLIT_HORIZON; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 134 | ri->split_horizon = ri->split_horizon_default; |
| 135 | |
| 136 | return ri; |
| 137 | } |
| 138 | |
| 139 | void |
paul | 1a51786 | 2004-08-19 04:03:08 +0000 | [diff] [blame] | 140 | rip_interface_multicast_set (int sock, struct connected *connected) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 141 | { |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 142 | struct in_addr addr; |
paul | cc1131a | 2003-10-15 23:20:17 +0000 | [diff] [blame] | 143 | struct prefix_ipv4 *p; |
paul | c49ad8f | 2004-10-22 10:27:28 +0000 | [diff] [blame] | 144 | |
| 145 | assert (connected != NULL); |
| 146 | |
| 147 | if (if_is_pointopoint(connected->ifp) && CONNECTED_DEST_HOST(connected)) |
| 148 | p = (struct prefix_ipv4 *) connected->destination; |
| 149 | else |
| 150 | p = (struct prefix_ipv4 *) connected->address; |
| 151 | |
| 152 | addr = p->prefix; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 153 | |
paul | 1a51786 | 2004-08-19 04:03:08 +0000 | [diff] [blame] | 154 | if (setsockopt_multicast_ipv4 (sock, IP_MULTICAST_IF, addr, 0, |
| 155 | connected->ifp->ifindex) < 0) |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 156 | { |
| 157 | zlog_warn ("Can't setsockopt IP_MULTICAST_IF on fd %d to " |
| 158 | "source address %s for interface %s", |
| 159 | sock, inet_ntoa(addr), |
paul | c49ad8f | 2004-10-22 10:27:28 +0000 | [diff] [blame] | 160 | connected->ifp->name); |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 161 | } |
paul | 2c61ae3 | 2005-08-16 15:22:14 +0000 | [diff] [blame] | 162 | |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 163 | return; |
| 164 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 165 | |
| 166 | /* Send RIP request packet to specified interface. */ |
| 167 | void |
| 168 | rip_request_interface_send (struct interface *ifp, u_char version) |
| 169 | { |
| 170 | struct sockaddr_in to; |
| 171 | |
| 172 | /* RIPv2 support multicast. */ |
| 173 | if (version == RIPv2 && if_is_multicast (ifp)) |
| 174 | { |
| 175 | |
| 176 | if (IS_RIP_DEBUG_EVENT) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 177 | zlog_debug ("multicast request on %s", ifp->name); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 178 | |
paul | 931cd54 | 2004-01-23 15:31:42 +0000 | [diff] [blame] | 179 | rip_request_send (NULL, ifp, version, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 180 | return; |
| 181 | } |
| 182 | |
| 183 | /* RIPv1 and non multicast interface. */ |
| 184 | if (if_is_pointopoint (ifp) || if_is_broadcast (ifp)) |
| 185 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 186 | struct listnode *cnode, *cnnode; |
| 187 | struct connected *connected; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 188 | |
| 189 | if (IS_RIP_DEBUG_EVENT) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 190 | zlog_debug ("broadcast request to %s", ifp->name); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 191 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 192 | for (ALL_LIST_ELEMENTS (ifp->connected, cnode, cnnode, connected)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 193 | { |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 194 | if (connected->address->family == AF_INET) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 195 | { |
| 196 | memset (&to, 0, sizeof (struct sockaddr_in)); |
| 197 | to.sin_port = htons (RIP_PORT_DEFAULT); |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 198 | if (connected->destination) |
| 199 | /* use specified broadcast or point-to-point destination addr */ |
| 200 | to.sin_addr = connected->destination->u.prefix4; |
| 201 | else |
| 202 | /* calculate the appropriate broadcast address */ |
| 203 | to.sin_addr.s_addr = |
| 204 | ipv4_broadcast_addr(connected->address->u.prefix4.s_addr, |
| 205 | connected->address->prefixlen); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 206 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 207 | if (IS_RIP_DEBUG_EVENT) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 208 | zlog_debug ("SEND request to %s", inet_ntoa (to.sin_addr)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 209 | |
paul | 931cd54 | 2004-01-23 15:31:42 +0000 | [diff] [blame] | 210 | rip_request_send (&to, ifp, version, connected); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 211 | } |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | /* This will be executed when interface goes up. */ |
| 217 | void |
| 218 | rip_request_interface (struct interface *ifp) |
| 219 | { |
| 220 | struct rip_interface *ri; |
| 221 | |
| 222 | /* In default ripd doesn't send RIP_REQUEST to the loopback interface. */ |
| 223 | if (if_is_loopback (ifp)) |
| 224 | return; |
| 225 | |
| 226 | /* If interface is down, don't send RIP packet. */ |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 227 | if (! if_is_operative (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 228 | return; |
| 229 | |
| 230 | /* Fetch RIP interface information. */ |
| 231 | ri = ifp->info; |
| 232 | |
| 233 | |
| 234 | /* If there is no version configuration in the interface, |
| 235 | use rip's version setting. */ |
paul | f38a471 | 2003-06-07 01:10:00 +0000 | [diff] [blame] | 236 | { |
| 237 | int vsend = ((ri->ri_send == RI_RIP_UNSPEC) ? |
| 238 | rip->version_send : ri->ri_send); |
| 239 | if (vsend & RIPv1) |
| 240 | rip_request_interface_send (ifp, RIPv1); |
| 241 | if (vsend & RIPv2) |
| 242 | rip_request_interface_send (ifp, RIPv2); |
| 243 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | /* Send RIP request to the neighbor. */ |
| 247 | void |
| 248 | rip_request_neighbor (struct in_addr addr) |
| 249 | { |
| 250 | struct sockaddr_in to; |
| 251 | |
| 252 | memset (&to, 0, sizeof (struct sockaddr_in)); |
| 253 | to.sin_port = htons (RIP_PORT_DEFAULT); |
| 254 | to.sin_addr = addr; |
| 255 | |
paul | 931cd54 | 2004-01-23 15:31:42 +0000 | [diff] [blame] | 256 | rip_request_send (&to, NULL, rip->version_send, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | /* Request routes at all interfaces. */ |
| 260 | void |
| 261 | rip_request_neighbor_all () |
| 262 | { |
| 263 | struct route_node *rp; |
| 264 | |
| 265 | if (! rip) |
| 266 | return; |
| 267 | |
| 268 | if (IS_RIP_DEBUG_EVENT) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 269 | zlog_debug ("request to the all neighbor"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 270 | |
| 271 | /* Send request to all neighbor. */ |
| 272 | for (rp = route_top (rip->neighbor); rp; rp = route_next (rp)) |
| 273 | if (rp->info) |
| 274 | rip_request_neighbor (rp->p.u.prefix4); |
| 275 | } |
| 276 | |
| 277 | /* Multicast packet receive socket. */ |
| 278 | int |
| 279 | rip_multicast_join (struct interface *ifp, int sock) |
| 280 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 281 | struct listnode *cnode; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 282 | struct connected *ifc; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 283 | |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 284 | if (if_is_operative (ifp) && if_is_multicast (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 285 | { |
| 286 | if (IS_RIP_DEBUG_EVENT) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 287 | zlog_debug ("multicast join at %s", ifp->name); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 288 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 289 | for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, ifc)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 290 | { |
| 291 | struct prefix_ipv4 *p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 292 | struct in_addr group; |
| 293 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 294 | p = (struct prefix_ipv4 *) ifc->address; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 295 | |
| 296 | if (p->family != AF_INET) |
| 297 | continue; |
| 298 | |
| 299 | group.s_addr = htonl (INADDR_RIP_GROUP); |
| 300 | if (ipv4_multicast_join (sock, group, p->prefix, ifp->ifindex) < 0) |
| 301 | return -1; |
| 302 | else |
| 303 | return 0; |
| 304 | } |
| 305 | } |
| 306 | return 0; |
| 307 | } |
| 308 | |
| 309 | /* Leave from multicast group. */ |
| 310 | void |
| 311 | rip_multicast_leave (struct interface *ifp, int sock) |
| 312 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 313 | struct listnode *cnode; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 314 | struct connected *connected; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 315 | |
| 316 | if (if_is_up (ifp) && if_is_multicast (ifp)) |
| 317 | { |
| 318 | if (IS_RIP_DEBUG_EVENT) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 319 | zlog_debug ("multicast leave from %s", ifp->name); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 320 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 321 | for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, connected)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 322 | { |
| 323 | struct prefix_ipv4 *p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 324 | struct in_addr group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 325 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 326 | p = (struct prefix_ipv4 *) connected->address; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 327 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 328 | if (p->family != AF_INET) |
| 329 | continue; |
| 330 | |
| 331 | group.s_addr = htonl (INADDR_RIP_GROUP); |
| 332 | if (ipv4_multicast_leave (sock, group, p->prefix, ifp->ifindex) == 0) |
| 333 | return; |
| 334 | } |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | /* Is there and address on interface that I could use ? */ |
| 339 | int |
| 340 | rip_if_ipv4_address_check (struct interface *ifp) |
| 341 | { |
| 342 | struct listnode *nn; |
| 343 | struct connected *connected; |
| 344 | int count = 0; |
| 345 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 346 | for (ALL_LIST_ELEMENTS_RO (ifp->connected, nn, connected)) |
| 347 | { |
| 348 | struct prefix *p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 349 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 350 | p = connected->address; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 351 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 352 | if (p->family == AF_INET) |
| 353 | count++; |
| 354 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 355 | |
| 356 | return count; |
| 357 | } |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 358 | |
| 359 | |
| 360 | |
| 361 | |
| 362 | /* Does this address belongs to me ? */ |
| 363 | int |
| 364 | if_check_address (struct in_addr addr) |
| 365 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 366 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 367 | struct interface *ifp; |
| 368 | |
| 369 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 370 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 371 | struct listnode *cnode; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 372 | struct connected *connected; |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 373 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 374 | for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, connected)) |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 375 | { |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 376 | struct prefix_ipv4 *p; |
| 377 | |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 378 | p = (struct prefix_ipv4 *) connected->address; |
| 379 | |
| 380 | if (p->family != AF_INET) |
| 381 | continue; |
| 382 | |
| 383 | if (IPV4_ADDR_CMP (&p->prefix, &addr) == 0) |
| 384 | return 1; |
| 385 | } |
| 386 | } |
| 387 | return 0; |
| 388 | } |
| 389 | |
| 390 | /* is this address from a valid neighbor? (RFC2453 - Sec. 3.9.2) */ |
| 391 | int |
| 392 | if_valid_neighbor (struct in_addr addr) |
| 393 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 394 | struct listnode *node; |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 395 | struct connected *connected = NULL; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 396 | struct interface *ifp; |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 397 | struct prefix_ipv4 *p; |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 398 | struct prefix_ipv4 pa; |
| 399 | |
| 400 | pa.family = AF_INET; |
| 401 | pa.prefix = addr; |
| 402 | pa.prefixlen = IPV4_MAX_PREFIXLEN; |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 403 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 404 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 405 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 406 | struct listnode *cnode; |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 407 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 408 | for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, connected)) |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 409 | { |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 410 | if (if_is_pointopoint (ifp)) |
| 411 | { |
| 412 | p = (struct prefix_ipv4 *) connected->address; |
| 413 | |
| 414 | if (p && p->family == AF_INET) |
| 415 | { |
| 416 | if (IPV4_ADDR_SAME (&p->prefix, &addr)) |
| 417 | return 1; |
| 418 | |
| 419 | p = (struct prefix_ipv4 *) connected->destination; |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 420 | if (p) |
| 421 | { |
| 422 | if (IPV4_ADDR_SAME (&p->prefix, &addr)) |
| 423 | return 1; |
| 424 | } |
| 425 | else |
| 426 | { |
| 427 | if (prefix_match(connected->address,(struct prefix *)&pa)) |
| 428 | return 1; |
| 429 | } |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 430 | } |
| 431 | } |
| 432 | else |
| 433 | { |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 434 | if ((connected->address->family == AF_INET) && |
| 435 | prefix_match(connected->address,(struct prefix *)&pa)) |
| 436 | return 1; |
paul | 31a476c | 2003-09-29 19:54:53 +0000 | [diff] [blame] | 437 | } |
| 438 | } |
| 439 | } |
| 440 | return 0; |
| 441 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 442 | |
| 443 | /* Inteface link down message processing. */ |
| 444 | int |
| 445 | rip_interface_down (int command, struct zclient *zclient, zebra_size_t length) |
| 446 | { |
| 447 | struct interface *ifp; |
| 448 | struct stream *s; |
| 449 | |
| 450 | s = zclient->ibuf; |
| 451 | |
| 452 | /* zebra_interface_state_read() updates interface structure in |
| 453 | iflist. */ |
| 454 | ifp = zebra_interface_state_read(s); |
| 455 | |
| 456 | if (ifp == NULL) |
| 457 | return 0; |
| 458 | |
| 459 | rip_if_down(ifp); |
| 460 | |
| 461 | if (IS_RIP_DEBUG_ZEBRA) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 462 | zlog_debug ("interface %s index %d flags %ld metric %d mtu %d is down", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 463 | ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); |
| 464 | |
| 465 | return 0; |
| 466 | } |
| 467 | |
| 468 | /* Inteface link up message processing */ |
| 469 | int |
| 470 | rip_interface_up (int command, struct zclient *zclient, zebra_size_t length) |
| 471 | { |
| 472 | struct interface *ifp; |
| 473 | |
| 474 | /* zebra_interface_state_read () updates interface structure in |
| 475 | iflist. */ |
| 476 | ifp = zebra_interface_state_read (zclient->ibuf); |
| 477 | |
| 478 | if (ifp == NULL) |
| 479 | return 0; |
| 480 | |
| 481 | if (IS_RIP_DEBUG_ZEBRA) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 482 | zlog_debug ("interface %s index %d flags %ld metric %d mtu %d is up", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 483 | ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); |
| 484 | |
| 485 | /* Check if this interface is RIP enabled or not.*/ |
| 486 | rip_enable_apply (ifp); |
| 487 | |
| 488 | /* Check for a passive interface */ |
| 489 | rip_passive_interface_apply (ifp); |
| 490 | |
| 491 | /* Apply distribute list to the all interface. */ |
| 492 | rip_distribute_update_interface (ifp); |
| 493 | |
| 494 | return 0; |
| 495 | } |
| 496 | |
| 497 | /* Inteface addition message from zebra. */ |
| 498 | int |
| 499 | rip_interface_add (int command, struct zclient *zclient, zebra_size_t length) |
| 500 | { |
| 501 | struct interface *ifp; |
| 502 | |
| 503 | ifp = zebra_interface_add_read (zclient->ibuf); |
| 504 | |
| 505 | if (IS_RIP_DEBUG_ZEBRA) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 506 | zlog_debug ("interface add %s index %d flags %ld metric %d mtu %d", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 507 | ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); |
| 508 | |
| 509 | /* Check if this interface is RIP enabled or not.*/ |
| 510 | rip_enable_apply (ifp); |
ajs | d4e4728 | 2005-05-11 15:56:21 +0000 | [diff] [blame] | 511 | |
| 512 | /* Check for a passive interface */ |
| 513 | rip_passive_interface_apply (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 514 | |
| 515 | /* Apply distribute list to the all interface. */ |
| 516 | rip_distribute_update_interface (ifp); |
| 517 | |
| 518 | /* rip_request_neighbor_all (); */ |
| 519 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 520 | /* Check interface routemap. */ |
| 521 | rip_if_rmap_update_interface (ifp); |
| 522 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 523 | return 0; |
| 524 | } |
| 525 | |
| 526 | int |
| 527 | rip_interface_delete (int command, struct zclient *zclient, |
| 528 | zebra_size_t length) |
| 529 | { |
| 530 | struct interface *ifp; |
| 531 | struct stream *s; |
| 532 | |
| 533 | |
| 534 | s = zclient->ibuf; |
| 535 | /* zebra_interface_state_read() updates interface structure in iflist */ |
| 536 | ifp = zebra_interface_state_read(s); |
| 537 | |
| 538 | if (ifp == NULL) |
| 539 | return 0; |
| 540 | |
| 541 | if (if_is_up (ifp)) { |
| 542 | rip_if_down(ifp); |
| 543 | } |
| 544 | |
| 545 | zlog_info("interface delete %s index %d flags %ld metric %d mtu %d", |
| 546 | ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); |
| 547 | |
| 548 | /* To support pseudo interface do not free interface structure. */ |
| 549 | /* if_delete(ifp); */ |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 550 | ifp->ifindex = IFINDEX_INTERNAL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 551 | |
| 552 | return 0; |
| 553 | } |
| 554 | |
| 555 | void |
| 556 | rip_interface_clean () |
| 557 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 558 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 559 | struct interface *ifp; |
| 560 | struct rip_interface *ri; |
| 561 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 562 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 563 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 564 | ri = ifp->info; |
| 565 | |
| 566 | ri->enable_network = 0; |
| 567 | ri->enable_interface = 0; |
| 568 | ri->running = 0; |
| 569 | |
| 570 | if (ri->t_wakeup) |
| 571 | { |
| 572 | thread_cancel (ri->t_wakeup); |
| 573 | ri->t_wakeup = NULL; |
| 574 | } |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | void |
| 579 | rip_interface_reset () |
| 580 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 581 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 582 | struct interface *ifp; |
| 583 | struct rip_interface *ri; |
| 584 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 585 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 586 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 587 | ri = ifp->info; |
| 588 | |
| 589 | ri->enable_network = 0; |
| 590 | ri->enable_interface = 0; |
| 591 | ri->running = 0; |
| 592 | |
| 593 | ri->ri_send = RI_RIP_UNSPEC; |
| 594 | ri->ri_receive = RI_RIP_UNSPEC; |
| 595 | |
paul | 7755a8c | 2005-06-02 08:20:53 +0000 | [diff] [blame] | 596 | ri->auth_type = RIP_NO_AUTH; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 597 | |
| 598 | if (ri->auth_str) |
| 599 | { |
| 600 | free (ri->auth_str); |
| 601 | ri->auth_str = NULL; |
| 602 | } |
| 603 | if (ri->key_chain) |
| 604 | { |
| 605 | free (ri->key_chain); |
| 606 | ri->key_chain = NULL; |
| 607 | } |
| 608 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 609 | ri->split_horizon = RIP_NO_SPLIT_HORIZON; |
| 610 | ri->split_horizon_default = RIP_NO_SPLIT_HORIZON; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 611 | |
| 612 | ri->list[RIP_FILTER_IN] = NULL; |
| 613 | ri->list[RIP_FILTER_OUT] = NULL; |
| 614 | |
| 615 | ri->prefix[RIP_FILTER_IN] = NULL; |
| 616 | ri->prefix[RIP_FILTER_OUT] = NULL; |
| 617 | |
| 618 | if (ri->t_wakeup) |
| 619 | { |
| 620 | thread_cancel (ri->t_wakeup); |
| 621 | ri->t_wakeup = NULL; |
| 622 | } |
| 623 | |
| 624 | ri->recv_badpackets = 0; |
| 625 | ri->recv_badroutes = 0; |
| 626 | ri->sent_updates = 0; |
| 627 | |
| 628 | ri->passive = 0; |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | int |
| 633 | rip_if_down(struct interface *ifp) |
| 634 | { |
| 635 | struct route_node *rp; |
| 636 | struct rip_info *rinfo; |
| 637 | struct rip_interface *ri = NULL; |
| 638 | if (rip) |
| 639 | { |
| 640 | for (rp = route_top (rip->table); rp; rp = route_next (rp)) |
| 641 | if ((rinfo = rp->info) != NULL) |
| 642 | { |
| 643 | /* Routes got through this interface. */ |
| 644 | if (rinfo->ifindex == ifp->ifindex && |
| 645 | rinfo->type == ZEBRA_ROUTE_RIP && |
| 646 | rinfo->sub_type == RIP_ROUTE_RTE) |
| 647 | { |
| 648 | rip_zebra_ipv4_delete ((struct prefix_ipv4 *) &rp->p, |
| 649 | &rinfo->nexthop, |
| 650 | rinfo->ifindex); |
| 651 | |
| 652 | rip_redistribute_delete (rinfo->type,rinfo->sub_type, |
| 653 | (struct prefix_ipv4 *)&rp->p, |
| 654 | rinfo->ifindex); |
| 655 | } |
| 656 | else |
| 657 | { |
| 658 | /* All redistributed routes but static and system */ |
| 659 | if ((rinfo->ifindex == ifp->ifindex) && |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 660 | /* (rinfo->type != ZEBRA_ROUTE_STATIC) && */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 661 | (rinfo->type != ZEBRA_ROUTE_SYSTEM)) |
| 662 | rip_redistribute_delete (rinfo->type,rinfo->sub_type, |
| 663 | (struct prefix_ipv4 *)&rp->p, |
| 664 | rinfo->ifindex); |
| 665 | } |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | ri = ifp->info; |
| 670 | |
| 671 | if (ri->running) |
| 672 | { |
| 673 | if (IS_RIP_DEBUG_EVENT) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 674 | zlog_debug ("turn off %s", ifp->name); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 675 | |
| 676 | /* Leave from multicast group. */ |
| 677 | rip_multicast_leave (ifp, rip->sock); |
| 678 | |
| 679 | ri->running = 0; |
| 680 | } |
| 681 | |
| 682 | return 0; |
| 683 | } |
| 684 | |
| 685 | /* Needed for stop RIP process. */ |
| 686 | void |
| 687 | rip_if_down_all () |
| 688 | { |
| 689 | struct interface *ifp; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 690 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 691 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 692 | for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp)) |
| 693 | rip_if_down (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 694 | } |
| 695 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 696 | static void |
| 697 | rip_apply_address_add (struct connected *ifc) { |
| 698 | struct prefix_ipv4 address; |
| 699 | struct prefix *p; |
| 700 | |
| 701 | if (!rip) |
| 702 | return; |
| 703 | |
| 704 | if (! if_is_up(ifc->ifp)) |
| 705 | return; |
| 706 | |
| 707 | p = ifc->address; |
| 708 | |
| 709 | memset (&address, 0, sizeof (address)); |
| 710 | address.family = p->family; |
| 711 | address.prefix = p->u.prefix4; |
| 712 | address.prefixlen = p->prefixlen; |
| 713 | apply_mask_ipv4(&address); |
| 714 | |
| 715 | /* Check if this interface is RIP enabled or not |
| 716 | or Check if this address's prefix is RIP enabled */ |
| 717 | if ((rip_enable_if_lookup(ifc->ifp->name) >= 0) || |
| 718 | (rip_enable_network_lookup2(ifc) >= 0)) |
| 719 | rip_redistribute_add(ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE, |
vincent | fbf5d03 | 2005-09-29 11:25:50 +0000 | [diff] [blame] | 720 | &address, ifc->ifp->ifindex, NULL, 0, 0); |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 721 | |
| 722 | } |
| 723 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 724 | int |
| 725 | rip_interface_address_add (int command, struct zclient *zclient, |
| 726 | zebra_size_t length) |
| 727 | { |
| 728 | struct connected *ifc; |
| 729 | struct prefix *p; |
| 730 | |
paul | 0a58935 | 2004-05-08 11:48:26 +0000 | [diff] [blame] | 731 | ifc = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD, |
| 732 | zclient->ibuf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 733 | |
| 734 | if (ifc == NULL) |
| 735 | return 0; |
| 736 | |
| 737 | p = ifc->address; |
| 738 | |
| 739 | if (p->family == AF_INET) |
| 740 | { |
| 741 | if (IS_RIP_DEBUG_ZEBRA) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 742 | zlog_debug ("connected address %s/%d is added", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 743 | inet_ntoa (p->u.prefix4), p->prefixlen); |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 744 | |
paul | 878ef2e | 2003-09-23 23:41:50 +0000 | [diff] [blame] | 745 | rip_enable_apply(ifc->ifp); |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 746 | /* Check if this prefix needs to be redistributed */ |
| 747 | rip_apply_address_add(ifc); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 748 | |
| 749 | #ifdef HAVE_SNMP |
| 750 | rip_ifaddr_add (ifc->ifp, ifc); |
| 751 | #endif /* HAVE_SNMP */ |
| 752 | } |
| 753 | |
| 754 | return 0; |
| 755 | } |
| 756 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 757 | static void |
| 758 | rip_apply_address_del (struct connected *ifc) { |
| 759 | struct prefix_ipv4 address; |
| 760 | struct prefix *p; |
| 761 | |
| 762 | if (!rip) |
| 763 | return; |
| 764 | |
| 765 | if (! if_is_up(ifc->ifp)) |
| 766 | return; |
| 767 | |
| 768 | p = ifc->address; |
| 769 | |
| 770 | memset (&address, 0, sizeof (address)); |
| 771 | address.family = p->family; |
| 772 | address.prefix = p->u.prefix4; |
| 773 | address.prefixlen = p->prefixlen; |
| 774 | apply_mask_ipv4(&address); |
| 775 | |
| 776 | rip_redistribute_delete(ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE, |
| 777 | &address, ifc->ifp->ifindex); |
| 778 | } |
| 779 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 780 | int |
| 781 | rip_interface_address_delete (int command, struct zclient *zclient, |
| 782 | zebra_size_t length) |
| 783 | { |
| 784 | struct connected *ifc; |
| 785 | struct prefix *p; |
| 786 | |
paul | 0a58935 | 2004-05-08 11:48:26 +0000 | [diff] [blame] | 787 | ifc = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE, |
| 788 | zclient->ibuf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 789 | |
| 790 | if (ifc) |
| 791 | { |
| 792 | p = ifc->address; |
| 793 | if (p->family == AF_INET) |
| 794 | { |
| 795 | if (IS_RIP_DEBUG_ZEBRA) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 796 | zlog_debug ("connected address %s/%d is deleted", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 797 | inet_ntoa (p->u.prefix4), p->prefixlen); |
| 798 | |
| 799 | #ifdef HAVE_SNMP |
| 800 | rip_ifaddr_delete (ifc->ifp, ifc); |
| 801 | #endif /* HAVE_SNMP */ |
| 802 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 803 | /* Chech wether this prefix needs to be removed */ |
| 804 | rip_apply_address_del(ifc); |
| 805 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 806 | } |
| 807 | |
| 808 | connected_free (ifc); |
| 809 | |
| 810 | } |
| 811 | |
| 812 | return 0; |
| 813 | } |
| 814 | |
| 815 | /* Check interface is enabled by network statement. */ |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 816 | /* Check wether the interface has at least a connected prefix that |
| 817 | * is within the ripng_enable_network table. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 818 | int |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 819 | rip_enable_network_lookup_if (struct interface *ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 820 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 821 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 822 | struct connected *connected; |
| 823 | struct prefix_ipv4 address; |
| 824 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 825 | for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, connected)) |
| 826 | { |
| 827 | struct prefix *p; |
| 828 | struct route_node *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 829 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 830 | p = connected->address; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 831 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 832 | if (p->family == AF_INET) |
| 833 | { |
| 834 | address.family = AF_INET; |
| 835 | address.prefix = p->u.prefix4; |
| 836 | address.prefixlen = IPV4_MAX_BITLEN; |
| 837 | |
| 838 | node = route_node_match (rip_enable_network, |
| 839 | (struct prefix *)&address); |
| 840 | if (node) |
| 841 | { |
| 842 | route_unlock_node (node); |
| 843 | return 1; |
| 844 | } |
| 845 | } |
| 846 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 847 | return -1; |
| 848 | } |
| 849 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 850 | /* Check wether connected is within the ripng_enable_network table. */ |
| 851 | int |
| 852 | rip_enable_network_lookup2 (struct connected *connected) |
| 853 | { |
| 854 | struct prefix_ipv4 address; |
| 855 | struct prefix *p; |
| 856 | |
| 857 | p = connected->address; |
| 858 | |
| 859 | if (p->family == AF_INET) { |
| 860 | struct route_node *node; |
| 861 | |
| 862 | address.family = p->family; |
| 863 | address.prefix = p->u.prefix4; |
| 864 | address.prefixlen = IPV4_MAX_BITLEN; |
| 865 | |
| 866 | /* LPM on p->family, p->u.prefix4/IPV4_MAX_BITLEN within rip_enable_network */ |
| 867 | node = route_node_match (rip_enable_network, |
| 868 | (struct prefix *)&address); |
| 869 | |
| 870 | if (node) { |
| 871 | route_unlock_node (node); |
| 872 | return 1; |
| 873 | } |
| 874 | } |
| 875 | |
| 876 | return -1; |
| 877 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 878 | /* Add RIP enable network. */ |
| 879 | int |
| 880 | rip_enable_network_add (struct prefix *p) |
| 881 | { |
| 882 | struct route_node *node; |
| 883 | |
| 884 | node = route_node_get (rip_enable_network, p); |
| 885 | |
| 886 | if (node->info) |
| 887 | { |
| 888 | route_unlock_node (node); |
| 889 | return -1; |
| 890 | } |
| 891 | else |
hasso | 8a676be | 2004-10-08 06:36:38 +0000 | [diff] [blame] | 892 | node->info = (char *) "enabled"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 893 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 894 | /* XXX: One should find a better solution than a generic one */ |
| 895 | rip_enable_apply_all(); |
| 896 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 897 | return 1; |
| 898 | } |
| 899 | |
| 900 | /* Delete RIP enable network. */ |
| 901 | int |
| 902 | rip_enable_network_delete (struct prefix *p) |
| 903 | { |
| 904 | struct route_node *node; |
| 905 | |
| 906 | node = route_node_lookup (rip_enable_network, p); |
| 907 | if (node) |
| 908 | { |
| 909 | node->info = NULL; |
| 910 | |
| 911 | /* Unlock info lock. */ |
| 912 | route_unlock_node (node); |
| 913 | |
| 914 | /* Unlock lookup lock. */ |
| 915 | route_unlock_node (node); |
| 916 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 917 | /* XXX: One should find a better solution than a generic one */ |
| 918 | rip_enable_apply_all (); |
| 919 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 920 | return 1; |
| 921 | } |
| 922 | return -1; |
| 923 | } |
| 924 | |
| 925 | /* Check interface is enabled by ifname statement. */ |
| 926 | int |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 927 | rip_enable_if_lookup (const char *ifname) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 928 | { |
hasso | 8a676be | 2004-10-08 06:36:38 +0000 | [diff] [blame] | 929 | unsigned int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 930 | char *str; |
| 931 | |
paul | 55468c8 | 2005-03-14 20:19:01 +0000 | [diff] [blame] | 932 | for (i = 0; i < vector_active (rip_enable_interface); i++) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 933 | if ((str = vector_slot (rip_enable_interface, i)) != NULL) |
| 934 | if (strcmp (str, ifname) == 0) |
| 935 | return i; |
| 936 | return -1; |
| 937 | } |
| 938 | |
| 939 | /* Add interface to rip_enable_if. */ |
| 940 | int |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 941 | rip_enable_if_add (const char *ifname) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 942 | { |
| 943 | int ret; |
| 944 | |
| 945 | ret = rip_enable_if_lookup (ifname); |
| 946 | if (ret >= 0) |
| 947 | return -1; |
| 948 | |
| 949 | vector_set (rip_enable_interface, strdup (ifname)); |
| 950 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 951 | rip_enable_apply_all(); /* TODOVJ */ |
| 952 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 953 | return 1; |
| 954 | } |
| 955 | |
| 956 | /* Delete interface from rip_enable_if. */ |
| 957 | int |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 958 | rip_enable_if_delete (const char *ifname) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 959 | { |
| 960 | int index; |
| 961 | char *str; |
| 962 | |
| 963 | index = rip_enable_if_lookup (ifname); |
| 964 | if (index < 0) |
| 965 | return -1; |
| 966 | |
| 967 | str = vector_slot (rip_enable_interface, index); |
| 968 | free (str); |
| 969 | vector_unset (rip_enable_interface, index); |
| 970 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 971 | rip_enable_apply_all(); /* TODOVJ */ |
| 972 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 973 | return 1; |
| 974 | } |
| 975 | |
| 976 | /* Join to multicast group and send request to the interface. */ |
| 977 | int |
| 978 | rip_interface_wakeup (struct thread *t) |
| 979 | { |
| 980 | struct interface *ifp; |
| 981 | struct rip_interface *ri; |
| 982 | |
| 983 | /* Get interface. */ |
| 984 | ifp = THREAD_ARG (t); |
| 985 | |
| 986 | ri = ifp->info; |
| 987 | ri->t_wakeup = NULL; |
| 988 | |
| 989 | /* Join to multicast group. */ |
| 990 | if (rip_multicast_join (ifp, rip->sock) < 0) |
| 991 | { |
| 992 | zlog_err ("multicast join failed, interface %s not running", ifp->name); |
| 993 | return 0; |
| 994 | } |
| 995 | |
| 996 | /* Set running flag. */ |
| 997 | ri->running = 1; |
| 998 | |
| 999 | /* Send RIP request to the interface. */ |
| 1000 | rip_request_interface (ifp); |
| 1001 | |
| 1002 | return 0; |
| 1003 | } |
| 1004 | |
| 1005 | int rip_redistribute_check (int); |
| 1006 | |
| 1007 | void |
| 1008 | rip_connect_set (struct interface *ifp, int set) |
| 1009 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1010 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1011 | struct connected *connected; |
| 1012 | struct prefix_ipv4 address; |
| 1013 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1014 | for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, connected)) |
| 1015 | { |
| 1016 | struct prefix *p; |
| 1017 | p = connected->address; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1018 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1019 | if (p->family != AF_INET) |
| 1020 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1021 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1022 | address.family = AF_INET; |
| 1023 | address.prefix = p->u.prefix4; |
| 1024 | address.prefixlen = p->prefixlen; |
| 1025 | apply_mask_ipv4 (&address); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1026 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1027 | if (set) { |
| 1028 | /* Check once more wether this prefix is within a "network IF_OR_PREF" one */ |
| 1029 | if ((rip_enable_if_lookup(connected->ifp->name) >= 0) || |
| 1030 | (rip_enable_network_lookup2(connected) >= 0)) |
| 1031 | rip_redistribute_add (ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE, |
vincent | fbf5d03 | 2005-09-29 11:25:50 +0000 | [diff] [blame] | 1032 | &address, connected->ifp->ifindex, |
| 1033 | NULL, 0, 0); |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1034 | } else |
| 1035 | { |
| 1036 | rip_redistribute_delete (ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE, |
| 1037 | &address, connected->ifp->ifindex); |
| 1038 | if (rip_redistribute_check (ZEBRA_ROUTE_CONNECT)) |
| 1039 | rip_redistribute_add (ZEBRA_ROUTE_CONNECT, RIP_ROUTE_REDISTRIBUTE, |
vincent | fbf5d03 | 2005-09-29 11:25:50 +0000 | [diff] [blame] | 1040 | &address, connected->ifp->ifindex, |
| 1041 | NULL, 0, 0); |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1042 | } |
| 1043 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1044 | } |
| 1045 | |
| 1046 | /* Update interface status. */ |
| 1047 | void |
| 1048 | rip_enable_apply (struct interface *ifp) |
| 1049 | { |
| 1050 | int ret; |
| 1051 | struct rip_interface *ri = NULL; |
| 1052 | |
| 1053 | /* Check interface. */ |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 1054 | if (! if_is_operative (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1055 | return; |
| 1056 | |
| 1057 | ri = ifp->info; |
| 1058 | |
| 1059 | /* Check network configuration. */ |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 1060 | ret = rip_enable_network_lookup_if (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1061 | |
| 1062 | /* If the interface is matched. */ |
| 1063 | if (ret > 0) |
| 1064 | ri->enable_network = 1; |
| 1065 | else |
| 1066 | ri->enable_network = 0; |
| 1067 | |
| 1068 | /* Check interface name configuration. */ |
| 1069 | ret = rip_enable_if_lookup (ifp->name); |
| 1070 | if (ret >= 0) |
| 1071 | ri->enable_interface = 1; |
| 1072 | else |
| 1073 | ri->enable_interface = 0; |
| 1074 | |
| 1075 | /* any interface MUST have an IPv4 address */ |
| 1076 | if ( ! rip_if_ipv4_address_check (ifp) ) |
| 1077 | { |
| 1078 | ri->enable_network = 0; |
| 1079 | ri->enable_interface = 0; |
| 1080 | } |
| 1081 | |
| 1082 | /* Update running status of the interface. */ |
| 1083 | if (ri->enable_network || ri->enable_interface) |
| 1084 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1085 | { |
| 1086 | if (IS_RIP_DEBUG_EVENT) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 1087 | zlog_debug ("turn on %s", ifp->name); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1088 | |
| 1089 | /* Add interface wake up thread. */ |
| 1090 | if (! ri->t_wakeup) |
| 1091 | ri->t_wakeup = thread_add_timer (master, rip_interface_wakeup, |
| 1092 | ifp, 1); |
| 1093 | rip_connect_set (ifp, 1); |
| 1094 | } |
| 1095 | } |
| 1096 | else |
| 1097 | { |
| 1098 | if (ri->running) |
| 1099 | { |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 1100 | /* Might as well clean up the route table as well |
| 1101 | * rip_if_down sets to 0 ri->running, and displays "turn off %s" |
| 1102 | **/ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1103 | rip_if_down(ifp); |
| 1104 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1105 | rip_connect_set (ifp, 0); |
| 1106 | } |
| 1107 | } |
| 1108 | } |
| 1109 | |
| 1110 | /* Apply network configuration to all interface. */ |
| 1111 | void |
| 1112 | rip_enable_apply_all () |
| 1113 | { |
| 1114 | struct interface *ifp; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1115 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1116 | |
| 1117 | /* Check each interface. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1118 | for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp)) |
| 1119 | rip_enable_apply (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1120 | } |
| 1121 | |
| 1122 | int |
| 1123 | rip_neighbor_lookup (struct sockaddr_in *from) |
| 1124 | { |
| 1125 | struct prefix_ipv4 p; |
| 1126 | struct route_node *node; |
| 1127 | |
| 1128 | memset (&p, 0, sizeof (struct prefix_ipv4)); |
| 1129 | p.family = AF_INET; |
| 1130 | p.prefix = from->sin_addr; |
| 1131 | p.prefixlen = IPV4_MAX_BITLEN; |
| 1132 | |
| 1133 | node = route_node_lookup (rip->neighbor, (struct prefix *) &p); |
| 1134 | if (node) |
| 1135 | { |
| 1136 | route_unlock_node (node); |
| 1137 | return 1; |
| 1138 | } |
| 1139 | return 0; |
| 1140 | } |
| 1141 | |
| 1142 | /* Add new RIP neighbor to the neighbor tree. */ |
| 1143 | int |
| 1144 | rip_neighbor_add (struct prefix_ipv4 *p) |
| 1145 | { |
| 1146 | struct route_node *node; |
| 1147 | |
| 1148 | node = route_node_get (rip->neighbor, (struct prefix *) p); |
| 1149 | |
| 1150 | if (node->info) |
| 1151 | return -1; |
| 1152 | |
| 1153 | node->info = rip->neighbor; |
| 1154 | |
| 1155 | return 0; |
| 1156 | } |
| 1157 | |
| 1158 | /* Delete RIP neighbor from the neighbor tree. */ |
| 1159 | int |
| 1160 | rip_neighbor_delete (struct prefix_ipv4 *p) |
| 1161 | { |
| 1162 | struct route_node *node; |
| 1163 | |
| 1164 | /* Lock for look up. */ |
| 1165 | node = route_node_lookup (rip->neighbor, (struct prefix *) p); |
| 1166 | if (! node) |
| 1167 | return -1; |
| 1168 | |
| 1169 | node->info = NULL; |
| 1170 | |
| 1171 | /* Unlock lookup lock. */ |
| 1172 | route_unlock_node (node); |
| 1173 | |
| 1174 | /* Unlock real neighbor information lock. */ |
| 1175 | route_unlock_node (node); |
| 1176 | |
| 1177 | return 0; |
| 1178 | } |
| 1179 | |
| 1180 | /* Clear all network and neighbor configuration. */ |
| 1181 | void |
| 1182 | rip_clean_network () |
| 1183 | { |
hasso | 8a676be | 2004-10-08 06:36:38 +0000 | [diff] [blame] | 1184 | unsigned int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1185 | char *str; |
| 1186 | struct route_node *rn; |
| 1187 | |
| 1188 | /* rip_enable_network. */ |
| 1189 | for (rn = route_top (rip_enable_network); rn; rn = route_next (rn)) |
| 1190 | if (rn->info) |
| 1191 | { |
| 1192 | rn->info = NULL; |
| 1193 | route_unlock_node (rn); |
| 1194 | } |
| 1195 | |
| 1196 | /* rip_enable_interface. */ |
paul | 55468c8 | 2005-03-14 20:19:01 +0000 | [diff] [blame] | 1197 | for (i = 0; i < vector_active (rip_enable_interface); i++) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1198 | if ((str = vector_slot (rip_enable_interface, i)) != NULL) |
| 1199 | { |
| 1200 | free (str); |
| 1201 | vector_slot (rip_enable_interface, i) = NULL; |
| 1202 | } |
| 1203 | } |
| 1204 | |
| 1205 | /* Utility function for looking up passive interface settings. */ |
| 1206 | int |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 1207 | rip_passive_nondefault_lookup (const char *ifname) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1208 | { |
hasso | 8a676be | 2004-10-08 06:36:38 +0000 | [diff] [blame] | 1209 | unsigned int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1210 | char *str; |
| 1211 | |
paul | 55468c8 | 2005-03-14 20:19:01 +0000 | [diff] [blame] | 1212 | for (i = 0; i < vector_active (Vrip_passive_nondefault); i++) |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 1213 | if ((str = vector_slot (Vrip_passive_nondefault, i)) != NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1214 | if (strcmp (str, ifname) == 0) |
| 1215 | return i; |
| 1216 | return -1; |
| 1217 | } |
| 1218 | |
| 1219 | void |
| 1220 | rip_passive_interface_apply (struct interface *ifp) |
| 1221 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1222 | struct rip_interface *ri; |
| 1223 | |
| 1224 | ri = ifp->info; |
| 1225 | |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 1226 | ri->passive = ((rip_passive_nondefault_lookup (ifp->name) < 0) ? |
| 1227 | passive_default : !passive_default); |
| 1228 | |
| 1229 | if (IS_RIP_DEBUG_ZEBRA) |
ajs | 5d6c377 | 2004-12-08 19:24:06 +0000 | [diff] [blame] | 1230 | zlog_debug ("interface %s: passive = %d",ifp->name,ri->passive); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1231 | } |
| 1232 | |
| 1233 | void |
| 1234 | rip_passive_interface_apply_all () |
| 1235 | { |
| 1236 | struct interface *ifp; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1237 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1238 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1239 | for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp)) |
| 1240 | rip_passive_interface_apply (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1241 | } |
| 1242 | |
| 1243 | /* Passive interface. */ |
| 1244 | int |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 1245 | rip_passive_nondefault_set (struct vty *vty, const char *ifname) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1246 | { |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 1247 | if (rip_passive_nondefault_lookup (ifname) >= 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1248 | return CMD_WARNING; |
| 1249 | |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 1250 | vector_set (Vrip_passive_nondefault, strdup (ifname)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1251 | |
| 1252 | rip_passive_interface_apply_all (); |
| 1253 | |
| 1254 | return CMD_SUCCESS; |
| 1255 | } |
| 1256 | |
| 1257 | int |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 1258 | rip_passive_nondefault_unset (struct vty *vty, const char *ifname) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1259 | { |
| 1260 | int i; |
| 1261 | char *str; |
| 1262 | |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 1263 | i = rip_passive_nondefault_lookup (ifname); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1264 | if (i < 0) |
| 1265 | return CMD_WARNING; |
| 1266 | |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 1267 | str = vector_slot (Vrip_passive_nondefault, i); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1268 | free (str); |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 1269 | vector_unset (Vrip_passive_nondefault, i); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1270 | |
| 1271 | rip_passive_interface_apply_all (); |
| 1272 | |
| 1273 | return CMD_SUCCESS; |
| 1274 | } |
| 1275 | |
| 1276 | /* Free all configured RIP passive-interface settings. */ |
| 1277 | void |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 1278 | rip_passive_nondefault_clean () |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1279 | { |
hasso | 8a676be | 2004-10-08 06:36:38 +0000 | [diff] [blame] | 1280 | unsigned int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1281 | char *str; |
| 1282 | |
paul | 55468c8 | 2005-03-14 20:19:01 +0000 | [diff] [blame] | 1283 | for (i = 0; i < vector_active (Vrip_passive_nondefault); i++) |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 1284 | if ((str = vector_slot (Vrip_passive_nondefault, i)) != NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1285 | { |
| 1286 | free (str); |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 1287 | vector_slot (Vrip_passive_nondefault, i) = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1288 | } |
| 1289 | rip_passive_interface_apply_all (); |
| 1290 | } |
| 1291 | |
| 1292 | /* RIP enable network or interface configuration. */ |
| 1293 | DEFUN (rip_network, |
| 1294 | rip_network_cmd, |
| 1295 | "network (A.B.C.D/M|WORD)", |
| 1296 | "Enable routing on an IP network\n" |
| 1297 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 1298 | "Interface name\n") |
| 1299 | { |
| 1300 | int ret; |
| 1301 | struct prefix_ipv4 p; |
| 1302 | |
| 1303 | ret = str2prefix_ipv4 (argv[0], &p); |
| 1304 | |
| 1305 | if (ret) |
| 1306 | ret = rip_enable_network_add ((struct prefix *) &p); |
| 1307 | else |
| 1308 | ret = rip_enable_if_add (argv[0]); |
| 1309 | |
| 1310 | if (ret < 0) |
| 1311 | { |
| 1312 | vty_out (vty, "There is a same network configuration %s%s", argv[0], |
| 1313 | VTY_NEWLINE); |
| 1314 | return CMD_WARNING; |
| 1315 | } |
| 1316 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1317 | return CMD_SUCCESS; |
| 1318 | } |
| 1319 | |
| 1320 | /* RIP enable network or interface configuration. */ |
| 1321 | DEFUN (no_rip_network, |
| 1322 | no_rip_network_cmd, |
| 1323 | "no network (A.B.C.D/M|WORD)", |
| 1324 | NO_STR |
| 1325 | "Enable routing on an IP network\n" |
| 1326 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 1327 | "Interface name\n") |
| 1328 | { |
| 1329 | int ret; |
| 1330 | struct prefix_ipv4 p; |
| 1331 | |
| 1332 | ret = str2prefix_ipv4 (argv[0], &p); |
| 1333 | |
| 1334 | if (ret) |
| 1335 | ret = rip_enable_network_delete ((struct prefix *) &p); |
| 1336 | else |
| 1337 | ret = rip_enable_if_delete (argv[0]); |
| 1338 | |
| 1339 | if (ret < 0) |
| 1340 | { |
| 1341 | vty_out (vty, "Can't find network configuration %s%s", argv[0], |
| 1342 | VTY_NEWLINE); |
| 1343 | return CMD_WARNING; |
| 1344 | } |
| 1345 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1346 | return CMD_SUCCESS; |
| 1347 | } |
| 1348 | |
| 1349 | /* RIP neighbor configuration set. */ |
| 1350 | DEFUN (rip_neighbor, |
| 1351 | rip_neighbor_cmd, |
| 1352 | "neighbor A.B.C.D", |
| 1353 | "Specify a neighbor router\n" |
| 1354 | "Neighbor address\n") |
| 1355 | { |
| 1356 | int ret; |
| 1357 | struct prefix_ipv4 p; |
| 1358 | |
| 1359 | ret = str2prefix_ipv4 (argv[0], &p); |
| 1360 | |
| 1361 | if (ret <= 0) |
| 1362 | { |
| 1363 | vty_out (vty, "Please specify address by A.B.C.D%s", VTY_NEWLINE); |
| 1364 | return CMD_WARNING; |
| 1365 | } |
| 1366 | |
| 1367 | rip_neighbor_add (&p); |
| 1368 | |
| 1369 | return CMD_SUCCESS; |
| 1370 | } |
| 1371 | |
| 1372 | /* RIP neighbor configuration unset. */ |
| 1373 | DEFUN (no_rip_neighbor, |
| 1374 | no_rip_neighbor_cmd, |
| 1375 | "no neighbor A.B.C.D", |
| 1376 | NO_STR |
| 1377 | "Specify a neighbor router\n" |
| 1378 | "Neighbor address\n") |
| 1379 | { |
| 1380 | int ret; |
| 1381 | struct prefix_ipv4 p; |
| 1382 | |
| 1383 | ret = str2prefix_ipv4 (argv[0], &p); |
| 1384 | |
| 1385 | if (ret <= 0) |
| 1386 | { |
| 1387 | vty_out (vty, "Please specify address by A.B.C.D%s", VTY_NEWLINE); |
| 1388 | return CMD_WARNING; |
| 1389 | } |
| 1390 | |
| 1391 | rip_neighbor_delete (&p); |
| 1392 | |
| 1393 | return CMD_SUCCESS; |
| 1394 | } |
| 1395 | |
| 1396 | DEFUN (ip_rip_receive_version, |
| 1397 | ip_rip_receive_version_cmd, |
| 1398 | "ip rip receive version (1|2)", |
| 1399 | IP_STR |
| 1400 | "Routing Information Protocol\n" |
| 1401 | "Advertisement reception\n" |
| 1402 | "Version control\n" |
| 1403 | "RIP version 1\n" |
| 1404 | "RIP version 2\n") |
| 1405 | { |
| 1406 | struct interface *ifp; |
| 1407 | struct rip_interface *ri; |
| 1408 | |
| 1409 | ifp = (struct interface *)vty->index; |
| 1410 | ri = ifp->info; |
| 1411 | |
| 1412 | /* Version 1. */ |
| 1413 | if (atoi (argv[0]) == 1) |
| 1414 | { |
| 1415 | ri->ri_receive = RI_RIP_VERSION_1; |
| 1416 | return CMD_SUCCESS; |
| 1417 | } |
| 1418 | if (atoi (argv[0]) == 2) |
| 1419 | { |
| 1420 | ri->ri_receive = RI_RIP_VERSION_2; |
| 1421 | return CMD_SUCCESS; |
| 1422 | } |
| 1423 | return CMD_WARNING; |
| 1424 | } |
| 1425 | |
| 1426 | DEFUN (ip_rip_receive_version_1, |
| 1427 | ip_rip_receive_version_1_cmd, |
| 1428 | "ip rip receive version 1 2", |
| 1429 | IP_STR |
| 1430 | "Routing Information Protocol\n" |
| 1431 | "Advertisement reception\n" |
| 1432 | "Version control\n" |
| 1433 | "RIP version 1\n" |
| 1434 | "RIP version 2\n") |
| 1435 | { |
| 1436 | struct interface *ifp; |
| 1437 | struct rip_interface *ri; |
| 1438 | |
| 1439 | ifp = (struct interface *)vty->index; |
| 1440 | ri = ifp->info; |
| 1441 | |
| 1442 | /* Version 1 and 2. */ |
| 1443 | ri->ri_receive = RI_RIP_VERSION_1_AND_2; |
| 1444 | return CMD_SUCCESS; |
| 1445 | } |
| 1446 | |
| 1447 | DEFUN (ip_rip_receive_version_2, |
| 1448 | ip_rip_receive_version_2_cmd, |
| 1449 | "ip rip receive version 2 1", |
| 1450 | IP_STR |
| 1451 | "Routing Information Protocol\n" |
| 1452 | "Advertisement reception\n" |
| 1453 | "Version control\n" |
| 1454 | "RIP version 2\n" |
| 1455 | "RIP version 1\n") |
| 1456 | { |
| 1457 | struct interface *ifp; |
| 1458 | struct rip_interface *ri; |
| 1459 | |
| 1460 | ifp = (struct interface *)vty->index; |
| 1461 | ri = ifp->info; |
| 1462 | |
| 1463 | /* Version 1 and 2. */ |
| 1464 | ri->ri_receive = RI_RIP_VERSION_1_AND_2; |
| 1465 | return CMD_SUCCESS; |
| 1466 | } |
| 1467 | |
| 1468 | DEFUN (no_ip_rip_receive_version, |
| 1469 | no_ip_rip_receive_version_cmd, |
| 1470 | "no ip rip receive version", |
| 1471 | NO_STR |
| 1472 | IP_STR |
| 1473 | "Routing Information Protocol\n" |
| 1474 | "Advertisement reception\n" |
| 1475 | "Version control\n") |
| 1476 | { |
| 1477 | struct interface *ifp; |
| 1478 | struct rip_interface *ri; |
| 1479 | |
| 1480 | ifp = (struct interface *)vty->index; |
| 1481 | ri = ifp->info; |
| 1482 | |
| 1483 | ri->ri_receive = RI_RIP_UNSPEC; |
| 1484 | return CMD_SUCCESS; |
| 1485 | } |
| 1486 | |
| 1487 | ALIAS (no_ip_rip_receive_version, |
| 1488 | no_ip_rip_receive_version_num_cmd, |
| 1489 | "no ip rip receive version (1|2)", |
| 1490 | NO_STR |
| 1491 | IP_STR |
| 1492 | "Routing Information Protocol\n" |
| 1493 | "Advertisement reception\n" |
| 1494 | "Version control\n" |
| 1495 | "Version 1\n" |
| 1496 | "Version 2\n") |
| 1497 | |
| 1498 | DEFUN (ip_rip_send_version, |
| 1499 | ip_rip_send_version_cmd, |
| 1500 | "ip rip send version (1|2)", |
| 1501 | IP_STR |
| 1502 | "Routing Information Protocol\n" |
| 1503 | "Advertisement transmission\n" |
| 1504 | "Version control\n" |
| 1505 | "RIP version 1\n" |
| 1506 | "RIP version 2\n") |
| 1507 | { |
| 1508 | struct interface *ifp; |
| 1509 | struct rip_interface *ri; |
| 1510 | |
| 1511 | ifp = (struct interface *)vty->index; |
| 1512 | ri = ifp->info; |
| 1513 | |
| 1514 | /* Version 1. */ |
| 1515 | if (atoi (argv[0]) == 1) |
| 1516 | { |
| 1517 | ri->ri_send = RI_RIP_VERSION_1; |
| 1518 | return CMD_SUCCESS; |
| 1519 | } |
| 1520 | if (atoi (argv[0]) == 2) |
| 1521 | { |
| 1522 | ri->ri_send = RI_RIP_VERSION_2; |
| 1523 | return CMD_SUCCESS; |
| 1524 | } |
| 1525 | return CMD_WARNING; |
| 1526 | } |
| 1527 | |
| 1528 | DEFUN (ip_rip_send_version_1, |
| 1529 | ip_rip_send_version_1_cmd, |
| 1530 | "ip rip send version 1 2", |
| 1531 | IP_STR |
| 1532 | "Routing Information Protocol\n" |
| 1533 | "Advertisement transmission\n" |
| 1534 | "Version control\n" |
| 1535 | "RIP version 1\n" |
| 1536 | "RIP version 2\n") |
| 1537 | { |
| 1538 | struct interface *ifp; |
| 1539 | struct rip_interface *ri; |
| 1540 | |
| 1541 | ifp = (struct interface *)vty->index; |
| 1542 | ri = ifp->info; |
| 1543 | |
| 1544 | /* Version 1 and 2. */ |
| 1545 | ri->ri_send = RI_RIP_VERSION_1_AND_2; |
| 1546 | return CMD_SUCCESS; |
| 1547 | } |
| 1548 | |
| 1549 | DEFUN (ip_rip_send_version_2, |
| 1550 | ip_rip_send_version_2_cmd, |
| 1551 | "ip rip send version 2 1", |
| 1552 | IP_STR |
| 1553 | "Routing Information Protocol\n" |
| 1554 | "Advertisement transmission\n" |
| 1555 | "Version control\n" |
| 1556 | "RIP version 2\n" |
| 1557 | "RIP version 1\n") |
| 1558 | { |
| 1559 | struct interface *ifp; |
| 1560 | struct rip_interface *ri; |
| 1561 | |
| 1562 | ifp = (struct interface *)vty->index; |
| 1563 | ri = ifp->info; |
| 1564 | |
| 1565 | /* Version 1 and 2. */ |
| 1566 | ri->ri_send = RI_RIP_VERSION_1_AND_2; |
| 1567 | return CMD_SUCCESS; |
| 1568 | } |
| 1569 | |
| 1570 | DEFUN (no_ip_rip_send_version, |
| 1571 | no_ip_rip_send_version_cmd, |
| 1572 | "no ip rip send version", |
| 1573 | NO_STR |
| 1574 | IP_STR |
| 1575 | "Routing Information Protocol\n" |
| 1576 | "Advertisement transmission\n" |
| 1577 | "Version control\n") |
| 1578 | { |
| 1579 | struct interface *ifp; |
| 1580 | struct rip_interface *ri; |
| 1581 | |
| 1582 | ifp = (struct interface *)vty->index; |
| 1583 | ri = ifp->info; |
| 1584 | |
| 1585 | ri->ri_send = RI_RIP_UNSPEC; |
| 1586 | return CMD_SUCCESS; |
| 1587 | } |
| 1588 | |
| 1589 | ALIAS (no_ip_rip_send_version, |
| 1590 | no_ip_rip_send_version_num_cmd, |
| 1591 | "no ip rip send version (1|2)", |
| 1592 | NO_STR |
| 1593 | IP_STR |
| 1594 | "Routing Information Protocol\n" |
| 1595 | "Advertisement transmission\n" |
| 1596 | "Version control\n" |
| 1597 | "Version 1\n" |
| 1598 | "Version 2\n") |
| 1599 | |
| 1600 | DEFUN (ip_rip_authentication_mode, |
| 1601 | ip_rip_authentication_mode_cmd, |
| 1602 | "ip rip authentication mode (md5|text)", |
| 1603 | IP_STR |
| 1604 | "Routing Information Protocol\n" |
| 1605 | "Authentication control\n" |
| 1606 | "Authentication mode\n" |
| 1607 | "Keyed message digest\n" |
| 1608 | "Clear text authentication\n") |
| 1609 | { |
| 1610 | struct interface *ifp; |
| 1611 | struct rip_interface *ri; |
| 1612 | |
| 1613 | ifp = (struct interface *)vty->index; |
| 1614 | ri = ifp->info; |
| 1615 | |
paul | ca5e516 | 2004-06-06 22:06:33 +0000 | [diff] [blame] | 1616 | if ( (argc < 1) || (argc > 2) ) |
| 1617 | { |
| 1618 | vty_out (vty, "incorrect argument count%s", VTY_NEWLINE); |
| 1619 | return CMD_WARNING; |
| 1620 | } |
| 1621 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1622 | if (strncmp ("md5", argv[0], strlen (argv[0])) == 0) |
| 1623 | ri->auth_type = RIP_AUTH_MD5; |
| 1624 | else if (strncmp ("text", argv[0], strlen (argv[0])) == 0) |
| 1625 | ri->auth_type = RIP_AUTH_SIMPLE_PASSWORD; |
| 1626 | else |
| 1627 | { |
| 1628 | vty_out (vty, "mode should be md5 or text%s", VTY_NEWLINE); |
| 1629 | return CMD_WARNING; |
| 1630 | } |
| 1631 | |
paul | ca5e516 | 2004-06-06 22:06:33 +0000 | [diff] [blame] | 1632 | if (argc == 1) |
| 1633 | return CMD_SUCCESS; |
| 1634 | |
| 1635 | if ( (argc == 2) && (ri->auth_type != RIP_AUTH_MD5) ) |
| 1636 | { |
| 1637 | vty_out (vty, "auth length argument only valid for md5%s", VTY_NEWLINE); |
| 1638 | return CMD_WARNING; |
| 1639 | } |
| 1640 | |
| 1641 | if (strncmp ("r", argv[1], 1) == 0) |
| 1642 | ri->md5_auth_len = RIP_AUTH_MD5_SIZE; |
| 1643 | else if (strncmp ("o", argv[1], 1) == 0) |
| 1644 | ri->md5_auth_len = RIP_AUTH_MD5_COMPAT_SIZE; |
| 1645 | else |
| 1646 | return CMD_WARNING; |
| 1647 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1648 | return CMD_SUCCESS; |
| 1649 | } |
| 1650 | |
paul | ca5e516 | 2004-06-06 22:06:33 +0000 | [diff] [blame] | 1651 | ALIAS (ip_rip_authentication_mode, |
| 1652 | ip_rip_authentication_mode_authlen_cmd, |
| 1653 | "ip rip authentication mode (md5|text) auth-length (rfc|old-ripd)", |
| 1654 | IP_STR |
| 1655 | "Routing Information Protocol\n" |
| 1656 | "Authentication control\n" |
| 1657 | "Authentication mode\n" |
| 1658 | "Keyed message digest\n" |
| 1659 | "Clear text authentication\n" |
| 1660 | "MD5 authentication data length\n" |
| 1661 | "RFC compatible\n" |
| 1662 | "Old ripd compatible\n") |
| 1663 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1664 | DEFUN (no_ip_rip_authentication_mode, |
| 1665 | no_ip_rip_authentication_mode_cmd, |
| 1666 | "no ip rip authentication mode", |
| 1667 | NO_STR |
| 1668 | IP_STR |
| 1669 | "Routing Information Protocol\n" |
| 1670 | "Authentication control\n" |
| 1671 | "Authentication mode\n") |
| 1672 | { |
| 1673 | struct interface *ifp; |
| 1674 | struct rip_interface *ri; |
| 1675 | |
| 1676 | ifp = (struct interface *)vty->index; |
| 1677 | ri = ifp->info; |
| 1678 | |
paul | 7755a8c | 2005-06-02 08:20:53 +0000 | [diff] [blame] | 1679 | ri->auth_type = RIP_NO_AUTH; |
paul | ca5e516 | 2004-06-06 22:06:33 +0000 | [diff] [blame] | 1680 | ri->md5_auth_len = RIP_AUTH_MD5_COMPAT_SIZE; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1681 | |
| 1682 | return CMD_SUCCESS; |
| 1683 | } |
| 1684 | |
| 1685 | ALIAS (no_ip_rip_authentication_mode, |
| 1686 | no_ip_rip_authentication_mode_type_cmd, |
| 1687 | "no ip rip authentication mode (md5|text)", |
| 1688 | NO_STR |
| 1689 | IP_STR |
| 1690 | "Routing Information Protocol\n" |
| 1691 | "Authentication control\n" |
| 1692 | "Authentication mode\n" |
| 1693 | "Keyed message digest\n" |
| 1694 | "Clear text authentication\n") |
| 1695 | |
paul | ca5e516 | 2004-06-06 22:06:33 +0000 | [diff] [blame] | 1696 | ALIAS (no_ip_rip_authentication_mode, |
| 1697 | no_ip_rip_authentication_mode_type_authlen_cmd, |
| 1698 | "no ip rip authentication mode (md5|text) auth-length (rfc|old-ripd)", |
| 1699 | NO_STR |
| 1700 | IP_STR |
| 1701 | "Routing Information Protocol\n" |
| 1702 | "Authentication control\n" |
| 1703 | "Authentication mode\n" |
| 1704 | "Keyed message digest\n" |
| 1705 | "Clear text authentication\n" |
| 1706 | "MD5 authentication data length\n" |
| 1707 | "RFC compatible\n" |
| 1708 | "Old ripd compatible\n") |
| 1709 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1710 | DEFUN (ip_rip_authentication_string, |
| 1711 | ip_rip_authentication_string_cmd, |
| 1712 | "ip rip authentication string LINE", |
| 1713 | IP_STR |
| 1714 | "Routing Information Protocol\n" |
| 1715 | "Authentication control\n" |
| 1716 | "Authentication string\n" |
| 1717 | "Authentication string\n") |
| 1718 | { |
| 1719 | struct interface *ifp; |
| 1720 | struct rip_interface *ri; |
| 1721 | |
| 1722 | ifp = (struct interface *)vty->index; |
| 1723 | ri = ifp->info; |
| 1724 | |
| 1725 | if (strlen (argv[0]) > 16) |
| 1726 | { |
| 1727 | vty_out (vty, "%% RIPv2 authentication string must be shorter than 16%s", |
| 1728 | VTY_NEWLINE); |
| 1729 | return CMD_WARNING; |
| 1730 | } |
| 1731 | |
| 1732 | if (ri->key_chain) |
| 1733 | { |
| 1734 | vty_out (vty, "%% key-chain configuration exists%s", VTY_NEWLINE); |
| 1735 | return CMD_WARNING; |
| 1736 | } |
| 1737 | |
| 1738 | if (ri->auth_str) |
| 1739 | free (ri->auth_str); |
| 1740 | |
| 1741 | ri->auth_str = strdup (argv[0]); |
| 1742 | |
| 1743 | return CMD_SUCCESS; |
| 1744 | } |
| 1745 | |
| 1746 | DEFUN (no_ip_rip_authentication_string, |
| 1747 | no_ip_rip_authentication_string_cmd, |
| 1748 | "no ip rip authentication string", |
| 1749 | NO_STR |
| 1750 | IP_STR |
| 1751 | "Routing Information Protocol\n" |
| 1752 | "Authentication control\n" |
| 1753 | "Authentication string\n") |
| 1754 | { |
| 1755 | struct interface *ifp; |
| 1756 | struct rip_interface *ri; |
| 1757 | |
| 1758 | ifp = (struct interface *)vty->index; |
| 1759 | ri = ifp->info; |
| 1760 | |
| 1761 | if (ri->auth_str) |
| 1762 | free (ri->auth_str); |
| 1763 | |
| 1764 | ri->auth_str = NULL; |
| 1765 | |
| 1766 | return CMD_SUCCESS; |
| 1767 | } |
| 1768 | |
| 1769 | ALIAS (no_ip_rip_authentication_string, |
| 1770 | no_ip_rip_authentication_string2_cmd, |
| 1771 | "no ip rip authentication string LINE", |
| 1772 | NO_STR |
| 1773 | IP_STR |
| 1774 | "Routing Information Protocol\n" |
| 1775 | "Authentication control\n" |
| 1776 | "Authentication string\n" |
| 1777 | "Authentication string\n") |
| 1778 | |
| 1779 | DEFUN (ip_rip_authentication_key_chain, |
| 1780 | ip_rip_authentication_key_chain_cmd, |
| 1781 | "ip rip authentication key-chain LINE", |
| 1782 | IP_STR |
| 1783 | "Routing Information Protocol\n" |
| 1784 | "Authentication control\n" |
| 1785 | "Authentication key-chain\n" |
| 1786 | "name of key-chain\n") |
| 1787 | { |
| 1788 | struct interface *ifp; |
| 1789 | struct rip_interface *ri; |
| 1790 | |
| 1791 | ifp = (struct interface *) vty->index; |
| 1792 | ri = ifp->info; |
| 1793 | |
| 1794 | if (ri->auth_str) |
| 1795 | { |
| 1796 | vty_out (vty, "%% authentication string configuration exists%s", |
| 1797 | VTY_NEWLINE); |
| 1798 | return CMD_WARNING; |
| 1799 | } |
| 1800 | |
| 1801 | if (ri->key_chain) |
| 1802 | free (ri->key_chain); |
| 1803 | |
| 1804 | ri->key_chain = strdup (argv[0]); |
| 1805 | |
| 1806 | return CMD_SUCCESS; |
| 1807 | } |
| 1808 | |
| 1809 | DEFUN (no_ip_rip_authentication_key_chain, |
| 1810 | no_ip_rip_authentication_key_chain_cmd, |
| 1811 | "no ip rip authentication key-chain", |
| 1812 | NO_STR |
| 1813 | IP_STR |
| 1814 | "Routing Information Protocol\n" |
| 1815 | "Authentication control\n" |
| 1816 | "Authentication key-chain\n") |
| 1817 | { |
| 1818 | struct interface *ifp; |
| 1819 | struct rip_interface *ri; |
| 1820 | |
| 1821 | ifp = (struct interface *) vty->index; |
| 1822 | ri = ifp->info; |
| 1823 | |
| 1824 | if (ri->key_chain) |
| 1825 | free (ri->key_chain); |
| 1826 | |
| 1827 | ri->key_chain = NULL; |
| 1828 | |
| 1829 | return CMD_SUCCESS; |
| 1830 | } |
| 1831 | |
| 1832 | ALIAS (no_ip_rip_authentication_key_chain, |
| 1833 | no_ip_rip_authentication_key_chain2_cmd, |
| 1834 | "no ip rip authentication key-chain LINE", |
| 1835 | NO_STR |
| 1836 | IP_STR |
| 1837 | "Routing Information Protocol\n" |
| 1838 | "Authentication control\n" |
| 1839 | "Authentication key-chain\n" |
| 1840 | "name of key-chain\n") |
| 1841 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 1842 | /* CHANGED: ip rip split-horizon |
| 1843 | Cisco and Zebra's command is |
| 1844 | ip split-horizon |
| 1845 | */ |
| 1846 | DEFUN (ip_rip_split_horizon, |
| 1847 | ip_rip_split_horizon_cmd, |
| 1848 | "ip rip split-horizon", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1849 | IP_STR |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 1850 | "Routing Information Protocol\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1851 | "Perform split horizon\n") |
| 1852 | { |
| 1853 | struct interface *ifp; |
| 1854 | struct rip_interface *ri; |
| 1855 | |
| 1856 | ifp = vty->index; |
| 1857 | ri = ifp->info; |
| 1858 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 1859 | ri->split_horizon = RIP_SPLIT_HORIZON; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1860 | return CMD_SUCCESS; |
| 1861 | } |
| 1862 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 1863 | DEFUN (ip_rip_split_horizon_poisoned_reverse, |
| 1864 | ip_rip_split_horizon_poisoned_reverse_cmd, |
| 1865 | "ip rip split-horizon poisoned-reverse", |
| 1866 | IP_STR |
| 1867 | "Routing Information Protocol\n" |
| 1868 | "Perform split horizon\n" |
| 1869 | "With poisoned-reverse\n") |
| 1870 | { |
| 1871 | struct interface *ifp; |
| 1872 | struct rip_interface *ri; |
| 1873 | |
| 1874 | ifp = vty->index; |
| 1875 | ri = ifp->info; |
| 1876 | |
| 1877 | ri->split_horizon = RIP_SPLIT_HORIZON_POISONED_REVERSE; |
| 1878 | return CMD_SUCCESS; |
| 1879 | } |
| 1880 | |
| 1881 | /* CHANGED: no ip rip split-horizon |
| 1882 | Cisco and Zebra's command is |
| 1883 | no ip split-horizon |
| 1884 | */ |
| 1885 | DEFUN (no_ip_rip_split_horizon, |
| 1886 | no_ip_rip_split_horizon_cmd, |
| 1887 | "no ip rip split-horizon", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1888 | NO_STR |
| 1889 | IP_STR |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 1890 | "Routing Information Protocol\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1891 | "Perform split horizon\n") |
| 1892 | { |
| 1893 | struct interface *ifp; |
| 1894 | struct rip_interface *ri; |
| 1895 | |
| 1896 | ifp = vty->index; |
| 1897 | ri = ifp->info; |
| 1898 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 1899 | ri->split_horizon = RIP_NO_SPLIT_HORIZON; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1900 | return CMD_SUCCESS; |
| 1901 | } |
| 1902 | |
vincent | fac3e84 | 2005-10-06 07:45:43 +0000 | [diff] [blame^] | 1903 | DEFUN (no_ip_rip_split_horizon_poisoned_reverse, |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 1904 | no_ip_rip_split_horizon_poisoned_reverse_cmd, |
| 1905 | "no ip rip split-horizon poisoned-reverse", |
| 1906 | NO_STR |
| 1907 | IP_STR |
| 1908 | "Routing Information Protocol\n" |
| 1909 | "Perform split horizon\n" |
| 1910 | "With poisoned-reverse\n") |
vincent | fac3e84 | 2005-10-06 07:45:43 +0000 | [diff] [blame^] | 1911 | { |
| 1912 | struct interface *ifp; |
| 1913 | struct rip_interface *ri; |
| 1914 | |
| 1915 | ifp = vty->index; |
| 1916 | ri = ifp->info; |
| 1917 | |
| 1918 | switch( ri->split_horizon ) |
| 1919 | { |
| 1920 | case RIP_SPLIT_HORIZON_POISONED_REVERSE: |
| 1921 | ri->split_horizon = RIP_SPLIT_HORIZON; |
| 1922 | default: |
| 1923 | break; |
| 1924 | } |
| 1925 | |
| 1926 | return CMD_SUCCESS; |
| 1927 | } |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 1928 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1929 | DEFUN (rip_passive_interface, |
| 1930 | rip_passive_interface_cmd, |
paul | 56e475c | 2003-06-20 00:23:27 +0000 | [diff] [blame] | 1931 | "passive-interface (IFNAME|default)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1932 | "Suppress routing updates on an interface\n" |
paul | 56e475c | 2003-06-20 00:23:27 +0000 | [diff] [blame] | 1933 | "Interface name\n" |
| 1934 | "default for all interfaces\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1935 | { |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 1936 | const char *ifname = argv[0]; |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 1937 | |
| 1938 | if (!strcmp(ifname,"default")) { |
| 1939 | passive_default = 1; |
| 1940 | rip_passive_nondefault_clean(); |
| 1941 | return CMD_SUCCESS; |
| 1942 | } |
| 1943 | if (passive_default) |
| 1944 | return rip_passive_nondefault_unset (vty, ifname); |
| 1945 | else |
| 1946 | return rip_passive_nondefault_set (vty, ifname); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1947 | } |
| 1948 | |
| 1949 | DEFUN (no_rip_passive_interface, |
| 1950 | no_rip_passive_interface_cmd, |
paul | 56e475c | 2003-06-20 00:23:27 +0000 | [diff] [blame] | 1951 | "no passive-interface (IFNAME|default)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1952 | NO_STR |
| 1953 | "Suppress routing updates on an interface\n" |
paul | 56e475c | 2003-06-20 00:23:27 +0000 | [diff] [blame] | 1954 | "Interface name\n" |
| 1955 | "default for all interfaces\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1956 | { |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 1957 | const char *ifname = argv[0]; |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 1958 | |
| 1959 | if (!strcmp(ifname,"default")) { |
| 1960 | passive_default = 0; |
| 1961 | rip_passive_nondefault_clean(); |
| 1962 | return CMD_SUCCESS; |
| 1963 | } |
| 1964 | if (passive_default) |
| 1965 | return rip_passive_nondefault_set (vty, ifname); |
| 1966 | else |
| 1967 | return rip_passive_nondefault_unset (vty, ifname); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1968 | } |
| 1969 | |
| 1970 | /* Write rip configuration of each interface. */ |
| 1971 | int |
| 1972 | rip_interface_config_write (struct vty *vty) |
| 1973 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 1974 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1975 | struct interface *ifp; |
| 1976 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1977 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1978 | { |
| 1979 | struct rip_interface *ri; |
| 1980 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1981 | ri = ifp->info; |
| 1982 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 1983 | /* Do not display the interface if there is no |
| 1984 | * configuration about it. |
| 1985 | **/ |
| 1986 | if ((!ifp->desc) && |
| 1987 | (ri->split_horizon == ri->split_horizon_default) && |
| 1988 | (ri->ri_send == RI_RIP_UNSPEC) && |
| 1989 | (ri->ri_receive == RI_RIP_UNSPEC) && |
| 1990 | (ri->auth_type != RIP_AUTH_MD5) && |
paul | ca5e516 | 2004-06-06 22:06:33 +0000 | [diff] [blame] | 1991 | (ri->md5_auth_len != RIP_AUTH_MD5_SIZE) && |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 1992 | (!ri->auth_str) && |
| 1993 | (!ri->key_chain) ) |
| 1994 | continue; |
| 1995 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1996 | vty_out (vty, "interface %s%s", ifp->name, |
| 1997 | VTY_NEWLINE); |
| 1998 | |
| 1999 | if (ifp->desc) |
| 2000 | vty_out (vty, " description %s%s", ifp->desc, |
| 2001 | VTY_NEWLINE); |
| 2002 | |
| 2003 | /* Split horizon. */ |
| 2004 | if (ri->split_horizon != ri->split_horizon_default) |
| 2005 | { |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 2006 | switch (ri->split_horizon) { |
| 2007 | case RIP_SPLIT_HORIZON: |
| 2008 | vty_out (vty, " ip rip split-horizon%s", VTY_NEWLINE); |
| 2009 | break; |
| 2010 | case RIP_SPLIT_HORIZON_POISONED_REVERSE: |
| 2011 | vty_out (vty, " ip rip split-horizon poisoned-reverse%s", |
| 2012 | VTY_NEWLINE); |
| 2013 | break; |
| 2014 | case RIP_NO_SPLIT_HORIZON: |
| 2015 | default: |
| 2016 | vty_out (vty, " no ip rip split-horizon%s", VTY_NEWLINE); |
| 2017 | break; |
| 2018 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2019 | } |
| 2020 | |
| 2021 | /* RIP version setting. */ |
| 2022 | if (ri->ri_send != RI_RIP_UNSPEC) |
| 2023 | vty_out (vty, " ip rip send version %s%s", |
| 2024 | lookup (ri_version_msg, ri->ri_send), |
| 2025 | VTY_NEWLINE); |
| 2026 | |
| 2027 | if (ri->ri_receive != RI_RIP_UNSPEC) |
| 2028 | vty_out (vty, " ip rip receive version %s%s", |
| 2029 | lookup (ri_version_msg, ri->ri_receive), |
| 2030 | VTY_NEWLINE); |
| 2031 | |
| 2032 | /* RIP authentication. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2033 | if (ri->auth_type == RIP_AUTH_SIMPLE_PASSWORD) |
| 2034 | vty_out (vty, " ip rip authentication mode text%s", VTY_NEWLINE); |
paul | ca5e516 | 2004-06-06 22:06:33 +0000 | [diff] [blame] | 2035 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2036 | if (ri->auth_type == RIP_AUTH_MD5) |
paul | ca5e516 | 2004-06-06 22:06:33 +0000 | [diff] [blame] | 2037 | { |
| 2038 | vty_out (vty, " ip rip authentication mode md5"); |
| 2039 | if (ri->md5_auth_len == RIP_AUTH_MD5_COMPAT_SIZE) |
| 2040 | vty_out (vty, " auth-length old-ripd"); |
| 2041 | else |
| 2042 | vty_out (vty, " auth-length rfc"); |
| 2043 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2044 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2045 | |
| 2046 | if (ri->auth_str) |
| 2047 | vty_out (vty, " ip rip authentication string %s%s", |
| 2048 | ri->auth_str, VTY_NEWLINE); |
| 2049 | |
| 2050 | if (ri->key_chain) |
| 2051 | vty_out (vty, " ip rip authentication key-chain %s%s", |
| 2052 | ri->key_chain, VTY_NEWLINE); |
| 2053 | |
| 2054 | vty_out (vty, "!%s", VTY_NEWLINE); |
| 2055 | } |
| 2056 | return 0; |
| 2057 | } |
| 2058 | |
| 2059 | int |
| 2060 | config_write_rip_network (struct vty *vty, int config_mode) |
| 2061 | { |
hasso | 8a676be | 2004-10-08 06:36:38 +0000 | [diff] [blame] | 2062 | unsigned int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2063 | char *ifname; |
| 2064 | struct route_node *node; |
| 2065 | |
| 2066 | /* Network type RIP enable interface statement. */ |
| 2067 | for (node = route_top (rip_enable_network); node; node = route_next (node)) |
| 2068 | if (node->info) |
| 2069 | vty_out (vty, "%s%s/%d%s", |
| 2070 | config_mode ? " network " : " ", |
| 2071 | inet_ntoa (node->p.u.prefix4), |
| 2072 | node->p.prefixlen, |
| 2073 | VTY_NEWLINE); |
| 2074 | |
| 2075 | /* Interface name RIP enable statement. */ |
paul | 55468c8 | 2005-03-14 20:19:01 +0000 | [diff] [blame] | 2076 | for (i = 0; i < vector_active (rip_enable_interface); i++) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2077 | if ((ifname = vector_slot (rip_enable_interface, i)) != NULL) |
| 2078 | vty_out (vty, "%s%s%s", |
| 2079 | config_mode ? " network " : " ", |
| 2080 | ifname, |
| 2081 | VTY_NEWLINE); |
| 2082 | |
| 2083 | /* RIP neighbors listing. */ |
| 2084 | for (node = route_top (rip->neighbor); node; node = route_next (node)) |
| 2085 | if (node->info) |
| 2086 | vty_out (vty, "%s%s%s", |
| 2087 | config_mode ? " neighbor " : " ", |
| 2088 | inet_ntoa (node->p.u.prefix4), |
| 2089 | VTY_NEWLINE); |
| 2090 | |
| 2091 | /* RIP passive interface listing. */ |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 2092 | if (config_mode) { |
| 2093 | if (passive_default) |
paul | 01d0908 | 2003-06-08 21:22:18 +0000 | [diff] [blame] | 2094 | vty_out (vty, " passive-interface default%s", VTY_NEWLINE); |
paul | 55468c8 | 2005-03-14 20:19:01 +0000 | [diff] [blame] | 2095 | for (i = 0; i < vector_active (Vrip_passive_nondefault); i++) |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 2096 | if ((ifname = vector_slot (Vrip_passive_nondefault, i)) != NULL) |
| 2097 | vty_out (vty, " %spassive-interface %s%s", |
| 2098 | (passive_default ? "no " : ""), ifname, VTY_NEWLINE); |
| 2099 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2100 | |
| 2101 | return 0; |
| 2102 | } |
| 2103 | |
| 2104 | struct cmd_node interface_node = |
| 2105 | { |
| 2106 | INTERFACE_NODE, |
| 2107 | "%s(config-if)# ", |
| 2108 | 1, |
| 2109 | }; |
| 2110 | |
| 2111 | /* Called when interface structure allocated. */ |
| 2112 | int |
| 2113 | rip_interface_new_hook (struct interface *ifp) |
| 2114 | { |
| 2115 | ifp->info = rip_interface_new (); |
| 2116 | return 0; |
| 2117 | } |
| 2118 | |
| 2119 | /* Called when interface structure deleted. */ |
| 2120 | int |
| 2121 | rip_interface_delete_hook (struct interface *ifp) |
| 2122 | { |
| 2123 | XFREE (MTYPE_RIP_INTERFACE, ifp->info); |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 2124 | ifp->info = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2125 | return 0; |
| 2126 | } |
| 2127 | |
| 2128 | /* Allocate and initialize interface vector. */ |
| 2129 | void |
| 2130 | rip_if_init () |
| 2131 | { |
| 2132 | /* Default initial size of interface vector. */ |
| 2133 | if_init(); |
| 2134 | if_add_hook (IF_NEW_HOOK, rip_interface_new_hook); |
| 2135 | if_add_hook (IF_DELETE_HOOK, rip_interface_delete_hook); |
| 2136 | |
| 2137 | /* RIP network init. */ |
| 2138 | rip_enable_interface = vector_init (1); |
| 2139 | rip_enable_network = route_table_init (); |
| 2140 | |
| 2141 | /* RIP passive interface. */ |
paul | 4aaff3f | 2003-06-07 01:04:45 +0000 | [diff] [blame] | 2142 | Vrip_passive_nondefault = vector_init (1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2143 | |
| 2144 | /* Install interface node. */ |
| 2145 | install_node (&interface_node, rip_interface_config_write); |
| 2146 | |
| 2147 | /* Install commands. */ |
| 2148 | install_element (CONFIG_NODE, &interface_cmd); |
hasso | 034489d | 2003-05-24 07:59:25 +0000 | [diff] [blame] | 2149 | install_element (CONFIG_NODE, &no_interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2150 | install_default (INTERFACE_NODE); |
| 2151 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 2152 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 2153 | install_element (RIP_NODE, &rip_network_cmd); |
| 2154 | install_element (RIP_NODE, &no_rip_network_cmd); |
| 2155 | install_element (RIP_NODE, &rip_neighbor_cmd); |
| 2156 | install_element (RIP_NODE, &no_rip_neighbor_cmd); |
| 2157 | |
| 2158 | install_element (RIP_NODE, &rip_passive_interface_cmd); |
| 2159 | install_element (RIP_NODE, &no_rip_passive_interface_cmd); |
| 2160 | |
| 2161 | install_element (INTERFACE_NODE, &ip_rip_send_version_cmd); |
| 2162 | install_element (INTERFACE_NODE, &ip_rip_send_version_1_cmd); |
| 2163 | install_element (INTERFACE_NODE, &ip_rip_send_version_2_cmd); |
| 2164 | install_element (INTERFACE_NODE, &no_ip_rip_send_version_cmd); |
| 2165 | install_element (INTERFACE_NODE, &no_ip_rip_send_version_num_cmd); |
| 2166 | |
| 2167 | install_element (INTERFACE_NODE, &ip_rip_receive_version_cmd); |
| 2168 | install_element (INTERFACE_NODE, &ip_rip_receive_version_1_cmd); |
| 2169 | install_element (INTERFACE_NODE, &ip_rip_receive_version_2_cmd); |
| 2170 | install_element (INTERFACE_NODE, &no_ip_rip_receive_version_cmd); |
| 2171 | install_element (INTERFACE_NODE, &no_ip_rip_receive_version_num_cmd); |
| 2172 | |
| 2173 | install_element (INTERFACE_NODE, &ip_rip_authentication_mode_cmd); |
paul | ca5e516 | 2004-06-06 22:06:33 +0000 | [diff] [blame] | 2174 | install_element (INTERFACE_NODE, &ip_rip_authentication_mode_authlen_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2175 | install_element (INTERFACE_NODE, &no_ip_rip_authentication_mode_cmd); |
| 2176 | install_element (INTERFACE_NODE, &no_ip_rip_authentication_mode_type_cmd); |
paul | ca5e516 | 2004-06-06 22:06:33 +0000 | [diff] [blame] | 2177 | install_element (INTERFACE_NODE, &no_ip_rip_authentication_mode_type_authlen_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2178 | |
| 2179 | install_element (INTERFACE_NODE, &ip_rip_authentication_key_chain_cmd); |
| 2180 | install_element (INTERFACE_NODE, &no_ip_rip_authentication_key_chain_cmd); |
| 2181 | install_element (INTERFACE_NODE, &no_ip_rip_authentication_key_chain2_cmd); |
| 2182 | |
| 2183 | install_element (INTERFACE_NODE, &ip_rip_authentication_string_cmd); |
| 2184 | install_element (INTERFACE_NODE, &no_ip_rip_authentication_string_cmd); |
| 2185 | install_element (INTERFACE_NODE, &no_ip_rip_authentication_string2_cmd); |
| 2186 | |
hasso | 1670513 | 2003-05-25 14:49:19 +0000 | [diff] [blame] | 2187 | install_element (INTERFACE_NODE, &ip_rip_split_horizon_cmd); |
| 2188 | install_element (INTERFACE_NODE, &ip_rip_split_horizon_poisoned_reverse_cmd); |
| 2189 | install_element (INTERFACE_NODE, &no_ip_rip_split_horizon_cmd); |
| 2190 | install_element (INTERFACE_NODE, &no_ip_rip_split_horizon_poisoned_reverse_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2191 | } |