jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1 | /* |
| 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 | */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 23 | #include <zebra.h> |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 24 | |
| 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" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 38 | #include "isis_flags.h" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 39 | #include "dict.h" |
| 40 | #include "isisd.h" |
| 41 | #include "isis_misc.h" |
| 42 | #include "isis_adjacency.h" |
| 43 | #include "isis_circuit.h" |
| 44 | #include "isis_tlv.h" |
| 45 | #include "isis_pdu.h" |
| 46 | #include "isis_lsp.h" |
| 47 | #include "isis_spf.h" |
| 48 | #include "isis_route.h" |
| 49 | #include "isis_zebra.h" |
| 50 | |
| 51 | extern struct isis *isis; |
| 52 | |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 53 | /* |
| 54 | * Prototypes. |
| 55 | */ |
| 56 | void isis_route_map_upd(const char *); |
| 57 | void isis_route_map_event(route_map_event_t, const char *); |
| 58 | void isis_route_map_init(void); |
| 59 | |
| 60 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 61 | void |
hasso | f90a5f6 | 2004-10-11 13:11:56 +0000 | [diff] [blame] | 62 | isis_route_map_upd (const char *name) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 63 | { |
| 64 | int i = 0; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 65 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 66 | if (!isis) |
| 67 | return; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 68 | |
| 69 | for (i = 0; i <= ZEBRA_ROUTE_MAX; i++) |
| 70 | { |
| 71 | if (isis->rmap[i].name) |
| 72 | isis->rmap[i].map = isis->rmap[i].map = |
| 73 | route_map_lookup_by_name (isis->rmap[i].name); |
| 74 | else |
| 75 | isis->rmap[i].map = NULL; |
| 76 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 77 | /* FIXME: do the address family sub-mode AF_INET6 here ? */ |
| 78 | } |
| 79 | |
| 80 | void |
hasso | f90a5f6 | 2004-10-11 13:11:56 +0000 | [diff] [blame] | 81 | isis_route_map_event (route_map_event_t event, const char *name) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 82 | { |
| 83 | int type; |
| 84 | |
| 85 | if (!isis) |
| 86 | return; |
| 87 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 88 | for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) |
| 89 | { |
| 90 | if (isis->rmap[type].name && isis->rmap[type].map && |
| 91 | !strcmp (isis->rmap[type].name, name)) |
| 92 | { |
| 93 | isis_distribute_list_update (type); |
| 94 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 95 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 96 | } |
| 97 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 98 | void |
| 99 | isis_route_map_init (void) |
| 100 | { |
| 101 | route_map_init (); |
| 102 | route_map_init_vty (); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 103 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 104 | route_map_add_hook (isis_route_map_upd); |
| 105 | route_map_delete_hook (isis_route_map_upd); |
| 106 | route_map_event_hook (isis_route_map_event); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 107 | } |