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