From 039f3a3495b9b19e486d296de57a8ba46f9a8c87 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 7 Jan 2016 10:03:01 -0500 Subject: [PATCH] lib, bgpd, tests: Refactor FILTER_X in zebra.h lib/zebra.h has FILTER_X #define's. These do not belong there. Put them in lib/filter.h where they belong. Signed-off-by: Donald Sharp (cherry picked from commit 0490729cc033a3483fc6b0ed45085ee249cac779) --- bgpd/bgp_advertise.c | 1 + bgpd/bgp_aspath.c | 1 + bgpd/bgp_attr.c | 1 + bgpd/bgp_bfd.c | 2 ++ bgpd/bgp_btoa.c | 1 + bgpd/bgp_clist.c | 1 + bgpd/bgp_damp.c | 1 + bgpd/bgp_debug.c | 1 + bgpd/bgp_dump.c | 2 +- bgpd/bgp_ecommunity.c | 1 + bgpd/bgp_filter.c | 9 ++------- bgpd/bgp_fsm.c | 1 + bgpd/bgp_mpath.c | 1 + bgpd/bgp_mplsvpn.c | 1 + bgpd/bgp_network.c | 1 + bgpd/bgp_nexthop.c | 1 + bgpd/bgp_nht.c | 1 + bgpd/bgp_open.c | 1 + bgpd/bgp_packet.c | 1 + bgpd/bgp_regex.c | 1 + bgpd/bgp_snmp.c | 1 + bgpd/bgp_table.c | 1 + bgpd/bgp_updgrp_adv.c | 1 + bgpd/bgp_vty.c | 1 + bgpd/bgp_zebra.c | 1 + lib/filter.h | 5 +++++ lib/zebra.h | 5 ----- tests/aspath_test.c | 1 + tests/bgp_capability_test.c | 1 + tests/bgp_mp_attr_test.c | 1 + tests/bgp_mpath_test.c | 1 + tests/ecommunity_test.c | 1 + vtysh/vtysh.c | 1 + 33 files changed, 38 insertions(+), 13 deletions(-) diff --git a/bgpd/bgp_advertise.c b/bgpd/bgp_advertise.c index de27513a42..da5ab94e97 100644 --- a/bgpd/bgp_advertise.c +++ b/bgpd/bgp_advertise.c @@ -26,6 +26,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "hash.h" #include "thread.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index 4161d149fa..eca4441010 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -30,6 +30,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "stream.h" #include "jhash.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_aspath.h" diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index eefdd9e8ec..dc157ba7d0 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -31,6 +31,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "jhash.h" #include "queue.h" #include "table.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_attr.h" diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index b8b0053695..b0c812cca9 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -34,6 +34,8 @@ #include "vty.h" #include "bfd.h" #include "lib/json.h" +#include "filter.h" + #include "bgpd/bgpd.h" #include "bgp_fsm.h" #include "bgpd/bgp_bfd.h" diff --git a/bgpd/bgp_btoa.c b/bgpd/bgp_btoa.c index a6c16d8c2d..904ae66e10 100644 --- a/bgpd/bgp_btoa.c +++ b/bgpd/bgp_btoa.c @@ -27,6 +27,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "command.h" #include "memory.h" #include "privs.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_dump.h" diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c index 4beae4391e..12c936b190 100644 --- a/bgpd/bgp_clist.c +++ b/bgpd/bgp_clist.c @@ -24,6 +24,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "prefix.h" #include "memory.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_community.h" diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index 2e2dc42ad1..f4a83d720b 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -27,6 +27,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "log.h" #include "thread.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_damp.h" diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 5b6ee0e070..7427afed7b 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -30,6 +30,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "sockunion.h" #include "memory.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_aspath.h" diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 59bb2f8a13..e219d5248e 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -29,9 +29,9 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "linklist.h" #include "queue.h" #include "memory.h" +#include "filter.h" #include "bgpd/bgp_table.h" - #include "bgpd/bgpd.h" #include "bgpd/bgp_route.h" #include "bgpd/bgp_attr.h" diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index dc0137fd19..e55ce3528c 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -25,6 +25,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "prefix.h" #include "command.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_ecommunity.h" diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 693c639f75..33877e7258 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -25,6 +25,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "memory.h" #include "buffer.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_aspath.h" @@ -66,18 +67,12 @@ struct as_filter char *reg_str; }; -enum as_list_type -{ - ACCESS_TYPE_STRING, - ACCESS_TYPE_NUMBER -}; - /* AS path filter list. */ struct as_list { char *name; - enum as_list_type type; + enum access_type type; struct as_list *next; struct as_list *prev; diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 9da21fdffd..ae77ac421a 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -32,6 +32,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "plist.h" #include "workqueue.h" #include "queue.h" +#include "filter.h" #include "lib/json.h" #include "bgpd/bgpd.h" diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index 8397177f8f..9d742204f6 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -29,6 +29,7 @@ #include "sockunion.h" #include "memory.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 00f8221bcb..4650495faf 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -26,6 +26,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "memory.h" #include "stream.h" #include "queue.h" +#include "filter.h" #include "lib/json.h" #include "bgpd/bgpd.h" diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index bafc666a19..0caada488b 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -33,6 +33,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "network.h" #include "queue.h" #include "hash.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_open.h" diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 80495065b0..d96224c093 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -32,6 +32,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "jhash.h" #include "nexthop.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 9d8d8f3b52..42885165c7 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -31,6 +31,7 @@ #include "memory.h" #include "nexthop.h" #include "vrf.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 8765488881..915757e622 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -28,6 +28,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "command.h" #include "memory.h" #include "queue.h" +#include "filter.h" #include "lib/json.h" #include "bgpd/bgpd.h" diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 0236f6777a..937623a30b 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -32,6 +32,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "linklist.h" #include "plist.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" diff --git a/bgpd/bgp_regex.c b/bgpd/bgp_regex.c index 15c23c9ff9..ea87633dc0 100644 --- a/bgpd/bgp_regex.c +++ b/bgpd/bgp_regex.c @@ -24,6 +24,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "command.h" #include "memory.h" #include "queue.h" +#include "filter.h" #include "bgpd.h" #include "bgp_aspath.h" diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c index fc5a0eb59c..5e6218e8a3 100644 --- a/bgpd/bgp_snmp.c +++ b/bgpd/bgp_snmp.c @@ -30,6 +30,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "command.h" #include "thread.h" #include "smux.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index 1df24859f5..114c6ef013 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -25,6 +25,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "sockunion.h" #include "vty.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index 4b684be1bb..96bcd011ca 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -36,6 +36,7 @@ #include "thread.h" #include "queue.h" #include "routemap.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 9df92fea03..4b1174b16d 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -32,6 +32,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "memory.h" #include "hash.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_advertise.h" diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 874d80bd8e..ce5d1b498e 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -33,6 +33,7 @@ Boston, MA 02111-1307, USA. */ #include "memory.h" #include "lib/json.h" #include "lib/bfd.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_route.h" diff --git a/lib/filter.h b/lib/filter.h index 37535cb13b..e6ccd33b3a 100644 --- a/lib/filter.h +++ b/lib/filter.h @@ -25,6 +25,11 @@ #include "if.h" +/* Filter direction. */ +#define FILTER_IN 0 +#define FILTER_OUT 1 +#define FILTER_MAX 2 + /* Filter type is made by `permit', `deny' and `dynamic'. */ enum filter_type { diff --git a/lib/zebra.h b/lib/zebra.h index 59c154ba46..b3a814c0d2 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -522,11 +522,6 @@ typedef enum { #define SAFI_ENCAP 7 /* per IANA */ #define SAFI_MAX 8 -/* Filter direction. */ -#define FILTER_IN 0 -#define FILTER_OUT 1 -#define FILTER_MAX 2 - /* Default Administrative Distance of each protocol. */ #define ZEBRA_KERNEL_DISTANCE_DEFAULT 0 #define ZEBRA_CONNECT_DISTANCE_DEFAULT 0 diff --git a/tests/aspath_test.c b/tests/aspath_test.c index fde12c41c4..9d595807fe 100644 --- a/tests/aspath_test.c +++ b/tests/aspath_test.c @@ -25,6 +25,7 @@ #include "stream.h" #include "privs.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_aspath.h" diff --git a/tests/bgp_capability_test.c b/tests/bgp_capability_test.c index ecabc2f19f..73f46b59a0 100644 --- a/tests/bgp_capability_test.c +++ b/tests/bgp_capability_test.c @@ -26,6 +26,7 @@ #include "privs.h" #include "memory.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_open.h" diff --git a/tests/bgp_mp_attr_test.c b/tests/bgp_mp_attr_test.c index ba619916d4..928d69752a 100644 --- a/tests/bgp_mp_attr_test.c +++ b/tests/bgp_mp_attr_test.c @@ -26,6 +26,7 @@ #include "privs.h" #include "memory.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_attr.h" diff --git a/tests/bgp_mpath_test.c b/tests/bgp_mpath_test.c index bafbef75fb..66a718cbe2 100644 --- a/tests/bgp_mpath_test.c +++ b/tests/bgp_mpath_test.c @@ -30,6 +30,7 @@ #include "memory.h" #include "zclient.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" diff --git a/tests/ecommunity_test.c b/tests/ecommunity_test.c index 1d4f6a1860..9166af6142 100644 --- a/tests/ecommunity_test.c +++ b/tests/ecommunity_test.c @@ -25,6 +25,7 @@ #include "privs.h" #include "memory.h" #include "queue.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_ecommunity.h" diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index ad43f41fd9..80ee0acc3e 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -37,6 +37,7 @@ #include "linklist.h" #include "command.h" #include "memory.h" +#include "filter.h" #include "vtysh/vtysh.h" #include "log.h" #include "bgpd/bgp_vty.h" -- 2.39.5