2004-07-09 Paul Jakma <paul@dishone.st>

Merge of GNU Zebra cvs2svn changesets r799, r800 and r807.

        * bgp_dump.c: (bgp_dump_attr) cleanup. return status code. check
          attributes present before printing.
        * bgp_dump.c: update bgp_dump_attr prototype.
        * bgp_packet.c: (bgp_update_receive) init attrstr. check status
          of bgp_dump_attr. Log end-of-rib UPDATEs.
This commit is contained in:
paul 2004-07-09 17:48:53 +00:00
parent b9790b34c8
commit e01f9cbb87
4 changed files with 96 additions and 21 deletions

View File

@ -1,3 +1,12 @@
2004-07-09 Paul Jakma <paul@dishone.st>
* Merge of GNU Zebra cvs2svn changesets r799, r800 and r807.
* bgp_dump.c: (bgp_dump_attr) cleanup. return status code. check
attributes present before printing.
* bgp_dump.c: update bgp_dump_attr prototype.
* bgp_packet.c: (bgp_update_receive) init attrstr. check status
of bgp_dump_attr. Log end-of-rib UPDATEs.
2004-07-09 Sowmini Varadhan <sowmini.varadhan@sun.com> 2004-07-09 Sowmini Varadhan <sowmini.varadhan@sun.com>
* bgp_packet.c: (bgp_collision_detect) Send NOTIFY on new socket * bgp_packet.c: (bgp_collision_detect) Send NOTIFY on new socket

View File

@ -158,14 +158,16 @@ char *bgp_origin_str[] = {"i","e","?"};
char *bgp_origin_long_str[] = {"IGP","EGP","incomplete"}; char *bgp_origin_long_str[] = {"IGP","EGP","incomplete"};
/* Dump attribute. */ /* Dump attribute. */
void int
bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size) bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size)
{ {
if (! attr) if (! attr)
return; return 0;
if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP)))
snprintf (buf, size, "nexthop %s", inet_ntoa (attr->nexthop)); snprintf (buf, size, "nexthop %s", inet_ntoa (attr->nexthop));
if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_ORIGIN)))
snprintf (buf + strlen (buf), size - strlen (buf), ", origin %s", snprintf (buf + strlen (buf), size - strlen (buf), ", origin %s",
bgp_origin_str[attr->origin]); bgp_origin_str[attr->origin]);
@ -186,30 +188,30 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size)
} }
#endif /* HAVE_IPV6 */ #endif /* HAVE_IPV6 */
if (peer_sort (peer) == BGP_PEER_IBGP) if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF)))
snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %d", snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %d",
attr->local_pref); attr->local_pref);
if (attr->med) if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC)))
snprintf (buf + strlen (buf), size - strlen (buf), ", metric %d", snprintf (buf + strlen (buf), size - strlen (buf), ", metric %d",
attr->med); attr->med);
if (attr->community) if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES)))
snprintf (buf + strlen (buf), size - strlen (buf), ", community %s", snprintf (buf + strlen (buf), size - strlen (buf), ", community %s",
community_str (attr->community)); community_str (attr->community));
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE)) if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE)))
snprintf (buf + strlen (buf), size - strlen (buf), ", atomic-aggregate"); snprintf (buf + strlen (buf), size - strlen (buf), ", atomic-aggregate");
if (attr->aggregator_as) if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR)))
snprintf (buf + strlen (buf), size - strlen (buf), ", aggregated by %d %s", snprintf (buf + strlen (buf), size - strlen (buf), ", aggregated by %d %s",
attr->aggregator_as, inet_ntoa (attr->aggregator_addr)); attr->aggregator_as, inet_ntoa (attr->aggregator_addr));
if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID)) if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID)))
snprintf (buf + strlen (buf), size - strlen (buf), ", originator %s", snprintf (buf + strlen (buf), size - strlen (buf), ", originator %s",
inet_ntoa (attr->originator_id)); inet_ntoa (attr->originator_id));
if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_CLUSTER_LIST)) if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_CLUSTER_LIST)))
{ {
int i; int i;
@ -219,9 +221,14 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size)
inet_ntoa (attr->cluster->list[i])); inet_ntoa (attr->cluster->list[i]));
} }
if (attr->aspath) if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_AS_PATH)))
snprintf (buf + strlen (buf), size - strlen (buf), ", path %s", snprintf (buf + strlen (buf), size - strlen (buf), ", path %s",
aspath_print (attr->aspath)); aspath_print (attr->aspath));
if (strlen (buf) > 1)
return 1;
else
return 0;
} }
/* dump notify packet */ /* dump notify packet */

View File

@ -106,7 +106,7 @@ extern unsigned long term_bgp_debug_normal;
extern char *bgp_type_str[]; extern char *bgp_type_str[];
void bgp_dump_attr (struct peer *, struct attr *, char *, size_t); int bgp_dump_attr (struct peer *, struct attr *, char *, size_t);
void bgp_notify_print (struct peer *, struct bgp_notify *, char *); void bgp_notify_print (struct peer *, struct bgp_notify *, char *);
extern struct message bgp_status_msg[]; extern struct message bgp_status_msg[];

View File

