]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Rework code to use `const struct prefix`
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 22 Mar 2020 01:56:36 +0000 (21:56 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 24 Mar 2020 11:51:41 +0000 (07:51 -0400)
Future work needs the ability to specify a
const struct prefix value.  Iterate into
bgp a bit to get this started.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
23 files changed:
bgpd/bgp_evpn.c
bgpd/bgp_evpn.h
bgpd/bgp_mac.c
bgpd/bgp_mac.h
bgpd/bgp_pbr.c
bgpd/bgp_pbr.h
bgpd/bgp_rd.c
bgpd/bgp_rd.h
bgpd/bgp_route.c
bgpd/bgp_route.h
bgpd/bgp_zebra.c
bgpd/bgp_zebra.h
bgpd/rfapi/rfapi.c
bgpd/rfapi/rfapi_backend.h
bgpd/rfapi/rfapi_import.c
bgpd/rfapi/rfapi_import.h
bgpd/rfapi/rfapi_private.h
bgpd/rfapi/vnc_export_bgp.c
bgpd/rfapi/vnc_export_bgp_p.h
bgpd/rfapi/vnc_export_table.c
bgpd/rfapi/vnc_export_table.h
bgpd/rfapi/vnc_import_bgp.c
bgpd/rfapi/vnc_import_bgp.h

index 5972359f73b7a569e2e081e349873b2b0179d2ee..5202f6801e818b9eec7b6417c1d055f5c99db5e0 100644 (file)
@@ -3524,7 +3524,7 @@ static int install_uninstall_route_in_vnis(struct bgp *bgp, afi_t afi,
  * Install or uninstall route for appropriate VNIs/ESIs.
  */
 static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi,
-                                       struct prefix *p,
+                                       const struct prefix *p,
                                        struct bgp_path_info *pi, int import)
 {
        struct prefix_evpn *evp = (struct prefix_evpn *)p;
@@ -5550,7 +5550,7 @@ void bgp_evpn_es_free(struct bgp *bgp, struct evpnes *es)
  * Import evpn route from global table to VNI/VRF/ESI.
  */
 int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi,
-                         struct prefix *p, struct bgp_path_info *pi)
+                         const struct prefix *p, struct bgp_path_info *pi)
 {
        return install_uninstall_evpn_route(bgp, afi, safi, p, pi, 1);
 }
@@ -5559,7 +5559,7 @@ int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi,
  * Unimport evpn route from VNI/VRF/ESI.
  */
 int bgp_evpn_unimport_route(struct bgp *bgp, afi_t afi, safi_t safi,
-                           struct prefix *p, struct bgp_path_info *pi)
+                           const struct prefix *p, struct bgp_path_info *pi)
 {
        return install_uninstall_evpn_route(bgp, afi, safi, p, pi, 0);
 }
@@ -6280,7 +6280,7 @@ int bgp_evpn_get_type5_prefixlen(struct prefix *pfx)
 /*
  * Should we register nexthop for this EVPN prefix for nexthop tracking?
  */
-bool bgp_evpn_is_prefix_nht_supported(struct prefix *pfx)
+bool bgp_evpn_is_prefix_nht_supported(const struct prefix *pfx)
 {
        struct prefix_evpn *evp = (struct prefix_evpn *)pfx;
 
index 308ced098f8a2cf93774b6c93cb091f2c492d992..219321fc6830544c1b13927319d35873172a26a1 100644 (file)
@@ -164,9 +164,11 @@ extern void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p,
 extern int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
                               struct bgp_nlri *packet, int withdraw);
 extern int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi,
