]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd, lib: adopt afi_t and safi_t in several places
authorMichael Lambert <lambert@psc.edu>
Thu, 22 Jul 2010 17:20:55 +0000 (13:20 -0400)
committerGreg Troxel <gdt@ir.bbn.com>
Wed, 6 Oct 2010 16:33:05 +0000 (12:33 -0400)
* bgpd/bgp_attr.c, bgpd/bgp_open.h, bgpd/bgp_route.c, lib/prefix.c,
  lib/prefix.h: Various integer types were being used where, if we
  had strict type checking, afi_t and safi_t would be required.

Signed-off-by: G.Balaji <balajig81@gmail.com>
(cherry picked from commit c8af35ffa2dc79ff7d7ff00b1b61f1f50a100ab6)

bgpd/bgp_attr.c
bgpd/bgp_open.h
bgpd/bgp_route.c
lib/prefix.c
lib/prefix.h

index 3996afd35ae19311e496b1000a75332d5bc316d4..ae0dc88aee619ba0e378436a49b74268506eda6e 100644 (file)
@@ -1301,8 +1301,8 @@ int
 bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr,
                    struct bgp_nlri *mp_update)
 {
-  u_int16_t afi;
-  u_char safi;
+  afi_t afi;
+  safi_t safi;
   bgp_size_t nlri_len;
   size_t start;
   int ret;
@@ -1436,8 +1436,8 @@ bgp_mp_unreach_parse (struct peer *peer, bgp_size_t length,
                      struct bgp_nlri *mp_withdraw)
 {
   struct stream *s;
-  u_int16_t afi;
-  u_char safi;
+  afi_t afi;
+  safi_t safi;
   u_int16_t withdraw_len;
   int ret;
 
index 59265dc990282a76537672803ad7f4be33bb4048..2b1382d8b731eea6966073c25f4a47bafbac171e 100644 (file)
@@ -31,9 +31,9 @@ struct capability_header
 /* Generic MP capability data */
 struct capability_mp_data
 {
-  u_int16_t afi;
+  afi_t afi;
   u_char reserved;
-  u_char safi;
+  safi_t safi;
 };
 
 #pragma pack(1)
@@ -55,8 +55,8 @@ struct capability_as4
 
 struct graceful_restart_af
 {
-  u_int16_t afi;
-  u_char safi;
+  afi_t afi;
+  safi_t safi;
   u_char flag;
 };
 
index a92ca4e2bca99781d549c70d75eb6f47349c1ea4..2391f740156c30ecd0f3fb902cb0e8282f6f8fa5 100644 (file)
@@ -3518,8 +3518,8 @@ bgp_static_update (struct bgp *bgp, struct prefix *p,
 }
 
 static void
-bgp_static_update_vpnv4 (struct bgp *bgp, struct prefix *p, u_int16_t afi,
-                        u_char safi, struct prefix_rd *prd, u_char *tag)
+bgp_static_update_vpnv4 (struct bgp *bgp, struct prefix *p, afi_t afi,
+                        safi_t safi, struct prefix_rd *prd, u_char *tag)
 {
   struct bgp_node *rn;
   struct bgp_info *new;
@@ -3599,8 +3599,8 @@ bgp_check_local_routes_rsclient (struct peer *rsclient, afi_t afi, safi_t safi)
 }
 
 static void
-bgp_static_withdraw_vpnv4 (struct bgp *bgp, struct prefix *p, u_int16_t afi,
-                          u_char safi, struct prefix_rd *prd, u_char *tag)
+bgp_static_withdraw_vpnv4 (struct bgp *bgp, struct prefix *p, afi_t afi,
+                          safi_t safi, struct prefix_rd *prd, u_char *tag)
 {
   struct bgp_node *rn;
   struct bgp_info *ri;
@@ -3653,7 +3653,7 @@ bgp_pathlimit_update_parents (struct bgp *bgp, struct bgp_node *rn,
    route should be installed as valid.  */
 static int
 bgp_static_set (struct vty *vty, struct bgp *bgp, const char *ip_str, 
-                u_int16_t afi, u_char safi, const char *rmap, int backdoor,
+                afi_t afi, safi_t safi, const char *rmap, int backdoor,
                 u_char ttl)
 {
   int ret;
@@ -3798,7 +3798,7 @@ bgp_static_set (struct vty *vty, struct bgp *bgp, const char *ip_str,
 /* Configure static BGP network. */
 static int
 bgp_static_unset (struct vty *vty, struct bgp *bgp, const char *ip_str,
-                 u_int16_t afi, u_char safi)
+                 afi_t afi, safi_t safi)
 {
   int ret;
   struct prefix p;
@@ -7622,7 +7622,7 @@ DEFUN (show_ipv6_mbgp_community_all,
 \f
 static int
 bgp_show_community (struct vty *vty, int argc, const char **argv, int exact,
-                    u_int16_t afi, u_char safi)
+                    afi_t afi, safi_t safi)
 {
   struct community *com;
   struct buffer *b;
@@ -8622,7 +8622,7 @@ ALIAS (show_ipv6_mbgp_community_exact,
 \f
 static int
 bgp_show_community_list (struct vty *vty, const char *com, int exact,
-                        u_int16_t afi, u_char safi)
+                        afi_t afi, safi_t safi)
 {
   struct community_list *list;
 
index c85e65949cf46a18b2ec7fd26f1c5ac2435826a9..7dc866d11675a01b50257f6ae441a48dfd5ca237 100644 (file)
@@ -41,7 +41,7 @@ static const u_char maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
 
 /* Address Famiy Identifier to Address Family converter. */
 int
-afi2family (int afi)
+afi2family (afi_t afi)
 {
   if (afi == AFI_IP)
     return AF_INET;
@@ -52,7 +52,7 @@ afi2family (int afi)
   return 0;
 }
 
-int
+afi_t
 family2afi (int family)
 {
   if (family == AF_INET)
index a7598b7e64aa6edf2619225d71ad9470e814f084..5f1ff05c95c1fd7e082b7552bb872f2361aecd90 100644 (file)
@@ -144,8 +144,8 @@ prefix6_bit (const struct in6_addr *prefix, const u_char prefixlen)
 }
 
 /* Prototypes. */
-extern int afi2family (int);
-extern int family2afi (int);
+extern int afi2family (afi_t);
+extern afi_t family2afi (int);
 
 extern struct prefix *prefix_new (void);
 extern void prefix_free (struct prefix *);