diff options
Diffstat (limited to 'lib/distribute.c')
-rw-r--r-- | lib/distribute.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/lib/distribute.c b/lib/distribute.c index 420849da..8c0f057e 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -20,6 +20,7 @@ */ #include <zebra.h> +#include "miyagi.h" #include "hash.h" #include "if.h" @@ -34,7 +35,7 @@ struct hash *disthash; /* Hook functions. */ void (*distribute_add_hook) (struct distribute *); void (*distribute_delete_hook) (struct distribute *); - + static struct distribute * distribute_new (void) { @@ -69,10 +70,10 @@ distribute_lookup (const char *ifname) struct distribute *dist; /* temporary reference */ - key.ifname = (char *)ifname; + key.ifname = miyagi(ifname) ; dist = hash_lookup (disthash, &key); - + return dist; } @@ -108,8 +109,8 @@ distribute_get (const char *ifname) struct distribute key; /* temporary reference */ - key.ifname = (char *)ifname; - + key.ifname = miyagi(ifname) ; + return hash_get (disthash, &key, (void * (*) (void *))distribute_hash_alloc); } @@ -133,10 +134,10 @@ distribute_cmp (const struct distribute *dist1, const struct distribute *dist2) return 1; return 0; } - + /* Set access-list name to the distribute list. */ static struct distribute * -distribute_list_set (const char *ifname, enum distribute_type type, +distribute_list_set (const char *ifname, enum distribute_type type, const char *alist_name) { struct distribute *dist; @@ -158,14 +159,14 @@ distribute_list_set (const char *ifname, enum distribute_type type, /* Apply this distribute-list to the interface. */ (*distribute_add_hook) (dist); - + return dist; } /* Unset distribute-list. If matched distribute-list exist then return 1. */ static int -distribute_list_unset (const char *ifname, enum distribute_type type, +distribute_list_unset (const char *ifname, enum distribute_type type, const char *alist_name) { struct distribute *dist; @@ -182,7 +183,7 @@ distribute_list_unset (const char *ifname, enum distribute_type type, return 0; free (dist->list[DISTRIBUTE_IN]); - dist->list[DISTRIBUTE_IN] = NULL; + dist->list[DISTRIBUTE_IN] = NULL; } if (type == DISTRIBUTE_OUT) @@ -193,7 +194,7 @@ distribute_list_unset (const char *ifname, enum distribute_type type, return 0; free (dist->list[DISTRIBUTE_OUT]); - dist->list[DISTRIBUTE_OUT] = NULL; + dist->list[DISTRIBUTE_OUT] = NULL; } /* Apply this distribute-list to the interface. */ @@ -236,7 +237,7 @@ distribute_list_prefix_set (const char *ifname, enum distribute_type type, /* Apply this distribute-list to the interface. */ (*distribute_add_hook) (dist); - + return dist; } @@ -260,7 +261,7 @@ distribute_list_prefix_unset (const char *ifname, enum distribute_type type, return 0; free (dist->prefix[DISTRIBUTE_IN]); - dist->prefix[DISTRIBUTE_IN] = NULL; + dist->prefix[DISTRIBUTE_IN] = NULL; } if (type == DISTRIBUTE_OUT) @@ -271,7 +272,7 @@ distribute_list_prefix_unset (const char *ifname, enum distribute_type type, return 0; free (dist->prefix[DISTRIBUTE_OUT]); - dist->prefix[DISTRIBUTE_OUT] = NULL; + dist->prefix[DISTRIBUTE_OUT] = NULL; } /* Apply this distribute-list to the interface. */ @@ -396,7 +397,7 @@ DEFUN (distribute_list, dist = distribute_list_set (argv[2], type, argv[0]); return CMD_SUCCESS; -} +} ALIAS (distribute_list, ipv6_distribute_list_cmd, @@ -437,7 +438,7 @@ DEFUN (no_districute_list, no_distribute_list_cmd, return CMD_WARNING; } return CMD_SUCCESS; -} +} ALIAS (no_districute_list, no_ipv6_distribute_list_cmd, "no distribute-list WORD (in|out) WORD", @@ -467,7 +468,7 @@ DEFUN (districute_list_prefix_all, type = DISTRIBUTE_OUT; else { - vty_out (vty, "distribute list direction must be [in|out]%s", + vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE); return CMD_WARNING; } @@ -476,7 +477,7 @@ DEFUN (districute_list_prefix_all, dist = distribute_list_prefix_set (NULL, type, argv[0]); return CMD_SUCCESS; -} +} ALIAS (districute_list_prefix_all, ipv6_distribute_list_prefix_all_cmd, @@ -507,7 +508,7 @@ DEFUN (no_districute_list_prefix_all, type = DISTRIBUTE_OUT; else { - vty_out (vty, "distribute list direction must be [in|out]%s", + vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE); return CMD_WARNING; } @@ -519,7 +520,7 @@ DEFUN (no_districute_list_prefix_all, return CMD_WARNING; } return CMD_SUCCESS; -} +} ALIAS (no_districute_list_prefix_all, no_ipv6_distribute_list_prefix_all_cmd, @@ -550,7 +551,7 @@ DEFUN (districute_list_prefix, distribute_list_prefix_cmd, type = DISTRIBUTE_OUT; else { - vty_out (vty, "distribute list direction must be [in|out]%s", + vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE); return CMD_WARNING; } @@ -559,7 +560,7 @@ DEFUN (districute_list_prefix, distribute_list_prefix_cmd, dist = distribute_list_prefix_set (argv[2], type, argv[0]); return CMD_SUCCESS; -} +} ALIAS (districute_list_prefix, ipv6_distribute_list_prefix_cmd, "distribute-list prefix WORD (in|out) WORD", @@ -590,7 +591,7 @@ DEFUN (no_districute_list_prefix, no_distribute_list_prefix_cmd, type = DISTRIBUTE_OUT; else { - vty_out (vty, "distribute list direction must be [in|out]%s", + vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE); return CMD_WARNING; } @@ -602,7 +603,7 @@ DEFUN (no_districute_list_prefix, no_distribute_list_prefix_cmd, return CMD_WARNING; } return CMD_SUCCESS; -} +} ALIAS (no_districute_list_prefix, no_ipv6_distribute_list_prefix_cmd, "no distribute-list prefix WORD (in|out) WORD", @@ -709,7 +710,7 @@ config_write_distribute (struct vty *vty) if (dist->list[DISTRIBUTE_IN]) { - vty_out (vty, " distribute-list %s in %s%s", + vty_out (vty, " distribute-list %s in %s%s", dist->list[DISTRIBUTE_IN], dist->ifname ? dist->ifname : "", VTY_NEWLINE); @@ -718,7 +719,7 @@ config_write_distribute (struct vty *vty) if (dist->list[DISTRIBUTE_OUT]) { - vty_out (vty, " distribute-list %s out %s%s", + vty_out (vty, " distribute-list %s out %s%s", dist->list[DISTRIBUTE_OUT], dist->ifname ? dist->ifname : "", |