mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-29 12:21:25 +00:00
Remove draft-walton-bgp-hostname-capability-00 for now
This commit is contained in:
parent
eb4b183040
commit
c744aa9fc6
@ -183,7 +183,6 @@ bgp_find_peer (struct vty *vty, const char *peer_str)
|
|||||||
int ret;
|
int ret;
|
||||||
union sockunion su;
|
union sockunion su;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
struct peer *peer;
|
|
||||||
|
|
||||||
bgp = vty->index;
|
bgp = vty->index;
|
||||||
ret = str2sockunion (peer_str, &su);
|
ret = str2sockunion (peer_str, &su);
|
||||||
@ -191,11 +190,7 @@ bgp_find_peer (struct vty *vty, const char *peer_str)
|
|||||||
/* 'swpX' string */
|
/* 'swpX' string */
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
peer = peer_lookup_by_conf_if (bgp, peer_str);
|
return peer_lookup_by_conf_if (bgp, peer_str);
|
||||||
if (!peer)
|
|
||||||
peer = peer_lookup_by_hostname (bgp, peer_str);
|
|
||||||
|
|
||||||
return peer;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return peer_lookup (bgp, &su);
|
return peer_lookup (bgp, &su);
|
||||||
|
@ -160,10 +160,6 @@ peer_xfer_conn(struct peer *from_peer)
|
|||||||
from_peer->last_event = last_evt;
|
from_peer->last_event = last_evt;
|
||||||
from_peer->last_major_event = last_maj_evt;
|
from_peer->last_major_event = last_maj_evt;
|
||||||
peer->remote_id = from_peer->remote_id;
|
peer->remote_id = from_peer->remote_id;
|
||||||
if (from_peer->hostname != NULL)
|
|
||||||
peer->hostname = XSTRDUP(MTYPE_HOST, from_peer->hostname);
|
|
||||||
if (from_peer->domainname != NULL)
|
|
||||||
peer->domainname = XSTRDUP(MTYPE_HOST, from_peer->domainname);
|
|
||||||
|
|
||||||
for (afi = AFI_IP; afi < AFI_MAX; afi++)
|
for (afi = AFI_IP; afi < AFI_MAX; afi++)
|
||||||
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
|
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
|
||||||
|
132
bgpd/bgp_open.c
132
bgpd/bgp_open.c
@ -465,85 +465,6 @@ bgp_capability_addpath (struct peer *peer, struct capability_header *hdr)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
bgp_capability_hostname (struct peer *peer, struct capability_header *hdr)
|
|
||||||
{
|
|
||||||
struct stream *s = BGP_INPUT (peer);
|
|
||||||
char str[BGP_MAX_HOSTNAME+1];
|
|
||||||
size_t end = stream_get_getp (s) + hdr->length;
|
|
||||||
u_char len;
|
|
||||||
|
|
||||||
SET_FLAG(peer->cap, PEER_CAP_HOSTNAME_RCV);
|
|
||||||
|
|
||||||
len = stream_getc(s);
|
|
||||||
if (stream_get_getp(s) + len > end)
|
|
||||||
{
|
|
||||||
zlog_warn("%s: Received malformed hostname capability from peer %s",
|
|
||||||
__FUNCTION__, peer->host);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (len > BGP_MAX_HOSTNAME)
|
|
||||||
{
|
|
||||||
stream_get(str, s, BGP_MAX_HOSTNAME);
|
|
||||||
stream_forward_getp(s, len-BGP_MAX_HOSTNAME);
|
|
||||||
len = BGP_MAX_HOSTNAME; /* to set the '\0' below */
|
|
||||||
}
|
|
||||||
else if (len)
|
|
||||||
stream_get(str, s, len);
|
|
||||||
|
|
||||||
if (len)
|
|
||||||
{
|
|
||||||
str[len] = '\0';
|
|
||||||
|
|
||||||
if (peer->hostname != NULL)
|
|
||||||
XFREE(MTYPE_HOST, peer->hostname);
|
|
||||||
|
|
||||||
if (peer->domainname != NULL)
|
|
||||||
XFREE(MTYPE_HOST, peer->domainname);
|
|
||||||
|
|
||||||
peer->hostname = XSTRDUP(MTYPE_HOST, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stream_get_getp(s) +1 > end)
|
|
||||||
{
|
|
||||||
zlog_warn("%s: Received invalid domain name len (hostname capability) from peer %s",
|
|
||||||
__FUNCTION__, peer->host);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
len = stream_getc(s);
|
|
||||||
if (stream_get_getp(s) + len > end)
|
|
||||||
{
|
|
||||||
zlog_warn("%s: Received runt domain name (hostname capability) from peer %s",
|
|
||||||
__FUNCTION__, peer->host);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (len > BGP_MAX_HOSTNAME)
|
|
||||||
{
|
|
||||||
stream_get(str, s, BGP_MAX_HOSTNAME);
|
|
||||||
stream_forward_getp(s, len-BGP_MAX_HOSTNAME);
|
|
||||||
len = BGP_MAX_HOSTNAME; /* to set the '\0' below */
|
|
||||||
}
|
|
||||||
else if (len)
|
|
||||||
stream_get(str, s, len);
|
|
||||||
|
|
||||||
if (len)
|
|
||||||
{
|
|
||||||
str[len] = '\0';
|
|
||||||
peer->domainname = XSTRDUP(MTYPE_HOST, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bgp_debug_neighbor_events(peer))
|
|
||||||
{
|
|
||||||
zlog_debug("%s received hostname %s, domainname %s",
|
|
||||||
peer->host, peer->hostname, peer->domainname);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bgp_capability_enhe (struct peer *peer, struct capability_header *hdr)
|
bgp_capability_enhe (struct peer *peer, struct capability_header *hdr)
|
||||||
{
|
{
|
||||||
@ -599,7 +520,6 @@ bgp_capability_enhe (struct peer *peer, struct capability_header *hdr)
|
|||||||
{ CAPABILITY_CODE_DYNAMIC_OLD, "Dynamic (Old)" },
|
{ CAPABILITY_CODE_DYNAMIC_OLD, "Dynamic (Old)" },
|
||||||
{ CAPABILITY_CODE_REFRESH_OLD, "Route Refresh (Old)" },
|
{ CAPABILITY_CODE_REFRESH_OLD, "Route Refresh (Old)" },
|
||||||
{ CAPABILITY_CODE_ORF_OLD, "ORF (Old)" },
|
{ CAPABILITY_CODE_ORF_OLD, "ORF (Old)" },
|
||||||
{ CAPABILITY_CODE_HOSTNAME, "Hostname" },
|
|
||||||
};
|
};
|
||||||
static const int capcode_str_max = array_size(capcode_str);
|
static const int capcode_str_max = array_size(capcode_str);
|
||||||
|
|
||||||
@ -617,7 +537,6 @@ static const size_t cap_minsizes[] =
|
|||||||
[CAPABILITY_CODE_ENHE] = CAPABILITY_CODE_ENHE_LEN,
|
[CAPABILITY_CODE_ENHE] = CAPABILITY_CODE_ENHE_LEN,
|
||||||
[CAPABILITY_CODE_REFRESH_OLD] = CAPABILITY_CODE_REFRESH_LEN,
|
[CAPABILITY_CODE_REFRESH_OLD] = CAPABILITY_CODE_REFRESH_LEN,
|
||||||
[CAPABILITY_CODE_ORF_OLD] = sizeof (struct capability_orf_entry),
|
[CAPABILITY_CODE_ORF_OLD] = sizeof (struct capability_orf_entry),
|
||||||
[CAPABILITY_CODE_HOSTNAME] = CAPABILITY_CODE_MIN_HOSTNAME_LEN,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -683,7 +602,6 @@ bgp_capability_parse (struct peer *peer, size_t length, int *mp_capability,
|
|||||||
case CAPABILITY_CODE_DYNAMIC:
|
case CAPABILITY_CODE_DYNAMIC:
|
||||||
case CAPABILITY_CODE_DYNAMIC_OLD:
|
case CAPABILITY_CODE_DYNAMIC_OLD:
|
||||||
case CAPABILITY_CODE_ENHE:
|
case CAPABILITY_CODE_ENHE:
|
||||||
case CAPABILITY_CODE_HOSTNAME:
|
|
||||||
/* Check length. */
|
/* Check length. */
|
||||||
if (caphdr.length < cap_minsizes[caphdr.code])
|
if (caphdr.length < cap_minsizes[caphdr.code])
|
||||||
{
|
{
|
||||||
@ -758,10 +676,6 @@ bgp_capability_parse (struct peer *peer, size_t length, int *mp_capability,
|
|||||||
if (bgp_capability_addpath (peer, &caphdr))
|
if (bgp_capability_addpath (peer, &caphdr))
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
case CAPABILITY_CODE_HOSTNAME:
|
|
||||||
if (bgp_capability_hostname (peer, &caphdr))
|
|
||||||
return -1;
|
|
||||||
break;
|
|
||||||
case CAPABILITY_CODE_ENHE:
|
case CAPABILITY_CODE_ENHE:
|
||||||
if (bgp_capability_enhe (peer, &caphdr))
|
if (bgp_capability_enhe (peer, &caphdr))
|
||||||
return -1;
|
return -1;
|
||||||
@ -1100,7 +1014,6 @@ bgp_open_capability (struct stream *s, struct peer *peer)
|
|||||||
as_t local_as;
|
as_t local_as;
|
||||||
u_int32_t restart_time;
|
u_int32_t restart_time;
|
||||||
u_char afi_safi_count = 0;
|
u_char afi_safi_count = 0;
|
||||||
struct utsname names;
|
|
||||||
|
|
||||||
/* Remember current pointer for Opt Parm Len. */
|
/* Remember current pointer for Opt Parm Len. */
|
||||||
cp = stream_get_endp (s);
|
cp = stream_get_endp (s);
|
||||||
@ -1267,51 +1180,6 @@ bgp_open_capability (struct stream *s, struct peer *peer)
|
|||||||
stream_putc (s, CAPABILITY_CODE_DYNAMIC_LEN);
|
stream_putc (s, CAPABILITY_CODE_DYNAMIC_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hostname capability */
|
|
||||||
uname(&names);
|
|
||||||
if (names.nodename[0] != '\0')
|
|
||||||
{
|
|
||||||
SET_FLAG(peer->cap, PEER_CAP_HOSTNAME_ADV);
|
|
||||||
stream_putc (s, BGP_OPEN_OPT_CAP);
|
|
||||||
rcapp = stream_get_endp(s); /* Ptr to length placeholder */
|
|
||||||
stream_putc(s, 0); /* dummy len for now */
|
|
||||||
stream_putc (s, CAPABILITY_CODE_HOSTNAME);
|
|
||||||
capp = stream_get_endp(s);
|
|
||||||
stream_putc(s, 0); /* dummy len for now */
|
|
||||||
len = strlen(names.nodename);
|
|
||||||
if (len > BGP_MAX_HOSTNAME)
|
|
||||||
len = BGP_MAX_HOSTNAME;
|
|
||||||
|
|
||||||
stream_putc(s, len);
|
|
||||||
stream_put(s, names.nodename, len);
|
|
||||||
#ifdef _GNU_SOURCE
|
|
||||||
if ((names.domainname[0] != '\0') &&
|
|
||||||
(strcmp(names.domainname, "(none)") != 0))
|
|
||||||
{
|
|
||||||
len = strlen(names.domainname);
|
|
||||||
if (len > BGP_MAX_HOSTNAME)
|
|
||||||
len = BGP_MAX_HOSTNAME;
|
|
||||||
|
|
||||||
stream_putc(s, len);
|
|
||||||
stream_put(s, names.domainname, len);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
stream_putc(s, 0); /* 0 length */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the lengths straight */
|
|
||||||
len = stream_get_endp(s) - rcapp - 1;
|
|
||||||
stream_putc_at(s, rcapp, len);
|
|
||||||
len = stream_get_endp(s) - capp - 1;
|
|
||||||
stream_putc_at(s, capp, len);
|
|
||||||
|
|
||||||
if (bgp_debug_neighbor_events(peer))
|
|
||||||
zlog_debug("%s Sending hostname cap with hn = %s, dn = %s",
|
|
||||||
peer->host, names.nodename, names.domainname);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sending base graceful-restart capability irrespective of the config */
|
/* Sending base graceful-restart capability irrespective of the config */
|
||||||
SET_FLAG (peer->cap, PEER_CAP_RESTART_ADV);
|
SET_FLAG (peer->cap, PEER_CAP_RESTART_ADV);
|
||||||
stream_putc (s, BGP_OPEN_OPT_CAP);
|
stream_putc (s, BGP_OPEN_OPT_CAP);
|
||||||
|
@ -78,7 +78,6 @@ struct capability_gr
|
|||||||
#define CAPABILITY_CODE_ENHE 5 /* Extended Next Hop Encoding */
|
#define CAPABILITY_CODE_ENHE 5 /* Extended Next Hop Encoding */
|
||||||
#define CAPABILITY_CODE_REFRESH_OLD 128 /* Route Refresh Capability(cisco) */
|
#define CAPABILITY_CODE_REFRESH_OLD 128 /* Route Refresh Capability(cisco) */
|
||||||
#define CAPABILITY_CODE_ORF_OLD 130 /* Cooperative Route Filtering Capability(cisco) */
|
#define CAPABILITY_CODE_ORF_OLD 130 /* Cooperative Route Filtering Capability(cisco) */
|
||||||
#define CAPABILITY_CODE_HOSTNAME 131 /* Advertise hostname capabilty */
|
|
||||||
|
|
||||||
/* Capability Length */
|
/* Capability Length */
|
||||||
#define CAPABILITY_CODE_MP_LEN 4
|
#define CAPABILITY_CODE_MP_LEN 4
|
||||||
@ -87,7 +86,6 @@ struct capability_gr
|
|||||||
#define CAPABILITY_CODE_RESTART_LEN 2 /* Receiving only case */
|
#define CAPABILITY_CODE_RESTART_LEN 2 /* Receiving only case */
|
||||||
#define CAPABILITY_CODE_AS4_LEN 4
|
#define CAPABILITY_CODE_AS4_LEN 4
|
||||||
#define CAPABILITY_CODE_ADDPATH_LEN 4
|
#define CAPABILITY_CODE_ADDPATH_LEN 4
|
||||||
#define CAPABILITY_CODE_MIN_HOSTNAME_LEN 2
|
|
||||||
#define CAPABILITY_CODE_ENHE_LEN 6 /* NRLI AFI = 2, SAFI = 2, Nexthop AFI = 2 */
|
#define CAPABILITY_CODE_ENHE_LEN 6 /* NRLI AFI = 2, SAFI = 2, Nexthop AFI = 2 */
|
||||||
|
|
||||||
/* Cooperative Route Filtering Capability. */
|
/* Cooperative Route Filtering Capability. */
|
||||||
|
@ -7242,35 +7242,15 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
|
|||||||
json_object_string_add(json_peer, "peer-id", sockunion2str (&binfo->peer->su, buf, SU_ADDRSTRLEN));
|
json_object_string_add(json_peer, "peer-id", sockunion2str (&binfo->peer->su, buf, SU_ADDRSTRLEN));
|
||||||
json_object_string_add(json_peer, "router-id", inet_ntop (AF_INET, &binfo->peer->remote_id, buf1, BUFSIZ));
|
json_object_string_add(json_peer, "router-id", inet_ntop (AF_INET, &binfo->peer->remote_id, buf1, BUFSIZ));
|
||||||
|
|
||||||
if (binfo->peer->hostname)
|
|
||||||
json_object_string_add(json_peer, "hostname", binfo->peer->hostname);
|
|
||||||
|
|
||||||
if (binfo->peer->domainname)
|
|
||||||
json_object_string_add(json_peer, "domainname", binfo->peer->domainname);
|
|
||||||
|
|
||||||
if (binfo->peer->conf_if)
|
if (binfo->peer->conf_if)
|
||||||
json_object_string_add(json_peer, "interface", binfo->peer->conf_if);
|
json_object_string_add(json_peer, "interface", binfo->peer->conf_if);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (binfo->peer->conf_if)
|
if (binfo->peer->conf_if)
|
||||||
{
|
vty_out (vty, " from %s", binfo->peer->conf_if);
|
||||||
if (binfo->peer->hostname &&
|
|
||||||
bgp_flag_check(binfo->peer->bgp, BGP_FLAG_SHOW_HOSTNAME))
|
|
||||||
vty_out (vty, " from %s(%s)", binfo->peer->hostname,
|
|
||||||
binfo->peer->conf_if);
|
|
||||||
else
|
|
||||||
vty_out (vty, " from %s", binfo->peer->conf_if);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
vty_out (vty, " from %s", sockunion2str (&binfo->peer->su, buf, SU_ADDRSTRLEN));
|
||||||
if (binfo->peer->hostname &&
|
|
||||||
bgp_flag_check(binfo->peer->bgp, BGP_FLAG_SHOW_HOSTNAME))
|
|
||||||
vty_out (vty, " from %s(%s)", binfo->peer->hostname,
|
|
||||||
binfo->peer->host);
|
|
||||||
else
|
|
||||||
vty_out (vty, " from %s", sockunion2str (&binfo->peer->su, buf, SU_ADDRSTRLEN));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))
|
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))
|
||||||
vty_out (vty, " (%s)", inet_ntoa (attr->extra->originator_id));
|
vty_out (vty, " (%s)", inet_ntoa (attr->extra->originator_id));
|
||||||
@ -8041,9 +8021,6 @@ route_vty_out_detail_header (struct vty *vty, struct bgp *bgp,
|
|||||||
*/
|
*/
|
||||||
json_peer = json_object_new_object();
|
json_peer = json_object_new_object();
|
||||||
|
|
||||||
if (peer->hostname)
|
|
||||||
json_object_string_add(json_peer, "hostname", peer->hostname);
|
|
||||||
|
|
||||||
if (!json_adv_to)
|
if (!json_adv_to)
|
||||||
json_adv_to = json_object_new_object();
|
json_adv_to = json_object_new_object();
|
||||||
|
|
||||||
@ -8059,21 +8036,10 @@ route_vty_out_detail_header (struct vty *vty, struct bgp *bgp,
|
|||||||
if (! first)
|
if (! first)
|
||||||
vty_out (vty, " Advertised to non peer-group peers:%s ", VTY_NEWLINE);
|
vty_out (vty, " Advertised to non peer-group peers:%s ", VTY_NEWLINE);
|
||||||
|
|
||||||
if (peer->hostname && bgp_flag_check(peer->bgp, BGP_FLAG_SHOW_HOSTNAME))
|
if (peer->conf_if)
|
||||||
{
|
vty_out (vty, " %s", peer->conf_if);
|
||||||
if (peer->conf_if)
|
else
|
||||||
vty_out (vty, " %s(%s)", peer->hostname, peer->conf_if);
|
vty_out (vty, " %s", sockunion2str (&peer->su, buf1, SU_ADDRSTRLEN));
|
||||||
else
|
|
||||||
vty_out (vty, " %s(%s)", peer->hostname,
|
|
||||||
sockunion2str (&peer->su, buf1, SU_ADDRSTRLEN));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (peer->conf_if)
|
|
||||||
vty_out (vty, " %s", peer->conf_if);
|
|
||||||
else
|
|
||||||
vty_out (vty, " %s", sockunion2str (&peer->su, buf1, SU_ADDRSTRLEN));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
first = 1;
|
first = 1;
|
||||||
}
|
}
|
||||||
@ -11157,13 +11123,8 @@ peer_lookup_in_view (struct vty *vty, const char *view_name,
|
|||||||
peer = peer_lookup_by_conf_if (bgp, ip_str);
|
peer = peer_lookup_by_conf_if (bgp, ip_str);
|
||||||
if (!peer)
|
if (!peer)
|
||||||
{
|
{
|
||||||
/* search for peer by hostname */
|
vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE);
|
||||||
peer = peer_lookup_by_hostname(bgp, ip_str);
|
return NULL;
|
||||||
if (!peer)
|
|
||||||
{
|
|
||||||
vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return peer;
|
return peer;
|
||||||
}
|
}
|
||||||
@ -11649,15 +11610,8 @@ bgp_peer_counts (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi)
|
|||||||
*/
|
*/
|
||||||
thread_execute (bm->master, bgp_peer_count_walker, &pcounts, 0);
|
thread_execute (bm->master, bgp_peer_count_walker, &pcounts, 0);
|
||||||
|
|
||||||
if (peer->hostname && bgp_flag_check(peer->bgp, BGP_FLAG_SHOW_HOSTNAME))
|
vty_out (vty, "Prefix counts for %s, %s%s",
|
||||||
{
|
peer->host, afi_safi_print (afi, safi), VTY_NEWLINE);
|
||||||
vty_out (vty, "Prefix counts for %s/%s, %s%s",
|
|
||||||
peer->hostname, peer->host, afi_safi_print (afi, safi),
|
|
||||||
VTY_NEWLINE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
vty_out (vty, "Prefix counts for %s, %s%s",
|
|
||||||
peer->host, afi_safi_print (afi, safi), VTY_NEWLINE);
|
|
||||||
vty_out (vty, "PfxCt: %ld%s", peer->pcount[afi][safi], VTY_NEWLINE);
|
vty_out (vty, "PfxCt: %ld%s", peer->pcount[afi][safi], VTY_NEWLINE);
|
||||||
vty_out (vty, "%sCounts from RIB table walk:%s%s",
|
vty_out (vty, "%sCounts from RIB table walk:%s%s",
|
||||||
VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
|
VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
|
||||||
|
@ -151,11 +151,8 @@ peer_lookup_vty (struct vty *vty, const char *ip_str)
|
|||||||
peer = peer_lookup_by_conf_if (bgp, ip_str);
|
peer = peer_lookup_by_conf_if (bgp, ip_str);
|
||||||
if (!peer)
|
if (!peer)
|
||||||
{
|
{
|
||||||
if ((peer = peer_lookup_by_hostname(bgp, ip_str)) == NULL)
|
vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE);
|
||||||
{
|
return NULL;
|
||||||
vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -421,12 +418,8 @@ bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
|
|||||||
peer = peer_lookup_by_conf_if (bgp, arg);
|
peer = peer_lookup_by_conf_if (bgp, arg);
|
||||||
if (!peer)
|
if (!peer)
|
||||||
{
|
{
|
||||||
peer = peer_lookup_by_hostname(bgp, arg);
|
vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE);
|
||||||
if (!peer)
|
return CMD_WARNING;
|
||||||
{
|
|
||||||
vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2149,36 +2142,6 @@ DEFUN (bgp_default_ipv4_unicast,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display hostname in certain command outputs */
|
|
||||||
DEFUN (bgp_default_show_hostname,
|
|
||||||
bgp_default_show_hostname_cmd,
|
|
||||||
"bgp default show-hostname",
|
|
||||||
"BGP specific commands\n"
|
|
||||||
"Configure BGP defaults\n"
|
|
||||||
"Show hostname in certain command ouputs\n")
|
|
||||||
{
|
|
||||||
struct bgp *bgp;
|
|
||||||
|
|
||||||
bgp = vty->index;
|
|
||||||
bgp_flag_set (bgp, BGP_FLAG_SHOW_HOSTNAME);
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (no_bgp_default_show_hostname,
|
|
||||||
no_bgp_default_show_hostname_cmd,
|
|
||||||
"no bgp default show-hostname",
|
|
||||||
NO_STR
|
|
||||||
"BGP specific commands\n"
|
|
||||||
"Configure BGP defaults\n"
|
|
||||||
"Show hostname in certain command ouputs\n")
|
|
||||||
{
|
|
||||||
struct bgp *bgp;
|
|
||||||
|
|
||||||
bgp = vty->index;
|
|
||||||
bgp_flag_unset (bgp, BGP_FLAG_SHOW_HOSTNAME);
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* "bgp import-check" configuration. */
|
/* "bgp import-check" configuration. */
|
||||||
DEFUN (bgp_network_import_check,
|
DEFUN (bgp_network_import_check,
|
||||||
bgp_network_import_check_cmd,
|
bgp_network_import_check_cmd,
|
||||||
@ -8614,12 +8577,6 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi,
|
|||||||
if (peer_dynamic_neighbor(peer))
|
if (peer_dynamic_neighbor(peer))
|
||||||
json_object_boolean_true_add(json_peer, "dynamic-peer");
|
json_object_boolean_true_add(json_peer, "dynamic-peer");
|
||||||
|
|
||||||
if (peer->hostname)
|
|
||||||
json_object_string_add(json_peer, "hostname", peer->hostname);
|
|
||||||
|
|
||||||
if (peer->domainname)
|
|
||||||
json_object_string_add(json_peer, "domainname", peer->domainname);
|
|
||||||
|
|
||||||
json_object_int_add(json_peer, "remote-as", peer->as);
|
json_object_int_add(json_peer, "remote-as", peer->as);
|
||||||
json_object_int_add(json_peer, "version", 4);
|
json_object_int_add(json_peer, "version", 4);
|
||||||
json_object_int_add(json_peer, "msgrcvd",
|
json_object_int_add(json_peer, "msgrcvd",
|
||||||
@ -8664,11 +8621,7 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi,
|
|||||||
dn_flag[0] = '*';
|
dn_flag[0] = '*';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (peer->hostname && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME))
|
len = vty_out (vty, "%s%s", dn_flag, peer->host);
|
||||||
len = vty_out (vty, "%s%s(%s)", dn_flag, peer->hostname,
|
|
||||||
peer->host);
|
|
||||||
else
|
|
||||||
len = vty_out (vty, "%s%s", dn_flag, peer->host);
|
|
||||||
len = 16 - len;
|
len = 16 - len;
|
||||||
|
|
||||||
if (len < 1)
|
if (len < 1)
|
||||||
@ -9353,16 +9306,7 @@ bgp_show_peer (struct vty *vty, struct peer *p)
|
|||||||
if (p->desc)
|
if (p->desc)
|
||||||
vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
|
vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
|
||||||
|
|
||||||
if (p->hostname)
|
/* Peer-group */
|
||||||
{
|
|
||||||
if (p->domainname && (p->domainname[0] != '\0'))
|
|
||||||
vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname,
|
|
||||||
VTY_NEWLINE);
|
|
||||||
else
|
|
||||||
vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Peer-group */
|
|
||||||
if (p->group)
|
if (p->group)
|
||||||
{
|
{
|
||||||
vty_out (vty, " Member of peer-group %s for session parameters%s",
|
vty_out (vty, " Member of peer-group %s for session parameters%s",
|
||||||
@ -9569,19 +9513,6 @@ bgp_show_peer (struct vty *vty, struct peer *p)
|
|||||||
vty_out (vty, "%s", VTY_NEWLINE);
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hostname capability */
|
|
||||||
if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV) ||
|
|
||||||
CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV))
|
|
||||||
{
|
|
||||||
vty_out (vty, " Hostname Capability:");
|
|
||||||
if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV))
|
|
||||||
vty_out (vty, " advertised");
|
|
||||||
if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_RCV))
|
|
||||||
vty_out (vty, " %sreceived",
|
|
||||||
CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV) ? "and " : "");
|
|
||||||
vty_out (vty, "%s", VTY_NEWLINE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Gracefull Restart */
|
/* Gracefull Restart */
|
||||||
if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
|
if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
|
||||||
|| CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
|
|| CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
|
||||||
@ -9864,11 +9795,6 @@ bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
|
|||||||
find = 1;
|
find = 1;
|
||||||
bgp_show_peer (vty, peer);
|
bgp_show_peer (vty, peer);
|
||||||
}
|
}
|
||||||
else if (peer->hostname && !strcmp(peer->hostname, conf_if))
|
|
||||||
{
|
|
||||||
find = 1;
|
|
||||||
bgp_show_peer (vty, peer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -11853,10 +11779,6 @@ bgp_vty_init (void)
|
|||||||
install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
|
install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
|
||||||
install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
|
install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
|
||||||
|
|
||||||
/* bgp default show-hostname */
|
|
||||||
install_element (BGP_NODE, &bgp_default_show_hostname_cmd);
|
|
||||||
install_element (BGP_NODE, &no_bgp_default_show_hostname_cmd);
|
|
||||||
|
|
||||||
/* "bgp default subgroup-pkt-queue-max" commands. */
|
/* "bgp default subgroup-pkt-queue-max" commands. */
|
||||||
install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd);
|
install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd);
|
||||||
install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd);
|
install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd);
|
||||||
|
39
bgpd/bgpd.c
39
bgpd/bgpd.c
@ -1759,12 +1759,6 @@ peer_delete (struct peer *peer)
|
|||||||
|
|
||||||
FOREACH_AFI_SAFI (afi, safi)
|
FOREACH_AFI_SAFI (afi, safi)
|
||||||
peer_af_delete (peer, afi, safi);
|
peer_af_delete (peer, afi, safi);
|
||||||
|
|
||||||
if (peer->hostname)
|
|
||||||
XFREE(MTYPE_HOST, peer->hostname);
|
|
||||||
if (peer->domainname)
|
|
||||||
XFREE(MTYPE_HOST, peer->domainname);
|
|
||||||
|
|
||||||
peer_unlock (peer); /* initial reference */
|
peer_unlock (peer); /* initial reference */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -2840,35 +2834,6 @@ peer_lookup_by_conf_if (struct bgp *bgp, const char *conf_if)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct peer *
|
|
||||||
peer_lookup_by_hostname (struct bgp *bgp, const char *hostname)
|
|
||||||
{
|
|
||||||
struct peer *peer;
|
|
||||||
struct listnode *node, *nnode;
|
|
||||||
|
|
||||||
if (!hostname)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (bgp != NULL)
|
|
||||||
{
|
|
||||||
for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
|
|
||||||
if (peer->hostname && !strcmp(peer->hostname, hostname)
|
|
||||||
&& ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
|
|
||||||
return peer;
|
|
||||||
}
|
|
||||||
else if (bm->bgp != NULL)
|
|
||||||
{
|
|
||||||
struct listnode *bgpnode, *nbgpnode;
|
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS (bm->bgp, bgpnode, nbgpnode, bgp))
|
|
||||||
for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
|
|
||||||
if (peer->hostname && !strcmp(peer->hostname, hostname)
|
|
||||||
&& ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
|
|
||||||
return peer;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct peer *
|
struct peer *
|
||||||
peer_lookup (struct bgp *bgp, union sockunion *su)
|
peer_lookup (struct bgp *bgp, union sockunion *su)
|
||||||
{
|
{
|
||||||
@ -6490,10 +6455,6 @@ bgp_config_write (struct vty *vty)
|
|||||||
vty_out (vty, " bgp default local-preference %d%s",
|
vty_out (vty, " bgp default local-preference %d%s",
|
||||||
bgp->default_local_pref, VTY_NEWLINE);
|
bgp->default_local_pref, VTY_NEWLINE);
|
||||||
|
|
||||||
/* BGP default show-hostname */
|
|
||||||
if (bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME))
|
|
||||||
vty_out (vty, " bgp default show-hostname%s", VTY_NEWLINE);
|
|
||||||
|
|
||||||
/* BGP default subgroup-pkt-queue-max. */
|
/* BGP default subgroup-pkt-queue-max. */
|
||||||
if (bgp->default_subgroup_pkt_queue_max != BGP_DEFAULT_SUBGROUP_PKT_QUEUE_MAX)
|
if (bgp->default_subgroup_pkt_queue_max != BGP_DEFAULT_SUBGROUP_PKT_QUEUE_MAX)
|
||||||
vty_out (vty, " bgp default subgroup-pkt-queue-max %d%s",
|
vty_out (vty, " bgp default subgroup-pkt-queue-max %d%s",
|
||||||
|
14
bgpd/bgpd.h
14
bgpd/bgpd.h
@ -70,8 +70,6 @@ enum bgp_af_index
|
|||||||
for (afi = AFI_IP; afi < AFI_MAX; afi++) \
|
for (afi = AFI_IP; afi < AFI_MAX; afi++) \
|
||||||
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
|
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
|
||||||
|
|
||||||
#define BGP_MAX_HOSTNAME 64 /* Linux max, is larger than most other sys */
|
|
||||||
|
|
||||||
/* BGP master for system wide configurations and variables. */
|
/* BGP master for system wide configurations and variables. */
|
||||||
struct bgp_master
|
struct bgp_master
|
||||||
{
|
{
|
||||||
@ -255,7 +253,6 @@ struct bgp
|
|||||||
#define BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET (1 << 17)
|
#define BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET (1 << 17)
|
||||||
#define BGP_FLAG_FORCE_STATIC_PROCESS (1 << 18)
|
#define BGP_FLAG_FORCE_STATIC_PROCESS (1 << 18)
|
||||||
#define BGP_FLAG_IMPORT_CHECK_EXACT_MATCH (1 << 19)
|
#define BGP_FLAG_IMPORT_CHECK_EXACT_MATCH (1 << 19)
|
||||||
#define BGP_FLAG_SHOW_HOSTNAME (1 << 20)
|
|
||||||
|
|
||||||
/* BGP Per AF flags */
|
/* BGP Per AF flags */
|
||||||
u_int16_t af_flags[AFI_MAX][SAFI_MAX];
|
u_int16_t af_flags[AFI_MAX][SAFI_MAX];
|
||||||
@ -579,10 +576,8 @@ struct peer
|
|||||||
#define PEER_CAP_RESTART_BIT_RCV (1 << 10) /* peer restart state */
|
#define PEER_CAP_RESTART_BIT_RCV (1 << 10) /* peer restart state */
|
||||||
#define PEER_CAP_ADDPATH_ADV (1 << 11) /* addpath advertised */
|
#define PEER_CAP_ADDPATH_ADV (1 << 11) /* addpath advertised */
|
||||||
#define PEER_CAP_ADDPATH_RCV (1 << 12) /* addpath received */
|
#define PEER_CAP_ADDPATH_RCV (1 << 12) /* addpath received */
|
||||||
#define PEER_CAP_HOSTNAME_ADV (1 << 13) /* hostname advertised */
|
#define PEER_CAP_ENHE_ADV (1 << 13) /* Extended nexthop advertised */
|
||||||
#define PEER_CAP_HOSTNAME_RCV (1 << 14) /* hostname received */
|
#define PEER_CAP_ENHE_RCV (1 << 14) /* Extended nexthop received */
|
||||||
#define PEER_CAP_ENHE_ADV (1 << 15) /* Extended nexthop advertised */
|
|
||||||
#define PEER_CAP_ENHE_RCV (1 << 16) /* Extended nexthop received */
|
|
||||||
|
|
||||||
/* Capability flags (reset in bgp_stop) */
|
/* Capability flags (reset in bgp_stop) */
|
||||||
u_int16_t af_cap[AFI_MAX][SAFI_MAX];
|
u_int16_t af_cap[AFI_MAX][SAFI_MAX];
|
||||||
@ -815,10 +810,6 @@ u_char last_reset_cause[BGP_MAX_PACKET_SIZE];
|
|||||||
#define PEER_RMAP_TYPE_IMPORT (1 << 6) /* neighbor route-map import */
|
#define PEER_RMAP_TYPE_IMPORT (1 << 6) /* neighbor route-map import */
|
||||||
#define PEER_RMAP_TYPE_EXPORT (1 << 7) /* neighbor route-map export */
|
#define PEER_RMAP_TYPE_EXPORT (1 << 7) /* neighbor route-map export */
|
||||||
|
|
||||||
/* hostname and domainname advertised by host */
|
|
||||||
char *hostname;
|
|
||||||
char *domainname;
|
|
||||||
|
|
||||||
/* peer specific BFD information */
|
/* peer specific BFD information */
|
||||||
void *bfd_info;
|
void *bfd_info;
|
||||||
};
|
};
|
||||||
@ -1119,7 +1110,6 @@ extern struct bgp *bgp_lookup (as_t, const char *);
|
|||||||
extern struct bgp *bgp_lookup_by_name (const char *);
|
extern struct bgp *bgp_lookup_by_name (const char *);
|
||||||
extern struct peer *peer_lookup (struct bgp *, union sockunion *);
|
extern struct peer *peer_lookup (struct bgp *, union sockunion *);
|
||||||
extern struct peer *peer_lookup_by_conf_if (struct bgp *, const char *);
|
extern struct peer *peer_lookup_by_conf_if (struct bgp *, const char *);
|
||||||
extern struct peer *peer_lookup_by_hostname(struct bgp *, const char *);
|
|
||||||
extern struct peer *peer_conf_interface_get(struct bgp *, const char *, afi_t,
|
extern struct peer *peer_conf_interface_get(struct bgp *, const char *, afi_t,
|
||||||
safi_t);
|
safi_t);
|
||||||
extern void bgp_peer_conf_if_to_su_update (struct peer *);
|
extern void bgp_peer_conf_if_to_su_update (struct peer *);
|
||||||
|
Loading…
Reference in New Issue
Block a user