From 28b0c6b377e56e76c674c27e384238a755b173b2 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 9 Sep 2016 20:24:31 +0000 Subject: [PATCH] Unable to remove route-map from quagga Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp Ticket: CM-12816 pim was missing route-map hooks --- pimd/pim_routemap.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ pimd/pimd.c | 2 ++ pimd/pimd.h | 1 + vtysh/extract.pl.in | 4 ++-- 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/pimd/pim_routemap.c b/pimd/pim_routemap.c index ced7c87484..adfd4fd2c3 100644 --- a/pimd/pim_routemap.c +++ b/pimd/pim_routemap.c @@ -26,9 +26,56 @@ #include "pimd.h" + +static void +pim_route_map_mark_update (const char *rmap_name) +{ + // placeholder + return; +} + +static void +pim_route_map_add (const char *rmap_name) +{ + if (route_map_mark_updated(rmap_name, 0) == 0) + pim_route_map_mark_update(rmap_name); + + route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED); +} + +static void +pim_route_map_delete (const char *rmap_name) +{ + if (route_map_mark_updated(rmap_name, 1) == 0) + pim_route_map_mark_update(rmap_name); + + route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_DELETED); +} + +static void +pim_route_map_event (route_map_event_t event, const char *rmap_name) +{ + if (route_map_mark_updated(rmap_name, 0) == 0) + pim_route_map_mark_update(rmap_name); + + route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED); +} + void pim_route_map_init (void) { route_map_init (); route_map_init_vty (); + route_map_add_hook (pim_route_map_add); + route_map_delete_hook (pim_route_map_delete); + route_map_event_hook (pim_route_map_event); +} + +void +pim_route_map_terminate (void) +{ + route_map_add_hook (NULL); + route_map_delete_hook (NULL); + route_map_event_hook (NULL); + route_map_finish(); } diff --git a/pimd/pimd.c b/pimd/pimd.c index 5b6824da58..91d8d56afc 100644 --- a/pimd/pimd.c +++ b/pimd/pimd.c @@ -87,6 +87,8 @@ static void pim_free() if (qpim_static_route_list) list_free(qpim_static_route_list); + + pim_route_map_terminate(); } void pim_init() diff --git a/pimd/pimd.h b/pimd/pimd.h index 0a376aa905..6d48d83621 100644 --- a/pimd/pimd.h +++ b/pimd/pimd.h @@ -177,5 +177,6 @@ void pim_init(void); void pim_terminate(void); extern void pim_route_map_init (void); +extern void pim_route_map_terminate(void); #endif /* PIMD_H */ diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 31ab3b3ad8..7563daa506 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -121,7 +121,7 @@ foreach (@ARGV) { $protocol = "VTYSH_RIPD"; } elsif ($file =~ /lib\/routemap\.c$/) { - $protocol = "VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA"; + $protocol = "VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_PIMD"; } elsif ($file =~ /lib\/vrf\.c$/) { $protocol = "VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA"; @@ -136,7 +136,7 @@ foreach (@ARGV) { if ($defun_array[1] =~ m/ipv6/) { $protocol = "VTYSH_RIPNGD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA"; } else { - $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD|VTYSH_ZEBRA"; + $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_PIMD"; } } elsif ($file =~ /lib\/distribute\.c$/) { -- 2.39.5