[quagga] Update to v0.99.22

git-svn-id: svn+ssh://svn.openwrt.org/openwrt@36717 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
acinonyx 2013-05-25 17:05:33 +00:00
parent 4d4f6b899c
commit 4b340f7974
20 changed files with 17 additions and 4485 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2006-2012 OpenWrt.org
# Copyright (C) 2006-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -8,9 +8,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=quagga
PKG_VERSION:=0.99.21
PKG_VERSION:=0.99.22
PKG_RELEASE:=6
PKG_MD5SUM:=99840adbe57047c90dfba6b6ed9aec7f
PKG_MD5SUM:=3057bf3a91116a1017dd0df7e5e8ef93
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://download.savannah.gnu.org/releases/quagga/

View File

@ -1,11 +0,0 @@
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1646,7 +1646,7 @@ bgp_attr_ext_communities (struct bgp_att
static bgp_attr_parse_ret_t
bgp_attr_unknown (struct bgp_attr_parser_args *args)
{
- bgp_size_t total;
+ bgp_size_t total = args->total;
struct transit *transit;
struct attr_extra *attre;
struct peer *const peer = args->peer;

View File

@ -1,58 +0,0 @@
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -194,11 +194,11 @@ bgp_dump_attr (struct peer *peer, struct
#endif /* HAVE_IPV6 */
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 %u",
attr->local_pref);
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 %u",
attr->med);
if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES)))
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -5954,7 +5954,7 @@ route_vty_out_detail (struct vty *vty, s
if (! CHECK_FLAG (binfo->flags, BGP_INFO_VALID))
vty_out (vty, " (inaccessible)");
else if (binfo->extra && binfo->extra->igpmetric)
- vty_out (vty, " (metric %d)", binfo->extra->igpmetric);
+ vty_out (vty, " (metric %u)", binfo->extra->igpmetric);
vty_out (vty, " from %s", sockunion2str (&binfo->peer->su, buf, SU_ADDRSTRLEN));
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))
vty_out (vty, " (%s)", inet_ntoa (attr->extra->originator_id));
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -8966,7 +8966,7 @@ bgp_config_write_redistribute (struct vt
vty_out (vty, " redistribute %s", zebra_route_string(i));
if (bgp->redist_metric_flag[afi][i])
- vty_out (vty, " metric %d", bgp->redist_metric[afi][i]);
+ vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
if (bgp->rmap[afi][i].name)
vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -541,7 +541,7 @@ vty_show_ip_route_detail (struct vty *vt
inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
VTY_NEWLINE);
vty_out (vty, " Known via \"%s\"", zebra_route_string (rib->type));
- vty_out (vty, ", distance %d, metric %d", rib->distance, rib->metric);
+ vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric);
if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
vty_out (vty, ", best");
if (rib->refcnt)
@@ -1519,7 +1519,7 @@ vty_show_ipv6_route_detail (struct vty *
rn->p.prefixlen,
VTY_NEWLINE);
vty_out (vty, " Known via \"%s\"", zebra_route_string (rib->type));
- vty_out (vty, ", distance %d, metric %d", rib->distance, rib->metric);
+ vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric);
if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
vty_out (vty, ", best");
if (rib->refcnt)

View File

