]> git.proxmox.com Git - mirror_frr.git/blame - ripd/rip_zebra.c
lib: zclient.c remove extern struct thread_master *
[mirror_frr.git] / ripd / rip_zebra.c
CommitLineData
718e3744 1/* RIPd and zebra interface.
2 * Copyright (C) 1997, 1999 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 "prefix.h"
26#include "stream.h"
27#include "routemap.h"
28#include "zclient.h"
29#include "log.h"
30#include "ripd/ripd.h"
31#include "ripd/rip_debug.h"
dc63bfd4 32#include "ripd/rip_interface.h"
718e3744 33
34/* All information about zebra. */
35struct zclient *zclient = NULL;
6b0655a2 36
718e3744 37/* RIPd to zebra command interface. */
38void
39rip_zebra_ipv4_add (struct prefix_ipv4 *p, struct in_addr *nexthop,
40 u_int32_t metric, u_char distance)
41{
42 struct zapi_ipv4 api;
43
8bb0831e 44 if (zclient->redist[AFI_IP][ZEBRA_ROUTE_RIP].enabled)
718e3744 45 {
46 api.type = ZEBRA_ROUTE_RIP;
7c8ff89e 47 api.instance = 0;
718e3744 48 api.flags = 0;
49 api.message = 0;
b4e45f67 50 api.safi = SAFI_UNICAST;
718e3744 51 SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP);
52 api.nexthop_num = 1;
53 api.nexthop = &nexthop;
54 api.ifindex_num = 0;
55 SET_FLAG (api.message, ZAPI_MESSAGE_METRIC);
56 api.metric = metric;
57
58 if (distance && distance != ZEBRA_RIP_DISTANCE_DEFAULT)
59 {
60 SET_FLAG (api.message, ZAPI_MESSAGE_DISTANCE);
61 api.distance = distance;
62 }
63
0a589359 64 zapi_ipv4_route (ZEBRA_IPV4_ROUTE_ADD, zclient, p, &api);
718e3744 65
66 rip_global_route_changes++;
67 }
68}
69
70void
71rip_zebra_ipv4_delete (struct prefix_ipv4 *p, struct in_addr *nexthop,
72 u_int32_t metric)
73{
74 struct zapi_ipv4 api;
75
8bb0831e 76 if (zclient->redist[AFI_IP][ZEBRA_ROUTE_RIP].enabled)
718e3744 77 {
78 api.type = ZEBRA_ROUTE_RIP;
7c8ff89e 79 api.instance = 0;
718e3744 80 api.flags = 0;
81 api.message = 0;
b4e45f67 82 api.safi = SAFI_UNICAST;
718e3744 83 SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP);
84 api.nexthop_num = 1;
85 api.nexthop = &nexthop;
86 api.ifindex_num = 0;
87 SET_FLAG (api.message, ZAPI_MESSAGE_METRIC);
88 api.metric = metric;
89
0a589359 90 zapi_ipv4_route (ZEBRA_IPV4_ROUTE_DELETE, zclient, p, &api);
718e3744 91
92 rip_global_route_changes++;
93 }
94}
95
96/* Zebra route add and delete treatment. */
dc63bfd4 97static int
718e3744 98rip_zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length)
99{
100 struct stream *s;
101 struct zapi_ipv4 api;
102 unsigned long ifindex;
103 struct in_addr nexthop;
104 struct prefix_ipv4 p;
105
106 s = zclient->ibuf;
107 ifindex = 0;
108 nexthop.s_addr = 0;
109
110 /* Type, flags, message. */
111 api.type = stream_getc (s);
7c8ff89e 112 api.instance = stream_getw (s);
718e3744 113 api.flags = stream_getc (s);
114 api.message = stream_getc (s);
115
116 /* IPv4 prefix. */
117 memset (&p, 0, sizeof (struct prefix_ipv4));
118 p.family = AF_INET;
119 p.prefixlen = stream_getc (s);
120 stream_get (&p.prefix, s, PSIZE (p.prefixlen));
121
122 /* Nexthop, ifindex, distance, metric. */
123 if (CHECK_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP))
124 {
125 api.nexthop_num = stream_getc (s);
126 nexthop.s_addr = stream_get_ipv4 (s);
127 }
128 if (CHECK_FLAG (api.message, ZAPI_MESSAGE_IFINDEX))
129 {
130 api.ifindex_num = stream_getc (s);
131 ifindex = stream_getl (s);
132 }
133 if (CHECK_FLAG (api.message, ZAPI_MESSAGE_DISTANCE))
134 api.distance = stream_getc (s);
fbf5d033 135 else
136 api.distance = 255;
718e3744 137 if (CHECK_FLAG (api.message, ZAPI_MESSAGE_METRIC))
138 api.metric = stream_getl (s);
fbf5d033 139 else
140 api.metric = 0;
718e3744 141
142 /* Then fetch IPv4 prefixes. */
143 if (command == ZEBRA_IPV4_ROUTE_ADD)
fbf5d033 144 rip_redistribute_add (api.type, RIP_ROUTE_REDISTRIBUTE, &p, ifindex,
145 &nexthop, api.metric, api.distance);
718e3744 146 else
147 rip_redistribute_delete (api.type, RIP_ROUTE_REDISTRIBUTE, &p, ifindex);
148
149 return 0;
150}
151
152void
dc63bfd4 153rip_zclient_reset (void)
718e3744 154{
155 zclient_reset (zclient);
156}
157
158/* RIP route-map set for redistribution */
dc63bfd4 159static void
98b718a9 160rip_routemap_set (int type, const char *name)
718e3744 161{
162 if (rip->route_map[type].name)
163 free(rip->route_map[type].name);
164
165 rip->route_map[type].name = strdup (name);
166 rip->route_map[type].map = route_map_lookup_by_name (name);
167}
168
dc63bfd4 169static void
8a676be3 170rip_redistribute_metric_set (int type, unsigned int metric)
718e3744 171{
172 rip->route_map[type].metric_config = 1;
173 rip->route_map[type].metric = metric;
174}
175
dc63bfd4 176static int
8a676be3 177rip_metric_unset (int type, unsigned int metric)
718e3744 178{
179#define DONT_CARE_METRIC_RIP 17
180 if (metric != DONT_CARE_METRIC_RIP &&
181 rip->route_map[type].metric != metric)
182 return 1;
183 rip->route_map[type].metric_config = 0;
184 rip->route_map[type].metric = 0;
185 return 0;
186}
187
188/* RIP route-map unset for redistribution */
dc63bfd4 189static int
98b718a9 190rip_routemap_unset (int type, const char *name)
718e3744 191{
192 if (! rip->route_map[type].name ||
193 (name != NULL && strcmp(rip->route_map[type].name,name)))
194 return 1;
195
196 free (rip->route_map[type].name);
197 rip->route_map[type].name = NULL;
198 rip->route_map[type].map = NULL;
199
200 return 0;
201}
6b0655a2 202
718e3744 203/* Redistribution types */
204static struct {
205 int type;
206 int str_min_len;
8a676be3 207 const char *str;
718e3744 208} redist_type[] = {
209 {ZEBRA_ROUTE_KERNEL, 1, "kernel"},
210 {ZEBRA_ROUTE_CONNECT, 1, "connected"},
211 {ZEBRA_ROUTE_STATIC, 1, "static"},
212 {ZEBRA_ROUTE_OSPF, 1, "ospf"},
9c58fbd7
MB
213 {ZEBRA_ROUTE_BGP, 2, "bgp"},
214 {ZEBRA_ROUTE_BABEL, 2, "babel"},
718e3744 215 {0, 0, NULL}
216};
217
218DEFUN (router_zebra,
219 router_zebra_cmd,
220 "router zebra",
221 "Enable a routing process\n"
222 "Make connection to zebra daemon\n")
223{
224 vty->node = ZEBRA_NODE;
225 zclient->enable = 1;
226 zclient_start (zclient);
227 return CMD_SUCCESS;
228}
229
230DEFUN (no_router_zebra,
231 no_router_zebra_cmd,
232 "no router zebra",
233 NO_STR
234 "Enable a routing process\n"
235 "Make connection to zebra daemon\n")
236{
237 zclient->enable = 0;
238 zclient_stop (zclient);
239 return CMD_SUCCESS;
240}
241
2c239705 242#if 0
dc63bfd4 243static int
718e3744 244rip_redistribute_set (int type)
245{
8bb0831e 246 if (zclient->redist[AFI_IP][type])
718e3744 247 return CMD_SUCCESS;
248
8bb0831e 249 zclient->redist[AFI_IP][type] = 1;
718e3744 250
251 if (zclient->sock > 0)
8bb0831e 252 zebra_redistribute_send (ZEBRA_REDISTRIBUTE_ADD, zclient, API_IP, type);
718e3744 253
254 return CMD_SUCCESS;
255}
2c239705 256#endif
718e3744 257
dc63bfd4 258static int
718e3744 259rip_redistribute_unset (int type)
260{
8bb0831e 261 if (! zclient->redist[AFI_IP][type].enabled)
718e3744 262 return CMD_SUCCESS;
263
8bb0831e 264 redist_del_instance(&zclient->redist[AFI_IP][type], 0);
718e3744 265
266 if (zclient->sock > 0)
8bb0831e 267 zebra_redistribute_send (ZEBRA_REDISTRIBUTE_DELETE, zclient, AFI_IP, type, 0);
718e3744 268
269 /* Remove the routes from RIP table. */
270 rip_redistribute_withdraw (type);
271
272 return CMD_SUCCESS;
273}
274
275int
276rip_redistribute_check (int type)
277{
8bb0831e 278 return (zclient->redist[AFI_IP][type].enabled);
718e3744 279}
280
281void
dc63bfd4 282rip_redistribute_clean (void)
718e3744 283{
284 int i;
285
286 for (i = 0; redist_type[i].str; i++)
287 {
8bb0831e 288 if (zclient->redist[AFI_IP][redist_type[i].type].enabled)
718e3744 289 {
290 if (zclient->sock > 0)
291 zebra_redistribute_send (ZEBRA_REDISTRIBUTE_DELETE,
8bb0831e 292 zclient, AFI_IP, redist_type[i].type, 0);
718e3744 293
8bb0831e 294 redist_del_instance(&zclient->redist[AFI_IP][redist_type[i].type], 0);
718e3744 295
296 /* Remove the routes from RIP table. */
297 rip_redistribute_withdraw (redist_type[i].type);
298 }
299 }
300}
301
302DEFUN (rip_redistribute_rip,
303 rip_redistribute_rip_cmd,
304 "redistribute rip",
305 "Redistribute information from another routing protocol\n"
306 "Routing Information Protocol (RIP)\n")
307{
8bb0831e 308 redist_add_instance(&zclient->redist[AFI_IP][ZEBRA_ROUTE_RIP], 0);
718e3744 309 return CMD_SUCCESS;
310}
311
312DEFUN (no_rip_redistribute_rip,
313 no_rip_redistribute_rip_cmd,
314 "no redistribute rip",
315 NO_STR
316 "Redistribute information from another routing protocol\n"
317 "Routing Information Protocol (RIP)\n")
318{
8bb0831e 319 redist_del_instance(&zclient->redist[AFI_IP][ZEBRA_ROUTE_RIP], 0);
718e3744 320 return CMD_SUCCESS;
321}
322
323DEFUN (rip_redistribute_type,
324 rip_redistribute_type_cmd,
9a57dc69
PJ
325 "redistribute " QUAGGA_REDIST_STR_RIPD,
326 REDIST_STR
327 QUAGGA_REDIST_HELP_STR_RIPD)
718e3744 328{
329 int i;
330
331 for(i = 0; redist_type[i].str; i++)
332 {
333 if (strncmp (redist_type[i].str, argv[0],
334 redist_type[i].str_min_len) == 0)
335 {
0a589359 336 zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient,
8bb0831e 337 AFI_IP, redist_type[i].type, 0);
718e3744 338 return CMD_SUCCESS;
339 }
340 }
341
342 vty_out(vty, "Invalid type %s%s", argv[0],
343 VTY_NEWLINE);
344
345 return CMD_WARNING;
346}
347
348DEFUN (no_rip_redistribute_type,
349 no_rip_redistribute_type_cmd,
9a57dc69 350 "no redistribute " QUAGGA_REDIST_STR_RIPD,
718e3744 351 NO_STR
9a57dc69
PJ
352 REDIST_STR
353 QUAGGA_REDIST_HELP_STR_RIPD)
718e3744 354{
355 int i;
356
357 for (i = 0; redist_type[i].str; i++)
358 {
359 if (strncmp(redist_type[i].str, argv[0],
360 redist_type[i].str_min_len) == 0)
361 {
362 rip_metric_unset (redist_type[i].type, DONT_CARE_METRIC_RIP);
363 rip_routemap_unset (redist_type[i].type,NULL);
364 rip_redistribute_unset (redist_type[i].type);
365 return CMD_SUCCESS;
366 }
367 }
368
369 vty_out(vty, "Invalid type %s%s", argv[0],
370 VTY_NEWLINE);
371
372 return CMD_WARNING;
373}
374
375DEFUN (rip_redistribute_type_routemap,
376 rip_redistribute_type_routemap_cmd,
9a57dc69
PJ
377 "redistribute " QUAGGA_REDIST_STR_RIPD " route-map WORD",
378 REDIST_STR
379 QUAGGA_REDIST_HELP_STR_RIPD
718e3744 380 "Route map reference\n"
381 "Pointer to route-map entries\n")
382{
383 int i;
384
385 for (i = 0; redist_type[i].str; i++) {
386 if (strncmp(redist_type[i].str, argv[0],
387 redist_type[i].str_min_len) == 0)
388 {
389 rip_routemap_set (redist_type[i].type, argv[1]);
8bb0831e
DS
390 zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP,
391 redist_type[i].type, 0);
718e3744 392 return CMD_SUCCESS;
393 }
394 }
395
396 vty_out(vty, "Invalid type %s%s", argv[0],
397 VTY_NEWLINE);
398
399 return CMD_WARNING;
400}
401
402DEFUN (no_rip_redistribute_type_routemap,
403 no_rip_redistribute_type_routemap_cmd,
9a57dc69 404 "no redistribute " QUAGGA_REDIST_STR_RIPD " route-map WORD",
718e3744 405 NO_STR
9a57dc69
PJ
406 REDIST_STR
407 QUAGGA_REDIST_HELP_STR_RIPD
718e3744 408 "Route map reference\n"
409 "Pointer to route-map entries\n")
410{
411 int i;
412
413 for (i = 0; redist_type[i].str; i++)
414 {
415 if (strncmp(redist_type[i].str, argv[0],
416 redist_type[i].str_min_len) == 0)
417 {
418 if (rip_routemap_unset (redist_type[i].type,argv[1]))
419 return CMD_WARNING;
420 rip_redistribute_unset (redist_type[i].type);
421 return CMD_SUCCESS;
422 }
423 }
424
425 vty_out(vty, "Invalid type %s%s", argv[0],
426 VTY_NEWLINE);
427
428 return CMD_WARNING;
429}
430
431DEFUN (rip_redistribute_type_metric,
432 rip_redistribute_type_metric_cmd,
9a57dc69
PJ
433 "redistribute " QUAGGA_REDIST_STR_RIPD " metric <0-16>",
434 REDIST_STR
435 QUAGGA_REDIST_HELP_STR_RIPD
718e3744 436 "Metric\n"
437 "Metric value\n")
438{
439 int i;
440 int metric;
441
442 metric = atoi (argv[1]);
443
444 for (i = 0; redist_type[i].str; i++) {
445 if (strncmp(redist_type[i].str, argv[0],
446 redist_type[i].str_min_len) == 0)
447 {
448 rip_redistribute_metric_set (redist_type[i].type, metric);
8bb0831e
DS
449 zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP,
450 redist_type[i].type, 0);
718e3744 451 return CMD_SUCCESS;
452 }
453 }
454
455 vty_out(vty, "Invalid type %s%s", argv[0],
456 VTY_NEWLINE);
457
458 return CMD_WARNING;
459}
460
461DEFUN (no_rip_redistribute_type_metric,
462 no_rip_redistribute_type_metric_cmd,
9a57dc69 463 "no redistribute " QUAGGA_REDIST_STR_RIPD " metric <0-16>",
718e3744 464 NO_STR
9a57dc69
PJ
465 REDIST_STR
466 QUAGGA_REDIST_HELP_STR_RIPD
718e3744 467 "Metric\n"
468 "Metric value\n")
469{
470 int i;
471
472 for (i = 0; redist_type[i].str; i++)
473 {
474 if (strncmp(redist_type[i].str, argv[0],
475 redist_type[i].str_min_len) == 0)
476 {
477 if (rip_metric_unset (redist_type[i].type, atoi(argv[1])))
478 return CMD_WARNING;
479 rip_redistribute_unset (redist_type[i].type);
480 return CMD_SUCCESS;
481 }
482 }
483
484 vty_out(vty, "Invalid type %s%s", argv[0],
485 VTY_NEWLINE);
486
487 return CMD_WARNING;
488}
489
16705130 490DEFUN (rip_redistribute_type_metric_routemap,
491 rip_redistribute_type_metric_routemap_cmd,
9a57dc69
PJ
492 "redistribute " QUAGGA_REDIST_STR_RIPD " metric <0-16> route-map WORD",
493 REDIST_STR
494 QUAGGA_REDIST_HELP_STR_RIPD
16705130 495 "Metric\n"
496 "Metric value\n"
497 "Route map reference\n"
498 "Pointer to route-map entries\n")
499{
500 int i;
501 int metric;
502
503 metric = atoi (argv[1]);
504
505 for (i = 0; redist_type[i].str; i++) {
506 if (strncmp(redist_type[i].str, argv[0],
507 redist_type[i].str_min_len) == 0)
508 {
509 rip_redistribute_metric_set (redist_type[i].type, metric);
510 rip_routemap_set (redist_type[i].type, argv[2]);
8bb0831e
DS
511 zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP,
512 redist_type[i].type, 0);
16705130 513 return CMD_SUCCESS;
514 }
515 }
516
517 vty_out(vty, "Invalid type %s%s", argv[0],
518 VTY_NEWLINE);
519
520 return CMD_WARNING;
521}
522
523
718e3744 524DEFUN (no_rip_redistribute_type_metric_routemap,
525 no_rip_redistribute_type_metric_routemap_cmd,
9a57dc69
PJ
526 "no redistribute " QUAGGA_REDIST_STR_RIPD
527 " metric <0-16> route-map WORD",
718e3744 528 NO_STR
9a57dc69
PJ
529 REDIST_STR
530 QUAGGA_REDIST_HELP_STR_RIPD
718e3744 531 "Metric\n"
532 "Metric value\n"
533 "Route map reference\n"
534 "Pointer to route-map entries\n")
535{
536 int i;
537
538 for (i = 0; redist_type[i].str; i++)
539 {
540 if (strncmp(redist_type[i].str, argv[0],
541 redist_type[i].str_min_len) == 0)
542 {
543 if (rip_metric_unset (redist_type[i].type, atoi(argv[1])))
544 return CMD_WARNING;
545 if (rip_routemap_unset (redist_type[i].type, argv[2]))
546 {
547 rip_redistribute_metric_set(redist_type[i].type, atoi(argv[1]));
548 return CMD_WARNING;
549 }
550 rip_redistribute_unset (redist_type[i].type);
551 return CMD_SUCCESS;
552 }
553 }
554
555 vty_out(vty, "Invalid type %s%s", argv[0],
556 VTY_NEWLINE);
557
558 return CMD_WARNING;
559}
6b0655a2 560
718e3744 561/* Default information originate. */
562
563DEFUN (rip_default_information_originate,
564 rip_default_information_originate_cmd,
565 "default-information originate",
566 "Control distribution of default route\n"
567 "Distribute a default route\n")
568{
569 struct prefix_ipv4 p;
570
571 if (! rip->default_information)
572 {
573 memset (&p, 0, sizeof (struct prefix_ipv4));
574 p.family = AF_INET;
575
576 rip->default_information = 1;
577
fbf5d033 578 rip_redistribute_add (ZEBRA_ROUTE_RIP, RIP_ROUTE_DEFAULT, &p, 0,
579 NULL, 0, 0);
718e3744 580 }
581
582 return CMD_SUCCESS;
583}
584
585DEFUN (no_rip_default_information_originate,
586 no_rip_default_information_originate_cmd,
587 "no default-information originate",
588 NO_STR
589 "Control distribution of default route\n"
590 "Distribute a default route\n")
591{
592 struct prefix_ipv4 p;
593
594 if (rip->default_information)
595 {
596 memset (&p, 0, sizeof (struct prefix_ipv4));
597 p.family = AF_INET;
598
599 rip->default_information = 0;
600
16705130 601 rip_redistribute_delete (ZEBRA_ROUTE_RIP, RIP_ROUTE_DEFAULT, &p, 0);
718e3744 602 }
603
604 return CMD_SUCCESS;
605}
6b0655a2 606
718e3744 607/* RIP configuration write function. */
dc63bfd4 608static int
718e3744 609config_write_zebra (struct vty *vty)
610{
611 if (! zclient->enable)
612 {
613 vty_out (vty, "no router zebra%s", VTY_NEWLINE);
614 return 1;
615 }
8bb0831e 616 else if (! zclient->redist[AFI_IP][ZEBRA_ROUTE_RIP].enabled)
718e3744 617 {
618 vty_out (vty, "router zebra%s", VTY_NEWLINE);
619 vty_out (vty, " no redistribute rip%s", VTY_NEWLINE);
620 return 1;
621 }
622 return 0;
623}
624
625int
626config_write_rip_redistribute (struct vty *vty, int config_mode)
627{
628 int i;
718e3744 629
630 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
7c8ff89e 631 if (i != zclient->redist_default &&
8bb0831e 632 zclient->redist[AFI_IP][i].enabled)
718e3744 633 {
634 if (config_mode)
635 {
636 if (rip->route_map[i].metric_config)
637 {
638 if (rip->route_map[i].name)
639 vty_out (vty, " redistribute %s metric %d route-map %s%s",
f52d13cb 640 zebra_route_string(i), rip->route_map[i].metric,
718e3744 641 rip->route_map[i].name,
642 VTY_NEWLINE);
643 else
644 vty_out (vty, " redistribute %s metric %d%s",
f52d13cb 645 zebra_route_string(i), rip->route_map[i].metric,
718e3744 646 VTY_NEWLINE);
647 }
648 else
649 {
650 if (rip->route_map[i].name)
651 vty_out (vty, " redistribute %s route-map %s%s",
f52d13cb 652 zebra_route_string(i), rip->route_map[i].name,
718e3744 653 VTY_NEWLINE);
654 else
f52d13cb 655 vty_out (vty, " redistribute %s%s", zebra_route_string(i),
718e3744 656 VTY_NEWLINE);
657 }
658 }
659 else
f52d13cb 660 vty_out (vty, " %s", zebra_route_string(i));
718e3744 661 }
662 return 0;
663}
664
665/* Zebra node structure. */
7fc626de 666static struct cmd_node zebra_node =
718e3744 667{
668 ZEBRA_NODE,
669 "%s(config-router)# ",
670};
671
672void
4140ca4d 673rip_zclient_init (struct thread_master *master)
718e3744 674{
675 /* Set default value to the zebra client structure. */
4140ca4d 676 zclient = zclient_new(master);
7c8ff89e 677 zclient_init (zclient, ZEBRA_ROUTE_RIP, 0);
718e3744 678 zclient->interface_add = rip_interface_add;
679 zclient->interface_delete = rip_interface_delete;
680 zclient->interface_address_add = rip_interface_address_add;
681 zclient->interface_address_delete = rip_interface_address_delete;
682 zclient->ipv4_route_add = rip_zebra_read_ipv4;
683 zclient->ipv4_route_delete = rip_zebra_read_ipv4;
684 zclient->interface_up = rip_interface_up;
685 zclient->interface_down = rip_interface_down;
686
687 /* Install zebra node. */
688 install_node (&zebra_node, config_write_zebra);
689
690 /* Install command elements to zebra node. */
691 install_element (CONFIG_NODE, &router_zebra_cmd);
692 install_element (CONFIG_NODE, &no_router_zebra_cmd);
693 install_default (ZEBRA_NODE);
694 install_element (ZEBRA_NODE, &rip_redistribute_rip_cmd);
695 install_element (ZEBRA_NODE, &no_rip_redistribute_rip_cmd);
696
697 /* Install command elements to rip node. */
698 install_element (RIP_NODE, &rip_redistribute_type_cmd);
699 install_element (RIP_NODE, &rip_redistribute_type_routemap_cmd);
700 install_element (RIP_NODE, &rip_redistribute_type_metric_cmd);
16705130 701 install_element (RIP_NODE, &rip_redistribute_type_metric_routemap_cmd);
718e3744 702 install_element (RIP_NODE, &no_rip_redistribute_type_cmd);
703 install_element (RIP_NODE, &no_rip_redistribute_type_routemap_cmd);
704 install_element (RIP_NODE, &no_rip_redistribute_type_metric_cmd);
705 install_element (RIP_NODE, &no_rip_redistribute_type_metric_routemap_cmd);
706 install_element (RIP_NODE, &rip_default_information_originate_cmd);
707 install_element (RIP_NODE, &no_rip_default_information_originate_cmd);
708}