forked from Mirror/frr

whith the following config router bgp 65001 no bgp ebgp-requires-policy neighbor 192.168.1.2 remote-as external neighbor 192.168.1.2 timers 3 10 ! address-family ipv4 unicast neighbor 192.168.1.2 route-map r2 in exit-address-family exit ! bgp as-path access-list FIRST seq 5 permit ^65 bgp as-path access-list SECOND seq 5 permit 2$ ! route-map r2 permit 6 match ip address prefix-list p2 set as-path exclude as-path-access-list SECOND exit ! route-map r2 permit 10 match ip address prefix-list p1 set as-path exclude 65003 exit ! route-map r2 permit 20 match ip address prefix-list p3 set as-path exclude all exit making some no bgp as-path access-list SECOND permit 2$ bgp as-path access-list SECOND permit 3$ clear bgp * no bgp as-path access-list SECOND permit 3$ bgp as-path access-list SECOND permit 2$ clear bgp * will induce some crashes thus we rework the links between aslists and aspath_exclude Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
56 lines
1.1 KiB
C
56 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/* AS path filter list.
|
|
* Copyright (C) 1999 Kunihiro Ishiguro
|
|
*/
|
|
|
|
#ifndef _QUAGGA_BGP_FILTER_H
|
|
#define _QUAGGA_BGP_FILTER_H
|
|
|
|
#include <typesafe.h>
|
|
|
|
#define ASPATH_SEQ_NUMBER_AUTO -1
|
|
|
|
enum as_filter_type { AS_FILTER_DENY, AS_FILTER_PERMIT };
|
|
|
|
/* Element of AS path filter. */
|
|
struct as_filter {
|
|
struct as_filter *next;
|
|
struct as_filter *prev;
|
|
|
|
enum as_filter_type type;
|
|
|
|
regex_t *reg;
|
|
char *reg_str;
|
|
|
|
/* Sequence number. */
|
|
int64_t seq;
|
|
};
|
|
|
|
PREDECL_DLIST(as_list_list);
|
|
/* AS path filter list. */
|
|
struct as_list {
|
|
char *name;
|
|
|
|
struct as_list *next;
|
|
struct as_list *prev;
|
|
|
|
struct as_filter *head;
|
|
struct as_filter *tail;
|
|
|
|
/* Changes in AS path */
|
|
struct as_list_list_head exclude_rule;
|
|
};
|
|
|
|
|
|
extern void bgp_filter_init(void);
|
|
extern void bgp_filter_reset(void);
|
|
|
|
extern enum as_filter_type as_list_apply(struct as_list *, void *);
|
|
|
|
extern struct as_list *as_list_lookup(const char *);
|
|
extern void as_list_add_hook(void (*func)(char *));
|
|
extern void as_list_delete_hook(void (*func)(const char *));
|
|
extern bool config_bgp_aspath_validate(const char *regstr);
|
|
|
|
#endif /* _QUAGGA_BGP_FILTER_H */
|