blob: 4df983d2b62726143ab2e47076e270199c449851 [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>
26#include <net/ethernet.h>
27
28#include "thread.h"
29#include "linklist.h"
30#include "vty.h"
31#include "log.h"
32#include "memory.h"
33#include "prefix.h"
34#include "hash.h"
35#include "if.h"
36#include "table.h"
37#include "routemap.h"
38
39#include "isis_constants.h"
40#include "isis_common.h"
41#include "dict.h"
42#include "isisd.h"
43#include "isis_misc.h"
44#include "isis_adjacency.h"
45#include "isis_circuit.h"
46#include "isis_tlv.h"
47#include "isis_pdu.h"
48#include "isis_lsp.h"
49#include "isis_spf.h"
50#include "isis_route.h"
51#include "isis_zebra.h"
52
53extern struct isis *isis;
54
55void
56isis_route_map_upd()
57{
58 int i = 0;
59
60 if (!isis)
61 return;
62
63 for (i = 0; i <= ZEBRA_ROUTE_MAX; i++) {
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 }
70 /* FIXME: do the address family sub-mode AF_INET6 here ? */
71}
72
73void
74isis_route_map_event(route_map_event_t event, char *name)
75{
76 int type;
77
78 if (!isis)
79 return;
80
81 for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
82 if (isis->rmap[type].name && isis->rmap[type].map &&
83 !strcmp (isis->rmap[type].name, name)) {
84 isis_distribute_list_update (type);
85 }
86 }
87}
88
89
90void
91isis_route_map_init (void)
92{
93 route_map_init ();
94 route_map_init_vty ();
95
96 route_map_add_hook (isis_route_map_upd);
97 route_map_delete_hook (isis_route_map_upd);
98 route_map_event_hook (isis_route_map_event);
99
100}