@ -1375,7 +1375,7 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
struct bgp_nlri withdraw; struct bgp_nlri withdraw;
struct bgp_nlri mp_update; struct bgp_nlri mp_update;
struct bgp_nlri mp_withdraw; struct bgp_nlri mp_withdraw;
char attrstr[BUFSIZ]; char attrstr[BUFSIZ] = "";
/* Status must be Established. */ /* Status must be Established. */
if (peer->status != Established) if (peer->status != Established)
@ -1478,7 +1478,9 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
/* Logging the attribute. */ /* Logging the attribute. */
if (BGP_DEBUG (update, UPDATE_IN)) if (BGP_DEBUG (update, UPDATE_IN))
{ {
bgp_dump_attr (peer, &attr, attrstr, BUFSIZ); ret= bgp_dump_attr (peer, &attr, attrstr, BUFSIZ);
if (ret)
zlog (peer->log, LOG_INFO, "%s rcvd UPDATE w/ attr: %s", zlog (peer->log, LOG_INFO, "%s rcvd UPDATE w/ attr: %s",
peer->host, attrstr); peer->host, attrstr);
} }
@ -1518,6 +1520,15 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
bgp_nlri_parse (peer, &attr, &update); bgp_nlri_parse (peer, &attr, &update);
} }
if (! attribute_len && ! withdraw_len)
{
/* End-of-RIB received */
if (BGP_DEBUG (update, UPDATE_IN))
zlog (peer->log, LOG_INFO, "rcvd End-of-RIB for IPv4 Unicast from %s",
peer->host);
}
} }
if (peer->afc[AFI_IP][SAFI_MULTICAST]) if (peer->afc[AFI_IP][SAFI_MULTICAST])
{ {
@ -1530,6 +1541,18 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
&& mp_withdraw.afi == AFI_IP && mp_withdraw.afi == AFI_IP
&& mp_withdraw.safi == SAFI_MULTICAST) && mp_withdraw.safi == SAFI_MULTICAST)
bgp_nlri_parse (peer, NULL, &mp_withdraw); bgp_nlri_parse (peer, NULL, &mp_withdraw);
if (attribute_len == 6 && ! withdraw_len
&& mp_withdraw.afi == AFI_IP
&& mp_withdraw.safi == SAFI_MULTICAST
&& mp_withdraw.length == 0)
{
/* End-of-RIB received */
if (BGP_DEBUG (update, UPDATE_IN))
zlog (peer->log, LOG_INFO, "rcvd End-of-RIB for IPv4 Multicast from %s",
peer->host);
}
} }
if (peer->afc[AFI_IP6][SAFI_UNICAST]) if (peer->afc[AFI_IP6][SAFI_UNICAST])
{ {
@ -1542,6 +1565,18 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
&& mp_withdraw.afi == AFI_IP6 && mp_withdraw.afi == AFI_IP6
&& mp_withdraw.safi == SAFI_UNICAST) && mp_withdraw.safi == SAFI_UNICAST)
bgp_nlri_parse (peer, NULL, &mp_withdraw); bgp_nlri_parse (peer, NULL, &mp_withdraw);
if (attribute_len == 6 && ! withdraw_len
&& mp_withdraw.afi == AFI_IP6
&& mp_withdraw.safi == SAFI_UNICAST
&& mp_withdraw.length == 0)
{
/* End-of-RIB received */
if (BGP_DEBUG (update, UPDATE_IN))
zlog (peer->log, LOG_INFO, "rcvd End-of-RIB for IPv6 Unicast from %s",
peer->host);
}
} }
if (peer->afc[AFI_IP6][SAFI_MULTICAST]) if (peer->afc[AFI_IP6][SAFI_MULTICAST])
{ {
@ -1554,6 +1589,18 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
&& mp_withdraw.afi == AFI_IP6 && mp_withdraw.afi == AFI_IP6
&& mp_withdraw.safi == SAFI_MULTICAST) && mp_withdraw.safi == SAFI_MULTICAST)
bgp_nlri_parse (peer, NULL, &mp_withdraw); bgp_nlri_parse (peer, NULL, &mp_withdraw);
if (attribute_len == 6 && ! withdraw_len
&& mp_withdraw.afi == AFI_IP6
&& mp_withdraw.safi == SAFI_MULTICAST
&& mp_withdraw.length == 0)
{
/* End-of-RIB received */
if (BGP_DEBUG (update, UPDATE_IN))
zlog (peer->log, LOG_INFO, "rcvd End-of-RIB for IPv6 Multicast from %s",
peer->host);
}
} }
if (peer->afc[AFI_IP][SAFI_MPLS_VPN]) if (peer->afc[AFI_IP][SAFI_MPLS_VPN])
{ {
@ -1566,6 +1613,18 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
&& mp_withdraw.afi == AFI_IP && mp_withdraw.afi == AFI_IP
&& mp_withdraw.safi == BGP_SAFI_VPNV4) && mp_withdraw.safi == BGP_SAFI_VPNV4)
bgp_nlri_parse_vpnv4 (peer, NULL, &mp_withdraw); bgp_nlri_parse_vpnv4 (peer, NULL, &mp_withdraw);
if (attribute_len == 6 && ! withdraw_len
&& mp_withdraw.afi == AFI_IP
&& mp_withdraw.safi == BGP_SAFI_VPNV4
&& mp_withdraw.length == 0)
{
/* End-of-RIB received */
if (BGP_DEBUG (update, UPDATE_IN))
zlog (peer->log, LOG_INFO, "rcvd End-of-RIB for VPNv4 Unicast from %s",
peer->host);
}
} }
/* Everything is done. We unintern temporary structures which /* Everything is done. We unintern temporary structures which