blob: 56e44b888e50f657d845d196978e68fbf449c63f [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 */
23#include <stdlib.h>
24#include <stdio.h>
25#include <zebra.h>
jardineb5d44e2003-12-23 08:09:43 +000026
27#include "thread.h"
28#include "linklist.h"
29#include "vty.h"
30#include "log.h"
31#include "memory.h"
32#include "prefix.h"
33#include "hash.h"
34#include "if.h"
35#include "table.h"
36#include "routemap.h"
37
38#include "isis_constants.h"
39#include "isis_common.h"
40#include "dict.h"
41#include "isisd.h"
42#include "isis_misc.h"
43#include "isis_adjacency.h"
44#include "isis_circuit.h"
45#include "isis_tlv.h"
46#include "isis_pdu.h"
47#include "isis_lsp.h"
48#include "isis_spf.h"
49#include "isis_route.h"
50#include "isis_zebra.h"
51
52extern struct isis *isis;
53
54void
hassof390d2c2004-09-10 20:48:21 +000055isis_route_map_upd ()
jardineb5d44e2003-12-23 08:09:43 +000056{
57 int i = 0;
hassof390d2c2004-09-10 20:48:21 +000058
jardineb5d44e2003-12-23 08:09:43 +000059 if (!isis)
60 return;
hassof390d2c2004-09-10 20:48:21 +000061
62 for (i = 0; i <= ZEBRA_ROUTE_MAX; i++)
63 {
64 if (isis->rmap[i].name)
65 isis->rmap[i].map = isis->rmap[i].map =
66 route_map_lookup_by_name (isis->rmap[i].name);
67 else
68 isis->rmap[i].map = NULL;
69 }
jardineb5d44e2003-12-23 08:09:43 +000070 /* FIXME: do the address family sub-mode AF_INET6 here ? */
71}
72
73void
hassof390d2c2004-09-10 20:48:21 +000074isis_route_map_event (route_map_event_t event, char *name)
jardineb5d44e2003-12-23 08:09:43 +000075{
76 int type;
77
78 if (!isis)
79 return;
80
hassof390d2c2004-09-10 20:48:21 +000081 for (type = 0; type <= ZEBRA_ROUTE_MAX; type++)
82 {
83 if (isis->rmap[type].name && isis->rmap[type].map &&
84 !strcmp (isis->rmap[type].name, name))
85 {
86 isis_distribute_list_update (type);
87 }
jardineb5d44e2003-12-23 08:09:43 +000088 }
jardineb5d44e2003-12-23 08:09:43 +000089}
90
jardineb5d44e2003-12-23 08:09:43 +000091void
92isis_route_map_init (void)
93{
94 route_map_init ();
95 route_map_init_vty ();
hassof390d2c2004-09-10 20:48:21 +000096
jardineb5d44e2003-12-23 08:09:43 +000097 route_map_add_hook (isis_route_map_upd);
98 route_map_delete_hook (isis_route_map_upd);
99 route_map_event_hook (isis_route_map_event);
jardineb5d44e2003-12-23 08:09:43 +0000100}