zebra: cleanup RIB meta queue code
[jleu-quagga.git] / lib / distribute.c
blob242a225c2a32e6ebbaff2c01f0dc2ce54aeb8d78
1 /* Distribute list functions
2 * Copyright (C) 1998, 1999 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published
8 * by the Free Software Foundation; either version 2, or (at your
9 * option) any later version.
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.
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
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #include <zebra.h>
24 #include "hash.h"
25 #include "if.h"
26 #include "filter.h"
27 #include "command.h"
28 #include "distribute.h"
29 #include "memory.h"
31 /* Hash of distribute list. */
32 struct hash *disthash;
34 /* Hook functions. */
35 void (*distribute_add_hook) (struct distribute *);
36 void (*distribute_delete_hook) (struct distribute *);
38 static struct distribute *
39 distribute_new (void)
41 return XCALLOC (MTYPE_DISTRIBUTE, sizeof (struct distribute));
44 /* Free distribute object. */
45 static void
46 distribute_free (struct distribute *dist)
48 if (dist->ifname)
49 XFREE (MTYPE_DISTRIBUTE_IFNAME, dist->ifname);
51 if (dist->list[DISTRIBUTE_IN])
52 free (dist->list[DISTRIBUTE_IN]);
53 if (dist->list[DISTRIBUTE_OUT])
54 free (dist->list[DISTRIBUTE_OUT]);
56 if (dist->prefix[DISTRIBUTE_IN])
57 free (dist->prefix[DISTRIBUTE_IN]);
58 if (dist->prefix[DISTRIBUTE_OUT])
59 free (dist->prefix[DISTRIBUTE_OUT]);
61 XFREE (MTYPE_DISTRIBUTE, dist);
64 /* Lookup interface's distribute list. */
65 struct distribute *
66 distribute_lookup (const char *ifname)
68 struct distribute key;
69 struct distribute *dist;
71 /* temporary reference */
72 key.ifname = (char *)ifname;
74 dist = hash_lookup (disthash, &key);
76 return dist;
79 void
80 distribute_list_add_hook (void (*func) (struct distribute *))
82 distribute_add_hook = func;
85 void
86 distribute_list_delete_hook (void (*func) (struct distribute *))
88 distribute_delete_hook = func;
91 static void *
92 distribute_hash_alloc (struct distribute *arg)
94 struct distribute *dist;
96 dist = distribute_new ();
97 if (arg->ifname)
98 dist->ifname = XSTRDUP (MTYPE_DISTRIBUTE_IFNAME, arg->ifname);
99 else
100 dist->ifname = NULL;
101 return dist;
104 /* Make new distribute list and push into hash. */
105 static struct distribute *
106 distribute_get (const char *ifname)
108 struct distribute key;
110 /* temporary reference */
111 key.ifname = (char *)ifname;
113 return hash_get (disthash, &key, (void * (*) (void *))distribute_hash_alloc);
116 static unsigned int
117 distribute_hash_make (struct distribute *dist)
119 unsigned int i, key;
121 key = 0;
122 if (dist->ifname)
123 for (i = 0; i < strlen (dist->ifname); i++)
124 key += dist->ifname[i];
126 return key;
129 /* If two distribute-list have same value then return 1 else return
130 0. This function is used by hash package. */
131 static int
132 distribute_cmp (const struct distribute *dist1, const struct distribute *dist2)
134 if (dist1->ifname && dist2->ifname)
135 if (strcmp (dist1->ifname, dist2->ifname) == 0)
136 return 1;
137 if (! dist1->ifname && ! dist2->ifname)
138 return 1;
139 return 0;
142 /* Set access-list name to the distribute list. */
143 static struct distribute *
144 distribute_list_set (const char *ifname, enum distribute_type type,
145 const char *alist_name)
147 struct distribute *dist;
149 dist = distribute_get (ifname);
151 if (type == DISTRIBUTE_IN)
153 if (dist->list[DISTRIBUTE_IN])
154 free (dist->list[DISTRIBUTE_IN]);
155 dist->list[DISTRIBUTE_IN] = strdup (alist_name);
157 if (type == DISTRIBUTE_OUT)
159 if (dist->list[DISTRIBUTE_OUT])
160 free (dist->list[DISTRIBUTE_OUT]);
161 dist->list[DISTRIBUTE_OUT] = strdup (alist_name);
164 /* Apply this distribute-list to the interface. */
165 (*distribute_add_hook) (dist);
167 return dist;
170 /* Unset distribute-list. If matched distribute-list exist then
171 return 1. */
172 static int
173 distribute_list_unset (const char *ifname, enum distribute_type type,
174 const char *alist_name)
176 struct distribute *dist;
178 dist = distribute_lookup (ifname);
179 if (!dist)
180 return 0;
182 if (type == DISTRIBUTE_IN)
184 if (!dist->list[DISTRIBUTE_IN])
185 return 0;
186 if (strcmp (dist->list[DISTRIBUTE_IN], alist_name) != 0)
187 return 0;
189 free (dist->list[DISTRIBUTE_IN]);
190 dist->list[DISTRIBUTE_IN] = NULL;
193 if (type == DISTRIBUTE_OUT)
195 if (!dist->list[DISTRIBUTE_OUT])
196 return 0;
197 if (strcmp (dist->list[DISTRIBUTE_OUT], alist_name) != 0)
198 return 0;
200 free (dist->list[DISTRIBUTE_OUT]);
201 dist->list[DISTRIBUTE_OUT] = NULL;
204 /* Apply this distribute-list to the interface. */
205 (*distribute_delete_hook) (dist);
207 /* If both out and in is NULL then free distribute list. */
208 if (dist->list[DISTRIBUTE_IN] == NULL &&
209 dist->list[DISTRIBUTE_OUT] == NULL &&
210 dist->prefix[DISTRIBUTE_IN] == NULL &&
211 dist->prefix[DISTRIBUTE_OUT] == NULL)
213 hash_release (disthash, dist);
214 distribute_free (dist);
217 return 1;
220 /* Set access-list name to the distribute list. */
221 static struct distribute *
222 distribute_list_prefix_set (const char *ifname, enum distribute_type type,
223 const char *plist_name)
225 struct distribute *dist;
227 dist = distribute_get (ifname);
229 if (type == DISTRIBUTE_IN)
231 if (dist->prefix[DISTRIBUTE_IN])
232 free (dist->prefix[DISTRIBUTE_IN]);
233 dist->prefix[DISTRIBUTE_IN] = strdup (plist_name);
235 if (type == DISTRIBUTE_OUT)
237 if (dist->prefix[DISTRIBUTE_OUT])
238 free (dist->prefix[DISTRIBUTE_OUT]);
239 dist->prefix[DISTRIBUTE_OUT] = strdup (plist_name);
242 /* Apply this distribute-list to the interface. */
243 (*distribute_add_hook) (dist);
245 return dist;
248 /* Unset distribute-list. If matched distribute-list exist then
249 return 1. */
250 static int
251 distribute_list_prefix_unset (const char *ifname, enum distribute_type type,
252 const char *plist_name)
254 struct distribute *dist;
256 dist = distribute_lookup (ifname);
257 if (!dist)
258 return 0;
260 if (type == DISTRIBUTE_IN)
262 if (!dist->prefix[DISTRIBUTE_IN])
263 return 0;
264 if (strcmp (dist->prefix[DISTRIBUTE_IN], plist_name) != 0)
265 return 0;
267 free (dist->prefix[DISTRIBUTE_IN]);
268 dist->prefix[DISTRIBUTE_IN] = NULL;
271 if (type == DISTRIBUTE_OUT)
273 if (!dist->prefix[DISTRIBUTE_OUT])
274 return 0;
275 if (strcmp (dist->prefix[DISTRIBUTE_OUT], plist_name) != 0)
276 return 0;
278 free (dist->prefix[DISTRIBUTE_OUT]);
279 dist->prefix[DISTRIBUTE_OUT] = NULL;
282 /* Apply this distribute-list to the interface. */
283 (*distribute_delete_hook) (dist);
285 /* If both out and in is NULL then free distribute list. */
286 if (dist->list[DISTRIBUTE_IN] == NULL &&
287 dist->list[DISTRIBUTE_OUT] == NULL &&
288 dist->prefix[DISTRIBUTE_IN] == NULL &&
289 dist->prefix[DISTRIBUTE_OUT] == NULL)
291 hash_release (disthash, dist);
292 distribute_free (dist);
295 return 1;
298 DEFUN (distribute_list_all,
299 distribute_list_all_cmd,
300 "distribute-list WORD (in|out)",
301 "Filter networks in routing updates\n"
302 "Access-list name\n"
303 "Filter incoming routing updates\n"
304 "Filter outgoing routing updates\n")
306 enum distribute_type type;
307 struct distribute *dist;
309 /* Check of distribute list type. */
310 if (strncmp (argv[1], "i", 1) == 0)
311 type = DISTRIBUTE_IN;
312 else if (strncmp (argv[1], "o", 1) == 0)
313 type = DISTRIBUTE_OUT;
314 else
316 vty_out (vty, "distribute list direction must be [in|out]%s",
317 VTY_NEWLINE);
318 return CMD_WARNING;
321 /* Get interface name corresponding distribute list. */
322 dist = distribute_list_set (NULL, type, argv[0]);
324 return CMD_SUCCESS;
327 ALIAS (distribute_list_all,
328 ipv6_distribute_list_all_cmd,
329 "distribute-list WORD (in|out)",
330 "Filter networks in routing updates\n"
331 "Access-list name\n"
332 "Filter incoming routing updates\n"
333 "Filter outgoing routing updates\n")
335 DEFUN (no_distribute_list_all,
336 no_distribute_list_all_cmd,
337 "no distribute-list WORD (in|out)",
338 NO_STR
339 "Filter networks in routing updates\n"
340 "Access-list name\n"
341 "Filter incoming routing updates\n"
342 "Filter outgoing routing updates\n")
344 int ret;
345 enum distribute_type type;
347 /* Check of distribute list type. */
348 if (strncmp (argv[1], "i", 1) == 0)
349 type = DISTRIBUTE_IN;
350 else if (strncmp (argv[1], "o", 1) == 0)
351 type = DISTRIBUTE_OUT;
352 else
354 vty_out (vty, "distribute list direction must be [in|out]%s",
355 VTY_NEWLINE);
356 return CMD_WARNING;
359 ret = distribute_list_unset (NULL, type, argv[0]);
360 if (! ret)
362 vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE);
363 return CMD_WARNING;
365 return CMD_SUCCESS;
368 ALIAS (no_distribute_list_all,
369 no_ipv6_distribute_list_all_cmd,
370 "no distribute-list WORD (in|out)",
371 NO_STR
372 "Filter networks in routing updates\n"
373 "Access-list name\n"
374 "Filter incoming routing updates\n"
375 "Filter outgoing routing updates\n")
377 DEFUN (distribute_list,
378 distribute_list_cmd,
379 "distribute-list WORD (in|out) WORD",
380 "Filter networks in routing updates\n"
381 "Access-list name\n"
382 "Filter incoming routing updates\n"
383 "Filter outgoing routing updates\n"
384 "Interface name\n")
386 enum distribute_type type;
387 struct distribute *dist;
389 /* Check of distribute list type. */
390 if (strncmp (argv[1], "i", 1) == 0)
391 type = DISTRIBUTE_IN;
392 else if (strncmp (argv[1], "o", 1) == 0)
393 type = DISTRIBUTE_OUT;
394 else
396 vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE);
397 return CMD_WARNING;
400 /* Get interface name corresponding distribute list. */
401 dist = distribute_list_set (argv[2], type, argv[0]);
403 return CMD_SUCCESS;
406 ALIAS (distribute_list,
407 ipv6_distribute_list_cmd,
408 "distribute-list WORD (in|out) WORD",
409 "Filter networks in routing updates\n"
410 "Access-list name\n"
411 "Filter incoming routing updates\n"
412 "Filter outgoing routing updates\n"
413 "Interface name\n")
415 DEFUN (no_districute_list, no_distribute_list_cmd,
416 "no distribute-list WORD (in|out) WORD",
417 NO_STR
418 "Filter networks in routing updates\n"
419 "Access-list name\n"
420 "Filter incoming routing updates\n"
421 "Filter outgoing routing updates\n"
422 "Interface name\n")
424 int ret;
425 enum distribute_type type;
427 /* Check of distribute list type. */
428 if (strncmp (argv[1], "i", 1) == 0)
429 type = DISTRIBUTE_IN;
430 else if (strncmp (argv[1], "o", 1) == 0)
431 type = DISTRIBUTE_OUT;
432 else
434 vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE);
435 return CMD_WARNING;
438 ret = distribute_list_unset (argv[2], type, argv[0]);
439 if (! ret)
441 vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE);
442 return CMD_WARNING;
444 return CMD_SUCCESS;
447 ALIAS (no_districute_list, no_ipv6_distribute_list_cmd,
448 "no distribute-list WORD (in|out) WORD",
449 NO_STR
450 "Filter networks in routing updates\n"
451 "Access-list name\n"
452 "Filter incoming routing updates\n"
453 "Filter outgoing routing updates\n"
454 "Interface name\n")
456 DEFUN (districute_list_prefix_all,
457 distribute_list_prefix_all_cmd,
458 "distribute-list prefix WORD (in|out)",
459 "Filter networks in routing updates\n"
460 "Filter prefixes in routing updates\n"
461 "Name of an IP prefix-list\n"
462 "Filter incoming routing updates\n"
463 "Filter outgoing routing updates\n")
465 enum distribute_type type;
466 struct distribute *dist;
468 /* Check of distribute list type. */
469 if (strncmp (argv[1], "i", 1) == 0)
470 type = DISTRIBUTE_IN;
471 else if (strncmp (argv[1], "o", 1) == 0)
472 type = DISTRIBUTE_OUT;
473 else
475 vty_out (vty, "distribute list direction must be [in|out]%s",
476 VTY_NEWLINE);
477 return CMD_WARNING;
480 /* Get interface name corresponding distribute list. */
481 dist = distribute_list_prefix_set (NULL, type, argv[0]);
483 return CMD_SUCCESS;
486 ALIAS (districute_list_prefix_all,
487 ipv6_distribute_list_prefix_all_cmd,
488 "distribute-list prefix WORD (in|out)",
489 "Filter networks in routing updates\n"
490 "Filter prefixes in routing updates\n"
491 "Name of an IP prefix-list\n"
492 "Filter incoming routing updates\n"
493 "Filter outgoing routing updates\n")
495 DEFUN (no_districute_list_prefix_all,
496 no_distribute_list_prefix_all_cmd,
497 "no distribute-list prefix WORD (in|out)",
498 NO_STR
499 "Filter networks in routing updates\n"
500 "Filter prefixes in routing updates\n"
501 "Name of an IP prefix-list\n"
502 "Filter incoming routing updates\n"
503 "Filter outgoing routing updates\n")
505 int ret;
506 enum distribute_type type;
508 /* Check of distribute list type. */
509 if (strncmp (argv[1], "i", 1) == 0)
510 type = DISTRIBUTE_IN;
511 else if (strncmp (argv[1], "o", 1) == 0)
512 type = DISTRIBUTE_OUT;
513 else
515 vty_out (vty, "distribute list direction must be [in|out]%s",
516 VTY_NEWLINE);
517 return CMD_WARNING;
520 ret = distribute_list_prefix_unset (NULL, type, argv[0]);
521 if (! ret)
523 vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE);
524 return CMD_WARNING;
526 return CMD_SUCCESS;
529 ALIAS (no_districute_list_prefix_all,
530 no_ipv6_distribute_list_prefix_all_cmd,
531 "no distribute-list prefix WORD (in|out)",
532 NO_STR
533 "Filter networks in routing updates\n"
534 "Filter prefixes in routing updates\n"
535 "Name of an IP prefix-list\n"
536 "Filter incoming routing updates\n"
537 "Filter outgoing routing updates\n")
539 DEFUN (districute_list_prefix, distribute_list_prefix_cmd,
540 "distribute-list prefix WORD (in|out) WORD",
541 "Filter networks in routing updates\n"
542 "Filter prefixes in routing updates\n"
543 "Name of an IP prefix-list\n"
544 "Filter incoming routing updates\n"
545 "Filter outgoing routing updates\n"
546 "Interface name\n")
548 enum distribute_type type;
549 struct distribute *dist;
551 /* Check of distribute list type. */
552 if (strncmp (argv[1], "i", 1) == 0)
553 type = DISTRIBUTE_IN;
554 else if (strncmp (argv[1], "o", 1) == 0)
555 type = DISTRIBUTE_OUT;
556 else
558 vty_out (vty, "distribute list direction must be [in|out]%s",
559 VTY_NEWLINE);
560 return CMD_WARNING;
563 /* Get interface name corresponding distribute list. */
564 dist = distribute_list_prefix_set (argv[2], type, argv[0]);
566 return CMD_SUCCESS;
569 ALIAS (districute_list_prefix, ipv6_distribute_list_prefix_cmd,
570 "distribute-list prefix WORD (in|out) WORD",
571 "Filter networks in routing updates\n"
572 "Filter prefixes in routing updates\n"
573 "Name of an IP prefix-list\n"
574 "Filter incoming routing updates\n"
575 "Filter outgoing routing updates\n"
576 "Interface name\n")
578 DEFUN (no_districute_list_prefix, no_distribute_list_prefix_cmd,
579 "no distribute-list prefix WORD (in|out) WORD",
580 NO_STR
581 "Filter networks in routing updates\n"
582 "Filter prefixes in routing updates\n"
583 "Name of an IP prefix-list\n"
584 "Filter incoming routing updates\n"
585 "Filter outgoing routing updates\n"
586 "Interface name\n")
588 int ret;
589 enum distribute_type type;
591 /* Check of distribute list type. */
592 if (strncmp (argv[1], "i", 1) == 0)
593 type = DISTRIBUTE_IN;
594 else if (strncmp (argv[1], "o", 1) == 0)
595 type = DISTRIBUTE_OUT;
596 else
598 vty_out (vty, "distribute list direction must be [in|out]%s",
599 VTY_NEWLINE);
600 return CMD_WARNING;
603 ret = distribute_list_prefix_unset (argv[2], type, argv[0]);
604 if (! ret)
606 vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE);
607 return CMD_WARNING;
609 return CMD_SUCCESS;
612 ALIAS (no_districute_list_prefix, no_ipv6_distribute_list_prefix_cmd,
613 "no distribute-list prefix WORD (in|out) WORD",
614 NO_STR
615 "Filter networks in routing updates\n"
616 "Filter prefixes in routing updates\n"
617 "Name of an IP prefix-list\n"
618 "Filter incoming routing updates\n"
619 "Filter outgoing routing updates\n"
620 "Interface name\n")
623 config_show_distribute (struct vty *vty)
625 unsigned int i;
626 struct hash_backet *mp;
627 struct distribute *dist;
629 /* Output filter configuration. */
630 dist = distribute_lookup (NULL);
631 if (dist && (dist->list[DISTRIBUTE_OUT] || dist->prefix[DISTRIBUTE_OUT]))
633 vty_out (vty, " Outgoing update filter list for all interface is");
634 if (dist->list[DISTRIBUTE_OUT])
635 vty_out (vty, " %s", dist->list[DISTRIBUTE_OUT]);
636 if (dist->prefix[DISTRIBUTE_OUT])
637 vty_out (vty, "%s (prefix-list) %s",
638 dist->list[DISTRIBUTE_OUT] ? "," : "",
639 dist->prefix[DISTRIBUTE_OUT]);
640 vty_out (vty, "%s", VTY_NEWLINE);
642 else
643 vty_out (vty, " Outgoing update filter list for all interface is not set%s", VTY_NEWLINE);
645 for (i = 0; i < disthash->size; i++)
646 for (mp = disthash->index[i]; mp; mp = mp->next)
648 dist = mp->data;
649 if (dist->ifname)
650 if (dist->list[DISTRIBUTE_OUT] || dist->prefix[DISTRIBUTE_OUT])
652 vty_out (vty, " %s filtered by", dist->ifname);
653 if (dist->list[DISTRIBUTE_OUT])
654 vty_out (vty, " %s", dist->list[DISTRIBUTE_OUT]);
655 if (dist->prefix[DISTRIBUTE_OUT])
656 vty_out (vty, "%s (prefix-list) %s",
657 dist->list[DISTRIBUTE_OUT] ? "," : "",
658 dist->prefix[DISTRIBUTE_OUT]);
659 vty_out (vty, "%s", VTY_NEWLINE);
664 /* Input filter configuration. */
665 dist = distribute_lookup (NULL);
666 if (dist && (dist->list[DISTRIBUTE_IN] || dist->prefix[DISTRIBUTE_IN]))
668 vty_out (vty, " Incoming update filter list for all interface is");
669 if (dist->list[DISTRIBUTE_IN])
670 vty_out (vty, " %s", dist->list[DISTRIBUTE_IN]);
671 if (dist->prefix[DISTRIBUTE_IN])
672 vty_out (vty, "%s (prefix-list) %s",
673 dist->list[DISTRIBUTE_IN] ? "," : "",
674 dist->prefix[DISTRIBUTE_IN]);
675 vty_out (vty, "%s", VTY_NEWLINE);
677 else
678 vty_out (vty, " Incoming update filter list for all interface is not set%s", VTY_NEWLINE);
680 for (i = 0; i < disthash->size; i++)
681 for (mp = disthash->index[i]; mp; mp = mp->next)
683 dist = mp->data;
684 if (dist->ifname)
685 if (dist->list[DISTRIBUTE_IN] || dist->prefix[DISTRIBUTE_IN])
687 vty_out (vty, " %s filtered by", dist->ifname);
688 if (dist->list[DISTRIBUTE_IN])
689 vty_out (vty, " %s", dist->list[DISTRIBUTE_IN]);
690 if (dist->prefix[DISTRIBUTE_IN])
691 vty_out (vty, "%s (prefix-list) %s",
692 dist->list[DISTRIBUTE_IN] ? "," : "",
693 dist->prefix[DISTRIBUTE_IN]);
694 vty_out (vty, "%s", VTY_NEWLINE);
697 return 0;
700 /* Configuration write function. */
702 config_write_distribute (struct vty *vty)
704 unsigned int i;
705 struct hash_backet *mp;
706 int write = 0;
708 for (i = 0; i < disthash->size; i++)
709 for (mp = disthash->index[i]; mp; mp = mp->next)
711 struct distribute *dist;
713 dist = mp->data;
715 if (dist->list[DISTRIBUTE_IN])
717 vty_out (vty, " distribute-list %s in %s%s",
718 dist->list[DISTRIBUTE_IN],
719 dist->ifname ? dist->ifname : "",
720 VTY_NEWLINE);
721 write++;
724 if (dist->list[DISTRIBUTE_OUT])
726 vty_out (vty, " distribute-list %s out %s%s",
728 dist->list[DISTRIBUTE_OUT],
729 dist->ifname ? dist->ifname : "",
730 VTY_NEWLINE);
731 write++;
734 if (dist->prefix[DISTRIBUTE_IN])
736 vty_out (vty, " distribute-list prefix %s in %s%s",
737 dist->prefix[DISTRIBUTE_IN],
738 dist->ifname ? dist->ifname : "",
739 VTY_NEWLINE);
740 write++;
743 if (dist->prefix[DISTRIBUTE_OUT])
745 vty_out (vty, " distribute-list prefix %s out %s%s",
746 dist->prefix[DISTRIBUTE_OUT],
747 dist->ifname ? dist->ifname : "",
748 VTY_NEWLINE);
749 write++;
752 return write;
755 /* Clear all distribute list. */
756 void
757 distribute_list_reset ()
759 hash_clean (disthash, (void (*) (void *)) distribute_free);
762 /* Initialize distribute list related hash. */
763 void
764 distribute_list_init (int node)
766 disthash = hash_create ((unsigned int (*) (void *)) distribute_hash_make,
767 (int (*) (const void *, const void *)) distribute_cmp);
769 if(node==RIP_NODE) {
770 install_element (RIP_NODE, &distribute_list_all_cmd);
771 install_element (RIP_NODE, &no_distribute_list_all_cmd);
772 install_element (RIP_NODE, &distribute_list_cmd);
773 install_element (RIP_NODE, &no_distribute_list_cmd);
774 install_element (RIP_NODE, &distribute_list_prefix_all_cmd);
775 install_element (RIP_NODE, &no_distribute_list_prefix_all_cmd);
776 install_element (RIP_NODE, &distribute_list_prefix_cmd);
777 install_element (RIP_NODE, &no_distribute_list_prefix_cmd);
778 } else {
779 install_element (RIPNG_NODE, &ipv6_distribute_list_all_cmd);
780 install_element (RIPNG_NODE, &no_ipv6_distribute_list_all_cmd);
781 install_element (RIPNG_NODE, &ipv6_distribute_list_cmd);
782 install_element (RIPNG_NODE, &no_ipv6_distribute_list_cmd);
783 install_element (RIPNG_NODE, &ipv6_distribute_list_prefix_all_cmd);
784 install_element (RIPNG_NODE, &no_ipv6_distribute_list_prefix_all_cmd);
785 install_element (RIPNG_NODE, &ipv6_distribute_list_prefix_cmd);
786 install_element (RIPNG_NODE, &no_ipv6_distribute_list_prefix_cmd);