blob: 4235d882f32aa641b0d63aeb4a9f458fbe747e51 [file] [log] [blame]
jardineb5d44e2003-12-23 08:09:43 +00001/*
2 * IS-IS Rout(e)ing protocol - isis_routemap.c
3 *
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public Licenseas published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
jardineb5d44e2003-12-23 08:09:43 +000023#include <zebra.h>
jardineb5d44e2003-12-23 08:09:43 +000024
25#include "thread.h"
26#include "linklist.h"
27#include "vty.h"
28#include "log.h"
29#include "memory.h"
30#include "prefix.h"
31#include "hash.h"
32#include "if.h"
33#include "table.h"
34#include "routemap.h"
35
36#include "isis_constants.h"
37#include "isis_common.h"
38#include "dict.h"
39#include "isisd.h"
40#include "isis_misc.h"
41#include "isis_adjacency.h"
42#include "isis_circuit.h"
43#include "isis_tlv.h"
44#include "isis_pdu.h"
45#include "isis_lsp.h"
46#include "isis_spf.h"
47#include "isis_route.h"
48#include "isis_zebra.h"
49
50extern struct isis *isis;
51
52void
hassof90a5f62004-10-11 13:11:56 +000053isis_route_map_upd (const char *name)
jardineb5d44e2003-12-23 08:09:43 +000054{
55 int i = 0;
hassof390d2c2004-09-10 20:48:21 +000056
jardineb5d44e2003-12-23 08:09:43 +000057 if (!isis)
58 return;
hassof390d2c2004-09-10 20:48:21 +000059
60 for (i = 0; i <= ZEBRA_ROUTE_MAX; i++)
61 {
62 if (isis->rmap[i].name)
63 isis->rmap[i].map = isis->rmap[i].map =
64 route_map_lookup_by_name (isis->rmap[i].name);
65 else
66 isis->rmap[i].map = NULL;
67 }
jardineb5d44e2003-12-23 08:09:43 +000068 /* FIXME: do the address family sub-mode AF_INET6 here ? */
69}
70
71void
hassof90a5f62004-10-11 13:11:56 +000072isis_route_map_event (route_map_event_t event, const char *name)
jardineb5d44e2003-12-23 08:09:43 +000073{
74 int type;
75
76 if (!isis)
77 return;
78
hassof390d2c2004-09-10 20:48:21 +000079 for (type = 0; type <= ZEBRA_ROUTE_MAX; type++)
80 {
81 if (isis->rmap[type].name && isis->rmap[type].map &&
82 !strcmp (isis->rmap[type].name, name))
83 {
84 isis_distribute_list_update (type);
85 }
jardineb5d44e2003-12-23 08:09:43 +000086 }
jardineb5d44e2003-12-23 08:09:43 +000087}
88
jardineb5d44e2003-12-23 08:09:43 +000089void
90isis_route_map_init (void)
91{
92 route_map_init ();
93 route_map_init_vty ();
hassof390d2c2004-09-10 20:48:21 +000094
jardineb5d44e2003-12-23 08:09:43 +000095 route_map_add_hook (isis_route_map_upd);
96 route_map_delete_hook (isis_route_map_upd);
97 route_map_event_hook (isis_route_map_event);
jardineb5d44e2003-12-23 08:09:43 +000098}