-                                struct prefix *p, struct bgp_path_info *ri);
+                                const struct prefix *p,
+                                struct bgp_path_info *ri);
 extern int bgp_evpn_unimport_route(struct bgp *bgp, afi_t afi, safi_t safi,
-                                  struct prefix *p, struct bgp_path_info *ri);
+                                  const struct prefix *p,
+                                  struct bgp_path_info *ri);
 extern int bgp_filter_evpn_routes_upon_martian_nh_change(struct bgp *bgp);
 extern int bgp_evpn_local_macip_del(struct bgp *bgp, vni_t vni,
                                    struct ethaddr *mac, struct ipaddr *ip,
@@ -194,7 +196,7 @@ extern void bgp_evpn_cleanup_on_disable(struct bgp *bgp);
 extern void bgp_evpn_cleanup(struct bgp *bgp);
 extern void bgp_evpn_init(struct bgp *bgp);
 extern int bgp_evpn_get_type5_prefixlen(struct prefix *pfx);
-extern bool bgp_evpn_is_prefix_nht_supported(struct prefix *pfx);
+extern bool bgp_evpn_is_prefix_nht_supported(const struct prefix *pfx);
 extern void update_advertise_vrf_routes(struct bgp *bgp_vrf);
 
 #endif /* _QUAGGA_BGP_EVPN_H */
index 537bb45455e8c2357485fc88f4c22389a4789436..fed88fd508abf4257741b5b8a9224f49be0165e2 100644 (file)
@@ -358,7 +358,7 @@ void bgp_mac_del_mac_entry(struct interface *ifp)
  * An example: router-mac attribute in any of evpn update
  * requires to compare against local mac.
  */
-bool bgp_mac_exist(struct ethaddr *mac)
+bool bgp_mac_exist(const struct ethaddr *mac)
 {
        struct bgp_self_mac lookup;
        struct bgp_self_mac *bsm;
@@ -379,9 +379,9 @@ bool bgp_mac_exist(struct ethaddr *mac)
  * mac against any of local assigned (SVIs) MAC
  * address.
  */
-bool bgp_mac_entry_exists(struct prefix *p)
+bool bgp_mac_entry_exists(const struct prefix *p)
 {
-       struct prefix_evpn *pevpn = (struct prefix_evpn *)p;
+       const struct prefix_evpn *pevpn = (const struct prefix_evpn *)p;
 
        if (pevpn->family != AF_EVPN)
                return false;
index 68449b574ab3062e8cf84b5c2dd9b26617467fb4..4b94d80d1a36a8e7be135f9168729fd5312d70f7 100644 (file)
@@ -36,7 +36,7 @@ void bgp_mac_dump_table(struct vty *vty);
 /*
  * Function to lookup the prefix and see if we have a matching mac
  */
-bool bgp_mac_entry_exists(struct prefix *p);
-bool bgp_mac_exist(struct ethaddr *mac);
+bool bgp_mac_entry_exists(const struct prefix *p);
+bool bgp_mac_exist(const struct ethaddr *mac);
 
 #endif
index 172ec8b42e95970650c0dc728d1280633bacc53a..fd3fad63f51627aedfc24b915efb7db4df6d63b5 100644 (file)
@@ -685,9 +685,9 @@ static int bgp_pbr_validate_policy_route(struct bgp_pbr_entry_main *api)
 }
 
 /* return -1 if build or validation failed */
-int bgp_pbr_build_and_validate_entry(struct prefix *p,
-                                           struct bgp_path_info *path,
-                                           struct bgp_pbr_entry_main *api)
+int bgp_pbr_build_and_validate_entry(const struct prefix *p,
+                                    struct bgp_path_info *path,
+                                    struct bgp_pbr_entry_main *api)
 {
        int ret;
        int i, action_count = 0;
@@ -2610,7 +2610,7 @@ static void bgp_pbr_handle_entry(struct bgp *bgp, struct bgp_path_info *path,
        }
 }
 
-void bgp_pbr_update_entry(struct bgp *bgp, struct prefix *p,
+void bgp_pbr_update_entry(struct bgp *bgp, const struct prefix *p,
                          struct bgp_path_info *info, afi_t afi, safi_t safi,
                          bool nlri_update)
 {
index 393b08da4819285da0f92111b98635e487b76c80..47d5e2169212b5cef904ee78c5d5ce308e24741b 100644 (file)
@@ -291,7 +291,7 @@ void bgp_pbr_print_policy_route(struct bgp_pbr_entry_main *api);
 
 struct bgp_node;
 struct bgp_path_info;
-extern void bgp_pbr_update_entry(struct bgp *bgp, struct prefix *p,
+extern void bgp_pbr_update_entry(struct bgp *bgp, const struct prefix *p,
                                 struct bgp_path_info *new_select, afi_t afi,
                                 safi_t safi, bool nlri_update);
 
@@ -301,7 +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,
+extern int bgp_pbr_build_and_validate_entry(const struct prefix *p,
                                            struct bgp_path_info *path,
                                            struct bgp_pbr_entry_main *api);
 #endif /* __BGP_PBR_H__ */
index ea97583495e884dfb03173ac1c13e02adf7af611..5facf3269e805e0abf3bfd5f91b947e665dbdcb4 100644 (file)
@@ -76,7 +76,7 @@ void decode_rd_as4(const uint8_t *pnt, struct rd_as *rd_as)
 }
 
 /* type == RD_TYPE_IP */
-void decode_rd_ip(uint8_t *pnt, struct rd_ip *rd_ip)
+void decode_rd_ip(const uint8_t *pnt, struct rd_ip *rd_ip)
 {
        memcpy(&rd_ip->ip, pnt, 4);
        pnt += 4;
index da8c553b4ba06bb9a8a8d12076da37925e549907..439dfd4a3100ee7b1d01b6dac0284c062ac26755 100644 (file)
@@ -59,7 +59,7 @@ extern void encode_rd_type(uint16_t, uint8_t *);
 
 extern void decode_rd_as(const uint8_t *pnt, struct rd_as *rd_as);
 extern void decode_rd_as4(const uint8_t *pnt, struct rd_as *rd_as);
-extern void decode_rd_ip(uint8_t *pnt, struct rd_ip *rd_ip);
+extern void decode_rd_ip(const uint8_t *pnt, struct rd_ip *rd_ip);
 #if ENABLE_BGP_VNC
 extern void decode_rd_vnc_eth(uint8_t *pnt, struct rd_vnc_eth *rd_vnc_eth);
 #endif
index 442a5051fecf0432732707748bcc044ad1b1329c..e1c72d8bbdb41188297c4bc98f44f263948014f1 100644 (file)
@@ -116,7 +116,7 @@ DEFINE_HOOK(bgp_process,
 
 
 struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi,
-                                 safi_t safi, struct prefix *p,
+                                 safi_t safi, const struct prefix *p,
                                  struct prefix_rd *prd)
 {
        struct bgp_node *rn;
@@ -1202,7 +1202,8 @@ int bgp_path_info_cmp_compatible(struct bgp *bgp, struct bgp_path_info *new,
        return ret;
 }
 
-static enum filter_type bgp_input_filter(struct peer *peer, struct prefix *p,
+static enum filter_type bgp_input_filter(struct peer *peer,
+                                        const struct prefix *p,
                                         struct attr *attr, afi_t afi,
                                         safi_t safi)
 {
@@ -1322,7 +1323,7 @@ static bool bgp_cluster_filter(struct peer *peer, struct attr *attr)
        return false;
 }
 
-static int bgp_input_modifier(struct peer *peer, struct prefix *p,
+static int bgp_input_modifier(struct peer *peer, const struct prefix *p,
                              struct attr *attr, afi_t afi, safi_t safi,
                              const char *rmap_name, mpls_label_t *label,
                              uint32_t num_labels, struct bgp_node *rn)
@@ -3258,7 +3259,7 @@ static bool bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi,
        return ret;
 }
 
-int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
+int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
               struct attr *attr, afi_t afi, safi_t safi, int type,
               int sub_type, struct prefix_rd *prd, mpls_label_t *label,
               uint32_t num_labels, int soft_reconfig,
@@ -6614,7 +6615,7 @@ static void bgp_remove_route_from_aggregate(struct bgp *bgp, afi_t afi,
                              lcommunity, atomic_aggregate, aggregate);
 }
 
-void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p,
+void bgp_aggregate_increment(struct bgp *bgp, const struct prefix *p,
                             struct bgp_path_info *pi, afi_t afi, safi_t safi)
 {
        struct bgp_node *child;
@@ -6647,7 +6648,7 @@ void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p,
        bgp_unlock_node(child);
 }
 
-void bgp_aggregate_decrement(struct bgp *bgp, struct prefix *p,
+void bgp_aggregate_decrement(struct bgp *bgp, const struct prefix *p,
                             struct bgp_path_info *del, afi_t afi, safi_t safi)
 {
        struct bgp_node *child;
index 7115f2668e37b687f7589343c00ae00a2175a7e9..36d15fabc78313a954490dc98b45cca3b54d900b 100644 (file)
@@ -510,7 +510,7 @@ extern bool bgp_outbound_policy_exists(struct peer *, struct bgp_filter *);
 extern bool bgp_inbound_policy_exists(struct peer *, struct bgp_filter *);
 
 extern struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi,
-                                        safi_t safi, struct prefix *p,
+                                        safi_t safi, const struct prefix *p,
                                         struct prefix_rd *prd);
 extern struct bgp_path_info *bgp_path_info_lock(struct bgp_path_info *path);
 extern struct bgp_path_info *bgp_path_info_unlock(struct bgp_path_info *path);
@@ -558,9 +558,12 @@ extern int bgp_static_unset_safi(afi_t afi, safi_t safi, struct vty *,
                                 const char *, const char *, const char *);
 
 /* this is primarily for MPLS-VPN */
-extern int bgp_update(struct peer *, struct prefix *, uint32_t, struct attr *,
-                     afi_t, safi_t, int, int, struct prefix_rd *,
-                     mpls_label_t *, uint32_t, int, struct bgp_route_evpn *);
+extern int bgp_update(struct peer *peer, const struct prefix *p,
+                     uint32_t addpath_id, struct attr *attr,
+                     afi_t afi, safi_t safi, int type, int sub_type,
+                     struct prefix_rd *prd, mpls_label_t *label,
+                     uint32_t num_labels, int soft_reconfig,
+                     struct bgp_route_evpn *evpn);
 extern int bgp_withdraw(struct peer *, struct prefix *, uint32_t, struct attr *,
                        afi_t, safi_t, int, int, struct prefix_rd *,
                        mpls_label_t *, uint32_t, struct bgp_route_evpn *);
@@ -583,10 +586,10 @@ extern void bgp_aggregate_delete(struct bgp *bgp, struct prefix *p, afi_t afi,
                                 safi_t safi, struct bgp_aggregate *aggregate);
 extern void bgp_aggregate_route(struct bgp *bgp, struct prefix *p, afi_t afi,
                                safi_t safi, struct bgp_aggregate *aggregate);
-extern void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p,
+extern void bgp_aggregate_increment(struct bgp *bgp, const struct prefix *p,
                                    struct bgp_path_info *path, afi_t afi,
                                    safi_t safi);
-extern void bgp_aggregate_decrement(struct bgp *bgp, struct prefix *p,
+extern void bgp_aggregate_decrement(struct bgp *bgp, const struct prefix *p,
                                    struct bgp_path_info *path, afi_t afi,
                                    safi_t safi);
 
index 3daef200676e7a616e7bc34488704c788284aab9..95b6548c7480a0a5a8cf1deeee814c59ada9330d 100644 (file)
@@ -1484,7 +1484,7 @@ void bgp_zebra_announce_table(struct bgp *bgp, afi_t afi, safi_t safi)
                                                   safi);
 }
 
-void bgp_zebra_withdraw(struct prefix *p, struct bgp_path_info *info,
+void bgp_zebra_withdraw(const struct prefix *p, struct bgp_path_info *info,
                        struct bgp *bgp, safi_t safi)
 {
        struct zapi_route api;
index b5b451092a9cf2ffb11e5697a4a8475815903492..e546cd5da7da035be20887c39b68fec0eaec710b 100644 (file)
@@ -36,8 +36,9 @@ extern void bgp_zebra_announce(struct bgp_node *rn, const struct prefix *p,
                               struct bgp_path_info *path, struct bgp *bgp,
                               afi_t afi, safi_t safi);
 extern void bgp_zebra_announce_table(struct bgp *, afi_t, safi_t);
-extern void bgp_zebra_withdraw(struct prefix *p, struct bgp_path_info *path,
-                              struct bgp *bgp, safi_t safi);
+extern void bgp_zebra_withdraw(const struct prefix *p,
+                              struct bgp_path_info *path, struct bgp *bgp,
+                              safi_t safi);
 
 extern void bgp_zebra_initiate_radv(struct bgp *bgp, struct peer *peer);
 extern void bgp_zebra_terminate_radv(struct bgp *bgp, struct peer *peer);
index d87292f652fd77a2538d529ebbbca568fe7c6944..435b61edf0c633eb3d8eed75b92e83a9d941bf2e 100644 (file)
@@ -355,7 +355,7 @@ int rfapi_check(void *handle)
 
 void del_vnc_route(struct rfapi_descriptor *rfd,
                   struct peer *peer, /* rfd->peer for RFP regs */
-                  struct bgp *bgp, safi_t safi, struct prefix *p,
+                  struct bgp *bgp, safi_t safi, const struct prefix *p,
                   struct prefix_rd *prd, uint8_t type, uint8_t sub_type,
                   struct rfapi_nexthop *lnh, int kill)
 {
@@ -557,7 +557,7 @@ void rfapi_vn_options_free(struct rfapi_vn_option *p)
 
 /* Based on bgp_redistribute_add() */
 void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
-                  struct bgp *bgp, int safi, struct prefix *p,
+                  struct bgp *bgp, int safi, const struct prefix *p,
                   struct prefix_rd *prd, struct rfapi_ip_addr *nexthop,
                   uint32_t *local_pref,
                   uint32_t *lifetime, /* NULL => dont send lifetime */
index ae1f7915f52a62e337496cb5c820c09267a609a4..4facc31c602f822dc2e9c9cedc40e9e687afa38f 100644 (file)
@@ -35,16 +35,16 @@ extern void rfapi_delete(struct bgp *);
 struct rfapi *bgp_rfapi_new(struct bgp *bgp);
 void bgp_rfapi_destroy(struct bgp *bgp, struct rfapi *h);
 
-extern void rfapiProcessUpdate(struct peer *peer, void *rfd, struct prefix *p,
-                              struct prefix_rd *prd, struct attr *attr,
-                              afi_t afi, safi_t safi, uint8_t type,
-                              uint8_t sub_type, uint32_t *label);
+extern void rfapiProcessUpdate(struct peer *peer, void *rfd,
+                              const struct prefix *p, struct prefix_rd *prd,
+                              struct attr *attr, afi_t afi, safi_t safi,
+                              uint8_t type, uint8_t sub_type, uint32_t *label);
 
 
-extern void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p,
-                                struct prefix_rd *prd, struct attr *attr,
-                                afi_t afi, safi_t safi, uint8_t type,
-                                int kill);
+extern void rfapiProcessWithdraw(struct peer *peer, void *rfd,
+                                const struct prefix *p, struct prefix_rd *prd,
+                                struct attr *attr, afi_t afi, safi_t safi,
+                                uint8_t type, int kill);
 
 extern void rfapiProcessPeerDown(struct peer *peer);
 
index 6c50092e6a602bd1aed706190f383083483278c2..f31ecc0175c24060a7d9d605529674ca21ed7c0a 100644 (file)
@@ -2153,7 +2153,7 @@ static void rfapiItBiIndexDump(struct agg_node *rn)
 static struct bgp_path_info *rfapiItBiIndexSearch(
        struct agg_node *rn, /* Import table VPN node */
        struct prefix_rd *prd, struct peer *peer,
-       struct prefix *aux_prefix) /* optional L3 addr for L2 ITs */
+       const struct prefix *aux_prefix) /* optional L3 addr for L2 ITs */
 {
        struct skiplist *sl;
        int rc;
@@ -2847,11 +2847,13 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table,
 }
 
 
-typedef void(rfapi_bi_filtered_import_f)(struct rfapi_import_table *, int,
-                                        struct peer *, void *, struct prefix *,
-                                        struct prefix *, afi_t,
-                                        struct prefix_rd *, struct attr *,
-                                        uint8_t, uint8_t, uint32_t *);
+typedef void(rfapi_bi_filtered_import_f)(struct rfapi_import_table *table,
+                                        int action, struct peer *peer,
+                                        void *rfd, const struct prefix *prefix,
+                                        const struct prefix *aux_prefix,
+                                        afi_t afi, struct prefix_rd *prd,
+                                        struct attr *attr, uint8_t type,
+                                        uint8_t sub_type, uint32_t *label);
 
 
 static void rfapiExpireEncapNow(struct rfapi_import_table *it,
@@ -2900,11 +2902,11 @@ static int rfapiGetNexthop(struct attr *attr, struct prefix *prefix)
 static void rfapiBgpInfoFilteredImportEncap(
        struct rfapi_import_table *import_table, int action, struct peer *peer,
        void *rfd, /* set for looped back routes */
-       struct prefix *p,
-       struct prefix *aux_prefix, /* Unused for encap routes */
+       const struct prefix *p,
+       const struct prefix *aux_prefix, /* Unused for encap routes */
        afi_t afi, struct prefix_rd *prd,
        struct attr *attr, /* part of bgp_path_info */
-       uint8_t type,      /* part of bgp_path_info */
+       uint8_t type,      /* part of bgp_path_info */
        uint8_t sub_type,  /* part of bgp_path_info */
        uint32_t *label)   /* part of bgp_path_info */
 {
@@ -3361,11 +3363,11 @@ static void rfapiExpireVpnNow(struct rfapi_import_table *it,
 void rfapiBgpInfoFilteredImportVPN(
        struct rfapi_import_table *import_table, int action, struct peer *peer,
        void *rfd, /* set for looped back routes */
-       struct prefix *p,
-       struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */
+       const struct prefix *p,
+       const struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */
        afi_t afi, struct prefix_rd *prd,
        struct attr *attr, /* part of bgp_path_info */
-       uint8_t type,      /* part of bgp_path_info */
+       uint8_t type,      /* part of bgp_path_info */
        uint8_t sub_type,  /* part of bgp_path_info */
        uint32_t *label)   /* part of bgp_path_info */
 {
@@ -3840,11 +3842,11 @@ void rfapiBgpInfoFilteredImportVPN(
 static void rfapiBgpInfoFilteredImportBadSafi(
        struct rfapi_import_table *import_table, int action, struct peer *peer,
        void *rfd, /* set for looped back routes */
-       struct prefix *p,
-       struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */
+       const struct prefix *p,
+       const struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */
        afi_t afi, struct prefix_rd *prd,
        struct attr *attr, /* part of bgp_path_info */
-       uint8_t type,      /* part of bgp_path_info */
+       uint8_t type,      /* part of bgp_path_info */
        uint8_t sub_type,  /* part of bgp_path_info */
        uint32_t *label)   /* part of bgp_path_info */
 {
@@ -3870,7 +3872,7 @@ rfapiBgpInfoFilteredImportFunction(safi_t safi)
 
 void rfapiProcessUpdate(struct peer *peer,
                        void *rfd, /* set when looped from RFP/RFAPI */
-                       struct prefix *p, struct prefix_rd *prd,
+                       const struct prefix *p, struct prefix_rd *prd,
                        struct attr *attr, afi_t afi, safi_t safi, uint8_t type,
                        uint8_t sub_type, uint32_t *label)
 {
@@ -3954,7 +3956,7 @@ void rfapiProcessUpdate(struct peer *peer,
 }
 
 
-void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p,
+void rfapiProcessWithdraw(struct peer *peer, void *rfd, const struct prefix *p,
                          struct prefix_rd *prd, struct attr *attr, afi_t afi,
                          safi_t safi, uint8_t type, int kill)
 {
index 1ab9cc5193fba289aedd196332f6affa14403433..50093111c2efcf8c044f299c99e3c444c084852e 100644 (file)
@@ -143,11 +143,11 @@ extern void rfapiUnicastNexthop2Prefix(afi_t afi, struct attr *attr,
 extern void rfapiBgpInfoFilteredImportVPN(
        struct rfapi_import_table *import_table, int action, struct peer *peer,
        void *rfd, /* set for looped back routes */
-       struct prefix *p,
-       struct prefix *aux_prefix, /* AFI_ETHER: optional IP */
+       const struct prefix *p,
+       const struct prefix *aux_prefix, /* AFI_ETHER: optional IP */
        afi_t afi, struct prefix_rd *prd,
        struct attr *attr, /* part of bgp_path_info */
-       uint8_t type,      /* part of bgp_path_info */
+       uint8_t type,      /* part of bgp_path_info */
        uint8_t sub_type,  /* part of bgp_path_info */
        uint32_t *label);  /* part of bgp_path_info */
 
index ff1cf7ef427d57119483383b7ce707a3e62d1d56..3baccee7ccb0f8a8e965d9cd710cfa78987acd28 100644 (file)
@@ -281,7 +281,7 @@ extern int rfapi_find_rfd(struct bgp *bgp, struct rfapi_ip_addr *vn_addr,
 
 extern void
 add_vnc_route(struct rfapi_descriptor *rfd, /* cookie + UN addr for VPN */
-             struct bgp *bgp, int safi, struct prefix *p,
+             struct bgp *bgp, int safi, const struct prefix *p,
              struct prefix_rd *prd, struct rfapi_ip_addr *nexthop,
              uint32_t *local_pref, /* host byte order */
              uint32_t *lifetime,   /* host byte order */
@@ -297,7 +297,7 @@ add_vnc_route(struct rfapi_descriptor *rfd, /* cookie + UN addr for VPN */
 #endif
 
 extern void del_vnc_route(struct rfapi_descriptor *rfd, struct peer *peer,
-                         struct bgp *bgp, safi_t safi, struct prefix *p,
+                         struct bgp *bgp, safi_t safi, const struct prefix *p,
                          struct prefix_rd *prd, uint8_t type, uint8_t sub_type,
                          struct rfapi_nexthop *lnh, int kill);
 
index 3d34d696b5626d57bb5326d51cfa1bafb141874b..3fe0fdaedb6eec4835999af1197dcdf69f5fa223 100644 (file)
@@ -1633,7 +1633,7 @@ void vnc_direct_bgp_vpn_disable(struct bgp *bgp, afi_t afi)
  * caller do it?
  */
 void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
-                                struct prefix *prefix, struct peer *peer,
+                                const struct prefix *prefix, struct peer *peer,
                                 struct attr *attr)
 {
        struct vnc_export_info *eti;
@@ -1757,7 +1757,7 @@ static int vncExportWithdrawTimer(struct thread *t)
  * caller do it?
  */
 void vnc_direct_bgp_rh_del_route(struct bgp *bgp, afi_t afi,
-                                struct prefix *prefix, struct peer *peer)
+                                const struct prefix *prefix, struct peer *peer)
 {
        struct vnc_export_info *eti;
 
index a1cb9727407b9a16ef8dd1e3e8eac07d3d7ede63..bf292abb0a8e41f75ce00103ad8a92d4bc067ee1 100644 (file)
@@ -61,12 +61,12 @@ extern void vnc_direct_bgp_reexport_group_afi(struct bgp *bgp,
 
 
 extern void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
-                                       struct prefix *prefix,
+                                       const struct prefix *prefix,
                                        struct peer *peer, struct attr *attr);
 
 
 extern void vnc_direct_bgp_rh_del_route(struct bgp *bgp, afi_t afi,
-                                       struct prefix *prefix,
+                                       const struct prefix *prefix,
                                        struct peer *peer);
 
 extern void vnc_direct_bgp_reexport(struct bgp *bgp, afi_t afi);
index 5e00a1017ba31e0d7a22af6588df8f3881a7e653..8bf1479a25d422a4a4c1799bc70b5548c179fa77 100644 (file)
@@ -34,7 +34,7 @@
 #include "bgpd/rfapi/vnc_debug.h"
 
 struct agg_node *vnc_etn_get(struct bgp *bgp, vnc_export_type_t type,
-                            struct prefix *p)
+                            const struct prefix *p)
 {
        struct agg_table *t = NULL;
        struct agg_node *rn = NULL;
@@ -66,7 +66,7 @@ struct agg_node *vnc_etn_get(struct bgp *bgp, vnc_export_type_t type,
 }
 
 struct agg_node *vnc_etn_lookup(struct bgp *bgp, vnc_export_type_t type,
-                               struct prefix *p)
+                               const struct prefix *p)
 {
        struct agg_table *t = NULL;
        struct agg_node *rn = NULL;
@@ -98,7 +98,7 @@ struct agg_node *vnc_etn_lookup(struct bgp *bgp, vnc_export_type_t type,
 }
 
 struct vnc_export_info *vnc_eti_get(struct bgp *bgp, vnc_export_type_t etype,
-                                   struct prefix *p, struct peer *peer,
+                                   const struct prefix *p, struct peer *peer,
                                    uint8_t type, uint8_t subtype)
 {
        struct agg_node *etn;
index fdb35e81e173b8e079e2edce46b380da3adb0be0..5dcf4e6c1dfeef939a8b0400bf063cd28887ba23 100644 (file)
@@ -46,15 +46,14 @@ struct vnc_export_info {
 };
 
 extern struct agg_node *vnc_etn_get(struct bgp *bgp, vnc_export_type_t type,
-                                   struct prefix *p);
+                                   const struct prefix *p);
 
 extern struct agg_node *vnc_etn_lookup(struct bgp *bgp, vnc_export_type_t type,
-                                      struct prefix *p);
+                                      const struct prefix *p);
 
-extern struct vnc_export_info *vnc_eti_get(struct bgp *bgp,
-                                          vnc_export_type_t etype,
-                                          struct prefix *p, struct peer *peer,
-                                          uint8_t type, uint8_t subtype);
+extern struct vnc_export_info *
+vnc_eti_get(struct bgp *bgp, vnc_export_type_t etype, const struct prefix *p,
+           struct peer *peer, uint8_t type, uint8_t subtype);
 
 extern void vnc_eti_delete(struct vnc_export_info *goner);
 
index d5e509d30d143dee4f1c5c29684dded87f08b6df..1ce5d370b0f44e9b632f2d4533943dfc32d16cff 100644 (file)
@@ -104,7 +104,7 @@ uint32_t calc_local_pref(struct attr *attr, struct peer *peer)
        return local_pref;
 }
 
-static int is_host_prefix(struct prefix *p)
+static int is_host_prefix(const struct prefix *p)
 {
        switch (p->family) {
        case AF_INET:
@@ -299,9 +299,9 @@ static void vnc_rhnck(char *tag)
  */
 static int process_unicast_route(struct bgp *bgp,               /* in */
                                 afi_t afi,                      /* in */
-                                struct prefix *prefix,          /* in */
-                                struct bgp_path_info *info,     /* in */
-                                struct ecommunity **ecom,       /* OUT */
+                                const struct prefix *prefix,    /* in */
+                                struct bgp_path_info *info,     /* in */
+                                struct ecommunity **ecom,       /* OUT */
                                 struct prefix *unicast_nexthop) /* OUT */
 {
        struct rfapi_cfg *hc = bgp->rfapi_cfg;
@@ -425,10 +425,10 @@ static int process_unicast_route(struct bgp *bgp,          /* in */
 static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
        struct bgp *bgp, afi_t afi, struct bgp_path_info *bpi, /* VPN bpi */
        struct prefix_rd *prd,                                 /* RD */
-       struct prefix *prefix,   /* unicast route prefix */
-       uint32_t *local_pref,    /* NULL = no local_pref */
-       uint32_t *med,           /* NULL = no med */
-       struct ecommunity *ecom) /* generated ecoms */
+       const struct prefix *prefix, /* unicast route prefix */
+       uint32_t *local_pref,        /* NULL = no local_pref */
+       uint32_t *med,               /* NULL = no med */
+       struct ecommunity *ecom)     /* generated ecoms */
 {
        struct prefix un;
        struct prefix nexthop;
@@ -509,11 +509,12 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
 }
 
 static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd(
-       struct prefix_rd *prd,      /* RD */
+       struct prefix_rd *prd,      /* RD */
        struct bgp_table *table_rd, /* per-rd VPN route table */
-       afi_t afi, struct bgp *bgp, struct prefix *prefix, /* unicast prefix */
-       struct ecommunity *ecom,                           /* generated ecoms */
-       uint32_t *local_pref,   /* NULL = no local_pref */
+       afi_t afi, struct bgp *bgp,
+       const struct prefix *prefix, /* unicast prefix */
+       struct ecommunity *ecom,     /* generated ecoms */
+       uint32_t *local_pref,        /* NULL = no local_pref */
        uint32_t *med,               /* NULL = no med */
        struct prefix *ubpi_nexthop) /* unicast nexthop */
 {
@@ -552,8 +553,8 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd(
 }
 
 static void vnc_import_bgp_add_route_mode_resolve_nve(
-       struct bgp *bgp, struct prefix *prefix, /* unicast prefix */
-       struct bgp_path_info *info)             /* unicast info */
+       struct bgp *bgp, const struct prefix *prefix, /* unicast prefix */
+       struct bgp_path_info *info)                   /* unicast info */
 {
        afi_t afi = family2afi(prefix->family);
 
@@ -686,7 +687,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
 
 
 static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
-                                               struct prefix *prefix,
+                                               const struct prefix *prefix,
                                                struct bgp_path_info *info)
 {
        afi_t afi = family2afi(prefix->family);
@@ -874,10 +875,9 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
                ecommunity_free(&ecom);
 }
 
-static void
-vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix,
-                                      struct bgp_path_info *info,
-                                      struct rfapi_nve_group_cfg *rfg)
+static void vnc_import_bgp_add_route_mode_nvegroup(
+       struct bgp *bgp, const struct prefix *prefix,
+       struct bgp_path_info *info, struct rfapi_nve_group_cfg *rfg)
 {
        afi_t afi = family2afi(prefix->family);
        struct peer *peer = info->peer;
@@ -1080,7 +1080,7 @@ vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix,
 }
 
 static void vnc_import_bgp_del_route_mode_plain(struct bgp *bgp,
-                                               struct prefix *prefix,
+                                               const struct prefix *prefix,
                                                struct bgp_path_info *info)
 {
        struct prefix_rd prd;
@@ -1153,7 +1153,7 @@ static void vnc_import_bgp_del_route_mode_plain(struct bgp *bgp,
 }
 
 static void vnc_import_bgp_del_route_mode_nvegroup(struct bgp *bgp,
-                                                  struct prefix *prefix,
+                                                  const struct prefix *prefix,
                                                   struct bgp_path_info *info)
 {
        struct prefix_rd prd;
@@ -1236,7 +1236,7 @@ static void vnc_import_bgp_del_route_mode_nvegroup(struct bgp *bgp,
 static void vnc_import_bgp_del_route_mode_resolve_nve_one_bi(
        struct bgp *bgp, afi_t afi, struct bgp_path_info *bpi, /* VPN bpi */
        struct prefix_rd *prd,                                 /* RD */
-       struct prefix *prefix) /* unicast route prefix */
+       const struct prefix *prefix) /* unicast route prefix */
 {
        struct prefix un;
 
@@ -1272,8 +1272,9 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_bi(
 static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd(
        struct prefix_rd *prd,
        struct bgp_table *table_rd, /* per-rd VPN route table */
-       afi_t afi, struct bgp *bgp, struct prefix *prefix, /* unicast prefix */
-       struct prefix *ubpi_nexthop) /* unicast bpi's nexthop */
+       afi_t afi, struct bgp *bgp,
+       const struct prefix *prefix,       /* unicast prefix */
+       const struct prefix *ubpi_nexthop) /* unicast bpi's nexthop */
 {
        struct bgp_node *bn;
        struct bgp_path_info *bpi;
@@ -1312,7 +1313,7 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd(
 
 static void
 vnc_import_bgp_del_route_mode_resolve_nve(struct bgp *bgp, afi_t afi,
-                                         struct prefix *prefix,
+                                         const struct prefix *prefix,
                                          struct bgp_path_info *info)
 {
        struct ecommunity *ecom = NULL;
@@ -1396,7 +1397,7 @@ vnc_import_bgp_del_route_mode_resolve_nve(struct bgp *bgp, afi_t afi,
 void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
        struct bgp *bgp, struct prefix_rd *prd, /* RD */
        struct bgp_table *table_rd,             /* per-rd VPN route table */
-       struct prefix *prefix,                  /* VPN prefix */
+       const struct prefix *prefix,            /* VPN prefix */
        struct bgp_path_info *bpi)              /* new VPN host route */
 {
        afi_t afi = family2afi(prefix->family);
@@ -1533,7 +1534,7 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
 void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
        struct bgp *bgp, struct prefix_rd *prd, /* RD */
        struct bgp_table *table_rd,             /* per-rd VPN route table */
-       struct prefix *prefix,                  /* VPN prefix */
+       const struct prefix *prefix,            /* VPN prefix */
        struct bgp_path_info *bpi)              /* old VPN host route */
 {
        afi_t afi = family2afi(prefix->family);
@@ -1675,8 +1676,8 @@ static int is_usable_interior_route(struct bgp_path_info *bpi_interior)
  */
 static void vnc_import_bgp_exterior_add_route_it(
        struct bgp *bgp,                    /* exterior instance, we hope */
-       struct prefix *prefix,              /* unicast prefix */
-       struct bgp_path_info *info,      /* unicast info */
+       const struct prefix *prefix,        /* unicast prefix */
+       struct bgp_path_info *info,         /* unicast info */
        struct rfapi_import_table *it_only) /* NULL, or limit to this IT */
 {
        struct rfapi *h;
@@ -1844,9 +1845,9 @@ static void vnc_import_bgp_exterior_add_route_it(
 }
 
 void vnc_import_bgp_exterior_add_route(
-       struct bgp *bgp,            /* exterior instance, we hope */
-       struct prefix *prefix,      /* unicast prefix */
-       struct bgp_path_info *info) /* unicast info */
+       struct bgp *bgp,             /* exterior instance, we hope */
+       const struct prefix *prefix, /* unicast prefix */
+       struct bgp_path_info *info)  /* unicast info */
 {
        vnc_import_bgp_exterior_add_route_it(bgp, prefix, info, NULL);
 }
@@ -1861,8 +1862,8 @@ void vnc_import_bgp_exterior_add_route(
  * right routes.
  */
 void vnc_import_bgp_exterior_del_route(
-       struct bgp *bgp, struct prefix *prefix, /* unicast prefix */
-       struct bgp_path_info *info)             /* unicast info */
+       struct bgp *bgp, const struct prefix *prefix, /* unicast prefix */
+       struct bgp_path_info *info)                   /* unicast info */
 {
        struct rfapi *h;
        struct rfapi_cfg *hc;
@@ -2597,7 +2598,7 @@ void vnc_import_bgp_exterior_del_route_interior(
  *                     Generic add/delete unicast routes
  ***********************************************************************/
 
-void vnc_import_bgp_add_route(struct bgp *bgp, struct prefix *prefix,
+void vnc_import_bgp_add_route(struct bgp *bgp, const struct prefix *prefix,
                              struct bgp_path_info *info)
 {
        afi_t afi = family2afi(prefix->family);
@@ -2666,7 +2667,7 @@ void vnc_import_bgp_add_route(struct bgp *bgp, struct prefix *prefix,
 /*
  * "Withdrawing a Route" import process
  */
-void vnc_import_bgp_del_route(struct bgp *bgp, struct prefix *prefix,
+void vnc_import_bgp_del_route(struct bgp *bgp, const struct prefix *prefix,
                              struct bgp_path_info *info) /* unicast info */
 {
        afi_t afi = family2afi(prefix->family);
index ca64e6eacc56e1622d30c0974a573517c84c598f..ab2ec1a7487ff64623d795cab25ed9e9ac800b2d 100644 (file)
@@ -34,10 +34,12 @@ extern uint32_t calc_local_pref(struct attr *attr, struct peer *peer);
 
 extern int vnc_prefix_cmp(const void *pfx1, const void *pfx2);
 
-extern void vnc_import_bgp_add_route(struct bgp *bgp, struct prefix *prefix,
+extern void vnc_import_bgp_add_route(struct bgp *bgp,
+                                    const struct prefix *prefix,
                                     struct bgp_path_info *info);
 
-extern void vnc_import_bgp_del_route(struct bgp *bgp, struct prefix *prefix,
+extern void vnc_import_bgp_del_route(struct bgp *bgp,
+                                    const struct prefix *prefix,
                                     struct bgp_path_info *info);
 
 extern void vnc_import_bgp_redist_enable(struct bgp *bgp, afi_t afi);
@@ -51,23 +53,23 @@ extern void vnc_import_bgp_exterior_redist_disable(struct bgp *bgp, afi_t afi);
 
 extern void vnc_import_bgp_exterior_add_route(
        struct bgp *bgp,             /* exterior instance, we hope */
-       struct prefix *prefix,       /* unicast prefix */
+       const struct prefix *prefix, /* unicast prefix */
        struct bgp_path_info *info); /* unicast info */
 
 extern void vnc_import_bgp_exterior_del_route(
-       struct bgp *bgp, struct prefix *prefix, /* unicast prefix */
-       struct bgp_path_info *info);            /* unicast info */
+       struct bgp *bgp, const struct prefix *prefix, /* unicast prefix */
+       struct bgp_path_info *info);                  /* unicast info */
 
 extern void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
        struct bgp *bgp, struct prefix_rd *prd, /* RD */
        struct bgp_table *table_rd,             /* per-rd VPN route table */
-       struct prefix *prefix,                  /* VPN prefix */
+       const struct prefix *prefix,            /* VPN prefix */
        struct bgp_path_info *bpi);             /* new VPN host route */
 
 extern void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
        struct bgp *bgp, struct prefix_rd *prd, /* RD */
        struct bgp_table *table_rd,             /* per-rd VPN route table */
-       struct prefix *prefix,                  /* VPN prefix */
+       const struct prefix *prefix,            /* VPN prefix */
        struct bgp_path_info *bpi);             /* old VPN host route */
 
 #endif /* _QUAGGA_RFAPI_VNC_IMPORT_BGP_H_ */