uint16_t value;
uint8_t compare_operator;
uint8_t unary_operator;
-} bgp_pbr_value_t;
+};
#define FRAGMENT_DONT 1
#define FRAGMENT_IS 2
#define FRAGMENT_FIRST 4
#define FRAGMENT_LAST 8
-struct bgp_pbr_fragment_val {
- uint8_t bitmask;
-};
-
struct bgp_pbr_entry_action {
/* used to store enum bgp_pbr_action_enum enumerate */
uint8_t action;
/* BGP Policy Route structure */
struct bgp_pbr_entry_main {
+#define BGP_PBR_UNDEFINED 0
+#define BGP_PBR_IPSET 1
+#define BGP_PBR_IPRULE 2
uint8_t type;
- uint16_t instance;
-
- uint32_t flags;
-
- uint8_t message;
/*
* This is an enum but we are going to treat it as a uint8_t
#define PREFIX_SRC_PRESENT (1 << 0)
#define PREFIX_DST_PRESENT (1 << 1)
+ uint8_t match_bitmask_iprule;
uint8_t match_bitmask;
uint8_t match_src_port_num;
uint16_t action_num;
struct bgp_pbr_entry_action actions[ACTIONS_MAX_NUM];
- uint8_t distance;
-
- uint32_t metric;
-
- route_tag_t tag;
-
- uint32_t mtu;
-
vrf_id_t vrf_id;
};
extern struct bgp_pbr_config *bgp_pbr_cfg;
+struct bgp_pbr_rule {
+ uint32_t flags;
+ struct prefix src;
+ struct prefix dst;
+ struct bgp_pbr_action *action;
+ vrf_id_t vrf_id;
+ uint32_t unique;
+ uint32_t priority;
+ bool installed;
+ bool install_in_progress;
+ void *path;
+};
+
struct bgp_pbr_match {
char ipset_name[ZEBRA_IPSET_NAME_SIZE];
uint16_t tcp_mask_flags;
uint8_t dscp_value;
uint8_t fragment;
+ uint8_t protocol;
vrf_id_t vrf_id;
uint16_t dst_port_max;
uint8_t proto;
- void *bgp_info;
+ void *path;
bool installed;
bool install_in_progress;
struct bgp *bgp;
};
+extern struct bgp_pbr_rule *bgp_pbr_rule_lookup(vrf_id_t vrf_id,
+ uint32_t unique);
+
extern struct bgp_pbr_action *bgp_pbr_action_rule_lookup(vrf_id_t vrf_id,
uint32_t unique);
extern void bgp_pbr_cleanup(struct bgp *bgp);
extern void bgp_pbr_init(struct bgp *bgp);
-extern uint32_t bgp_pbr_action_hash_key(void *arg);
-extern int bgp_pbr_action_hash_equal(const void *arg1,
+extern uint32_t bgp_pbr_rule_hash_key(const void *arg);
+extern bool bgp_pbr_rule_hash_equal(const void *arg1,
+ const void *arg2);
+extern uint32_t bgp_pbr_action_hash_key(const void *arg);
+extern bool bgp_pbr_action_hash_equal(const void *arg1,
const void *arg2);
-extern uint32_t bgp_pbr_match_entry_hash_key(void *arg);
-extern int bgp_pbr_match_entry_hash_equal(const void *arg1,
+extern uint32_t bgp_pbr_match_entry_hash_key(const void *arg);
+extern bool bgp_pbr_match_entry_hash_equal(const void *arg1,
const void *arg2);
-extern uint32_t bgp_pbr_match_hash_key(void *arg);
-extern int bgp_pbr_match_hash_equal(const void *arg1,
+extern uint32_t bgp_pbr_match_hash_key(const void *arg);
+extern bool bgp_pbr_match_hash_equal(const void *arg1,
const void *arg2);
void bgp_pbr_print_policy_route(struct bgp_pbr_entry_main *api);
struct bgp_node;
-struct bgp_info;
+struct bgp_path_info;
extern void bgp_pbr_update_entry(struct bgp *bgp, struct prefix *p,
- struct bgp_info *new_select,
- afi_t afi, safi_t safi,
- bool nlri_update);
+ struct bgp_path_info *new_select, afi_t afi,
+ safi_t safi, bool nlri_update);
/* bgp pbr utilities */
extern struct bgp_pbr_interface *pbr_interface_lookup(const char *name);
extern struct bgp_pbr_interface *bgp_pbr_interface_lookup(const char *name,
struct bgp_pbr_interface_head *head);
+extern int bgp_pbr_build_and_validate_entry(struct prefix *p,
+ struct bgp_path_info *path,
+ struct bgp_pbr_entry_main *api);
#endif /* __BGP_PBR_H__ */