summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_attr.c')
-rw-r--r--bgpd/bgp_attr.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index f38db414..41e9c223 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -39,7 +39,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_ecommunity.h"
/* Attribute strings for logging. */
-static struct message attr_str [] =
+static const struct message attr_str [] =
{
{ BGP_ATTR_ORIGIN, "ORIGIN" },
{ BGP_ATTR_AS_PATH, "AS_PATH" },
@@ -61,9 +61,9 @@ static struct message attr_str [] =
{ BGP_ATTR_AS4_AGGREGATOR, "AS4_AGGREGATOR" },
{ BGP_ATTR_AS_PATHLIMIT, "AS_PATHLIMIT" },
};
-int attr_str_max = sizeof(attr_str)/sizeof(attr_str[0]);
+static const int attr_str_max = sizeof(attr_str)/sizeof(attr_str[0]);
-struct hash *cluster_hash;
+static struct hash *cluster_hash;
static void *
cluster_hash_alloc (void *p)
@@ -148,13 +148,13 @@ cluster_free (struct cluster_list *cluster)
XFREE (MTYPE_CLUSTER, cluster);
}
+#if 0
static struct cluster_list *
cluster_dup (struct cluster_list *cluster)
{
struct cluster_list *new;
- new = XMALLOC (MTYPE_CLUSTER, sizeof (struct cluster_list));
- memset (new, 0, sizeof (struct cluster_list));
+ new = XCALLOC (MTYPE_CLUSTER, sizeof (struct cluster_list));
new->length = cluster->length;
if (cluster->length)
@@ -167,6 +167,7 @@ cluster_dup (struct cluster_list *cluster)
return new;
}
+#endif
static struct cluster_list *
cluster_intern (struct cluster_list *cluster)
@@ -201,7 +202,7 @@ cluster_init (void)
}
/* Unknown transit attribute. */
-struct hash *transit_hash;
+static struct hash *transit_hash;
static void
transit_free (struct transit *transit)
@@ -275,13 +276,13 @@ transit_hash_cmp (const void *p1, const void *p2)
}
static void
-transit_init ()
+transit_init (void)
{
transit_hash = hash_create (transit_hash_key_make, transit_hash_cmp);
}
/* Attribute hash routines. */
-struct hash *attrhash;
+static struct hash *attrhash;
static struct attr_extra *
bgp_attr_extra_new (void)
@@ -1255,7 +1256,7 @@ bgp_attr_cluster_list (struct peer *peer, bgp_size_t length,
}
/* Multiprotocol reachability information parse. */
-int
+static int
bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr,
struct bgp_nlri *mp_update)
{
@@ -1386,7 +1387,7 @@ bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr,
}
/* Multiprotocol unreachable parse */
-int
+static int
bgp_mp_unreach_parse (struct peer *peer, bgp_size_t length,
struct bgp_nlri *mp_withdraw)
{
@@ -1495,10 +1496,7 @@ bgp_attr_unknown (struct peer *peer, struct attr *attr, u_char flag,
/* Store transitive attribute to the end of attr->transit. */
if (! ((attre = bgp_attr_extra_get(attr))->transit) )
- {
- attre->transit = XMALLOC (MTYPE_TRANSIT, sizeof (struct transit));
- memset (attre->transit, 0, sizeof (struct transit));
- }
+ attre->transit = XCALLOC (MTYPE_TRANSIT, sizeof (struct transit));
transit = attre->transit;