summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_packet.c72
1 files changed, 44 insertions, 28 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 390b5563..95ed8046 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -149,7 +149,6 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi)
struct bgp_info *binfo = NULL;
bgp_size_t total_attr_len = 0;
unsigned long pos;
- char buf[BUFSIZ];
s = peer->work;
stream_reset (s);
@@ -199,10 +198,14 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi)
stream_put_prefix (s, &rn->p);
if (BGP_DEBUG (update, UPDATE_OUT))
- zlog (peer->log, LOG_DEBUG, "%s send UPDATE %s/%d",
- peer->host,
- inet_ntop (rn->p.family, &(rn->p.u.prefix), buf, BUFSIZ),
- rn->p.prefixlen);
+ {
+ char buf[INET6_BUFSIZ];
+
+ zlog (peer->log, LOG_DEBUG, "%s send UPDATE %s/%d",
+ peer->host,
+ inet_ntop (rn->p.family, &(rn->p.u.prefix), buf, INET6_BUFSIZ),
+ rn->p.prefixlen);
+ }
/* Synchnorize attribute. */
if (adj->attr)
@@ -285,7 +288,6 @@ bgp_withdraw_packet (struct peer *peer, afi_t afi, safi_t safi)
unsigned long pos;
bgp_size_t unfeasible_len;
bgp_size_t total_attr_len;
- char buf[BUFSIZ];
s = peer->work;
stream_reset (s);
@@ -324,10 +326,14 @@ bgp_withdraw_packet (struct peer *peer, afi_t afi, safi_t safi)
}
if (BGP_DEBUG (update, UPDATE_OUT))
- zlog (peer->log, LOG_DEBUG, "%s send UPDATE %s/%d -- unreachable",
- peer->host,
- inet_ntop (rn->p.family, &(rn->p.u.prefix), buf, BUFSIZ),
- rn->p.prefixlen);
+ {
+ char buf[INET6_BUFSIZ];
+
+ zlog (peer->log, LOG_DEBUG, "%s send UPDATE %s/%d -- unreachable",
+ peer->host,
+ inet_ntop (rn->p.family, &(rn->p.u.prefix), buf, INET6_BUFSIZ),
+ rn->p.prefixlen);
+ }
peer->scount[afi][safi]--;
@@ -366,8 +372,6 @@ bgp_default_update_send (struct peer *peer, struct attr *attr,
struct prefix p;
unsigned long pos;
bgp_size_t total_attr_len;
- char attrstr[BUFSIZ];
- char buf[BUFSIZ];
if (DISABLE_BGP_ANNOUNCE)
return;
@@ -382,9 +386,13 @@ bgp_default_update_send (struct peer *peer, struct attr *attr,
/* Logging the attribute. */
if (BGP_DEBUG (update, UPDATE_OUT))
{
+ char attrstr[BUFSIZ];
+ char buf[INET6_BUFSIZ];
+ attrstr[0] = '\0';
+
bgp_dump_attr (peer, attr, attrstr, BUFSIZ);
zlog (peer->log, LOG_DEBUG, "%s send UPDATE %s/%d %s",
- peer->host, inet_ntop(p.family, &(p.u.prefix), buf, BUFSIZ),
+ peer->host, inet_ntop(p.family, &(p.u.prefix), buf, INET6_BUFSIZ),
p.prefixlen, attrstr);
}
@@ -435,7 +443,6 @@ bgp_default_withdraw_send (struct peer *peer, afi_t afi, safi_t safi)
unsigned long cp;
bgp_size_t unfeasible_len;
bgp_size_t total_attr_len;
- char buf[BUFSIZ];
if (DISABLE_BGP_ANNOUNCE)
return;
@@ -451,9 +458,13 @@ bgp_default_withdraw_send (struct peer *peer, afi_t afi, safi_t safi)
pos = 0;
if (BGP_DEBUG (update, UPDATE_OUT))
- zlog (peer->log, LOG_DEBUG, "%s send UPDATE %s/%d -- unreachable",
- peer->host, inet_ntop(p.family, &(p.u.prefix), buf, BUFSIZ),
- p.prefixlen);
+ {
+ char buf[INET6_BUFSIZ];
+
+ zlog (peer->log, LOG_DEBUG, "%s send UPDATE %s/%d -- unreachable",
+ peer->host, inet_ntop(p.family, &(p.u.prefix), buf, INET6_BUFSIZ),
+ p.prefixlen);
+ }
s = stream_new (BGP_MAX_PACKET_SIZE);
@@ -1515,7 +1526,6 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
struct bgp_nlri withdraw;
struct bgp_nlri mp_update;
struct bgp_nlri mp_withdraw;
- char attrstr[BUFSIZ] = "";
/* Status must be Established. */
if (peer->status != Established)
@@ -1632,6 +1642,9 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
if (attr_parse_ret == BGP_ATTR_PARSE_WITHDRAW
|| BGP_DEBUG (update, UPDATE_IN))
{
+ char attrstr[BUFSIZ];
+ attrstr[0] = '\0';
+
ret= bgp_dump_attr (peer, &attr, attrstr, BUFSIZ);
int lvl = (attr_parse_ret == BGP_ATTR_PARSE_WITHDRAW)
? LOG_ERR : LOG_DEBUG;
@@ -2027,7 +2040,6 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
u_int32_t seq;
int psize;
char name[BUFSIZ];
- char buf[BUFSIZ];
int ret;
if (BGP_DEBUG (normal, NORMAL))
@@ -2097,15 +2109,19 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
p_pnt += psize;
if (BGP_DEBUG (normal, NORMAL))
- zlog_debug ("%s rcvd %s %s seq %u %s/%d ge %d le %d%s",
- peer->host,
- (common & ORF_COMMON_PART_REMOVE ? "Remove" : "Add"),
- (common & ORF_COMMON_PART_DENY ? "deny" : "permit"),
- orfp.seq,
- inet_ntop (orfp.p.family, &orfp.p.u.prefix, buf, BUFSIZ),
- orfp.p.prefixlen, orfp.ge, orfp.le,
- ok ? "" : " MALFORMED");
-
+ {
+ char buf[INET6_BUFSIZ];
+
+ zlog_debug ("%s rcvd %s %s seq %u %s/%d ge %d le %d%s",
+ peer->host,
+ (common & ORF_COMMON_PART_REMOVE ? "Remove" : "Add"),
+ (common & ORF_COMMON_PART_DENY ? "deny" : "permit"),
+ orfp.seq,
+ inet_ntop (orfp.p.family, &orfp.p.u.prefix, buf, INET6_BUFSIZ),
+ orfp.p.prefixlen, orfp.ge, orfp.le,
+ ok ? "" : " MALFORMED");
+ }
+
if (ok)
ret = prefix_bgp_orf_set (name, afi, &orfp,
(common & ORF_COMMON_PART_DENY ? 0 : 1 ),