@ -1,20 +0,0 @@
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -172,7 +172,7 @@ route_match_peer_compile (const char *ar
su = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (union sockunion));
- ret = str2sockunion ( (arg)? arg : "0.0.0.0", su);
+ ret = str2sockunion (strcmp(arg, "local") ? arg : "0.0.0.0", su);
if (ret < 0) {
XFREE (MTYPE_ROUTE_MAP_COMPILED, su);
return NULL;
@@ -2430,7 +2430,7 @@ DEFUN (match_peer_local,
"Match peer address\n"
"Static or Redistributed routes\n")
{
- return bgp_route_match_add (vty, vty->index, "peer", NULL);
+ return bgp_route_match_add (vty, vty->index, "peer", "local");
}
DEFUN (no_match_peer,

View File

@ -1,539 +0,0 @@
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -111,7 +111,8 @@ route_match_peer (void *rule, struct pre
void *object)
{
union sockunion *su;
- union sockunion *su2;
+ union sockunion su_def = { .sa.sa_family = AF_INET,
+ .sin.sin_addr.s_addr = INADDR_ANY };
struct peer_group *group;
struct peer *peer;
struct listnode *node, *nnode;
@@ -127,8 +128,7 @@ route_match_peer (void *rule, struct pre
/* If su='0.0.0.0' (command 'match peer local'), and it's a NETWORK,
REDISTRIBUTE or DEFAULT_GENERATED route => return RMAP_MATCH */
- su2 = sockunion_str2su ("0.0.0.0");
- if ( sockunion_same (su, su2) )
+ if (sockunion_same (su, &su_def))
{
int ret;
if ( CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_NETWORK) ||
@@ -137,12 +137,9 @@ route_match_peer (void *rule, struct pre
ret = RMAP_MATCH;
else
ret = RMAP_NOMATCH;
-
- sockunion_free (su2);
return ret;
}
- sockunion_free (su2);
-
+
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
{
if (sockunion_same (su, &peer->su))
@@ -878,7 +875,6 @@ route_set_ip_nexthop (void *rule, struct
route_map_object_t type, void *object)
{
struct rmap_ip_nexthop_set *rins = rule;
- struct in_addr peer_address;
struct bgp_info *bgp_info;
struct peer *peer;
@@ -894,16 +890,14 @@ route_set_ip_nexthop (void *rule, struct
&& peer->su_remote
&& sockunion_family (peer->su_remote) == AF_INET)
{
- inet_aton (sockunion_su2str (peer->su_remote), &peer_address);
- bgp_info->attr->nexthop = peer_address;
+ bgp_info->attr->nexthop.s_addr = sockunion2ip (peer->su_remote);
bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP);
}
else if (CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_OUT)
&& peer->su_local
&& sockunion_family (peer->su_local) == AF_INET)
{
- inet_aton (sockunion_su2str (peer->su_local), &peer_address);
- bgp_info->attr->nexthop = peer_address;
+ bgp_info->attr->nexthop.s_addr = sockunion2ip (peer->su_local);
bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP);
}
}
--- a/lib/sockunion.h
+++ b/lib/sockunion.h
@@ -78,23 +78,17 @@ enum connect_result
#define SET_IN6_LINKLOCAL_IFINDEX(a, i)
#endif /* KAME */
-/* shortcut macro to specify address field of struct sockaddr */
-#define sock2ip(X) (((struct sockaddr_in *)(X))->sin_addr.s_addr)
-#ifdef HAVE_IPV6
-#define sock2ip6(X) (((struct sockaddr_in6 *)(X))->sin6_addr.s6_addr)
-#endif /* HAVE_IPV6 */
-
#define sockunion_family(X) (X)->sa.sa_family
+#define sockunion2ip(X) (X)->sin.sin_addr.s_addr
+
/* Prototypes. */
extern int str2sockunion (const char *, union sockunion *);
extern const char *sockunion2str (union sockunion *, char *, size_t);
extern int sockunion_cmp (union sockunion *, union sockunion *);
extern int sockunion_same (union sockunion *, union sockunion *);
-extern char *sockunion_su2str (union sockunion *su);
extern union sockunion *sockunion_str2su (const char *str);
-extern struct in_addr sockunion_get_in_addr (union sockunion *su);
extern int sockunion_accept (int sock, union sockunion *);
extern int sockunion_stream_socket (union sockunion *);
extern int sockopt_reuseaddr (int);
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -597,8 +597,6 @@ bgp_stop_with_error (struct peer *peer)
static int
bgp_connect_success (struct peer *peer)
{
- char buf1[BUFSIZ];
-
if (peer->fd < 0)
{
zlog_err ("bgp_connect_success peer's fd is negative value %d",
@@ -612,6 +610,8 @@ bgp_connect_success (struct peer *peer)
if (BGP_DEBUG (normal, NORMAL))
{
+ char buf1[SU_ADDRSTRLEN];
+
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
zlog_debug ("%s open active, local address %s", peer->host,
sockunion2str (peer->su_local, buf1, SU_ADDRSTRLEN));
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -581,24 +581,25 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_ro
"Neighbor to display information about\n"
"Display routes learned from neighbor\n")
{
- union sockunion *su;
+ union sockunion su;
struct peer *peer;
-
- su = sockunion_str2su (argv[0]);
- if (su == NULL)
+ int ret;
+
+ ret = str2sockunion (argv[0], &su);
+ if (ret < 0)
{
vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE);
- return CMD_WARNING;
+ return CMD_WARNING;
}
- peer = peer_lookup (NULL, su);
+ peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
{
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_neighbor, su, 0);
+ return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_neighbor, &su, 0);
}
DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
@@ -615,7 +616,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_rou
"Display routes learned from neighbor\n")
{
int ret;
- union sockunion *su;
+ union sockunion su;
struct peer *peer;
struct prefix_rd prd;
@@ -626,21 +627,21 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_rou
return CMD_WARNING;
}
- su = sockunion_str2su (argv[1]);
- if (su == NULL)
+ ret = str2sockunion (argv[1], &su);
+ if (ret < 0)
{
vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE);
- return CMD_WARNING;
+ return CMD_WARNING;
}
- peer = peer_lookup (NULL, su);
+ peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
{
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_neighbor, su, 0);
+ return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_neighbor, &su, 0);
}
DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -185,7 +185,7 @@ bgp_accept (struct thread *thread)
zlog_debug ("[Event] Make dummy peer structure until read Open packet");
{
- char buf[SU_ADDRSTRLEN + 1];
+ char buf[SU_ADDRSTRLEN];
peer = peer_create_accept (peer1->bgp);
SET_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER);
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -10202,15 +10202,18 @@ DEFUN (show_ip_bgp_neighbor_received_pre
"Display the prefixlist filter\n")
{
char name[BUFSIZ];
- union sockunion *su;
+ union sockunion su;
struct peer *peer;
- int count;
+ int count, ret;
- su = sockunion_str2su (argv[0]);
- if (su == NULL)
- return CMD_WARNING;
+ ret = str2sockunion (argv[0], &su);
+ if (ret < 0)
+ {
+ vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
- peer = peer_lookup (NULL, su);
+ peer = peer_lookup (NULL, &su);
if (! peer)
return CMD_WARNING;
@@ -10241,15 +10244,18 @@ DEFUN (show_ip_bgp_ipv4_neighbor_receive
"Display the prefixlist filter\n")
{
char name[BUFSIZ];
- union sockunion *su;
+ union sockunion su;
struct peer *peer;
- int count;
+ int count, ret;
- su = sockunion_str2su (argv[1]);
- if (su == NULL)
- return CMD_WARNING;
+ ret = str2sockunion (argv[1], &su);
+ if (ret < 0)
+ {
+ vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
- peer = peer_lookup (NULL, su);
+ peer = peer_lookup (NULL, &su);
if (! peer)
return CMD_WARNING;
@@ -10312,15 +10318,18 @@ DEFUN (show_bgp_neighbor_received_prefix
"Display the prefixlist filter\n")
{
char name[BUFSIZ];
- union sockunion *su;
+ union sockunion su;
struct peer *peer;
- int count;
+ int count, ret;
- su = sockunion_str2su (argv[0]);
- if (su == NULL)
- return CMD_WARNING;
+ ret = str2sockunion (argv[0], &su);
+ if (ret < 0)
+ {
+ vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
- peer = peer_lookup (NULL, su);
+ peer = peer_lookup (NULL, &su);
if (! peer)
return CMD_WARNING;
@@ -10394,10 +10403,10 @@ DEFUN (show_bgp_view_neighbor_received_p
"Display the prefixlist filter\n")
{
char name[BUFSIZ];
- union sockunion *su;
+ union sockunion su;
struct peer *peer;
struct bgp *bgp;
- int count;
+ int count, ret;
/* BGP structure lookup. */
bgp = bgp_lookup_by_name (argv[0]);
@@ -10407,11 +10416,14 @@ DEFUN (show_bgp_view_neighbor_received_p
return CMD_WARNING;
}
- su = sockunion_str2su (argv[1]);
- if (su == NULL)
- return CMD_WARNING;
+ ret = str2sockunion (argv[1], &su);
+ if (ret < 0)
+ {
+ vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
- peer = peer_lookup (bgp, su);
+ peer = peer_lookup (bgp, &su);
if (! peer)
return CMD_WARNING;
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -2943,7 +2943,6 @@ peer_update_source_vty (struct vty *vty,
const char *source_str)
{
struct peer *peer;
- union sockunion *su;
peer = peer_and_group_lookup_vty (vty, peer_str);
if (! peer)
@@ -2951,12 +2950,11 @@ peer_update_source_vty (struct vty *vty,
if (source_str)
{
- su = sockunion_str2su (source_str);
- if (su)
- {
- peer_update_source_addr_set (peer, su);
- sockunion_free (su);
- }
+ union sockunion su;
+ int ret = str2sockunion (source_str, &su);
+
+ if (ret == 0)
+ peer_update_source_addr_set (peer, &su);
else
peer_update_source_if_set (peer, source_str);
}
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -177,55 +177,15 @@ sockunion2str (union sockunion *su, char
union sockunion *
sockunion_str2su (const char *str)
{
- int ret;
- union sockunion *su;
-
- su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion));
-
- ret = inet_pton (AF_INET, str, &su->sin.sin_addr);
- if (ret > 0) /* Valid IPv4 address format. */
- {
- su->sin.sin_family = AF_INET;
-#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
- su->sin.sin_len = sizeof(struct sockaddr_in);
-#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
- return su;
- }
-#ifdef HAVE_IPV6
- ret = inet_pton (AF_INET6, str, &su->sin6.sin6_addr);
- if (ret > 0) /* Valid IPv6 address format. */
- {
- su->sin6.sin6_family = AF_INET6;
-#ifdef SIN6_LEN
- su->sin6.sin6_len = sizeof(struct sockaddr_in6);
-#endif /* SIN6_LEN */
- return su;
- }
-#endif /* HAVE_IPV6 */
-
+ union sockunion *su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion));
+
+ if (!str2sockunion (str, su))
+ return su;
+
XFREE (MTYPE_SOCKUNION, su);
return NULL;
}
-char *
-sockunion_su2str (union sockunion *su)
-{
- char str[SU_ADDRSTRLEN];
-
- switch (su->sa.sa_family)
- {
- case AF_INET:
- inet_ntop (AF_INET, &su->sin.sin_addr, str, sizeof (str));
- break;
-#ifdef HAVE_IPV6
- case AF_INET6:
- inet_ntop (AF_INET6, &su->sin6.sin6_addr, str, sizeof (str));
- break;
-#endif /* HAVE_IPV6 */
- }
- return XSTRDUP (MTYPE_TMP, str);
-}
-
/* Convert IPv4 compatible IPv6 address to IPv4 address. */
static void
sockunion_normalise_mapped (union sockunion *su)
@@ -422,7 +382,7 @@ sockunion_bind (int sock, union sockunio
su->sin.sin_len = size;
#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
if (su_addr == NULL)
- su->sin.sin_addr.s_addr = htonl (INADDR_ANY);
+ sockunion2ip (su) = htonl (INADDR_ANY);
}
#ifdef HAVE_IPV6
else if (su->sa.sa_family == AF_INET6)
@@ -779,9 +739,9 @@ sockunion_cmp (union sockunion *su1, uni
if (su1->sa.sa_family == AF_INET)
{
- if (ntohl (su1->sin.sin_addr.s_addr) == ntohl (su2->sin.sin_addr.s_addr))
+ if (ntohl (sockunion2ip (su1)) == ntohl (sockunion2ip (su2)))
return 0;
- if (ntohl (su1->sin.sin_addr.s_addr) > ntohl (su2->sin.sin_addr.s_addr))
+ if (ntohl (sockunion2ip (su1)) > ntohl (sockunion2ip (su2)))
return 1;
else
return -1;
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -1612,13 +1612,16 @@ vty_flush (struct thread *thread)
static struct vty *
vty_create (int vty_sock, union sockunion *su)
{
+ char buf[SU_ADDRSTRLEN];
struct vty *vty;
+ sockunion2str(su, buf, SU_ADDRSTRLEN);
+
/* Allocate new vty structure and set up default values. */
vty = vty_new ();
vty->fd = vty_sock;
vty->type = VTY_TERM;
- vty->address = sockunion_su2str (su);
+ strcpy (vty->address, buf);
if (no_password_check)
{
if (restricted_mode)
@@ -1693,7 +1696,7 @@ vty_accept (struct thread *thread)
int accept_sock;
struct prefix *p = NULL;
struct access_list *acl = NULL;
- char *bufp;
+ char buf[SU_ADDRSTRLEN];
accept_sock = THREAD_FD (thread);
@@ -1719,10 +1722,8 @@ vty_accept (struct thread *thread)
if ((acl = access_list_lookup (AFI_IP, vty_accesslist_name)) &&
(access_list_apply (acl, p) == FILTER_DENY))
{
- char *buf;
zlog (NULL, LOG_INFO, "Vty connection refused from %s",
- (buf = sockunion_su2str (&su)));
- free (buf);
+ sockunion2str (&su, buf, SU_ADDRSTRLEN));
close (vty_sock);
/* continue accepting connections */
@@ -1741,10 +1742,8 @@ vty_accept (struct thread *thread)
if ((acl = access_list_lookup (AFI_IP6, vty_ipv6_accesslist_name)) &&
(access_list_apply (acl, p) == FILTER_DENY))
{
- char *buf;
zlog (NULL, LOG_INFO, "Vty connection refused from %s",
- (buf = sockunion_su2str (&su)));
- free (buf);
+ sockunion2str (&su, buf, SU_ADDRSTRLEN));
close (vty_sock);
/* continue accepting connections */
@@ -1767,9 +1766,7 @@ vty_accept (struct thread *thread)
safe_strerror (errno));
zlog (NULL, LOG_INFO, "Vty connection from %s",
- (bufp = sockunion_su2str (&su)));
- if (bufp)
- XFREE (MTYPE_TMP, bufp);
+ sockunion2str (&su, buf, SU_ADDRSTRLEN));
vty_create (vty_sock, &su);
@@ -2193,8 +2190,6 @@ vty_close (struct vty *vty)
if (vty->fd > 0)
close (vty->fd);
- if (vty->address)
- XFREE (MTYPE_TMP, vty->address);
if (vty->buf)
XFREE (MTYPE_VTY, vty->buf);
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -23,6 +23,7 @@ Software Foundation, Inc., 59 Temple Pla
#include "thread.h"
#include "log.h"
+#include "sockunion.h"
#define VTY_BUFSIZ 512
#define VTY_MAXHIST 20
@@ -39,9 +40,6 @@ struct vty
/* Node status of this vty */
int node;
- /* What address is this vty comming from. */
- char *address;
-
/* Failure count */
int fail;
@@ -118,6 +116,9 @@ struct vty
/* Timeout seconds and thread. */
unsigned long v_timeout;
struct thread *t_timeout;
+
+ /* What address is this vty comming from. */
+ char address[SU_ADDRSTRLEN];
};
/* Integrated configuration file. */
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -678,8 +678,8 @@ rib_lookup_ipv4_route (struct prefix_ipv
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
{
/* We are happy with either direct or recursive hexthop */
- if (nexthop->gate.ipv4.s_addr == qgate->sin.sin_addr.s_addr ||
- nexthop->rgate.ipv4.s_addr == qgate->sin.sin_addr.s_addr)
+ if (nexthop->gate.ipv4.s_addr == sockunion2ip (qgate) ||
+ nexthop->rgate.ipv4.s_addr == sockunion2ip (qgate))
return ZEBRA_RIB_FOUND_EXACT;
else
{
@@ -688,7 +688,7 @@ rib_lookup_ipv4_route (struct prefix_ipv
char gate_buf[INET_ADDRSTRLEN], rgate_buf[INET_ADDRSTRLEN], qgate_buf[INET_ADDRSTRLEN];
inet_ntop (AF_INET, &nexthop->gate.ipv4.s_addr, gate_buf, INET_ADDRSTRLEN);
inet_ntop (AF_INET, &nexthop->rgate.ipv4.s_addr, rgate_buf, INET_ADDRSTRLEN);
- inet_ntop (AF_INET, &qgate->sin.sin_addr.s_addr, qgate_buf, INET_ADDRSTRLEN);
+ inet_ntop (AF_INET, &sockunion2ip (qgate), qgate_buf, INET_ADDRSTRLEN);
zlog_debug ("%s: qgate == %s, gate == %s, rgate == %s", __func__, qgate_buf, gate_buf, rgate_buf);
}
return ZEBRA_RIB_FOUND_NOGATE;

View File

@ -1,21 +0,0 @@
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -191,6 +191,9 @@ connected_up_ipv4 (struct interface *ifp
rib_add_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, NULL, ifp->ifindex,
RT_TABLE_MAIN, ifp->metric, 0, SAFI_UNICAST);
+ rib_add_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, NULL, ifp->ifindex,
+ RT_TABLE_MAIN, ifp->metric, 0, SAFI_MULTICAST);
+
rib_update ();
}
@@ -297,6 +300,8 @@ connected_down_ipv4 (struct interface *i
/* Same logic as for connected_up_ipv4(): push the changes into the head. */
rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0, SAFI_UNICAST);
+ rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0, SAFI_MULTICAST);
+
rib_update ();
}

View File

@ -1,127 +0,0 @@
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -327,7 +327,9 @@ main (int argc, char **argv)
zebra_vty_init ();
access_list_init ();
prefix_list_init ();
+#ifdef RTADV
rtadv_init ();
+#endif
#ifdef HAVE_IRDP
irdp_init();
#endif
--- a/zebra/rtadv.h
+++ b/zebra/rtadv.h
@@ -26,6 +26,9 @@
#include "vty.h"
#include "zebra/interface.h"
+/* NB: RTADV is defined in zebra/interface.h above */
+#ifdef RTADV
+
/* Router advertisement prefix. */
struct rtadv_prefix
{
@@ -96,4 +99,6 @@ struct nd_opt_homeagent_info { /* Home
extern const char *rtadv_pref_strs[];
+#endif /* RTADV */
+
#endif /* _ZEBRA_RTADV_H */
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -1197,6 +1197,40 @@ DEFUN (show_ip_protocol,
return CMD_SUCCESS;
}
+/*
+ * Show IP mroute command to dump the BGP Multicast
+ * routing table
+ */
+DEFUN (show_ip_mroute,
+ show_ip_mroute_cmd,
+ "show ip mroute",
+ SHOW_STR
+ IP_STR
+ "IP Multicast routing table\n")
+{
+ struct route_table *table;
+ struct route_node *rn;
+ struct rib *rib;
+ int first = 1;
+
+ table = vrf_table (AFI_IP, SAFI_MULTICAST, 0);
+ if (! table)
+ return CMD_SUCCESS;
+
+ /* Show all IPv4 routes. */
+ for (rn = route_top (table); rn; rn = route_next (rn))
+ for (rib = rn->info; rib; rib = rib->next)
+ {
+ if (first)
+ {
+ vty_out (vty, SHOW_ROUTE_V4_HEADER);
+ first = 0;
+ }
+ vty_show_ip_route (vty, rn, rib);
+ }
+ return CMD_SUCCESS;
+}
+
#ifdef HAVE_IPV6
/* General fucntion for IPv6 static route. */
@@ -1952,40 +1986,6 @@ DEFUN (show_ipv6_route_summary,
}
/*
- * Show IP mroute command to dump the BGP Multicast
- * routing table
- */
-DEFUN (show_ip_mroute,
- show_ip_mroute_cmd,
- "show ip mroute",
- SHOW_STR
- IP_STR
- "IP Multicast routing table\n")
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- int first = 1;
-
- table = vrf_table (AFI_IP, SAFI_MULTICAST, 0);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show all IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- for (rib = rn->info; rib; rib = rib->next)
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib);
- }
- return CMD_SUCCESS;
-}
-
-/*
* Show IPv6 mroute command.Used to dump
* the Multicast routing table.
*/
@@ -2020,11 +2020,6 @@ DEFUN (show_ipv6_mroute,
return CMD_SUCCESS;
}
-
-
-
-
-
/* Write IPv6 static route configuration. */
static int
static_config_ipv6 (struct vty *vty)

View File

@ -1,90 +0,0 @@
--- a/lib/command.c
+++ b/lib/command.c
@@ -868,86 +868,7 @@ cmd_ipv6_match (const char *str)
if (ret == 1)
return exact_match;
- while (*str != '\0')
- {
- switch (state)
- {
- case STATE_START:
- if (*str == ':')
- {
- if (*(str + 1) != ':' && *(str + 1) != '\0')
- return no_match;
- colons--;
- state = STATE_COLON;
- }
- else
- {
- sp = str;
- state = STATE_ADDR;
- }
-
- continue;
- case STATE_COLON:
- colons++;
- if (*(str + 1) == ':')
- state = STATE_DOUBLE;
- else
- {
- sp = str + 1;
- state = STATE_ADDR;
- }
- break;
- case STATE_DOUBLE:
- if (double_colon)
- return no_match;
-
- if (*(str + 1) == ':')
- return no_match;
- else
- {
- if (*(str + 1) != '\0')
- colons++;
- sp = str + 1;
- state = STATE_ADDR;
- }
-
- double_colon++;
- nums++;
- break;
- case STATE_ADDR:
- if (*(str + 1) == ':' || *(str + 1) == '\0')
- {
- if (str - sp > 3)
- return no_match;
-
- nums++;
- state = STATE_COLON;
- }
- if (*(str + 1) == '.')
- state = STATE_DOT;
- break;
- case STATE_DOT:
- state = STATE_ADDR;
- break;
- default:
- break;
- }
-
- if (nums > 8)
- return no_match;
-
- if (colons > 7)
- return no_match;
-
- str++;
- }
-
-#if 0
- if (nums < 11)
- return partly_match;
-#endif /* 0 */
-
- return exact_match;
+ return no_match;
}
static enum match_type

View File

@ -1,27 +0,0 @@
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -916,6 +916,24 @@ thread_cancel_event (struct thread_maste
thread_add_unuse (m, t);
}
}
+
+ /* thread can be on the ready list too */
+ thread = m->ready.head;
+ while (thread)
+ {
+ struct thread *t;
+
+ t = thread;
+ thread = t->next;
+
+ if (t->arg == arg)
+ {
+ ret++;
+ thread_list_delete (&m->ready, t);
+ t->type = THREAD_UNUSED;
+ thread_add_unuse (m, t);
+ }
+ }
return ret;
}

View File

@ -1,89 +0,0 @@
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -2616,7 +2616,7 @@ bgp_announce_route_all (struct peer *pee
static void
bgp_soft_reconfig_table_rsclient (struct peer *rsclient, afi_t afi,
- safi_t safi, struct bgp_table *table)
+ safi_t safi, struct bgp_table *table, struct prefix_rd *prd)
{
struct bgp_node *rn;
struct bgp_adj_in *ain;
@@ -2627,8 +2627,11 @@ bgp_soft_reconfig_table_rsclient (struct
for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn))
for (ain = rn->adj_in; ain; ain = ain->next)
{
+ struct bgp_info *ri = rn->info;
+
bgp_update_rsclient (rsclient, afi, safi, ain->attr, ain->peer,
- &rn->p, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL, NULL);
+ &rn->p, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, prd,
+ (bgp_info_extra_get (ri))->tag);
}
}
@@ -2639,18 +2642,25 @@ bgp_soft_reconfig_rsclient (struct peer
struct bgp_node *rn;
if (safi != SAFI_MPLS_VPN)
- bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, NULL);
+ bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, NULL, NULL);
else
for (rn = bgp_table_top (rsclient->bgp->rib[afi][safi]); rn;
rn = bgp_route_next (rn))
if ((table = rn->info) != NULL)
- bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, table);
+ {
+ struct prefix_rd prd;
+ prd.family = AF_UNSPEC;
+ prd.prefixlen = 64;
+ memcpy(&prd.val, rn->p.u.val, 8);
+
+ bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, table, &prd);
+ }
}
static void
bgp_soft_reconfig_table (struct peer *peer, afi_t afi, safi_t safi,
- struct bgp_table *table)
+ struct bgp_table *table, struct prefix_rd *prd)
{
int ret;
struct bgp_node *rn;
@@ -2664,9 +2674,12 @@ bgp_soft_reconfig_table (struct peer *pe
{
if (ain->peer == peer)
{
+ struct bgp_info *ri = rn->info;
+
ret = bgp_update (peer, &rn->p, ain->attr, afi, safi,
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL,
- NULL, NULL, 1);
+ prd, (bgp_info_extra_get (ri))->tag, 1);
+
if (ret < 0)
{
bgp_unlock_node (rn);
@@ -2687,12 +2700,19 @@ bgp_soft_reconfig_in (struct peer *peer,
return;
if (safi != SAFI_MPLS_VPN)
- bgp_soft_reconfig_table (peer, afi, safi, NULL);
+ bgp_soft_reconfig_table (peer, afi, safi, NULL, NULL);
else
for (rn = bgp_table_top (peer->bgp->rib[afi][safi]); rn;
rn = bgp_route_next (rn))
if ((table = rn->info) != NULL)
- bgp_soft_reconfig_table (peer, afi, safi, table);
+ {
+ struct prefix_rd prd;
+ prd.family = AF_UNSPEC;
+ prd.prefixlen = 64;
+ memcpy(&prd.val, rn->p.u.val, 8);
+
+ bgp_soft_reconfig_table (peer, afi, safi, table, &prd);
+ }
}

View File

@ -1,17 +0,0 @@
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -2485,12 +2485,8 @@ bgp_default_originate (struct peer *peer
#ifdef HAVE_IPV6
else if (afi == AFI_IP6)
{
- struct attr_extra *ae;
- attr.extra = NULL;
-
- ae = bgp_attr_extra_get (&attr);
- attr.extra = ae;
-
+ struct attr_extra *ae = attr.extra;
+
str2prefix ("::/0", &p);
/* IPv6 global nexthop must be included. */

View File

@ -1,11 +0,0 @@
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -2413,7 +2413,7 @@ top_lsp_refresh (struct thread *thread)
isis_dynhn_insert (lsp->lsp_header->lsp_id, lsp->tlv_data.hostname,
IS_LEVEL_1);
- lsp->lsp_header->lsp_bits = lsp_bits_generate (level,
+ lsp->lsp_header->lsp_bits = lsp_bits_generate (lsp->level,
lsp->area->overload_bit);
rem_lifetime = lsp_rem_lifetime (lsp->area, IS_LEVEL_1);
lsp->lsp_header->rem_lifetime = htons (rem_lifetime);

View File

@ -1,25 +0,0 @@
Add definitions for IPCTL_FORWARDING and IP6CTL_FORWARDING.
Inspired from
http://svn.gnumonks.org/trunk/grouter/build/src/quagga/quagga/quagga-0.99.1-forward_sysctl-2.6.14.patch
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
--- a/zebra/ipforward_sysctl.c
+++ b/zebra/ipforward_sysctl.c
@@ -31,6 +31,15 @@
#define MIB_SIZ 4
+/* Fix for recent (2.6.14) kernel headers */
+#ifndef IPCTL_FORWARDING
+#define IPCTL_FORWARDING NET_IPV4_FORWARD
+#endif
+
+#ifndef IP6CTL_FORWARDING
+#define IP6CTL_FORWARDING NET_IPV6_FORWARDING
+#endif
+
extern struct zebra_privs_t zserv_privs;
/* IPv4 forwarding control MIB. */

View File

@ -1,6 +1,6 @@
--- a/lib/log.c
+++ b/lib/log.c
@@ -929,13 +929,19 @@ proto_redistnum(int afi, const char *s)
@@ -925,13 +925,19 @@ proto_redistnum(int afi, const char *s)
return ZEBRA_ROUTE_STATIC;
else if (strncmp (s, "r", 1) == 0)
return ZEBRA_ROUTE_RIP;
@ -22,7 +22,7 @@
return ZEBRA_ROUTE_BABEL;
}
if (afi == AFI_IP6)
@@ -948,13 +954,19 @@ proto_redistnum(int afi, const char *s)
@@ -944,13 +950,19 @@ proto_redistnum(int afi, const char *s)
return ZEBRA_ROUTE_STATIC;
else if (strncmp (s, "r", 1) == 0)
return ZEBRA_ROUTE_RIPNG;
@ -107,7 +107,7 @@
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -1623,6 +1623,9 @@ netlink_route_multipath (int cmd, struct
@@ -1609,6 +1609,9 @@ netlink_route_multipath (int cmd, struct
addattr_l (&req.n, sizeof req, RTA_PREFSRC,
&nexthop->src.ipv4, bytelen);
@ -119,7 +119,7 @@
"nexthop via if %u", nexthop->ifindex);
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -67,6 +67,9 @@ static const struct
@@ -68,6 +68,9 @@ static const struct
[ZEBRA_ROUTE_OSPF6] = {ZEBRA_ROUTE_OSPF6, 110},
[ZEBRA_ROUTE_ISIS] = {ZEBRA_ROUTE_ISIS, 115},
[ZEBRA_ROUTE_BGP] = {ZEBRA_ROUTE_BGP, 20 /* IBGP is 200. */},
@ -129,7 +129,7 @@
[ZEBRA_ROUTE_BABEL] = {ZEBRA_ROUTE_BABEL, 95},
/* no entry/default: 150 */
};
@@ -403,6 +406,18 @@ nexthop_active_ipv4 (struct rib *rib, st
@@ -456,6 +459,18 @@ nexthop_active_ipv4 (struct rib *rib, st
}
return 0;
}
@ -148,7 +148,7 @@
else
{
return 0;
@@ -507,6 +522,18 @@ nexthop_active_ipv6 (struct rib *rib, st
@@ -560,6 +575,18 @@ nexthop_active_ipv6 (struct rib *rib, st
}
return 0;
}
@ -167,7 +167,7 @@
else
{
return 0;
@@ -1236,6 +1263,8 @@ static const u_char meta_queue_map[ZEBRA
@@ -1376,6 +1403,8 @@ static const u_char meta_queue_map[ZEBRA
[ZEBRA_ROUTE_ISIS] = 2,
[ZEBRA_ROUTE_BGP] = 3,
[ZEBRA_ROUTE_HSLS] = 4,
@ -178,7 +178,7 @@
--- a/zebra/zebra_snmp.c
+++ b/zebra/zebra_snmp.c
@@ -251,6 +251,12 @@ proto_trans(int type)
@@ -245,6 +245,12 @@ proto_trans(int type)
return 1; /* shouldn't happen */
case ZEBRA_ROUTE_BGP:
return 14; /* bgp */

View File

@ -1,11 +0,0 @@
--- a/vtysh/extract.pl.in
+++ b/vtysh/extract.pl.in
@@ -63,7 +63,7 @@ $ignore{'"show history"'} = "ignore";
foreach (@ARGV) {
$file = $_;
- open (FH, "cpp -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_srcdir@/isisd/topology @SNMP_INCLUDES@ @CPPFLAGS@ $file |");
+ open (FH, "@CPP@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_srcdir@/isisd/topology @SNMP_INCLUDES@ @CPPFLAGS@ $file |");
local $/; undef $/;
$line = <FH>;
close (FH);

View File

@ -12,7 +12,7 @@
sockunion2str (&su, buf, SU_ADDRSTRLEN);
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -718,6 +718,7 @@ struct bgp_nlri
@@ -732,6 +732,7 @@ struct bgp_nlri
/* BGP timers default value. */
#define BGP_INIT_START_TIMER 5
#define BGP_ERROR_START_TIMER 30

View File

@ -1,6 +1,6 @@
--- a/lib/command.c
+++ b/lib/command.c
@@ -2522,6 +2522,13 @@ DEFUN (config_write_file,
@@ -2527,6 +2527,13 @@ DEFUN (config_write_file,
VTY_NEWLINE);
goto finished;
}
@ -14,7 +14,7 @@
if (link (config_file, config_file_sav) != 0)
{
vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav,
@@ -2535,7 +2542,23 @@ DEFUN (config_write_file,
@@ -2540,7 +2547,23 @@ DEFUN (config_write_file,
VTY_NEWLINE);
goto finished;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,318 +0,0 @@
From: Paul Jakma <paul.jakma@sun.com>
Date: Thu, 4 Sep 2008 22:27:13 +0000 (+0100)
Subject: [bgp/pgbgp] Add some pgbgp commands to restricted-mode and other command tweaks
X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6021635e9e1e5105c3e22bf7eb0d6c3
[bgp/pgbgp] Add some pgbgp commands to restricted-mode and other command tweaks
* bgp_pgbgp.c:
(edge_neighbor_iterator) make ASN==0 mean 'iterate over all ASNs'
(bgp_pgbgp_stats_origin_one) new function, to display one origin AS status.
(bgp_pgbgp_stats_origins) adapt to use previous.
Adapt to iterate over all stats if no prefix was giving.
(show_ip_bgp_pgbgp_neighbors_cmd) recognise no ASN argument case
(show_ip_bgp_pgbgp_neighbors_all_cmd) Iterate over all
(show_ip_bgp_pgbgp_origins_cmd) similar
(show_ip_bgp_pgbgp_origins_all_cmd)
(bgp_pgbgp_enable) install the lookup commands to ther new RESTRICTED_NODE
* bgp_route.c:
(route_vty_short_status_out) only allowed to print one char for anomalous
status.
(route_vty_out_detail) Add support for printing out more detail on
PG-BGP status
---
--- a/bgpd/bgp_pgbgp.c
+++ b/bgpd/bgp_pgbgp.c
@@ -227,7 +227,7 @@ static void
edge_neighbor_iterator (struct hash_backet *backet, struct nsearch *pns)
{
struct bgp_pgbgp_edge *hedge = backet->data;
- if ((hedge->e.a == pns->asn || hedge->e.b == pns->asn)
+ if ((!pns->asn || hedge->e.a == pns->asn || hedge->e.b == pns->asn)
&& hedge->e.a != hedge->e.b)
{
struct vty *vty = pns->pvty;
@@ -254,13 +254,39 @@ bgp_pgbgp_stats_neighbors (struct vty *v
return CMD_SUCCESS;
}
+static void
+bgp_pgbgp_stats_origin_one (struct vty *vty, struct bgp_node *rn,
+ time_t t_now)
+{
+ char str[INET6_BUFSIZ];
+
+ if (!rn->hist)
+ return;
+
+ prefix2str (&rn->p, str, sizeof(str));
+ vty_out (vty, "%s%s", str, VTY_NEWLINE);
+
+ for (struct bgp_pgbgp_origin * cur = rn->hist->o; cur != NULL;
+ cur = cur->next)
+ {
+ if (cur->deprefUntil > t_now)
+ vty_out (vty, "Untrusted Origin AS: %d%s", cur->originAS,
+ VTY_NEWLINE);
+ else
+ vty_out (vty, "Trusted Origin AS: %d%s", cur->originAS,
+ VTY_NEWLINE);
+ }
+}
+
static int
bgp_pgbgp_stats_origins (struct vty *vty, afi_t afi, safi_t safi,
const char *prefix)
{
struct bgp *bgp;
struct bgp_table *table;
+ struct bgp_node *rn;
time_t t_now = time (NULL);
+
bgp = bgp_get_default ();
if (bgp == NULL)
return CMD_WARNING;
@@ -269,28 +295,22 @@ bgp_pgbgp_stats_origins (struct vty *vty
table = bgp->rib[afi][safi];
if (table == NULL)
return CMD_WARNING;
-
- struct prefix p;
- str2prefix (prefix, &p);
- struct bgp_node *rn = bgp_node_match (table, &p);
- vty_out (vty, "%s%s", prefix, VTY_NEWLINE);
- if (rn)
+
+ if (prefix)
{
+ struct prefix p;
+ str2prefix (prefix, &p);
+ rn = bgp_node_match (table, &p);
if (rn->hist)
- {
- for (struct bgp_pgbgp_origin * cur = rn->hist->o; cur != NULL;
- cur = cur->next)
- {
- if (cur->deprefUntil > t_now)
- vty_out (vty, "Untrusted Origin AS: %d%s", cur->originAS,
- VTY_NEWLINE);
- else
- vty_out (vty, "Trusted Origin AS: %d%s", cur->originAS,
- VTY_NEWLINE);
- }
- }
+ bgp_pgbgp_stats_origin_one (vty, rn, t_now);
bgp_unlock_node (rn);
+ return CMD_SUCCESS;
}
+
+ for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn))
+ if (rn->hist)
+ bgp_pgbgp_stats_origin_one (vty, rn, t_now);
+
return CMD_SUCCESS;
}
@@ -377,7 +397,7 @@ bgp_pgbgp_stats (struct vty *vty, afi_t
DEFUN (show_ip_bgp_pgbgp,
show_ip_bgp_pgbgp_cmd,
"show ip bgp pgbgp",
- SHOW_STR IP_STR BGP_STR "Display PGBGP statistics\n")
+ SHOW_STR IP_STR BGP_STR "Pretty-Good BGP statistics\n")
{
return bgp_pgbgp_stats (vty, AFI_IP, SAFI_UNICAST);
}
@@ -385,29 +405,46 @@ DEFUN (show_ip_bgp_pgbgp,
DEFUN (show_ip_bgp_pgbgp_neighbors,
show_ip_bgp_pgbgp_neighbors_cmd,
"show ip bgp pgbgp neighbors WORD",
- SHOW_STR
- IP_STR
- BGP_STR
- "BGP pgbgp\n"
- "BGP pgbgp neighbors\n" "ASN whos neighbors should be displayed\n")
+ SHOW_STR IP_STR BGP_STR
+ "Pretty-Good BGP statistics\n"
+ "PG-BGP neighbor information\n"
+ "AS to show neighbors of\n")
{
return bgp_pgbgp_stats_neighbors (vty, AFI_IP, SAFI_UNICAST,
- atoi (argv[0]));
+ argc == 1 ? atoi (argv[0]) : 0);
}
+ALIAS (show_ip_bgp_pgbgp_neighbors,
+ show_ip_bgp_pgbgp_neighbors_all_cmd,
+ "show ip bgp pgbgp neighbors",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ "Pretty-Good BGP statistics\n"
+ "PG-BGP neighbors information\n")
+
DEFUN (show_ip_bgp_pgbgp_origins,
show_ip_bgp_pgbgp_origins_cmd,
"show ip bgp pgbgp origins A.B.C.D/M",
SHOW_STR
IP_STR
BGP_STR
- "BGP pgbgp\n"
- "BGP pgbgp neighbors\n" "Prefix to look up origin ASes of\n")
+ "Pretty-Good BGP statistics\n"
+ "PG-BGP prefix origin information\n"
+ "Prefix to look up origin ASes of\n")
{
- return bgp_pgbgp_stats_origins (vty, AFI_IP, SAFI_UNICAST, argv[0]);
+ return bgp_pgbgp_stats_origins (vty, AFI_IP, SAFI_UNICAST,
+ argc == 1 ? argv[0] : NULL);
}
-
+ALIAS (show_ip_bgp_pgbgp_origins,
+ show_ip_bgp_pgbgp_origins_all_cmd,
+ "show ip bgp pgbgp origins",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ "Pretty-Good BGP statistics\n"
+ "PG-BGP prefixes origin information")
/*! --------------- VTY (others exist in bgp_route.c) ------------------ !*/
@@ -749,12 +786,19 @@ bgp_pgbgp_enable (struct bgp *bgp, afi_t
pgbgp->lastgc = time (NULL);
pgbgp->lastStore = time (NULL);
pgbgp->startTime = time (NULL);
+ install_element (RESTRICTED_NODE, &show_ip_bgp_pgbgp_cmd);
+ install_element (RESTRICTED_NODE, &show_ip_bgp_pgbgp_neighbors_cmd);
+ install_element (RESTRICTED_NODE, &show_ip_bgp_pgbgp_origins_cmd);
install_element (VIEW_NODE, &show_ip_bgp_pgbgp_cmd);
- install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_cmd);
install_element (VIEW_NODE, &show_ip_bgp_pgbgp_neighbors_cmd);
- install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_neighbors_cmd);
install_element (VIEW_NODE, &show_ip_bgp_pgbgp_origins_cmd);
+ install_element (VIEW_NODE, &show_ip_bgp_pgbgp_neighbors_all_cmd);
+ install_element (VIEW_NODE, &show_ip_bgp_pgbgp_origins_all_cmd);
+ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_cmd);
+ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_neighbors_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_origins_cmd);
+ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_neighbors_all_cmd);
+ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_origins_all_cmd);
pgbgp->edgeT = hash_create_size (131072, edge_key_make, edge_cmp);
bgp_pgbgp_restore ();
return 0;
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -5597,20 +5597,6 @@ enum bgp_display_type
static void
route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo)
{
- if (ANOMALOUS(binfo->flags))
- {
- vty_out(vty, "a[");
- if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_P))
- vty_out(vty, "i");
- if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_O))
- vty_out(vty, "p");
- if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_E))
- vty_out(vty, "e");
- if (CHECK_FLAG(binfo->flags, BGP_INFO_IGNORED_P))
- vty_out(vty, "s");
- vty_out(vty, "] ");
- }
-
/* Route status display. */
if (CHECK_FLAG (binfo->flags, BGP_INFO_REMOVED))
vty_out (vty, "R");
@@ -5626,6 +5612,17 @@ route_vty_short_status_out (struct vty *
/* Selected */
if (CHECK_FLAG (binfo->flags, BGP_INFO_HISTORY))
vty_out (vty, "h");
+ else if (ANOMALOUS(binfo->flags))
+ {
+ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_O))
+ vty_out(vty, "p");
+ else if (CHECK_FLAG(binfo->flags, BGP_INFO_IGNORED_P))
+ vty_out(vty, "P");
+ else if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_P))
+ vty_out(vty, "a");
+ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_E))
+ vty_out(vty, "a");
+ }
else if (CHECK_FLAG (binfo->flags, BGP_INFO_DAMPED))
vty_out (vty, "d");
else if (CHECK_FLAG (binfo->flags, BGP_INFO_SELECTED))
@@ -6104,7 +6101,22 @@ route_vty_out_detail (struct vty *vty, s
if (binfo->extra && binfo->extra->damp_info)
bgp_damp_info_vty (vty, binfo);
- /* Line 7 display Uptime */
+ /* 8: PGBGP status */
+ if (ANOMALOUS(binfo->flags))
+ {
+ vty_out (vty, " Anomalous:");
+ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_P))
+ vty_out (vty, " divergent sub-prefixes,");
+ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_O))
+ vty_out (vty, " origin AS (prefix hijack?),");
+ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_E))
+ vty_out (vty, " new edge in path,");
+ if (CHECK_FLAG(binfo->flags, BGP_INFO_IGNORED_P))
+ vty_out (vty, " origin AS (sub-prefix hijack?),");
+ vty_out (vty, "%s", VTY_NEWLINE);
+ }
+
+ /* Line 9 display Uptime */
#ifdef HAVE_CLOCK_MONOTONIC
tbuf = time(NULL) - (bgp_clock() - binfo->uptime);
vty_out (vty, " Last update: %s", ctime(&tbuf));
@@ -6115,8 +6127,9 @@ route_vty_out_detail (struct vty *vty, s
vty_out (vty, "%s", VTY_NEWLINE);
}
-#define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s r RIB-failure, S Stale, R Removed%s"
-#define BGP_SHOW_PCODE_HEADER "Status code: a (anomalous) of: [p] prefix hijack, [s] sub-prefix hijack,%s [i] informant of sub-prefix [e] new edge%s"
+#define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s" \
+ " r RIB-failure, S Stale, R Removed, %s" \
+ " p prefix hijack, P sub-prefix hijack, a other anomaly%s"
#define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s"
#define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s"
#define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s"
@@ -6325,8 +6338,7 @@ bgp_show_table (struct vty *vty, struct
if (header)
{
vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id), VTY_NEWLINE);
- vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
- vty_out (vty, BGP_SHOW_PCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
if (type == bgp_show_type_dampend_paths
|| type == bgp_show_type_damp_neighbor)
@@ -9858,7 +9870,7 @@ show_adj_route (struct vty *vty, struct
PEER_STATUS_DEFAULT_ORIGINATE))
{
vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE);
- vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
vty_out (vty, "Originating default network 0.0.0.0%s%s",
@@ -9875,7 +9887,7 @@ show_adj_route (struct vty *vty, struct
if (header1)
{
vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE);
- vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
header1 = 0;
}
@@ -9899,7 +9911,7 @@ show_adj_route (struct vty *vty, struct
if (header1)
{
vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE);
- vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
header1 = 0;
}

View File

@ -1,6 +1,6 @@
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -269,7 +269,7 @@ vtysh_pager_init (void)
@@ -268,7 +268,7 @@ vtysh_pager_init (void)
if (pager_defined)
vtysh_pager_name = strdup (pager_defined);
else
@ -9,7 +9,7 @@
}
/* Command execution over the vty interface. */
@@ -1885,7 +1885,7 @@ DEFUN (vtysh_terminal_length,
@@ -1884,7 +1884,7 @@ DEFUN (vtysh_terminal_length,
{
int lines;
char *endptr = NULL;
@ -18,7 +18,7 @@
lines = strtol (argv[0], &endptr, 10);
if (lines < 0 || lines > 512 || *endptr != '\0')
@@ -1902,7 +1902,7 @@ DEFUN (vtysh_terminal_length,
@@ -1901,7 +1901,7 @@ DEFUN (vtysh_terminal_length,
if (lines != 0)
{