]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_pbr.h
Merge pull request #5805 from donaldsharp/babel_int_return
[mirror_frr.git] / bgpd / bgp_pbr.h
index d15cb39c32e22acf29ba37de7487fb26364ea46c..393b08da4819285da0f92111b98635e487b76c80 100644 (file)
@@ -87,12 +87,10 @@ struct bgp_pbr_entry_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
@@ -103,6 +101,7 @@ struct bgp_pbr_entry_main {
 
 #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;
@@ -137,14 +136,6 @@ struct bgp_pbr_entry_main {
        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;
 };
 
@@ -167,6 +158,19 @@ struct bgp_pbr_config {
 
 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];
 
@@ -182,6 +186,7 @@ struct bgp_pbr_match {
        uint16_t tcp_mask_flags;
        uint8_t dscp_value;
        uint8_t fragment;
+       uint8_t protocol;
 
        vrf_id_t vrf_id;
 
@@ -251,6 +256,9 @@ struct bgp_pbr_action {
        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);
 
@@ -266,14 +274,17 @@ extern struct bgp_pbr_match *bgp_pbr_match_iptable_lookup(vrf_id_t vrf_id,
 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);
@@ -290,4 +301,7 @@ extern void bgp_pbr_reset(struct bgp *bgp, afi_t afi);
 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__ */