Merge branch 'master' into nhrp_bugfix

This commit is contained in:
Ghasem Naddaf 2020-03-11 09:50:54 -07:00
commit 31384f929a
249 changed files with 4126 additions and 3348 deletions

6
.gitignore vendored
View File

@ -56,6 +56,12 @@
*.pb.cc
*_clippy.c
### gcov outputs
*.gcno
*.gcov
*.gcda
### dist
*.tar.?z

View File

@ -138,7 +138,7 @@ babel_create_routing_process (void)
assert (babel_routing_process == NULL);
/* Allocaste Babel instance. */
babel_routing_process = XCALLOC (MTYPE_BABEL, sizeof (struct babel));
babel_routing_process = XCALLOC(MTYPE_BABEL, sizeof(struct babel));
/* Initialize timeouts */
gettime(&babel_now);

View File

@ -122,7 +122,7 @@ void uchar_to_inaddr(struct in_addr *dest, const unsigned char *src);
void in6addr_to_uchar(unsigned char *dest, const struct in6_addr *src);
void uchar_to_in6addr(struct in6_addr *dest, const unsigned char *src);
int daemonise(void);
const unsigned char v4prefix[16];
extern const unsigned char v4prefix[16];
/* If debugging is disabled, we want to avoid calling format_address
for every omitted debugging message. So debug is a macro. But

View File

@ -383,7 +383,7 @@ int bfdd_bfd_sessions_single_hop_administrative_down_modify(
bs = nb_running_get_entry(dnode, NULL, true);
if (shutdown == false) {
if (!shutdown) {
if (!BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_SHUTDOWN))
return NB_OK;
@ -447,7 +447,7 @@ int bfdd_bfd_sessions_single_hop_echo_mode_modify(enum nb_event event,
bs = nb_running_get_entry(dnode, NULL, true);
if (echo == false) {
if (!echo) {
if (!BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_ECHO))
return NB_OK;

View File

@ -474,7 +474,7 @@ static void _display_peer_brief(struct vty *vty, struct bfd_session *bs)
}
}
static void _display_peer_brief_iter(struct hash_backet *hb, void *arg)
static void _display_peer_brief_iter(struct hash_bucket *hb, void *arg)
{
struct bfd_vrf_tuple *bvt = arg;
struct vty *vty;
@ -500,7 +500,7 @@ static void _display_peers_brief(struct vty *vty, const char *vrfname, bool use_
bvt.vrfname = vrfname;
if (use_json == false) {
if (!use_json) {
bvt.vty = vty;
vty_out(vty, "Session count: %lu\n", bfd_get_session_count());

View File

@ -41,9 +41,9 @@
#define AS_HEADER_SIZE 2
/* Now FOUR octets are used for AS value. */
#define AS_VALUE_SIZE sizeof (as_t)
#define AS_VALUE_SIZE sizeof(as_t)
/* This is the old one */
#define AS16_VALUE_SIZE sizeof (as16_t)
#define AS16_VALUE_SIZE sizeof(as16_t)
/* Maximum protocol segment length value */
#define AS_SEGMENT_MAX 255
@ -768,7 +768,7 @@ static int assegments_parse(struct stream *s, size_t length,
* on more, than 8 bits (otherwise it's a warning, bug
* #564).
*/
|| ((sizeof segh.length > 1)
|| ((sizeof(segh.length) > 1)
&& (0x10 + segh.length > 0x10 + AS_SEGMENT_MAX))) {
if (head)
assegment_free_all(head);
@ -793,7 +793,7 @@ static int assegments_parse(struct stream *s, size_t length,
if (head)
prev->next = seg;
else /* it's the first segment */
head = prev = seg;
head = seg;
for (i = 0; i < segh.length; i++)
seg->as[i] =
@ -2127,7 +2127,7 @@ static void *bgp_aggr_aspath_hash_alloc(void *p)
return aspath;
}
static void bgp_aggr_aspath_prepare(struct hash_backet *hb, void *arg)
static void bgp_aggr_aspath_prepare(struct hash_bucket *hb, void *arg)
{
struct aspath *hb_aspath = hb->data;
struct aspath **aggr_aspath = arg;

View File

@ -2506,9 +2506,14 @@ static bgp_attr_parse_ret_t bgp_attr_psid_sub(uint8_t type, uint16_t length,
}
/* Configure from Info */
attr->srv6_vpn = XMALLOC(MTYPE_BGP_SRV6_VPN,
if (attr->srv6_vpn) {
flog_err(EC_BGP_ATTRIBUTE_REPEATED,
"Prefix SID SRv6 VPN field repeated");
return bgp_attr_malformed(
args, BGP_NOTIFY_UPDATE_MAL_ATTR, args->total);
}
attr->srv6_vpn = XCALLOC(MTYPE_BGP_SRV6_VPN,
sizeof(struct bgp_attr_srv6_vpn));
attr->srv6_vpn->refcnt = 0;
attr->srv6_vpn->sid_flags = sid_flags;
sid_copy(&attr->srv6_vpn->sid, &ipv6_sid);
}
@ -2543,7 +2548,13 @@ static bgp_attr_parse_ret_t bgp_attr_psid_sub(uint8_t type, uint16_t length,
}
/* Configure from Info */
attr->srv6_l3vpn = XMALLOC(MTYPE_BGP_SRV6_L3VPN,
if (attr->srv6_l3vpn) {
flog_err(EC_BGP_ATTRIBUTE_REPEATED,
"Prefix SID SRv6 L3VPN field repeated");
return bgp_attr_malformed(
args, BGP_NOTIFY_UPDATE_MAL_ATTR, args->total);
}
attr->srv6_l3vpn = XCALLOC(MTYPE_BGP_SRV6_L3VPN,
sizeof(struct bgp_attr_srv6_l3vpn));
attr->srv6_l3vpn->sid_flags = sid_flags;
attr->srv6_l3vpn->endpoint_behavior = endpoint_behavior;

View File

@ -34,7 +34,6 @@
#define MAX_ET 0xffffffff
unsigned long eth_tag_id;
struct attr;
/* EVPN ESI */

View File

@ -44,7 +44,7 @@ static int64_t bgp_clist_new_seq_get(struct community_list *list)
int64_t newseq;
struct community_entry *entry;
maxseq = newseq = 0;
maxseq = 0;
for (entry = list->head; entry; entry = entry->next) {
if (maxseq < entry->seq)
@ -654,7 +654,7 @@ community_regexp_delete (struct community *com, regex_t * reg)
i = 0;
while (i < com->size)
{
memcpy (&comval, com_nthval (com, i), sizeof (uint32_t));
memcpy (&comval, com_nthval (com, i), sizeof(uint32_t));
comval = ntohl (comval);
switch (comval) {

View File

@ -907,7 +907,7 @@ static void *bgp_aggr_communty_hash_alloc(void *p)
return community;
}
static void bgp_aggr_community_prepare(struct hash_backet *hb, void *arg)
static void bgp_aggr_community_prepare(struct hash_bucket *hb, void *arg)
{
struct community *hb_community = hb->data;
struct community **aggr_community = arg;

View File

@ -501,7 +501,7 @@ static const char *bgp_get_reuse_time(unsigned int penalty, char *buf,
bool use_json, json_object *json)
{
time_t reuse_time = 0;
struct tm *tm = NULL;
struct tm tm;
int time_store = 0;
if (penalty > damp[afi][safi].reuse_limit) {
@ -513,7 +513,7 @@ static const char *bgp_get_reuse_time(unsigned int penalty, char *buf,
if (reuse_time > damp[afi][safi].max_suppress_time)
reuse_time = damp[afi][safi].max_suppress_time;
tm = gmtime(&reuse_time);
gmtime_r(&reuse_time, &tm);
} else
reuse_time = 0;
@ -525,39 +525,39 @@ static const char *bgp_get_reuse_time(unsigned int penalty, char *buf,
snprintf(buf, len, "00:00:00");
} else if (reuse_time < ONE_DAY_SECOND) {
if (use_json) {
time_store = (3600000 * tm->tm_hour)
+ (60000 * tm->tm_min)
+ (1000 * tm->tm_sec);
time_store = (3600000 * tm.tm_hour)
+ (60000 * tm.tm_min)
+ (1000 * tm.tm_sec);
json_object_int_add(json, "reuseTimerMsecs",
time_store);
} else
snprintf(buf, len, "%02d:%02d:%02d", tm->tm_hour,
tm->tm_min, tm->tm_sec);
snprintf(buf, len, "%02d:%02d:%02d", tm.tm_hour,
tm.tm_min, tm.tm_sec);
} else if (reuse_time < ONE_WEEK_SECOND) {
if (use_json) {
time_store = (86400000 * tm->tm_yday)
+ (3600000 * tm->tm_hour)
+ (60000 * tm->tm_min)
+ (1000 * tm->tm_sec);
time_store = (86400000 * tm.tm_yday)
+ (3600000 * tm.tm_hour)
+ (60000 * tm.tm_min)
+ (1000 * tm.tm_sec);
json_object_int_add(json, "reuseTimerMsecs",
time_store);
} else
snprintf(buf, len, "%dd%02dh%02dm", tm->tm_yday,
tm->tm_hour, tm->tm_min);
snprintf(buf, len, "%dd%02dh%02dm", tm.tm_yday,
tm.tm_hour, tm.tm_min);
} else {
if (use_json) {
time_store =
(604800000 * tm->tm_yday / 7)
(604800000 * tm.tm_yday / 7)
+ (86400000
* (tm->tm_yday - ((tm->tm_yday / 7) * 7)))
+ (3600000 * tm->tm_hour) + (60000 * tm->tm_min)
+ (1000 * tm->tm_sec);
* (tm.tm_yday - ((tm.tm_yday / 7) * 7)))
+ (3600000 * tm.tm_hour) + (60000 * tm.tm_min)
+ (1000 * tm.tm_sec);
json_object_int_add(json, "reuseTimerMsecs",
time_store);
} else
snprintf(buf, len, "%02dw%dd%02dh", tm->tm_yday / 7,
tm->tm_yday - ((tm->tm_yday / 7) * 7),
tm->tm_hour);
snprintf(buf, len, "%02dw%dd%02dh", tm.tm_yday / 7,
tm.tm_yday - ((tm.tm_yday / 7) * 7),
tm.tm_hour);
}
return buf;

View File

@ -106,19 +106,19 @@ static FILE *bgp_dump_open_file(struct bgp_dump *bgp_dump)
{
int ret;
time_t clock;
struct tm *tm;
struct tm tm;
char fullpath[MAXPATHLEN];
char realpath[MAXPATHLEN];
mode_t oldumask;
time(&clock);
tm = localtime(&clock);
localtime_r(&clock, &tm);
if (bgp_dump->filename[0] != DIRECTORY_SEP) {
sprintf(fullpath, "%s/%s", vty_get_cwd(), bgp_dump->filename);
ret = strftime(realpath, MAXPATHLEN, fullpath, tm);
ret = strftime(realpath, MAXPATHLEN, fullpath, &tm);
} else
ret = strftime(realpath, MAXPATHLEN, bgp_dump->filename, tm);
ret = strftime(realpath, MAXPATHLEN, bgp_dump->filename, &tm);
if (ret == 0) {
flog_warn(EC_BGP_DUMP, "bgp_dump_open_file: strftime error");
@ -147,7 +147,7 @@ static int bgp_dump_interval_add(struct bgp_dump *bgp_dump, int interval)
{
int secs_into_day;
time_t t;
struct tm *tm;
struct tm tm;
if (interval > 0) {
/* Periodic dump every interval seconds */
@ -158,9 +158,9 @@ static int bgp_dump_interval_add(struct bgp_dump *bgp_dump, int interval)
* midnight
*/
(void)time(&t);
tm = localtime(&t);
secs_into_day = tm->tm_sec + 60 * tm->tm_min
+ 60 * 60 * tm->tm_hour;
localtime_r(&t, &tm);
secs_into_day = tm.tm_sec + 60 * tm.tm_min
+ 60 * 60 * tm.tm_hour;
interval = interval
- secs_into_day % interval; /* always > 0 */
}

View File

@ -1026,7 +1026,7 @@ static void *bgp_aggr_ecommunty_hash_alloc(void *p)
return ecommunity;
}
static void bgp_aggr_ecommunity_prepare(struct hash_backet *hb, void *arg)
static void bgp_aggr_ecommunity_prepare(struct hash_bucket *hb, void *arg)
{
struct ecommunity *hb_ecommunity = hb->data;
struct ecommunity **aggr_ecommunity = arg;

View File

@ -600,8 +600,9 @@ static int bgp_zebra_send_remote_macip(struct bgp *bgp, struct bgpevpn *vpn,
/* Don't try to register if Zebra doesn't know of this instance. */
if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: No zebra instance to talk to, not installing remote macip",
__PRETTY_FUNCTION__);
zlog_debug(
"%s: No zebra instance to talk to, not installing remote macip",
__func__);
return 0;
}
s = zclient->obuf;
@ -662,8 +663,9 @@ static int bgp_zebra_send_remote_vtep(struct bgp *bgp, struct bgpevpn *vpn,
/* Don't try to register if Zebra doesn't know of this instance. */
if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: No zebra instance to talk to, not installing remote vtep",
__PRETTY_FUNCTION__);
zlog_debug(
"%s: No zebra instance to talk to, not installing remote vtep",
__func__);
return 0;
}

View File

@ -1450,7 +1450,7 @@ static int bgp_connect_success(struct peer *peer)
if (bgp_getsockname(peer) < 0) {
flog_err_sys(EC_LIB_SOCKET,
"%s: bgp_getsockname(): failed for peer %s, fd %d",
__FUNCTION__, peer->host, peer->fd);
__func__, peer->host, peer->fd);
bgp_notify_send(
peer, BGP_NOTIFY_FSM_ERR,
BGP_NOTIFY_SUBCODE_UNSPECIFIC); /* internal error */

View File

@ -550,7 +550,7 @@ static void *bgp_aggr_lcommunty_hash_alloc(void *p)
return lcommunity;
}
static void bgp_aggr_lcommunity_prepare(struct hash_backet *hb, void *arg)
static void bgp_aggr_lcommunity_prepare(struct hash_bucket *hb, void *arg)
{
struct lcommunity *hb_lcommunity = hb->data;
struct lcommunity **aggr_lcommunity = arg;

View File

@ -153,7 +153,7 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
if (BGP_DEBUG(nht, NHT)) {
zlog_debug(
"%s: Attempting to register with unknown AFI %d (not %d or %d)",
__FUNCTION__, afi, AFI_IP, AFI_IP6);
__func__, afi, AFI_IP, AFI_IP6);
}
return 0;
}
@ -338,7 +338,7 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) {
if (BGP_DEBUG(nht, NHT))
zlog_debug("%s[%s]: Failure to decode nexthop update",
__PRETTY_FUNCTION__, bgp->name_pretty);
__func__, bgp->name_pretty);
return;
}
@ -563,7 +563,7 @@ static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p)
if (BGP_DEBUG(nht, NHT)) {
zlog_debug(
"%s: Attempting to make prefix with unknown AFI %d (not %d or %d)",
__FUNCTION__, afi, AFI_IP, AFI_IP6);
__func__, afi, AFI_IP, AFI_IP6);
}
break;
}
@ -591,15 +591,17 @@ static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command)
/* Don't try to register if Zebra doesn't know of this instance. */
if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bnc->bgp)) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: No zebra instance to talk to, not installing NHT entry",
__PRETTY_FUNCTION__);
zlog_debug(
"%s: No zebra instance to talk to, not installing NHT entry",
__func__);
return;
}
if (!bgp_zebra_num_connects()) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: We have not connected yet, cannot send nexthops",
__PRETTY_FUNCTION__);
zlog_debug(
"%s: We have not connected yet, cannot send nexthops",
__func__);
}
p = &(bnc->node->p);
if ((command == ZEBRA_NEXTHOP_REGISTER
@ -801,9 +803,10 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
if (!CHECK_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED)) {
if (BGP_DEBUG(nht, NHT))
zlog_debug("%s: Updating peer (%s(%s)) status with NHT",
__FUNCTION__, peer->host,
peer->bgp->name_pretty);
zlog_debug(
"%s: Updating peer (%s(%s)) status with NHT",
__func__, peer->host,
peer->bgp->name_pretty);
bgp_fsm_event_update(peer, valid_nexthops);
SET_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED);
}
@ -882,7 +885,7 @@ void bgp_nht_register_enhe_capability_interfaces(struct peer *peer)
if (!sockunion2hostprefix(&peer->su, &p)) {
if (BGP_DEBUG(nht, NHT))
zlog_debug("%s: Unable to convert prefix to sockunion",
__PRETTY_FUNCTION__);
__func__);
return;
}

View File

@ -696,7 +696,7 @@ static int bgp_capability_hostname(struct peer *peer,
flog_warn(
EC_BGP_CAPABILITY_INVALID_DATA,
"%s: Received malformed hostname capability from peer %s",
__FUNCTION__, peer->host);
__func__, peer->host);
return -1;
}
@ -720,7 +720,7 @@ static int bgp_capability_hostname(struct peer *peer,
flog_warn(
EC_BGP_CAPABILITY_INVALID_DATA,
"%s: Received invalid domain name len (hostname capability) from peer %s",
__FUNCTION__, peer->host);
__func__, peer->host);
return -1;
}
@ -729,7 +729,7 @@ static int bgp_capability_hostname(struct peer *peer,
flog_warn(
EC_BGP_CAPABILITY_INVALID_DATA,
"%s: Received runt domain name (hostname capability) from peer %s",
__FUNCTION__, peer->host);
__func__, peer->host);
return -1;
}

View File

@ -1303,8 +1303,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
/* Open option part parse. */
if (optlen != 0) {
if ((ret = bgp_open_option_parse(peer, optlen, &mp_capability))
< 0)
if (bgp_open_option_parse(peer, optlen, &mp_capability) < 0)
return BGP_Stop;
} else {
if (bgp_debug_neighbor_events(peer))
@ -1346,10 +1345,10 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
return BGP_Stop;
/* Get sockname. */
if ((ret = bgp_getsockname(peer)) < 0) {
if (bgp_getsockname(peer) < 0) {
flog_err_sys(EC_LIB_SOCKET,
"%s: bgp_getsockname() failed for peer: %s",
__FUNCTION__, peer->host);
__func__, peer->host);
return BGP_Stop;
}
@ -1972,38 +1971,29 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
} else
p_pnt = p_end;
if ((ok = (p_pnt < p_end)))
orfp.ge =
*p_pnt++; /* value
checked in
prefix_bgp_orf_set()
*/
if ((ok = (p_pnt < p_end)))
orfp.le =
*p_pnt++; /* value
checked in
prefix_bgp_orf_set()
*/
/* val checked in prefix_bgp_orf_set */
if (p_pnt < p_end)
orfp.ge = *p_pnt++;
/* val checked in prefix_bgp_orf_set */
if (p_pnt < p_end)
orfp.le = *p_pnt++;
if ((ok = (p_pnt < p_end)))
orfp.p.prefixlen = *p_pnt++;
orfp.p.family = afi2family(
afi); /* afi checked already */
psize = PSIZE(
orfp.p.prefixlen); /* 0 if not
ok */
if (psize
> prefix_blen(
&orfp.p)) /* valid for
family ? */
{
/* afi checked already */
orfp.p.family = afi2family(afi);
/* 0 if not ok */
psize = PSIZE(orfp.p.prefixlen);
/* valid for family ? */
if (psize > prefix_blen(&orfp.p)) {
ok = 0;
psize = prefix_blen(&orfp.p);
}
if (psize
> (p_end - p_pnt)) /* valid for
packet ? */
{
/* valid for packet ? */
if (psize > (p_end - p_pnt)) {
ok = 0;
psize = p_end - p_pnt;
}

View File

@ -122,8 +122,6 @@ struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi,
struct bgp_node *prn = NULL;
assert(table);
if (!table)
return NULL;
if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP)
|| (safi == SAFI_EVPN)) {
@ -299,7 +297,7 @@ static int bgp_node_set_defer_flag(struct bgp_node *rn, bool delete)
{
struct peer *peer;
struct bgp_path_info *old_pi, *nextpi;
bool set_flag = 0;
bool set_flag = false;
struct bgp *bgp = NULL;
struct bgp_table *table = NULL;
afi_t afi = 0;
@ -339,7 +337,7 @@ static int bgp_node_set_defer_flag(struct bgp_node *rn, bool delete)
*/
if (CHECK_FLAG(old_pi->flags, BGP_PATH_STALE)
&& (old_pi->sub_type == BGP_ROUTE_NORMAL)) {
set_flag = 1;
set_flag = true;
} else {
/* If the peer is graceful restart capable and peer is
* restarting mode, set the flag BGP_NODE_SELECT_DEFER
@ -349,7 +347,7 @@ static int bgp_node_set_defer_flag(struct bgp_node *rn, bool delete)
&& BGP_PEER_RESTARTING_MODE(peer)
&& (old_pi
&& old_pi->sub_type == BGP_ROUTE_NORMAL)) {
set_flag = 1;
set_flag = true;
}
}
if (set_flag)
@ -2926,8 +2924,7 @@ static int bgp_maximum_prefix_restart_timer(struct thread *thread)
peer->host);
if ((peer_clear(peer, NULL) < 0) && bgp_debug_neighbor_events(peer))
zlog_debug("%s: %s peer_clear failed",
__PRETTY_FUNCTION__, peer->host);
zlog_debug("%s: %s peer_clear failed", __func__, peer->host);
return 0;
}
@ -3732,7 +3729,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
->nexthop,
buf1, INET6_ADDRSTRLEN);
zlog_debug("%s(%s): NH unresolved",
__FUNCTION__, buf1);
__func__, buf1);
}
bgp_path_info_unset_flag(rn, pi,
BGP_PATH_VALID);
@ -3880,8 +3877,8 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
inet_ntop(AF_INET,
(const void *)&attr_new->nexthop,
buf1, INET6_ADDRSTRLEN);
zlog_debug("%s(%s): NH unresolved",
__FUNCTION__, buf1);
zlog_debug("%s(%s): NH unresolved", __func__,
buf1);
}
bgp_path_info_unset_flag(rn, new, BGP_PATH_VALID);
}
@ -4909,8 +4906,6 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
#endif
assert(bgp_static);
if (!bgp_static)
return;
rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, NULL);
@ -5040,7 +5035,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
INET6_ADDRSTRLEN);
zlog_debug(
"%s(%s): Route not in table, not advertising",
__FUNCTION__, buf1);
__func__, buf1);
}
bgp_path_info_unset_flag(
rn, pi, BGP_PATH_VALID);
@ -5089,7 +5084,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
INET6_ADDRSTRLEN);
zlog_debug(
"%s(%s): Route not in table, not advertising",
__FUNCTION__, buf1);
__func__, buf1);
}
bgp_path_info_unset_flag(rn, new, BGP_PATH_VALID);
}

View File

@ -4400,10 +4400,10 @@ DEFUN (no_set_distance,
DEFUN (set_local_pref,
set_local_pref_cmd,
"set local-preference (0-4294967295)",
"set local-preference WORD",
SET_STR
"BGP local preference path attribute\n"
"Preference value\n")
"Preference value (0-4294967295)\n")
{
int idx_number = 2;
return generic_set_add(vty, VTY_GET_CONTEXT(route_map_index),
@ -4413,11 +4413,11 @@ DEFUN (set_local_pref,
DEFUN (no_set_local_pref,
no_set_local_pref_cmd,
"no set local-preference [(0-4294967295)]",
"no set local-preference [WORD]",
NO_STR
SET_STR
"BGP local preference path attribute\n"
"Preference value\n")
"Preference value (0-4294967295)\n")
{
int idx_localpref = 3;
if (argc <= idx_localpref)

View File

@ -869,7 +869,7 @@ static int bgpTrapEstablished(struct peer *peer)
smux_trap(bgp_variables, array_size(bgp_variables), bgp_trap_oid,
array_size(bgp_trap_oid), bgp_oid,
sizeof bgp_oid / sizeof(oid), index, IN_ADDR_SIZE,
sizeof(bgp_oid) / sizeof(oid), index, IN_ADDR_SIZE,
bgpTrapList, array_size(bgpTrapList), BGPESTABLISHED);
return 0;
}
@ -888,7 +888,7 @@ static int bgpTrapBackwardTransition(struct peer *peer)
smux_trap(bgp_variables, array_size(bgp_variables), bgp_trap_oid,
array_size(bgp_trap_oid), bgp_oid,
sizeof bgp_oid / sizeof(oid), index, IN_ADDR_SIZE,
sizeof(bgp_oid) / sizeof(oid), index, IN_ADDR_SIZE,
bgpTrapList, array_size(bgpTrapList), BGPBACKWARDTRANSITION);
return 0;
}

View File

@ -330,8 +330,6 @@ void bpacket_queue_remove_peer(struct peer_af *paf)
q = PAF_PKTQ(paf);
assert(q);
if (!q)
return;
LIST_REMOVE(paf, pkt_train);
paf->next_pkt_to_send = NULL;

View File

@ -753,7 +753,7 @@ static void bgp_clear_vty_error(struct vty *vty, struct peer *peer, afi_t afi,
}
static int bgp_peer_clear(struct peer *peer, afi_t afi, safi_t safi,
struct listnode *nnode, enum bgp_clear_type stype)
struct listnode **nnode, enum bgp_clear_type stype)
{
int ret = 0;
@ -767,7 +767,7 @@ static int bgp_peer_clear(struct peer *peer, afi_t afi, safi_t safi,
continue;
if (stype == BGP_CLEAR_SOFT_NONE)
ret = peer_clear(peer, &nnode);
ret = peer_clear(peer, nnode);
else
ret = peer_clear_soft(peer, tmp_afi, tmp_safi,
stype);
@ -782,7 +782,7 @@ static int bgp_peer_clear(struct peer *peer, afi_t afi, safi_t safi,
continue;
if (stype == BGP_CLEAR_SOFT_NONE)
ret = peer_clear(peer, &nnode);
ret = peer_clear(peer, nnode);
else
ret = peer_clear_soft(peer, afi,
tmp_safi, stype);
@ -793,7 +793,7 @@ static int bgp_peer_clear(struct peer *peer, afi_t afi, safi_t safi,
return 1;
if (stype == BGP_CLEAR_SOFT_NONE)
ret = peer_clear(peer, &nnode);
ret = peer_clear(peer, nnode);
else
ret = peer_clear_soft(peer, afi, safi, stype);
}
@ -826,7 +826,7 @@ static int bgp_clear(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
if (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART))
gr_router_detected = true;
ret = bgp_peer_clear(peer, afi, safi, nnode,
ret = bgp_peer_clear(peer, afi, safi, &nnode,
stype);
if (ret < 0)
@ -901,7 +901,7 @@ static int bgp_clear(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
}
for (ALL_LIST_ELEMENTS(group->peer, node, nnode, peer)) {
ret = bgp_peer_clear(peer, afi, safi, nnode, stype);
ret = bgp_peer_clear(peer, afi, safi, &nnode, stype);
if (ret < 0)
bgp_clear_vty_error(vty, peer, afi, safi, ret);
@ -928,7 +928,7 @@ static int bgp_clear(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
if (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART))
gr_router_detected = true;
ret = bgp_peer_clear(peer, afi, safi, nnode, stype);
ret = bgp_peer_clear(peer, afi, safi, &nnode, stype);
if (ret < 0)
bgp_clear_vty_error(vty, peer, afi, safi, ret);
@ -965,7 +965,7 @@ static int bgp_clear(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
if (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART))
gr_router_detected = true;
ret = bgp_peer_clear(peer, afi, safi, nnode, stype);
ret = bgp_peer_clear(peer, afi, safi, &nnode, stype);
if (ret < 0)
bgp_clear_vty_error(vty, peer, afi, safi, ret);
@ -7304,7 +7304,7 @@ ALIAS (af_label_vpn_export,
DEFPY (af_nexthop_vpn_export,
af_nexthop_vpn_export_cmd,
"[no] nexthop vpn export <A.B.C.D|X:X::X:X>$nexthop_str",
"[no] nexthop vpn export [<A.B.C.D|X:X::X:X>$nexthop_su]",
NO_STR
"Specify next hop to use for VRF advertised prefixes\n"
"Between current address-family and vpn\n"
@ -7315,14 +7315,14 @@ DEFPY (af_nexthop_vpn_export,
VTY_DECLVAR_CONTEXT(bgp, bgp);
afi_t afi;
struct prefix p;
int idx = 0;
int yes = 1;
if (argv_find(argv, argc, "no", &idx))
yes = 0;
if (!no) {
if (!nexthop_su) {
vty_out(vty, "%% Nexthop required\n");
return CMD_WARNING_CONFIG_FAILED;
}
if (yes) {
if (!sockunion2hostprefix(nexthop_str, &p))
if (!sockunion2hostprefix(nexthop_su, &p))
return CMD_WARNING_CONFIG_FAILED;
}
@ -7336,7 +7336,7 @@ DEFPY (af_nexthop_vpn_export,
vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN, afi,
bgp_get_default(), bgp);
if (yes) {
if (!no) {
bgp->vpn_policy[afi].tovpn_nexthop = p;
SET_FLAG(bgp->vpn_policy[afi].flags,
BGP_VPN_POLICY_TOVPN_NEXTHOP_SET);
@ -7352,14 +7352,6 @@ DEFPY (af_nexthop_vpn_export,
return CMD_SUCCESS;
}
ALIAS (af_nexthop_vpn_export,
af_no_nexthop_vpn_export_cmd,
"no nexthop vpn export",
NO_STR
"Specify next hop to use for VRF advertised prefixes\n"
"Between current address-family and vpn\n"
"For routes leaked from current address-family to vpn\n")
static int vpn_policy_getdirs(struct vty *vty, const char *dstr, int *dodir)
{
if (!strcmp(dstr, "import")) {
@ -9440,7 +9432,7 @@ static void bgp_show_neighnor_graceful_restart_rbit(struct vty *vty,
bool use_json,
json_object *json)
{
bool rbit_status = 0;
bool rbit_status = false;
if (!use_json)
vty_out(vty, "\n R bit: ");
@ -9450,9 +9442,9 @@ static void bgp_show_neighnor_graceful_restart_rbit(struct vty *vty,
&& (p->status == Established)) {
if (CHECK_FLAG(p->cap, PEER_CAP_RESTART_BIT_RCV))
rbit_status = 1;
rbit_status = true;
else
rbit_status = 0;
rbit_status = false;
}
if (rbit_status) {
@ -10657,28 +10649,31 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
/* read timer */
time_t uptime;
struct tm *tm;
struct tm tm;
uptime = bgp_clock();
uptime -= p->readtime;
tm = gmtime(&uptime);
gmtime_r(&uptime, &tm);
json_object_int_add(json_neigh, "bgpTimerLastRead",
(tm->tm_sec * 1000) + (tm->tm_min * 60000)
+ (tm->tm_hour * 3600000));
(tm.tm_sec * 1000) + (tm.tm_min * 60000)
+ (tm.tm_hour * 3600000));
uptime = bgp_clock();
uptime -= p->last_write;
tm = gmtime(&uptime);
gmtime_r(&uptime, &tm);
json_object_int_add(json_neigh, "bgpTimerLastWrite",
(tm->tm_sec * 1000) + (tm->tm_min * 60000)
+ (tm->tm_hour * 3600000));
(tm.tm_sec * 1000) + (tm.tm_min * 60000)
+ (tm.tm_hour * 3600000));
uptime = bgp_clock();
uptime -= p->update_time;
tm = gmtime(&uptime);
gmtime_r(&uptime, &tm);
json_object_int_add(json_neigh, "bgpInUpdateElapsedTimeMsecs",
(tm->tm_sec * 1000) + (tm->tm_min * 60000)
+ (tm->tm_hour * 3600000));
(tm.tm_sec * 1000) + (tm.tm_min * 60000)
+ (tm.tm_hour * 3600000));
/* Configured timer values. */
json_object_int_add(json_neigh, "bgpTimerHoldTimeMsecs",
@ -11506,12 +11501,12 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
vty_out(vty, "\n");
/* Gracefull Restart */
/* Graceful Restart */
if (CHECK_FLAG(p->cap, PEER_CAP_RESTART_RCV)
|| CHECK_FLAG(p->cap,
PEER_CAP_RESTART_ADV)) {
vty_out(vty,
" Graceful Restart Capabilty:");
" Graceful Restart Capability:");
if (CHECK_FLAG(p->cap,
PEER_CAP_RESTART_ADV))
vty_out(vty, " advertised");
@ -11841,15 +11836,16 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
} else {
if (use_json) {
time_t uptime;
struct tm *tm;
struct tm tm;
uptime = bgp_clock();
uptime -= p->resettime;
tm = gmtime(&uptime);
gmtime_r(&uptime, &tm);
json_object_int_add(json_neigh, "lastResetTimerMsecs",
(tm->tm_sec * 1000)
+ (tm->tm_min * 60000)
+ (tm->tm_hour * 3600000));
(tm.tm_sec * 1000)
+ (tm.tm_min * 60000)
+ (tm.tm_hour * 3600000));
bgp_show_peer_reset(NULL, p, json_neigh, true);
} else {
vty_out(vty, " Last reset %s, ",
@ -16609,8 +16605,6 @@ void bgp_vty_init(void)
install_element(BGP_IPV6_NODE, &af_no_rd_vpn_export_cmd);
install_element(BGP_IPV4_NODE, &af_no_label_vpn_export_cmd);
install_element(BGP_IPV6_NODE, &af_no_label_vpn_export_cmd);
install_element(BGP_IPV4_NODE, &af_no_nexthop_vpn_export_cmd);
install_element(BGP_IPV6_NODE, &af_no_nexthop_vpn_export_cmd);
install_element(BGP_IPV4_NODE, &af_no_rt_vpn_imexport_cmd);
install_element(BGP_IPV6_NODE, &af_no_rt_vpn_imexport_cmd);
install_element(BGP_IPV4_NODE, &af_no_route_map_vpn_imexport_cmd);

View File

@ -72,8 +72,9 @@ static inline int bgp_install_info_to_zebra(struct bgp *bgp)
return 0;
if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) {
zlog_debug("%s: No zebra instance to talk to, not installing information",
__PRETTY_FUNCTION__);
zlog_debug(
"%s: No zebra instance to talk to, not installing information",
__func__);
return 0;
}
@ -1918,8 +1919,9 @@ int bgp_zebra_advertise_subnet(struct bgp *bgp, int advertise, vni_t vni)
/* Don't try to register if Zebra doesn't know of this instance. */
if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: No zebra instance to talk to, cannot advertise subnet",
__PRETTY_FUNCTION__);
zlog_debug(
"%s: No zebra instance to talk to, cannot advertise subnet",
__func__);
return 0;
}
@ -1968,8 +1970,9 @@ int bgp_zebra_advertise_gw_macip(struct bgp *bgp, int advertise, vni_t vni)
/* Don't try to register if Zebra doesn't know of this instance. */
if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: No zebra instance to talk to, not installing gw_macip",
__PRETTY_FUNCTION__);
zlog_debug(
"%s: No zebra instance to talk to, not installing gw_macip",
__func__);
return 0;
}
@ -1996,8 +1999,9 @@ int bgp_zebra_vxlan_flood_control(struct bgp *bgp,
/* Don't try to register if Zebra doesn't know of this instance. */
if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: No zebra instance to talk to, not installing all vni",
__PRETTY_FUNCTION__);
zlog_debug(
"%s: No zebra instance to talk to, not installing all vni",
__func__);
return 0;
}
@ -2092,7 +2096,7 @@ static int rule_notify_owner(ZAPI_CALLBACK_ARGS)
if (!bgp_pbr && note != ZAPI_RULE_REMOVED) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Fail to look BGP rule (%u)",
__PRETTY_FUNCTION__, unique);
__func__, unique);
return 0;
}
}
@ -2100,8 +2104,7 @@ static int rule_notify_owner(ZAPI_CALLBACK_ARGS)
switch (note) {
case ZAPI_RULE_FAIL_INSTALL:
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received RULE_FAIL_INSTALL",
__PRETTY_FUNCTION__);
zlog_debug("%s: Received RULE_FAIL_INSTALL", __func__);
if (bgp_pbra) {
bgp_pbra->installed = false;
bgp_pbra->install_in_progress = false;
@ -2128,14 +2131,12 @@ static int rule_notify_owner(ZAPI_CALLBACK_ARGS)
bgp_pbr);
}
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received RULE_INSTALLED",
__PRETTY_FUNCTION__);
zlog_debug("%s: Received RULE_INSTALLED", __func__);
break;
case ZAPI_RULE_FAIL_REMOVE:
case ZAPI_RULE_REMOVED:
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received RULE REMOVED",
__PRETTY_FUNCTION__);
zlog_debug("%s: Received RULE REMOVED", __func__);
break;
}
@ -2157,15 +2158,14 @@ static int ipset_notify_owner(ZAPI_CALLBACK_ARGS)
if (!bgp_pbim) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Fail to look BGP match ( %u, ID %u)",
__PRETTY_FUNCTION__, note, unique);
__func__, note, unique);
return 0;
}
switch (note) {
case ZAPI_IPSET_FAIL_INSTALL:
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received IPSET_FAIL_INSTALL",
__PRETTY_FUNCTION__);
zlog_debug("%s: Received IPSET_FAIL_INSTALL", __func__);
bgp_pbim->installed = false;
bgp_pbim->install_in_progress = false;
break;
@ -2173,14 +2173,12 @@ static int ipset_notify_owner(ZAPI_CALLBACK_ARGS)
bgp_pbim->installed = true;
bgp_pbim->install_in_progress = false;
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received IPSET_INSTALLED",
__PRETTY_FUNCTION__);
zlog_debug("%s: Received IPSET_INSTALLED", __func__);
break;
case ZAPI_IPSET_FAIL_REMOVE:
case ZAPI_IPSET_REMOVED:
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received IPSET REMOVED",
__PRETTY_FUNCTION__);
zlog_debug("%s: Received IPSET REMOVED", __func__);
break;
}
@ -2205,8 +2203,9 @@ static int ipset_entry_notify_owner(ZAPI_CALLBACK_ARGS)
unique);
if (!bgp_pbime) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Fail to look BGP match entry (%u, ID %u)",
__PRETTY_FUNCTION__, note, unique);
zlog_debug(
"%s: Fail to look BGP match entry (%u, ID %u)",
__func__, note, unique);
return 0;
}
@ -2214,7 +2213,7 @@ static int ipset_entry_notify_owner(ZAPI_CALLBACK_ARGS)
case ZAPI_IPSET_ENTRY_FAIL_INSTALL:
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received IPSET_ENTRY_FAIL_INSTALL",
__PRETTY_FUNCTION__);
__func__);
bgp_pbime->installed = false;
bgp_pbime->install_in_progress = false;
break;
@ -2227,7 +2226,7 @@ static int ipset_entry_notify_owner(ZAPI_CALLBACK_ARGS)
bgp_pbime->install_in_progress = false;
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received IPSET_ENTRY_INSTALLED",
__PRETTY_FUNCTION__);
__func__);
/* link bgp_path_info to bpme */
path = (struct bgp_path_info *)bgp_pbime->path;
extra = bgp_path_info_extra_get(path);
@ -2238,7 +2237,7 @@ static int ipset_entry_notify_owner(ZAPI_CALLBACK_ARGS)
case ZAPI_IPSET_ENTRY_REMOVED:
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received IPSET_ENTRY_REMOVED",
__PRETTY_FUNCTION__);
__func__);
break;
}
return 0;
@ -2259,14 +2258,14 @@ static int iptable_notify_owner(ZAPI_CALLBACK_ARGS)
if (!bgpm) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Fail to look BGP iptable (%u %u)",
__PRETTY_FUNCTION__, note, unique);
__func__, note, unique);
return 0;
}
switch (note) {
case ZAPI_IPTABLE_FAIL_INSTALL:
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received IPTABLE_FAIL_INSTALL",
__PRETTY_FUNCTION__);
__func__);
bgpm->installed_in_iptable = false;
bgpm->install_iptable_in_progress = false;
break;
@ -2274,15 +2273,13 @@ static int iptable_notify_owner(ZAPI_CALLBACK_ARGS)
bgpm->installed_in_iptable = true;
bgpm->install_iptable_in_progress = false;
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received IPTABLE_INSTALLED",
__PRETTY_FUNCTION__);
zlog_debug("%s: Received IPTABLE_INSTALLED", __func__);
bgpm->action->refcnt++;
break;
case ZAPI_IPTABLE_FAIL_REMOVE:
case ZAPI_IPTABLE_REMOVED:
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received IPTABLE REMOVED",
__PRETTY_FUNCTION__);
zlog_debug("%s: Received IPTABLE REMOVED", __func__);
break;
}
return 0;
@ -2786,12 +2783,10 @@ void bgp_send_pbr_rule_action(struct bgp_pbr_action *pbra,
return;
if (BGP_DEBUG(zebra, ZEBRA)) {
if (pbr)
zlog_debug("%s: table %d (ip rule) %d",
__PRETTY_FUNCTION__,
zlog_debug("%s: table %d (ip rule) %d", __func__,
pbra->table_id, install);
else
zlog_debug("%s: table %d fwmark %d %d",
__PRETTY_FUNCTION__,
zlog_debug("%s: table %d fwmark %d %d", __func__,
pbra->table_id, pbra->fwmark, install);
}
s = zclient->obuf;
@ -2820,10 +2815,9 @@ void bgp_send_pbr_ipset_match(struct bgp_pbr_match *pbrim, bool install)
if (pbrim->install_in_progress)
return;
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: name %s type %d %d, ID %u",
__PRETTY_FUNCTION__,
pbrim->ipset_name, pbrim->type,
install, pbrim->unique);
zlog_debug("%s: name %s type %d %d, ID %u", __func__,
pbrim->ipset_name, pbrim->type, install,
pbrim->unique);
s = zclient->obuf;
stream_reset(s);
@ -2849,9 +2843,9 @@ void bgp_send_pbr_ipset_entry_match(struct bgp_pbr_match_entry *pbrime,
if (pbrime->install_in_progress)
return;
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: name %s %d %d, ID %u", __PRETTY_FUNCTION__,
pbrime->backpointer->ipset_name,
pbrime->unique, install, pbrime->unique);
zlog_debug("%s: name %s %d %d, ID %u", __func__,
pbrime->backpointer->ipset_name, pbrime->unique,
install, pbrime->unique);
s = zclient->obuf;
stream_reset(s);
@ -2916,9 +2910,8 @@ void bgp_send_pbr_iptable(struct bgp_pbr_action *pba,
if (pbm->install_iptable_in_progress)
return;
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: name %s type %d mark %d %d, ID %u",
__PRETTY_FUNCTION__, pbm->ipset_name,
pbm->type, pba->fwmark, install,
zlog_debug("%s: name %s type %d mark %d %d, ID %u", __func__,
pbm->ipset_name, pbm->type, pba->fwmark, install,
pbm->unique2);
s = zclient->obuf;
stream_reset(s);

View File

@ -1200,8 +1200,6 @@ struct peer *peer_new(struct bgp *bgp)
/* bgp argument is absolutely required */
assert(bgp);
if (!bgp)
return NULL;
/* Allocate new peer. */
peer = XCALLOC(MTYPE_BGP_PEER, sizeof(struct peer));
@ -3148,7 +3146,7 @@ int bgp_handle_socket(struct bgp *bgp, struct vrf *vrf, vrf_id_t old_vrf_id,
/*
* suppress vrf socket
*/
if (create == false) {
if (!create) {
bgp_close_vrf_socket(bgp);
return 0;
}
@ -3228,7 +3226,7 @@ int bgp_get(struct bgp **bgp_val, as_t *as, const char *name,
if (IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Registering BGP instance %s to zebra",
__PRETTY_FUNCTION__, name);
__func__, name);
bgp_zebra_instance_register(bgp);
}
@ -3400,8 +3398,9 @@ int bgp_delete(struct bgp *bgp)
/* Deregister from Zebra, if needed */
if (IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: deregistering this bgp %s instance from zebra",
__PRETTY_FUNCTION__, bgp->name);
zlog_debug(
"%s: deregistering this bgp %s instance from zebra",
__func__, bgp->name);
bgp_zebra_instance_deregister(bgp);
}
@ -4032,7 +4031,7 @@ static int peer_flag_modify(struct peer *peer, uint32_t flag, int set)
struct peer_flag_action action;
memset(&action, 0, sizeof(struct peer_flag_action));
size = sizeof peer_flag_action_list / sizeof(struct peer_flag_action);
size = sizeof(peer_flag_action_list) / sizeof(struct peer_flag_action);
invert = CHECK_FLAG(peer->flags_invert, flag);
found = peer_flag_action_set(peer_flag_action_list, size, &action,
@ -4138,7 +4137,7 @@ static int peer_af_flag_modify(struct peer *peer, afi_t afi, safi_t safi,
bgp_peer_sort_t ptype;
memset(&action, 0, sizeof(struct peer_flag_action));
size = sizeof peer_af_flag_action_list
size = sizeof(peer_af_flag_action_list)
/ sizeof(struct peer_flag_action);
invert = CHECK_FLAG(peer->af_flags_invert[afi][safi], flag);
@ -6848,7 +6847,7 @@ char *peer_uptime(time_t uptime2, char *buf, size_t len, bool use_json,
json_object *json)
{
time_t uptime1, epoch_tbuf;
struct tm *tm;
struct tm tm;
/* If there is no connection has been done before print `never'. */
if (uptime2 == 0) {
@ -6863,21 +6862,21 @@ char *peer_uptime(time_t uptime2, char *buf, size_t len, bool use_json,
/* Get current time. */
uptime1 = bgp_clock();
uptime1 -= uptime2;
tm = gmtime(&uptime1);
gmtime_r(&uptime1, &tm);
if (uptime1 < ONE_DAY_SECOND)
snprintf(buf, len, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,
tm->tm_sec);
snprintf(buf, len, "%02d:%02d:%02d", tm.tm_hour, tm.tm_min,
tm.tm_sec);
else if (uptime1 < ONE_WEEK_SECOND)
snprintf(buf, len, "%dd%02dh%02dm", tm->tm_yday, tm->tm_hour,
tm->tm_min);
snprintf(buf, len, "%dd%02dh%02dm", tm.tm_yday, tm.tm_hour,
tm.tm_min);
else if (uptime1 < ONE_YEAR_SECOND)
snprintf(buf, len, "%02dw%dd%02dh", tm->tm_yday / 7,
tm->tm_yday - ((tm->tm_yday / 7) * 7), tm->tm_hour);
snprintf(buf, len, "%02dw%dd%02dh", tm.tm_yday / 7,
tm.tm_yday - ((tm.tm_yday / 7) * 7), tm.tm_hour);
else
snprintf(buf, len, "%02dy%02dw%dd", tm->tm_year - 70,
tm->tm_yday / 7,
tm->tm_yday - ((tm->tm_yday / 7) * 7));
snprintf(buf, len, "%02dy%02dw%dd", tm.tm_year - 70,
tm.tm_yday / 7,
tm.tm_yday - ((tm.tm_yday / 7) * 7));
if (use_json) {
epoch_tbuf = time(NULL) - uptime1;

View File

@ -2184,6 +2184,7 @@ void rfapiRibPendingDeleteRoute(struct bgp *bgp, struct rfapi_import_table *it,
rfapiRibUpdatePendingNode(
bgp, m->rfd, it, it_node,
m->rfd->response_lifetime);
agg_unlock_node(rn);
}
}

View File

@ -101,7 +101,7 @@ Definition Grammar
FRR uses its own grammar for defining CLI commands. The grammar draws from
syntax commonly seen in \*nix manpages and should be fairly intuitive. The
parser is implemented in Bison and the lexer in Flex. These may be found in
``lib/command_lex.l`` and ``lib/command_parse.y``, respectively.
``lib/command_parse.y`` and ``lib/command_lex.l``, respectively.
**ProTip**: if you define a new command and find that the parser is
throwing syntax or other errors, the parser is the last place you want

View File

@ -192,7 +192,7 @@ html_theme = 'default'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = []
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied

View File

@ -1215,6 +1215,14 @@ Configuring Peers
keyword `all` is specified the modification is done also for routes learned
via iBGP.
.. index:: neighbor PEER attribute-unchanged [{as-path|next-hop|med}]
.. clicmd:: neighbor PEER attribute-unchanged [{as-path|next-hop|med}]
This command specifies attributes to be left unchanged for advertisements
sent to a peer. Use this to leave the next-hop unchanged in ipv6
configurations, as the route-map directive to leave the next-hop unchanged
is only available for ipv4.
.. index:: [no] neighbor PEER update-source <IFNAME|ADDRESS>
.. clicmd:: [no] neighbor PEER update-source <IFNAME|ADDRESS>

View File

@ -292,6 +292,8 @@ BGP
:t:`BGP/MPLS IP Virtual Private Networks (VPNs). Y. Rekhter. Feb 2006.`
- :rfc:`4659`
:t:`BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN. J. De Clercq, D. Ooms, M. Carugi, F. Le Faucheur. September 2006.`
- :rfc:`4893`
:t:`BGP Support for Four-octet AS Number Space. Q. Vohra, E. Chen May 2007.`
- :rfc:`5004`
:t:`Avoid BGP Best Path Transitions from One External to Another. E. Chen & S. Sangli. September 2007 (Partial support).`
- :rfc:`5082`
@ -445,4 +447,4 @@ For information on reporting bugs, please see :ref:`bug-reports`.
.. _frr: |package-url|
.. _github: https://github.com/frrouting/frr/
.. _github issues: https://github.com/frrouting/frr/issues
.. _slack: https://frrouting.slack.com/
.. _slack: https://frrouting.org/#participate

View File

@ -174,6 +174,13 @@ PIM interface commands allow you to configure an interface as either a Receiver
or a interface that you would like to form pim neighbors on. If the interface
is in a vrf, enter the interface command with the vrf keyword at the end.
.. index:: ip pim active-active
.. clicmd:: ip pim active-active
Turn on pim active-active configuration for a Vxlan interface. This
command will not do anything if you do not have the underlying ability
of a mlag implementation.
.. index:: ip pim bfd
.. clicmd:: ip pim bfd
@ -392,6 +399,11 @@ cause great confusion.
Display information about interfaces PIM is using.
.. index:: show ip pim mlag [vrf NAME] interface [detail|WORD] [json]
.. clicmd:: show ip pim mlag [vrf NAME|all] interface [detail|WORD] [json]
Display mlag interface information.
.. index:: show ip pim [vrf NAME] join [A.B.C.D [A.B.C.D]] [json]
.. clicmd:: show ip pim join
@ -404,6 +416,11 @@ cause great confusion.
Display information about PIM interface local-membership.
.. index:: show ip pim mlag summary [json]
.. clicmd:: show ip pim mlag summary [json]
Display mlag information state that PIM is keeping track of.
.. index:: show ip pim neighbor
.. clicmd:: show ip pim neighbor

View File

@ -273,6 +273,16 @@ Route Map Set Command
Set the BGP local preference to `local_pref`.
.. index:: set local-preference +LOCAL_PREF
.. clicmd:: set local-preference +LOCAL_PREF
Add the BGP local preference to an existing `local_pref`.
.. index:: set local-preference -LOCAL_PREF
.. clicmd:: set local-preference -LOCAL_PREF
Subtract the BGP local preference from an existing `local_pref`.
.. index:: [no] set distance DISTANCE
.. clicmd:: [no] set distance DISTANCE

View File

@ -200,6 +200,18 @@ Debugging
Displaying RPKI
---------------
.. index:: show rpki prefix <A.B.C.D/M|X:X::X:X/M> [(1-4294967295)]
.. clicmd:: show rpki prefix <A.B.C.D/M|X:X::X:X/M> [(1-4294967295)]
Display validated prefixes received from the cache servers filtered
by the specified prefix.
.. index:: show rpki as-number ASN
.. clicmd:: show rpki as-number ASN
Display validated prefixes received from the cache servers filtered
by ASN.
.. index:: show rpki prefix-table
.. clicmd:: show rpki prefix-table

View File

@ -140,7 +140,7 @@ macvlan device. If you are using ``iproute2``, the equivalent configuration is:
ip link set dev vrrp4-2-1 up
ip link add vrrp6-2-1 link eth0 addrgenmode random type macvlan mode bridge
ip link set dev vrrp4-2-1 address 00:00:5e:00:02:05
ip link set dev vrrp6-2-1 address 00:00:5e:00:02:05
ip addr add 2001:db8::370:7334/64 dev vrrp6-2-1
ip link set dev vrrp6-2-1 up

View File

@ -351,13 +351,13 @@ int eigrp_write(struct thread *thread)
ep = eigrp_fifo_next(ei->obuf);
if (!ep) {
flog_err(EC_LIB_DEVELOPMENT,
"%s: Interface %s no packet on queue?",
__PRETTY_FUNCTION__, ei->ifp->name);
"%s: Interface %s no packet on queue?", __func__,
ei->ifp->name);
goto out;
}
if (ep->length < EIGRP_HEADER_LEN) {
flog_err(EC_EIGRP_PACKET, "%s: Packet just has a header?",
__PRETTY_FUNCTION__);
__func__);
eigrp_header_dump((struct eigrp_header *)ep->s->data);
eigrp_packet_delete(ei);
goto out;
@ -1205,7 +1205,7 @@ uint16_t eigrp_add_internalTLV_to_stream(struct stream *s,
break;
default:
flog_err(EC_LIB_DEVELOPMENT, "%s: Unexpected prefix length: %d",
__PRETTY_FUNCTION__, pe->destination->prefixlen);
__func__, pe->destination->prefixlen);
return 0;
}
stream_putl(s, 0x00000000);

View File

@ -173,7 +173,7 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph,
flog_err(
EC_EIGRP_PACKET,
"%s: Received prefix %s which we do not know about",
__PRETTY_FUNCTION__,
__func__,
prefix2str(&dest_addr, buf, sizeof(buf)));
eigrp_IPv4_InternalTLV_free(tlv);
continue;

View File

@ -295,7 +295,7 @@ static void *route_match_metric_compile(const char *arg)
{
// uint32_t *metric;
//
// metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (uint32_t));
// metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t));
// *metric = atoi (arg);
//
// if(*metric > 0)
@ -574,7 +574,7 @@ static void *route_match_tag_compile(const char *arg)
{
// unsigned short *tag;
//
// tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (unsigned short));
// tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof(unsigned short));
// *tag = atoi (arg);
//
// return tag;
@ -667,7 +667,7 @@ static void *route_set_metric_compile(const char *arg)
// return NULL;*/
//
// mod = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
// sizeof (struct rip_metric_modifier));
// sizeof(struct rip_metric_modifier));
// mod->type = type;
// mod->metric = metric;
@ -718,7 +718,7 @@ static void *route_set_ip_nexthop_compile(const char *arg)
// int ret;
// struct in_addr *address;
//
// address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct
// address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof(struct
// in_addr));
//
// ret = inet_aton (arg, address);
@ -775,7 +775,7 @@ static void *route_set_tag_compile(const char *arg)
{
// unsigned short *tag;
//
// tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (unsigned short));
// tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof(unsigned short));
// *tag = atoi (arg);
//
// return tag;

View File

@ -138,7 +138,7 @@ void eigrp_prefix_entry_add(struct route_table *topology,
zlog_debug(
"%s: %s Should we have found this entry in the topo table?",
__PRETTY_FUNCTION__,
__func__,
prefix2str(pe->destination, buf, sizeof(buf)));
}
route_unlock_node(rn);
@ -402,7 +402,7 @@ eigrp_topology_update_distance(struct eigrp_fsm_action_message *msg)
break;
default:
flog_err(EC_LIB_DEVELOPMENT, "%s: Please implement handler",
__PRETTY_FUNCTION__);
__func__);
break;
}
distance_done:

View File

@ -175,7 +175,7 @@ static inline size_t fpm_msg_align(size_t len)
* The (rounded up) size of the FPM message header. This ensures that
* the message payload always starts at an aligned address.
*/
#define FPM_MSG_HDR_LEN (sizeof (fpm_msg_hdr_t))
#define FPM_MSG_HDR_LEN (sizeof(fpm_msg_hdr_t))
#ifndef COMPILE_ASSERT
#define COMPILE_ASSERT(x) extern int __dummy[2 * !!(x) - 1]

View File

@ -562,19 +562,20 @@ void vty_multiline(struct vty *vty, const char *prefix, const char *format, ...)
void vty_out_timestr(struct vty *vty, time_t uptime)
{
struct tm *tm;
struct tm tm;
time_t difftime = time(NULL);
difftime -= uptime;
tm = gmtime(&difftime);
gmtime_r(&difftime, &tm);
if (difftime < ONE_DAY_SECOND)
vty_out(vty, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,
tm->tm_sec);
vty_out(vty, "%02d:%02d:%02d", tm.tm_hour, tm.tm_min,
tm.tm_sec);
else if (difftime < ONE_WEEK_SECOND)
vty_out(vty, "%dd%02dh%02dm", tm->tm_yday, tm->tm_hour,
tm->tm_min);
vty_out(vty, "%dd%02dh%02dm", tm.tm_yday, tm.tm_hour,
tm.tm_min);
else
vty_out(vty, "%02dw%dd%02dh", tm->tm_yday / 7,
tm->tm_yday - ((tm->tm_yday / 7) * 7), tm->tm_hour);
vty_out(vty, "%02dw%dd%02dh", tm.tm_yday / 7,
tm.tm_yday - ((tm.tm_yday / 7) * 7), tm.tm_hour);
vty_out(vty, " ago");
}

View File

@ -129,18 +129,20 @@ static void lsp_print_flooding(struct vty *vty, struct isis_lsp *lsp)
lsp->flooding_interface : "(null)");
time_t uptime = time(NULL) - lsp->flooding_time;
struct tm *tm = gmtime(&uptime);
struct tm tm;
gmtime_r(&uptime, &tm);
if (uptime < ONE_DAY_SECOND)
vty_out(vty, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,
tm->tm_sec);
vty_out(vty, "%02d:%02d:%02d", tm.tm_hour, tm.tm_min,
tm.tm_sec);
else if (uptime < ONE_WEEK_SECOND)
vty_out(vty, "%dd%02dh%02dm", tm->tm_yday, tm->tm_hour,
tm->tm_min);
vty_out(vty, "%dd%02dh%02dm", tm.tm_yday, tm.tm_hour,
tm.tm_min);
else
vty_out(vty, "%02dw%dd%02dh", tm->tm_yday / 7,
tm->tm_yday - ((tm->tm_yday / 7) * 7),
tm->tm_hour);
vty_out(vty, "%02dw%dd%02dh", tm.tm_yday / 7,
tm.tm_yday - ((tm.tm_yday / 7) * 7),
tm.tm_hour);
vty_out(vty, " ago)\n");
if (lsp->flooding_circuit_scoped) {

View File

@ -67,7 +67,7 @@ send_address(struct nbr *nbr, int af, struct if_addr_head *addr_list,
fatalx("send_address: unknown af");
}
while ((if_addr = LIST_FIRST(addr_list)) != NULL) {
while (LIST_FIRST(addr_list) != NULL) {
/*
* Send as many addresses as possible - respect the session's
* negotiated maximum pdu length.

View File

@ -71,9 +71,6 @@ struct nbr_tree lde_nbrs = RB_INITIALIZER(&lde_nbrs);
static struct imsgev *iev_ldpe;
static struct imsgev *iev_main, *iev_main_sync;
/* Master of threads. */
struct thread_master *master;
/* lde privileges */
static zebra_capabilities_t _caps_p [] =
{

View File

@ -86,6 +86,8 @@ static struct imsgev *iev_lde, *iev_lde_sync;
static pid_t ldpe_pid;
static pid_t lde_pid;
enum ldpd_process ldpd_process;
#define LDP_DEFAULT_CONFIG "ldpd.conf"
#define LDP_VTY_PORT 2612
@ -858,7 +860,6 @@ ldp_acl_request(struct imsgev *iev, char *acl_name, int af,
union ldpd_addr *addr, uint8_t prefixlen)
{
struct imsg imsg;
ssize_t n;
struct acl_check acl_check;
if (acl_name[0] == '\0')
@ -876,9 +877,9 @@ ldp_acl_request(struct imsgev *iev, char *acl_name, int af,
imsg_flush(&iev->ibuf);
/* receive (blocking) and parse result */
if ((n = imsg_read(&iev->ibuf)) == -1)
if (imsg_read(&iev->ibuf) == -1)
fatal("imsg_read error");
if ((n = imsg_get(&iev->ibuf, &imsg)) == -1)
if (imsg_get(&iev->ibuf, &imsg) == -1)
fatal("imsg_get");
if (imsg.hdr.type != IMSG_ACL_CHECK ||
imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(int))
@ -1408,7 +1409,7 @@ merge_ifaces(struct ldpd_conf *conf, struct ldpd_conf *xconf)
RB_FOREACH_SAFE(iface, iface_head, &conf->iface_tree, itmp) {
/* find deleted interfaces */
if ((xi = if_lookup_name(xconf, iface->name)) == NULL) {
if (if_lookup_name(xconf, iface->name) == NULL) {
switch (ldpd_process) {
case PROC_LDP_ENGINE:
ldpe_if_exit(iface);
@ -1469,7 +1470,7 @@ merge_tnbrs(struct ldpd_conf *conf, struct ldpd_conf *xconf)
continue;
/* find deleted tnbrs */
if ((xt = tnbr_find(xconf, tnbr->af, &tnbr->addr)) == NULL) {
if (tnbr_find(xconf, tnbr->af, &tnbr->addr) == NULL) {
switch (ldpd_process) {
case PROC_LDP_ENGINE:
tnbr->flags &= ~F_TNBR_CONFIGURED;
@ -1515,33 +1516,35 @@ merge_nbrps(struct ldpd_conf *conf, struct ldpd_conf *xconf)
RB_FOREACH_SAFE(nbrp, nbrp_head, &conf->nbrp_tree, ntmp) {
/* find deleted nbrps */
if ((xn = nbr_params_find(xconf, nbrp->lsr_id)) == NULL) {
switch (ldpd_process) {
case PROC_LDP_ENGINE:
nbr = nbr_find_ldpid(nbrp->lsr_id.s_addr);
if (nbr) {
session_shutdown(nbr, S_SHUTDOWN, 0, 0);
if (nbr_params_find(xconf, nbrp->lsr_id) != NULL)
continue;
switch (ldpd_process) {
case PROC_LDP_ENGINE:
nbr = nbr_find_ldpid(nbrp->lsr_id.s_addr);
if (nbr) {
session_shutdown(nbr, S_SHUTDOWN, 0, 0);
#ifdef __OpenBSD__
pfkey_remove(nbr);
pfkey_remove(nbr);
#else
sock_set_md5sig(
(ldp_af_global_get(&global,
nbr->af))->ldp_session_socket,
nbr->af, &nbr->raddr, NULL);
sock_set_md5sig(
(ldp_af_global_get(&global, nbr->af))
->ldp_session_socket,
nbr->af, &nbr->raddr, NULL);
#endif
nbr->auth.method = AUTH_NONE;
if (nbr_session_active_role(nbr))
nbr_establish_connection(nbr);
}
break;
case PROC_LDE_ENGINE:
case PROC_MAIN:
break;
nbr->auth.method = AUTH_NONE;
if (nbr_session_active_role(nbr))
nbr_establish_connection(nbr);
}
RB_REMOVE(nbrp_head, &conf->nbrp_tree, nbrp);
free(nbrp);
break;
case PROC_LDE_ENGINE:
case PROC_MAIN:
break;
}
RB_REMOVE(nbrp_head, &conf->nbrp_tree, nbrp);
free(nbrp);
}
RB_FOREACH_SAFE(xn, nbrp_head, &xconf->nbrp_tree, ntmp) {
/* find new nbrps */
if ((nbrp = nbr_params_find(conf, xn->lsr_id)) == NULL) {
@ -1624,7 +1627,7 @@ merge_l2vpns(struct ldpd_conf *conf, struct ldpd_conf *xconf)
RB_FOREACH_SAFE(l2vpn, l2vpn_head, &conf->l2vpn_tree, ltmp) {
/* find deleted l2vpns */
if ((xl = l2vpn_find(xconf, l2vpn->name)) == NULL) {
if (l2vpn_find(xconf, l2vpn->name) == NULL) {
switch (ldpd_process) {
case PROC_LDE_ENGINE:
l2vpn_exit(l2vpn);
@ -1680,14 +1683,14 @@ merge_l2vpn(struct ldpd_conf *xconf, struct l2vpn *l2vpn, struct l2vpn *xl)
/* merge intefaces */
RB_FOREACH_SAFE(lif, l2vpn_if_head, &l2vpn->if_tree, ftmp) {
/* find deleted interfaces */
if ((xf = l2vpn_if_find(xl, lif->ifname)) == NULL) {
if (l2vpn_if_find(xl, lif->ifname) == NULL) {
RB_REMOVE(l2vpn_if_head, &l2vpn->if_tree, lif);
free(lif);
}
}
RB_FOREACH_SAFE(xf, l2vpn_if_head, &xl->if_tree, ftmp) {
/* find new interfaces */
if ((lif = l2vpn_if_find(l2vpn, xf->ifname)) == NULL) {
if (l2vpn_if_find(l2vpn, xf->ifname) == NULL) {
COPY(lif, xf);
RB_INSERT(l2vpn_if_head, &l2vpn->if_tree, lif);
lif->l2vpn = l2vpn;
@ -1706,7 +1709,7 @@ merge_l2vpn(struct ldpd_conf *xconf, struct l2vpn *l2vpn, struct l2vpn *xl)
/* merge active pseudowires */
RB_FOREACH_SAFE(pw, l2vpn_pw_head, &l2vpn->pw_tree, ptmp) {
/* find deleted active pseudowires */
if ((xp = l2vpn_pw_find_active(xl, pw->ifname)) == NULL) {
if (l2vpn_pw_find_active(xl, pw->ifname) == NULL) {
switch (ldpd_process) {
case PROC_LDE_ENGINE:
l2vpn_pw_exit(pw);
@ -1807,7 +1810,7 @@ merge_l2vpn(struct ldpd_conf *xconf, struct l2vpn *l2vpn, struct l2vpn *xl)
/* merge inactive pseudowires */
RB_FOREACH_SAFE(pw, l2vpn_pw_head, &l2vpn->pw_inactive_tree, ptmp) {
/* find deleted inactive pseudowires */
if ((xp = l2vpn_pw_find_inactive(xl, pw->ifname)) == NULL) {
if (l2vpn_pw_find_inactive(xl, pw->ifname) == NULL) {
RB_REMOVE(l2vpn_pw_head, &l2vpn->pw_inactive_tree, pw);
free(pw);
}

View File

@ -446,7 +446,7 @@ DECLARE_QOBJ_TYPE(l2vpn)
#define L2VPN_TYPE_VPLS 2
/* ldp_conf */
enum ldpd_process {
extern enum ldpd_process {
PROC_MAIN,
PROC_LDP_ENGINE,
PROC_LDE_ENGINE

View File

@ -54,9 +54,6 @@ static struct imsgev *iev_lde;
static struct thread *pfkey_ev;
#endif
/* Master of threads. */
struct thread_master *master;
/* ldpe privileges */
static zebra_capabilities_t _caps_p [] =
{
@ -97,6 +94,8 @@ static struct quagga_signal_t ldpe_signals[] =
},
};
char *pkt_ptr; /* packet buffer */
/* label distribution protocol engine */
void
ldpe(void)

View File

@ -291,7 +291,7 @@ struct tcp_conn *tcp_new(int, struct nbr *);
void pending_conn_del(struct pending_conn *);
struct pending_conn *pending_conn_find(int, union ldpd_addr *);
char *pkt_ptr; /* packet buffer */
extern char *pkt_ptr; /* packet buffer */
/* pfkey.c */
#ifdef __OpenBSD__

View File

@ -209,7 +209,7 @@ sock_set_nonblock(int fd)
flags |= O_NONBLOCK;
if ((flags = fcntl(fd, F_SETFL, flags)) == -1)
if (fcntl(fd, F_SETFL, flags) == -1)
fatal("fcntl F_SETFL");
}
@ -223,7 +223,7 @@ sock_set_cloexec(int fd)
flags |= FD_CLOEXEC;
if ((flags = fcntl(fd, F_SETFD, flags)) == -1)
if (fcntl(fd, F_SETFD, flags) == -1)
fatal("fcntl F_SETFD");
}

View File

@ -264,7 +264,7 @@ int smux_trap(struct variable *vp, size_t vp_len, const oid *ename,
uint8_t sptrap)
{
oid objid_snmptrap[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};
size_t objid_snmptrap_len = sizeof objid_snmptrap / sizeof(oid);
size_t objid_snmptrap_len = sizeof(objid_snmptrap) / sizeof(oid);
oid notification_oid[MAX_OID_LEN];
size_t notification_oid_len;
unsigned int i;

View File

@ -136,7 +136,7 @@ void bfd_peer_sendmsg(struct zclient *zclient, struct bfd_info *bfd_info,
if (bfd_debug)
zlog_debug(
"%s: Suppressing BFD peer reg/dereg messages",
__FUNCTION__);
__func__);
return;
}
@ -146,7 +146,7 @@ void bfd_peer_sendmsg(struct zclient *zclient, struct bfd_info *bfd_info,
zlog_debug(
"%s: Can't send BFD peer register, Zebra client not "
"established",
__FUNCTION__);
__func__);
return;
}
@ -328,7 +328,7 @@ static void bfd_last_update(time_t last_update, char *buf, size_t len)
{
time_t curr;
time_t diff;
struct tm *tm;
struct tm tm;
struct timeval tv;
/* If no BFD satatus update has ever been received, print `never'. */
@ -341,10 +341,10 @@ static void bfd_last_update(time_t last_update, char *buf, size_t len)
monotime(&tv);
curr = tv.tv_sec;
diff = curr - last_update;
tm = gmtime(&diff);
gmtime_r(&diff, &tm);
snprintf(buf, len, "%d:%02d:%02d:%02d", tm->tm_yday, tm->tm_hour,
tm->tm_min, tm->tm_sec);
snprintf(buf, len, "%d:%02d:%02d:%02d", tm.tm_yday, tm.tm_hour,
tm.tm_min, tm.tm_sec);
}
/*
@ -454,7 +454,7 @@ void bfd_client_sendmsg(struct zclient *zclient, int command,
zlog_debug(
"%s: Can't send BFD client register, Zebra client not "
"established",
__FUNCTION__);
__func__);
return;
}

View File

@ -288,7 +288,7 @@ buffer_status_t buffer_flush_window(struct buffer *b, int fd, int width,
/* Previously print out is performed. */
if (erase_flag) {
iov[iov_index].iov_base = erase;
iov[iov_index].iov_len = sizeof erase;
iov[iov_index].iov_len = sizeof(erase);
iov_index++;
}
@ -341,7 +341,7 @@ buffer_status_t buffer_flush_window(struct buffer *b, int fd, int width,
/* In case of `more' display need. */
if (b->tail && (b->tail->sp < b->tail->cp) && !no_more_flag) {
iov[iov_index].iov_base = more;
iov[iov_index].iov_len = sizeof more;
iov[iov_index].iov_len = sizeof(more);
iov_index++;
}

View File

@ -412,7 +412,7 @@ static int64_t filter_new_seq_get(struct access_list *access)
int64_t newseq;
struct filter *filter;
maxseq = newseq = 0;
maxseq = 0;
for (filter = access->head; filter; filter = filter->next) {
if (maxseq < filter->seq)

View File

@ -177,7 +177,7 @@ int funcname_frrzmq_thread_add_read(struct thread_master *master,
else {
cb = XCALLOC(MTYPE_ZEROMQ_CB, sizeof(struct frrzmq_cb));
cb->write.cancelled = 1;
cb->write.cancelled = true;
*cbp = cb;
}
@ -187,7 +187,7 @@ int funcname_frrzmq_thread_add_read(struct thread_master *master,
cb->read.cb_msg = msgfunc;
cb->read.cb_part = partfunc;
cb->read.cb_error = errfunc;
cb->read.cancelled = 0;
cb->read.cancelled = false;
if (events & ZMQ_POLLIN) {
if (cb->read.thread) {
@ -285,7 +285,7 @@ int funcname_frrzmq_thread_add_write(struct thread_master *master,
else {
cb = XCALLOC(MTYPE_ZEROMQ_CB, sizeof(struct frrzmq_cb));
cb->read.cancelled = 1;
cb->read.cancelled = true;
*cbp = cb;
}
@ -295,7 +295,7 @@ int funcname_frrzmq_thread_add_write(struct thread_master *master,
cb->write.cb_msg = msgfunc;
cb->write.cb_part = NULL;
cb->write.cb_error = errfunc;
cb->write.cancelled = 0;
cb->write.cancelled = false;
if (events & ZMQ_POLLOUT) {
if (cb->write.thread) {
@ -316,7 +316,7 @@ void frrzmq_thread_cancel(struct frrzmq_cb **cb, struct cb_core *core)
{
if (!cb || !*cb)
return;
core->cancelled = 1;
core->cancelled = true;
if (core->thread) {
thread_cancel(core->thread);
core->thread = NULL;

View File

@ -36,11 +36,6 @@ extern "C" {
#define HASHWALK_CONTINUE 0
#define HASHWALK_ABORT -1
#if CONFDATE > 20200225
CPP_NOTICE("hash.h: time to remove hash_backet #define")
#endif
#define hash_backet hash_bucket
struct hash_bucket {
/*
* if this bucket is the head of the linked listed, len denotes the

View File

@ -119,10 +119,13 @@ static inline void ipv4_mapped_ipv6_to_ipv4(struct in6_addr *in6,
memcpy(in, (char *)in6 + 12, sizeof(struct in_addr));
}
/*
* Check if a struct ipaddr has nonzero value
*/
static inline bool ipaddr_isset(struct ipaddr *ip)
{
static struct ipaddr a = {};
return (0 == memcmp(&a, ip, sizeof(struct ipaddr)));
return (0 != memcmp(&a, ip, sizeof(struct ipaddr)));
}
#ifdef __cplusplus

View File

@ -967,12 +967,12 @@ static struct cmd_node keychain_key_node = {KEYCHAIN_KEY_NODE,
static int keychain_strftime(char *buf, int bufsiz, time_t *time)
{
struct tm *tm;
struct tm tm;
size_t len;
tm = localtime(time);
localtime_r(time, &tm);
len = strftime(buf, bufsiz, "%T %b %d %Y", tm);
len = strftime(buf, bufsiz, "%T %b %d %Y", &tm);
return len;
}

View File

@ -383,7 +383,7 @@ static int frr_opt(int opt)
exit(0);
break;
case 'd':
di->daemon_mode = 1;
di->daemon_mode = true;
break;
case 'M':
oc = XMALLOC(MTYPE_TMP, sizeof(*oc));
@ -467,12 +467,12 @@ static int frr_opt(int opt)
case 'C':
if (di->flags & FRR_NO_CFG_PID_DRY)
return 1;
di->dryrun = 1;
di->dryrun = true;
break;
case 't':
if (di->flags & FRR_NO_CFG_PID_DRY)
return 1;
di->terminal = 1;
di->terminal = true;
break;
case 'z':
di->zpathspace = true;

View File

@ -220,11 +220,11 @@ size_t quagga_timestamp(int timestamp_precision, char *buf, size_t buflen)
/* first, we update the cache if the time has changed */
if (cache.last != clock.tv_sec) {
struct tm *tm;
struct tm tm;
cache.last = clock.tv_sec;
tm = localtime(&cache.last);
localtime_r(&cache.last, &tm);
cache.len = strftime(cache.buf, sizeof(cache.buf),
"%Y/%m/%d %H:%M:%S", tm);
"%Y/%m/%d %H:%M:%S", &tm);
}
/* note: it's not worth caching the subsecond part, because
chances are that back-to-back calls are not sufficiently close

View File

@ -412,8 +412,8 @@ void hmac_md5(unsigned char *text, int text_len, unsigned char *key,
*/
/* start out by storing key in pads */
bzero(k_ipad, sizeof k_ipad);
bzero(k_opad, sizeof k_opad);
bzero(k_ipad, sizeof(k_ipad));
bzero(k_opad, sizeof(k_opad));
bcopy(key, k_ipad, key_len);
bcopy(key, k_opad, key_len);

View File

@ -81,22 +81,33 @@ char *mlag_lib_msgid_to_str(enum mlag_msg_type msg_type, char *buf, size_t size)
}
int mlag_lib_decode_mlag_hdr(struct stream *s, struct mlag_msg *msg)
int mlag_lib_decode_mlag_hdr(struct stream *s, struct mlag_msg *msg,
size_t *length)
{
if (s == NULL || msg == NULL)
#define LIB_MLAG_HDR_LENGTH 8
*length = stream_get_endp(s);
if (s == NULL || msg == NULL || *length < LIB_MLAG_HDR_LENGTH)
return -1;
*length -= LIB_MLAG_HDR_LENGTH;
STREAM_GETL(s, msg->msg_type);
STREAM_GETW(s, msg->data_len);
STREAM_GETW(s, msg->msg_cnt);
return 0;
stream_failure:
return -1;
}
int mlag_lib_decode_mroute_add(struct stream *s, struct mlag_mroute_add *msg)
#define MLAG_MROUTE_ADD_LENGTH \
(VRF_NAMSIZ + INTERFACE_NAMSIZ + 4 + 4 + 4 + 4 + 1 + 1 + 4)
int mlag_lib_decode_mroute_add(struct stream *s, struct mlag_mroute_add *msg,
size_t *length)
{
if (s == NULL || msg == NULL)
if (s == NULL || msg == NULL || *length < MLAG_MROUTE_ADD_LENGTH)
return -1;
STREAM_GET(msg->vrf_name, s, VRF_NAMSIZ);
@ -108,14 +119,18 @@ int mlag_lib_decode_mroute_add(struct stream *s, struct mlag_mroute_add *msg)
STREAM_GETC(s, msg->am_i_dual_active);
STREAM_GETL(s, msg->vrf_id);
STREAM_GET(msg->intf_name, s, INTERFACE_NAMSIZ);
return 0;
stream_failure:
return -1;
}
int mlag_lib_decode_mroute_del(struct stream *s, struct mlag_mroute_del *msg)
#define MLAG_MROUTE_DEL_LENGTH (VRF_NAMSIZ + INTERFACE_NAMSIZ + 4 + 4 + 4 + 4)
int mlag_lib_decode_mroute_del(struct stream *s, struct mlag_mroute_del *msg,
size_t *length)
{
if (s == NULL || msg == NULL)
if (s == NULL || msg == NULL || *length < MLAG_MROUTE_DEL_LENGTH)
return -1;
STREAM_GET(msg->vrf_name, s, VRF_NAMSIZ);
@ -124,6 +139,7 @@ int mlag_lib_decode_mroute_del(struct stream *s, struct mlag_mroute_del *msg)
STREAM_GETL(s, msg->owner_id);
STREAM_GETL(s, msg->vrf_id);
STREAM_GET(msg->intf_name, s, INTERFACE_NAMSIZ);
return 0;
stream_failure:
return -1;

View File

@ -125,11 +125,14 @@ struct mlag_msg {
extern char *mlag_role2str(enum mlag_role role, char *buf, size_t size);
extern char *mlag_lib_msgid_to_str(enum mlag_msg_type msg_type, char *buf,
size_t size);
extern int mlag_lib_decode_mlag_hdr(struct stream *s, struct mlag_msg *msg);
extern int mlag_lib_decode_mlag_hdr(struct stream *s, struct mlag_msg *msg,
size_t *length);
extern int mlag_lib_decode_mroute_add(struct stream *s,
struct mlag_mroute_add *msg);
struct mlag_mroute_add *msg,
size_t *length);
extern int mlag_lib_decode_mroute_del(struct stream *s,
struct mlag_mroute_del *msg);
struct mlag_mroute_del *msg,
size_t *length);
extern int mlag_lib_decode_mlag_status(struct stream *s,
struct mlag_status *msg);
extern int mlag_lib_decode_vxlan_update(struct stream *s,

View File

@ -58,7 +58,7 @@ static const char *execname = NULL;
void frrmod_init(struct frrmod_runtime *modinfo)
{
modinfo->finished_loading = 1;
modinfo->finished_loading = true;
*frrmod_last = modinfo;
frrmod_last = &modinfo->next;
@ -134,7 +134,7 @@ struct frrmod_runtime *frrmod_load(const char *spec, const char *dir, char *err,
goto out_fail;
}
rtinfo->finished_loading = 1;
rtinfo->finished_loading = true;
*frrmod_last = rtinfo;
frrmod_last = &rtinfo->next;

View File

@ -216,7 +216,8 @@ struct nexthop_group *nexthop_group_new(void)
return XCALLOC(MTYPE_NEXTHOP_GROUP, sizeof(struct nexthop_group));
}
void nexthop_group_copy(struct nexthop_group *to, struct nexthop_group *from)
void nexthop_group_copy(struct nexthop_group *to,
const struct nexthop_group *from)
{
/* Copy everything, including recursive info */
copy_nexthops(&to->nexthop, from->nexthop, NULL);

View File

@ -43,7 +43,7 @@ struct nexthop_group *nexthop_group_new(void);
void nexthop_group_delete(struct nexthop_group **nhg);
void nexthop_group_copy(struct nexthop_group *to,
struct nexthop_group *from);
const struct nexthop_group *from);
/*
* Copy a list of nexthops in 'nh' to an nhg, enforcing canonical sort order

View File

@ -996,7 +996,7 @@ static int nb_transaction_process(enum nb_event event,
* Only try to release resources that were allocated
* successfully.
*/
if (event == NB_EV_ABORT && change->prepare_ok == false)
if (event == NB_EV_ABORT && !change->prepare_ok)
break;
/* Call the appropriate callback. */

View File

@ -387,7 +387,7 @@ static int64_t prefix_new_seq_get(struct prefix_list *plist)
int64_t newseq;
struct prefix_list_entry *pentry;
maxseq = newseq = 0;
maxseq = 0;
for (pentry = plist->head; pentry; pentry = pentry->next) {
if (maxseq < pentry->seq)
@ -2039,7 +2039,7 @@ static void prefix_list_reset_afi(afi_t afi, int orf)
assert(master->str.head == NULL);
assert(master->str.tail == NULL);
master->seqnum = 1;
master->seqnum = true;
master->recent = NULL;
}

View File

@ -1082,7 +1082,7 @@ struct prefix *prefix_new(void)
{
struct prefix *p;
p = XCALLOC(MTYPE_PREFIX, sizeof *p);
p = XCALLOC(MTYPE_PREFIX, sizeof(*p));
return p;
}

View File

@ -686,7 +686,7 @@ build_arg_table(struct typetable *types, va_list ap, union arg **argtable)
if (types->tablemax >= STATIC_ARG_TBL_SIZE) {
*argtable = (union arg *)
malloc (sizeof (union arg) * (types->tablemax + 1));
malloc (sizeof(union arg) * (types->tablemax + 1));
if (*argtable == NULL)
return;
}

View File

@ -143,7 +143,7 @@ int ptm_lib_append_msg(ptm_lib_handle_t *hdl, void *ctxt, const char *key,
csv_record_t *mh_rec, *rec;
if (!p_ctxt) {
ERRLOG("%s: no context \n", __FUNCTION__);
ERRLOG("%s: no context \n", __func__);
return -1;
}
@ -154,7 +154,7 @@ int ptm_lib_append_msg(ptm_lib_handle_t *hdl, void *ctxt, const char *key,
/* append to the hdr record */
rec = csv_append_record(csv, rec, 1, key);
if (!rec) {
ERRLOG("%s: Could not append key \n", __FUNCTION__);
ERRLOG("%s: Could not append key \n", __func__);
return -1;
}
@ -162,7 +162,7 @@ int ptm_lib_append_msg(ptm_lib_handle_t *hdl, void *ctxt, const char *key,
/* append to the data record */
rec = csv_append_record(csv, rec, 1, val);
if (!rec) {
ERRLOG("%s: Could not append val \n", __FUNCTION__);
ERRLOG("%s: Could not append val \n", __func__);
return -1;
}
@ -186,7 +186,7 @@ int ptm_lib_init_msg(ptm_lib_handle_t *hdl, int cmd_id, int type, void *in_ctxt,
csv = csv_init(NULL, NULL, PTMLIB_MSG_SZ);
if (!csv) {
ERRLOG("%s: Could not allocate csv \n", __FUNCTION__);
ERRLOG("%s: Could not allocate csv \n", __func__);
return -1;
}
@ -194,7 +194,7 @@ int ptm_lib_init_msg(ptm_lib_handle_t *hdl, int cmd_id, int type, void *in_ctxt,
cmd_id, hdl->client_name);
if (!rec) {
ERRLOG("%s: Could not allocate record \n", __FUNCTION__);
ERRLOG("%s: Could not allocate record \n", __func__);
csv_clean(csv);
csv_free(csv);
return -1;
@ -202,7 +202,7 @@ int ptm_lib_init_msg(ptm_lib_handle_t *hdl, int cmd_id, int type, void *in_ctxt,
p_ctxt = calloc(1, sizeof(*p_ctxt));
if (!p_ctxt) {
ERRLOG("%s: Could not allocate context \n", __FUNCTION__);
ERRLOG("%s: Could not allocate context \n", __func__);
csv_clean(csv);
csv_free(csv);
return -1;
@ -234,7 +234,7 @@ int ptm_lib_cleanup_msg(ptm_lib_handle_t *hdl, void *ctxt)
csv_t *csv;
if (!p_ctxt) {
ERRLOG("%s: no context \n", __FUNCTION__);
ERRLOG("%s: no context \n", __func__);
return -1;
}
@ -254,7 +254,7 @@ int ptm_lib_complete_msg(ptm_lib_handle_t *hdl, void *ctxt, char *buf, int *len)
csv_record_t *rec;
if (!p_ctxt) {
ERRLOG("%s: no context \n", __FUNCTION__);
ERRLOG("%s: no context \n", __func__);
return -1;
}
@ -268,7 +268,7 @@ int ptm_lib_complete_msg(ptm_lib_handle_t *hdl, void *ctxt, char *buf, int *len)
/* parse csv contents into string */
if (buf && len) {
if (csv_serialize(csv, buf, *len)) {
ERRLOG("%s: cannot serialize\n", __FUNCTION__);
ERRLOG("%s: cannot serialize\n", __func__);
return -1;
}
*len = csvlen(csv);
@ -425,8 +425,7 @@ int ptm_lib_process_msg(ptm_lib_handle_t *hdl, int fd, char *inbuf, int inlen,
csv_decode(csv, inbuf);
p_ctxt = calloc(1, sizeof(*p_ctxt));
if (!p_ctxt) {
ERRLOG("%s: Could not allocate context \n",
__FUNCTION__);
ERRLOG("%s: Could not allocate context \n", __func__);
csv_clean(csv);
csv_free(csv);
return -1;

View File

@ -2257,7 +2257,7 @@ static void route_map_pentry_update(route_map_event_t event,
}
}
static void route_map_pentry_process_dependency(struct hash_backet *backet,
static void route_map_pentry_process_dependency(struct hash_bucket *backet,
void *data)
{
char *rmap_name = NULL;
@ -2447,7 +2447,7 @@ route_map_result_t route_map_apply(struct route_map *map,
}
for (; index; index = index->next) {
if (skip_match_clause == false) {
if (!skip_match_clause) {
/* Apply this index. */
match_ret = route_map_apply_match(&index->match_list,
prefix, type, object);
@ -2684,8 +2684,7 @@ static void route_map_print_dependency(struct hash_bucket *bucket, void *data)
char *rmap_name = dep_data->rname;
char *dep_name = data;
zlog_debug("%s: Dependency for %s: %s", __FUNCTION__, dep_name,
rmap_name);
zlog_debug("%s: Dependency for %s: %s", __func__, dep_name, rmap_name);
}
static int route_map_dep_update(struct hash *dephash, const char *dep_name,

View File

@ -221,8 +221,7 @@ static int lib_route_map_entry_description_modify(enum nb_event event,
break;
case NB_EV_APPLY:
rmi = nb_running_get_entry(dnode, NULL, true);
if (rmi->description != NULL)
XFREE(MTYPE_TMP, rmi->description);
XFREE(MTYPE_TMP, rmi->description);
rmi->description = resource->ptr;
break;
}

View File

@ -254,7 +254,7 @@ bool seqlock_check(struct seqlock *sqlo, seqlock_val_t val)
cur = atomic_load_explicit(&sqlo->pos, memory_order_relaxed);
if (!(cur & SEQLOCK_HELD))
return 1;
return true;
cur = SEQLOCK_VAL(cur) - val - 1;
assert(cur < 0x40000000 || cur > 0xc0000000);
return cur < 0x80000000;

View File

@ -378,7 +378,7 @@ int skiplist_next_value(register struct skiplist *l, /* in */
void **valuePointer, /* in/out */
void **cursor) /* in/out */
{
register int k, m;
register int k;
register struct skiplistnode *p, *q;
CHECKLAST(l);
@ -389,7 +389,7 @@ int skiplist_next_value(register struct skiplist *l, /* in */
if (!cursor || !*cursor) {
p = l->header;
k = m = l->level;
k = l->level;
/*
* Find matching key

View File

@ -90,12 +90,11 @@ int getsockopt_so_recvbuf(const int sock)
static void *getsockopt_cmsg_data(struct msghdr *msgh, int level, int type)
{
struct cmsghdr *cmsg;
void *ptr = NULL;
for (cmsg = CMSG_FIRSTHDR(msgh); cmsg != NULL;
cmsg = CMSG_NXTHDR(msgh, cmsg))
if (cmsg->cmsg_level == level && cmsg->cmsg_type == type)
return (ptr = CMSG_DATA(cmsg));
return CMSG_DATA(cmsg);
return NULL;
}
@ -684,7 +683,7 @@ int sockopt_tcp_signature_ext(int sock, union sockunion *su, uint16_t prefixlen,
#endif /* GNU_LINUX */
if ((ret = setsockopt(sock, IPPROTO_TCP, optname, &md5sig,
sizeof md5sig))
sizeof(md5sig)))
< 0) {
/* ENOENT is harmless. It is returned when we clear a password
for which

View File

@ -39,7 +39,7 @@ extern int setsockopt_ipv6_hoplimit(int, int);
extern int setsockopt_ipv6_multicast_loop(int, int);
extern int setsockopt_ipv6_tclass(int, int);
#define SOPT_SIZE_CMSG_PKTINFO_IPV6() (sizeof (struct in6_pktinfo));
#define SOPT_SIZE_CMSG_PKTINFO_IPV6() (sizeof(struct in6_pktinfo));
/*
* Size defines for control messages used to get ifindex. We define
@ -49,7 +49,7 @@ extern int setsockopt_ipv6_tclass(int, int);
*/
#if defined(IP_PKTINFO)
/* Linux in_pktinfo. */
#define SOPT_SIZE_CMSG_PKTINFO_IPV4() (CMSG_SPACE(sizeof (struct in_pktinfo)))
#define SOPT_SIZE_CMSG_PKTINFO_IPV4() (CMSG_SPACE(sizeof(struct in_pktinfo)))
/* XXX This should perhaps be defined even if IP_PKTINFO is not. */
#define SOPT_SIZE_CMSG_PKTINFO(af) \
((af == AF_INET) ? SOPT_SIZE_CMSG_PKTINFO_IPV4() \
@ -60,9 +60,9 @@ extern int setsockopt_ipv6_tclass(int, int);
/* BSD/Solaris */
#if defined(SUNOS_5)
#define SOPT_SIZE_CMSG_RECVIF_IPV4() (sizeof (uint_t))
#define SOPT_SIZE_CMSG_RECVIF_IPV4() (sizeof(uint_t))
#else
#define SOPT_SIZE_CMSG_RECVIF_IPV4() (sizeof (struct sockaddr_dl))
#define SOPT_SIZE_CMSG_RECVIF_IPV4() (sizeof(struct sockaddr_dl))
#endif /* SUNOS_5 */
#endif /* IP_RECVIF */
@ -72,7 +72,7 @@ extern int setsockopt_ipv6_tclass(int, int);
#elif defined(SOPT_SIZE_CMSG_RECVIF_IPV4)
#define SOPT_SIZE_CMSG_IFINDEX_IPV4() SOPT_SIZE_CMSG_RECVIF_IPV4()
#else /* Nothing available */
#define SOPT_SIZE_CMSG_IFINDEX_IPV4() (sizeof (char *))
#define SOPT_SIZE_CMSG_IFINDEX_IPV4() (sizeof(char *))
#endif /* SOPT_SIZE_CMSG_IFINDEX_IPV4 */
#define SOPT_SIZE_CMSG_IFINDEX(af) \

View File

@ -214,7 +214,7 @@ enum connect_result sockunion_connect(int fd, const union sockunion *peersu,
if (errno != EINPROGRESS) {
char str[SU_ADDRSTRLEN];
zlog_info("can't connect to %s fd %d : %s",
sockunion_log(&su, str, sizeof str), fd,
sockunion_log(&su, str, sizeof(str)), fd,
safe_strerror(errno));
return connect_error;
}
@ -518,8 +518,8 @@ union sockunion *sockunion_getsockname(int fd)
} name;
union sockunion *su;
memset(&name, 0, sizeof name);
len = sizeof name;
memset(&name, 0, sizeof(name));
len = sizeof(name);
ret = getsockname(fd, (struct sockaddr *)&name, &len);
if (ret < 0) {
@ -556,8 +556,8 @@ union sockunion *sockunion_getpeername(int fd)
} name;
union sockunion *su;
memset(&name, 0, sizeof name);
len = sizeof name;
memset(&name, 0, sizeof(name));
len = sizeof(name);
ret = getpeername(fd, (struct sockaddr *)&name, &len);
if (ret < 0) {
flog_err(EC_LIB_SOCKET, "Can't get remote address and port: %s",

View File

@ -171,7 +171,7 @@ static void cpu_record_print(struct vty *vty, uint8_t filter)
struct thread_master *m;
struct listnode *ln;
memset(&tmp, 0, sizeof tmp);
memset(&tmp, 0, sizeof(tmp));
tmp.funcname = "TOTAL";
tmp.types = filter;

View File

@ -493,8 +493,7 @@ void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *),
/* initialise NS, in case VRF backend if NETNS */
ns_init();
if (debug_vrf)
zlog_debug("%s: Initializing VRF subsystem",
__PRETTY_FUNCTION__);
zlog_debug("%s: Initializing VRF subsystem", __func__);
vrf_master.vrf_new_hook = create;
vrf_master.vrf_enable_hook = enable;
@ -535,8 +534,7 @@ void vrf_terminate(void)
struct vrf *vrf;
if (debug_vrf)
zlog_debug("%s: Shutting down vrf subsystem",
__PRETTY_FUNCTION__);
zlog_debug("%s: Shutting down vrf subsystem", __func__);
while (!RB_EMPTY(vrf_id_head, &vrfs_by_id)) {
vrf = RB_ROOT(vrf_id_head, &vrfs_by_id);

View File

@ -47,8 +47,8 @@ static int wheel_timer_thread_helper(struct thread *t)
curr_slot = wheel->curr_slot % wheel->slots;
if (debug_timer_wheel)
zlog_debug("%s: Wheel Slot: %lld(%lld) count: %d",
__PRETTY_FUNCTION__, wheel->curr_slot, curr_slot,
zlog_debug("%s: Wheel Slot: %lld(%lld) count: %d", __func__,
wheel->curr_slot, curr_slot,
listcount(wheel->wheel_slot_lists[curr_slot]));
for (ALL_LIST_ELEMENTS(wheel->wheel_slot_lists[curr_slot], node,
@ -146,8 +146,8 @@ int wheel_add_item(struct timer_wheel *wheel, void *item)
slot = (*wheel->slot_key)(item);
if (debug_timer_wheel)
zlog_debug("%s: Inserting %p: %lld %lld", __PRETTY_FUNCTION__,
item, slot, slot % wheel->slots);
zlog_debug("%s: Inserting %p: %lld %lld", __func__, item, slot,
slot % wheel->slots);
listnode_add(wheel->wheel_slot_lists[slot % wheel->slots], item);
return 0;
@ -160,8 +160,8 @@ int wheel_remove_item(struct timer_wheel *wheel, void *item)
slot = (*wheel->slot_key)(item);
if (debug_timer_wheel)
zlog_debug("%s: Removing %p: %lld %lld", __PRETTY_FUNCTION__,
item, slot, slot % wheel->slots);
zlog_debug("%s: Removing %p: %lld %lld", __func__, item, slot,
slot % wheel->slots);
listnode_delete(wheel->wheel_slot_lists[slot % wheel->slots], item);
return 0;

View File

@ -236,9 +236,8 @@ int zclient_socket_connect(struct zclient *zclient)
ret = connect(sock, (struct sockaddr *)&zclient_addr, zclient_addr_len);
if (ret < 0) {
if (zclient_debug)
zlog_debug("%s connect failure: %d(%s)",
__PRETTY_FUNCTION__, errno,
safe_strerror(errno));
zlog_debug("%s connect failure: %d(%s)", __func__,
errno, safe_strerror(errno));
close(sock);
return -1;
}
@ -958,7 +957,7 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
if (api->type >= ZEBRA_ROUTE_MAX) {
flog_err(EC_LIB_ZAPI_ENCODE,
"%s: Specified route type (%u) is not a legal value\n",
__PRETTY_FUNCTION__, api->type);
__func__, api->type);
return -1;
}
stream_putc(s, api->type);
@ -970,7 +969,7 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
if (api->safi < SAFI_UNICAST || api->safi >= SAFI_MAX) {
flog_err(EC_LIB_ZAPI_ENCODE,
"%s: Specified route SAFI (%u) is not a legal value\n",
__PRETTY_FUNCTION__, api->safi);
__func__, api->safi);
return -1;
}
stream_putc(s, api->safi);
@ -1122,7 +1121,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
if (api->type >= ZEBRA_ROUTE_MAX) {
flog_err(EC_LIB_ZAPI_ENCODE,
"%s: Specified route type: %d is not a legal value\n",
__PRETTY_FUNCTION__, api->type);
__func__, api->type);
return -1;
}
@ -1133,7 +1132,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
if (api->safi < SAFI_UNICAST || api->safi >= SAFI_MAX) {
flog_err(EC_LIB_ZAPI_ENCODE,
"%s: Specified route SAFI (%u) is not a legal value\n",
__PRETTY_FUNCTION__, api->safi);
__func__, api->safi);
return -1;
}
@ -1146,7 +1145,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
flog_err(
EC_LIB_ZAPI_ENCODE,
"%s: V4 prefixlen is %d which should not be more than 32",
__PRETTY_FUNCTION__, api->prefix.prefixlen);
__func__, api->prefix.prefixlen);
return -1;
}
break;
@ -1155,14 +1154,14 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
flog_err(
EC_LIB_ZAPI_ENCODE,
"%s: v6 prefixlen is %d which should not be more than 128",
__PRETTY_FUNCTION__, api->prefix.prefixlen);
__func__, api->prefix.prefixlen);
return -1;
}
break;
default:
flog_err(EC_LIB_ZAPI_ENCODE,
"%s: Specified family %d is not v4 or v6",
__PRETTY_FUNCTION__, api->prefix.family);
"%s: Specified family %d is not v4 or v6", __func__,
api->prefix.family);
return -1;
}
STREAM_GET(&api->prefix.u.prefix, s, PSIZE(api->prefix.prefixlen));
@ -1174,7 +1173,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
flog_err(
EC_LIB_ZAPI_ENCODE,
"%s: SRC Prefix prefixlen received: %d is too large",
__PRETTY_FUNCTION__, api->src_prefix.prefixlen);
__func__, api->src_prefix.prefixlen);
return -1;
}
STREAM_GET(&api->src_prefix.prefix, s,
@ -1185,7 +1184,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
flog_err(
EC_LIB_ZAPI_ENCODE,
"%s: SRC prefix specified in some manner that makes no sense",
__PRETTY_FUNCTION__);
__func__);
return -1;
}
}
@ -1309,8 +1308,7 @@ bool zapi_rule_notify_decode(struct stream *s, uint32_t *seqno,
STREAM_GETL(s, ifi);
if (zclient_debug)
zlog_debug("%s: %u %u %u %u", __PRETTY_FUNCTION__, seq, prio,
uni, ifi);
zlog_debug("%s: %u %u %u %u", __func__, seq, prio, uni, ifi);
*seqno = seq;
*priority = prio;
*unique = uni;
@ -1332,7 +1330,7 @@ bool zapi_ipset_notify_decode(struct stream *s, uint32_t *unique,
STREAM_GETL(s, uni);
if (zclient_debug)
zlog_debug("%s: %u", __PRETTY_FUNCTION__, uni);
zlog_debug("%s: %u", __func__, uni);
*unique = uni;
return true;
@ -1354,7 +1352,7 @@ bool zapi_ipset_entry_notify_decode(struct stream *s, uint32_t *unique,
STREAM_GET(ipset_name, s, ZEBRA_IPSET_NAME_SIZE);
if (zclient_debug)
zlog_debug("%s: %u", __PRETTY_FUNCTION__, uni);
zlog_debug("%s: %u", __func__, uni);
*unique = uni;
return true;
@ -1374,7 +1372,7 @@ bool zapi_iptable_notify_decode(struct stream *s,
STREAM_GETL(s, uni);
if (zclient_debug)
zlog_debug("%s: %u", __PRETTY_FUNCTION__, uni);
zlog_debug("%s: %u", __func__, uni);
*unique = uni;
return true;
@ -1978,7 +1976,7 @@ struct connected *zebra_interface_address_read(int type, struct stream *s,
"warning: interface %s address %s with peer flag set, but no peer address!",
ifp->name,
prefix2str(ifc->address, buf,
sizeof buf));
sizeof(buf)));
UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
}
}
@ -2664,8 +2662,7 @@ int zapi_labels_decode(struct stream *s, struct zapi_labels *zl)
if (zl->route.prefix.prefixlen > IPV4_MAX_BITLEN) {
zlog_debug(
"%s: Specified prefix length %d is greater than a v4 address can support",
__PRETTY_FUNCTION__,
zl->route.prefix.prefixlen);
__func__, zl->route.prefix.prefixlen);
return -1;
}
STREAM_GET(&zl->route.prefix.u.prefix4.s_addr, s,
@ -2675,8 +2672,7 @@ int zapi_labels_decode(struct stream *s, struct zapi_labels *zl)
if (zl->route.prefix.prefixlen > IPV6_MAX_BITLEN) {
zlog_debug(
"%s: Specified prefix length %d is greater than a v6 address can support",
__PRETTY_FUNCTION__,
zl->route.prefix.prefixlen);
__func__, zl->route.prefix.prefixlen);
return -1;
}
STREAM_GET(&zl->route.prefix.u.prefix6, s, psize);
@ -2684,7 +2680,7 @@ int zapi_labels_decode(struct stream *s, struct zapi_labels *zl)
default:
flog_err(EC_LIB_ZAPI_ENCODE,
"%s: Specified family %u is not v4 or v6",
__PRETTY_FUNCTION__, zl->route.prefix.family);
__func__, zl->route.prefix.family);
return -1;
}

View File

@ -257,7 +257,7 @@ static void nhrp_cache_authorize_binding(struct nhrp_reqid *r, void *arg)
char buf[3][SU_ADDRSTRLEN];
debugf(NHRP_DEBUG_COMMON, "cache: %s %s: %s", c->ifp->name,
sockunion2str(&c->remote_addr, buf[0], sizeof buf[0]),
sockunion2str(&c->remote_addr, buf[0], sizeof(buf[0])),
(const char *)arg);
nhrp_reqid_free(&nhrp_event_reqid, r);
@ -377,7 +377,7 @@ int nhrp_cache_update_binding(struct nhrp_cache *c, enum nhrp_cache_type type,
c->cur.remote_nbma_natoa = *nbma_oa;
else
memset(&c->cur.remote_nbma_natoa, 0,
sizeof c->cur.remote_nbma_natoa);
sizeof(c->cur.remote_nbma_natoa));
nhrp_peer_unref(p);
} else {
debugf(NHRP_DEBUG_COMMON,

View File

@ -200,7 +200,7 @@ static int evmgr_reconnect(struct thread *t)
fd = sock_open_unix(nhrp_event_socket_path);
if (fd < 0) {
zlog_warn("%s: failure connecting nhrp-event socket: %s",
__PRETTY_FUNCTION__, strerror(errno));
__func__, strerror(errno));
zbufq_reset(&evmgr->obuf);
thread_add_timer(master, evmgr_reconnect, evmgr, 10,
&evmgr->t_reconnect);

View File

@ -112,7 +112,7 @@ static void nhrp_interface_interface_notifier(struct notifier_block *n,
NOTIFY_INTERFACE_NBMA_CHANGED);
debugf(NHRP_DEBUG_IF, "%s: NBMA change: address %s",
nifp->ifp->name,
sockunion2str(&nifp->nbma, buf, sizeof buf));
sockunion2str(&nifp->nbma, buf, sizeof(buf)));
break;
}
}
@ -221,7 +221,7 @@ static void nhrp_interface_update_address(struct interface *ifp, afi_t afi,
if (best && if_ad->configured
&& best->address->prefixlen != 8 * prefix_blen(best->address)) {
zlog_notice("%s: %s is not a host prefix", ifp->name,
prefix2str(best->address, buf, sizeof buf));
prefix2str(best->address, buf, sizeof(buf)));
best = NULL;
}
@ -243,7 +243,7 @@ static void nhrp_interface_update_address(struct interface *ifp, afi_t afi,
debugf(NHRP_DEBUG_KERNEL, "%s: IPv%d address changed to %s", ifp->name,
afi == AFI_IP ? 4 : 6,
best ? prefix2str(best->address, buf, sizeof buf) : "(none)");
best ? prefix2str(best->address, buf, sizeof(buf)) : "(none)");
if_ad->addr = addr;
if (if_ad->configured && sockunion_family(&if_ad->addr) != AF_UNSPEC) {
@ -342,7 +342,7 @@ int nhrp_interface_address_add(ZAPI_CALLBACK_ARGS)
return 0;
debugf(NHRP_DEBUG_IF, "if-addr-add: %s: %s", ifc->ifp->name,
prefix2str(ifc->address, buf, sizeof buf));
prefix2str(ifc->address, buf, sizeof(buf)));
nhrp_interface_update_address(
ifc->ifp, family2afi(PREFIX_FAMILY(ifc->address)), 0);
@ -360,7 +360,7 @@ int nhrp_interface_address_delete(ZAPI_CALLBACK_ARGS)
return 0;
debugf(NHRP_DEBUG_IF, "if-addr-del: %s: %s", ifc->ifp->name,
prefix2str(ifc->address, buf, sizeof buf));
prefix2str(ifc->address, buf, sizeof(buf)));
nhrp_interface_update_address(
ifc->ifp, family2afi(PREFIX_FAMILY(ifc->address)), 0);

View File

@ -136,7 +136,7 @@ static void nhrp_reg_peer_notify(struct notifier_block *n, unsigned long cmd)
case NOTIFY_PEER_MTU_CHANGED:
debugf(NHRP_DEBUG_COMMON, "NHS: Flush timer for %s",
sockunion2str(&r->peer->vc->remote.nbma, buf,
sizeof buf));
sizeof(buf)));
THREAD_TIMER_OFF(r->t_register);
thread_add_timer_msec(master, nhrp_reg_send_req, r, 10,
&r->t_register);
@ -162,7 +162,7 @@ static int nhrp_reg_send_req(struct thread *t)
if (!nhrp_peer_check(r->peer, 2)) {
debugf(NHRP_DEBUG_COMMON, "NHS: Waiting link for %s",
sockunion2str(&r->peer->vc->remote.nbma, buf1,
sizeof buf1));
sizeof(buf1)));
thread_add_timer(master, nhrp_reg_send_req, r, 120,
&r->t_register);
return 0;

View File

@ -305,8 +305,8 @@ void nhrp_peer_send(struct nhrp_peer *p, struct zbuf *zb)
return;
debugf(NHRP_DEBUG_KERNEL, "PACKET: Send %s -> %s",
sockunion2str(&p->vc->local.nbma, buf[0], sizeof buf[0]),
sockunion2str(&p->vc->remote.nbma, buf[1], sizeof buf[1]));
sockunion2str(&p->vc->local.nbma, buf[0], sizeof(buf[0])),
sockunion2str(&p->vc->remote.nbma, buf[1], sizeof(buf[1])));
os_sendmsg(zb->head, zbuf_used(zb), p->ifp->ifindex,
sockunion_get_addr(&p->vc->remote.nbma),
@ -650,15 +650,15 @@ void nhrp_peer_send_indication(struct interface *ifp, uint16_t protocol_type,
debugf(NHRP_DEBUG_COMMON,
"Send Traffic Indication to %s about packet to %s ignored",
sockunion2str(&p->vc->remote.nbma, buf[0],
sizeof buf[0]),
sockunion2str(&dst, buf[1], sizeof buf[1]));
sizeof(buf[0])),
sockunion2str(&dst, buf[1], sizeof(buf[1])));
return;
}
debugf(NHRP_DEBUG_COMMON,
"Send Traffic Indication to %s (online=%d) about packet to %s",
sockunion2str(&p->vc->remote.nbma, buf[0], sizeof buf[0]),
p->online, sockunion2str(&dst, buf[1], sizeof buf[1]));
sockunion2str(&p->vc->remote.nbma, buf[0], sizeof(buf[0])),
p->online, sockunion2str(&dst, buf[1], sizeof(buf[1])));
/* Create reply */
zb = zbuf_alloc(1500);
@ -688,8 +688,8 @@ static void nhrp_handle_error_ind(struct nhrp_packet_parser *pp)
debugf(NHRP_DEBUG_COMMON,
"Error Indication from %s about packet to %s ignored",
sockunion2str(&pp->src_proto, buf[0], sizeof buf[0]),
sockunion2str(&dst_proto, buf[1], sizeof buf[1]));
sockunion2str(&pp->src_proto, buf[0], sizeof(buf[0])),
sockunion2str(&dst_proto, buf[1], sizeof(buf[1])));
reqid = nhrp_reqid_lookup(&nhrp_packet_reqid, htonl(hdr->u.request_id));
if (reqid)
@ -707,8 +707,8 @@ static void nhrp_handle_traffic_ind(struct nhrp_packet_parser *p)
debugf(NHRP_DEBUG_COMMON,
"Traffic Indication from %s about packet to %s: %s",
sockunion2str(&p->src_proto, buf[0], sizeof buf[0]),
sockunion2str(&dst, buf[1], sizeof buf[1]),
sockunion2str(&p->src_proto, buf[0], sizeof(buf[0])),
sockunion2str(&dst, buf[1], sizeof(buf[1])),
(p->if_ad->flags & NHRP_IFF_SHORTCUT) ? "trying shortcut"
: "ignored");
@ -821,10 +821,9 @@ static void nhrp_peer_forward(struct nhrp_peer *p,
if ((type == NHRP_EXTENSION_REVERSE_TRANSIT_NHS)
== (packet_types[hdr->type].type == PACKET_REPLY)) {
/* Check NHS list for forwarding loop */
while ((cie = nhrp_cie_pull(&extpl, pp->hdr,
&cie_nbma,
&cie_protocol))
!= NULL) {
while (nhrp_cie_pull(&extpl, pp->hdr,
&cie_nbma,
&cie_protocol) != NULL) {
if (sockunion_same(&p->vc->remote.nbma,
&cie_nbma))
goto err;
@ -876,8 +875,8 @@ static void nhrp_packet_debug(struct zbuf *zb, const char *dir)
zbuf_init(&zhdr, zb->buf, zb->tail - zb->buf, zb->tail - zb->buf);
hdr = nhrp_packet_pull(&zhdr, &src_nbma, &src_proto, &dst_proto);
sockunion2str(&src_proto, buf[0], sizeof buf[0]);
sockunion2str(&dst_proto, buf[1], sizeof buf[1]);
sockunion2str(&src_proto, buf[0], sizeof(buf[0]));
sockunion2str(&dst_proto, buf[1], sizeof(buf[1]));
reply = packet_types[hdr->type].type == PACKET_REPLY;
debugf(NHRP_DEBUG_COMMON, "%s %s(%d) %s -> %s", dir,
@ -919,8 +918,8 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb)
afi_t nbma_afi, proto_afi;
debugf(NHRP_DEBUG_KERNEL, "PACKET: Recv %s -> %s",
sockunion2str(&vc->remote.nbma, buf[0], sizeof buf[0]),
sockunion2str(&vc->local.nbma, buf[1], sizeof buf[1]));
sockunion2str(&vc->remote.nbma, buf[0], sizeof(buf[0])),
sockunion2str(&vc->local.nbma, buf[1], sizeof(buf[1])));
if (!p->online) {
info = "peer not online";
@ -952,7 +951,7 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb)
|| htons(hdr->packet_size) > realsize) {
zlog_info(
"From %s: error: packet type %d, version %d, AFI %d, proto %x, size %d (real size %d)",
sockunion2str(&vc->remote.nbma, buf[0], sizeof buf[0]),
sockunion2str(&vc->remote.nbma, buf[0], sizeof(buf[0])),
(int)hdr->type, (int)hdr->version, (int)nbma_afi,
(int)htons(hdr->protocol_type),
(int)htons(hdr->packet_size), (int)realsize);
@ -1033,7 +1032,7 @@ drop:
if (info) {
zlog_info(
"From %s: error: %s",
sockunion2str(&vc->remote.nbma, buf[0], sizeof buf[0]),
sockunion2str(&vc->remote.nbma, buf[0], sizeof(buf[0])),
info);
}
if (peer)

View File

@ -220,8 +220,8 @@ int nhrp_route_read(ZAPI_CALLBACK_ARGS)
added = (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD);
debugf(NHRP_DEBUG_ROUTE, "if-route-%s: %s via %s dev %s",
added ? "add" : "del",
prefix2str(&api.prefix, buf[0], sizeof buf[0]),
sockunion2str(&nexthop_addr, buf[1], sizeof buf[1]),
prefix2str(&api.prefix, buf[0], sizeof(buf[0])),
sockunion2str(&nexthop_addr, buf[1], sizeof(buf[1])),
ifp ? ifp->name : "(none)");
nhrp_route_update_zebra(&api.prefix, &nexthop_addr, ifp);
@ -248,7 +248,7 @@ int nhrp_route_get_nexthop(const union sockunion *addr, struct prefix *p,
ri = rn->info;
if (ri->nhrp_ifp) {
debugf(NHRP_DEBUG_ROUTE, "lookup %s: nhrp_if=%s",
prefix2str(&lookup, buf, sizeof buf),
prefix2str(&lookup, buf, sizeof(buf)),
ri->nhrp_ifp->name);
if (via)
@ -257,7 +257,7 @@ int nhrp_route_get_nexthop(const union sockunion *addr, struct prefix *p,
*ifp = ri->nhrp_ifp;
} else {
debugf(NHRP_DEBUG_ROUTE, "lookup %s: zebra route dev %s",
prefix2str(&lookup, buf, sizeof buf),
prefix2str(&lookup, buf, sizeof(buf)),
ri->ifp ? ri->ifp->name : "(none)");
if (via)

View File

@ -32,7 +32,7 @@ static void nhrp_shortcut_check_use(struct nhrp_shortcut *s)
if (s->expiring && s->cache && s->cache->used) {
debugf(NHRP_DEBUG_ROUTE, "Shortcut %s used and expiring",
prefix2str(s->p, buf, sizeof buf));
prefix2str(s->p, buf, sizeof(buf)));
nhrp_shortcut_send_resolution_req(s);
}
}
@ -162,7 +162,7 @@ static void nhrp_shortcut_delete(struct nhrp_shortcut *s)
nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid);
debugf(NHRP_DEBUG_ROUTE, "Shortcut %s purged",
prefix2str(s->p, buf, sizeof buf));
prefix2str(s->p, buf, sizeof(buf)));
nhrp_shortcut_update_binding(s, NHRP_CACHE_INVALID, NULL, 0);
@ -202,7 +202,7 @@ static struct nhrp_shortcut *nhrp_shortcut_get(struct prefix *p)
s->p = &rn->p;
debugf(NHRP_DEBUG_ROUTE, "Shortcut %s created",
prefix2str(s->p, buf, sizeof buf));
prefix2str(s->p, buf, sizeof(buf)));
} else {
s = rn->info;
route_unlock_node(rn);
@ -246,7 +246,7 @@ static void nhrp_shortcut_recv_resolution_rep(struct nhrp_reqid *reqid,
}
/* Parse extensions */
memset(&nat_nbma, 0, sizeof nat_nbma);
memset(&nat_nbma, 0, sizeof(nat_nbma));
while ((ext = nhrp_ext_pull(&pp->extensions, &extpl)) != NULL) {
switch (htons(ext->type) & ~NHRP_EXTENSION_FLAG_COMPULSORY) {
case NHRP_EXTENSION_NAT_ADDRESS:
@ -260,8 +260,8 @@ static void nhrp_shortcut_recv_resolution_rep(struct nhrp_reqid *reqid,
if (!sockunion_same(&cie_proto, &pp->dst_proto)) {
debugf(NHRP_DEBUG_COMMON,
"Shortcut: Warning dst_proto altered from %s to %s",
sockunion2str(&cie_proto, buf[0], sizeof buf[0]),
sockunion2str(&pp->dst_proto, buf[1], sizeof buf[1]));
sockunion2str(&cie_proto, buf[0], sizeof(buf[0])),
sockunion2str(&pp->dst_proto, buf[1], sizeof(buf[1])));
}
/* One or more CIEs should be given as reply, we support only one */
@ -291,9 +291,8 @@ static void nhrp_shortcut_recv_resolution_rep(struct nhrp_reqid *reqid,
}
debugf(NHRP_DEBUG_COMMON,
"Shortcut: %s is at proto %s dst_proto %s cie-nbma %s nat-nbma "
"%s cie-holdtime %d",
prefix2str(&prefix, bufp, sizeof bufp),
"Shortcut: %s is at proto %s dst_proto %s cie-nbma %s nat-nbma %s cie-holdtime %d",
prefix2str(&prefix, bufp, sizeof(bufp)),
sockunion2str(proto, buf[0], sizeof(buf[0])),
sockunion2str(&pp->dst_proto, buf[1], sizeof(buf[1])),
sockunion2str(&cie_nbma, buf[2], sizeof(buf[2])),

View File

@ -142,8 +142,8 @@ int nhrp_vc_ipsec_updown(uint32_t child_id, struct nhrp_vc *vc)
sa->vc->abort_migration = 0;
debugf(NHRP_DEBUG_COMMON, "IPsec NBMA change of %s to %s",
sockunion2str(&sa->vc->remote.nbma, buf[0],
sizeof buf[0]),
sockunion2str(&vc->remote.nbma, buf[1], sizeof buf[1]));
sizeof(buf[0])),
sockunion2str(&vc->remote.nbma, buf[1], sizeof(buf[1])));
nhrp_vc_update(sa->vc, NOTIFY_VC_IPSEC_UPDATE_NBMA);
abort_migration = sa->vc->abort_migration;
}

View File

@ -613,9 +613,9 @@ static void show_ip_nhrp_cache(struct nhrp_cache *c, void *pctx)
vty_out(ctx->vty, "%-8s %-8s %-24s %-24s %c%c%c %s\n", c->ifp->name,
nhrp_cache_type_str[c->cur.type],
sockunion2str(&c->remote_addr, buf[0], sizeof buf[0]),
sockunion2str(&c->remote_addr, buf[0], sizeof(buf[0])),
c->cur.peer ? sockunion2str(&c->cur.peer->vc->remote.nbma,
buf[1], sizeof buf[1])
buf[1], sizeof(buf[1]))
: "-",
c->used ? 'U' : ' ', c->t_timeout ? 'T' : ' ',
c->t_auth ? 'A' : ' ',
@ -637,10 +637,10 @@ static void show_ip_nhrp_nhs(struct nhrp_nhs *n, struct nhrp_registration *reg,
vty_out(vty, "%-8s %-24s %-16s %-16s\n", n->ifp->name, n->nbma_fqdn,
(reg && reg->peer) ? sockunion2str(&reg->peer->vc->remote.nbma,
buf[0], sizeof buf[0])
buf[0], sizeof(buf[0]))
: "-",
sockunion2str(reg ? &reg->proto_addr : &n->proto_addr, buf[1],
sizeof buf[1]));
sizeof(buf[1])));
}
static void show_ip_nhrp_shortcut(struct nhrp_shortcut *s, void *pctx)
@ -658,8 +658,8 @@ static void show_ip_nhrp_shortcut(struct nhrp_shortcut *s, void *pctx)
c = s->cache;
vty_out(ctx->vty, "%-8s %-24s %-24s %s\n", nhrp_cache_type_str[s->type],
prefix2str(s->p, buf1, sizeof buf1),
c ? sockunion2str(&c->remote_addr, buf2, sizeof buf2) : "",
prefix2str(s->p, buf1, sizeof(buf1)),
c ? sockunion2str(&c->remote_addr, buf2, sizeof(buf2)) : "",
(c && c->cur.peer) ? c->cur.peer->vc->remote.id : "");
}
@ -678,19 +678,19 @@ static void show_ip_opennhrp_cache(struct nhrp_cache *c, void *pctx)
nhrp_cache_type_str[c->cur.type],
(c->cur.peer && c->cur.peer->online) ? " up" : "",
c->used ? " used" : "",
sockunion2str(&c->remote_addr, buf, sizeof buf),
sockunion2str(&c->remote_addr, buf, sizeof(buf)),
8 * family2addrsize(sockunion_family(&c->remote_addr)));
if (c->cur.peer) {
vty_out(ctx->vty, "NBMA-Address: %s\n",
sockunion2str(&c->cur.peer->vc->remote.nbma, buf,
sizeof buf));
sizeof(buf)));
}
if (sockunion_family(&c->cur.remote_nbma_natoa) != AF_UNSPEC) {
vty_out(ctx->vty, "NBMA-NAT-OA-Address: %s\n",
sockunion2str(&c->cur.remote_nbma_natoa, buf,
sizeof buf));
sizeof(buf)));
}
vty_out(ctx->vty, "\n\n");
@ -741,8 +741,8 @@ static void show_dmvpn_entry(struct nhrp_vc *vc, void *ctx)
char buf[2][SU_ADDRSTRLEN];
vty_out(vty, "%-24s %-24s %c %-4d %-24s\n",
sockunion2str(&vc->local.nbma, buf[0], sizeof buf[0]),
sockunion2str(&vc->remote.nbma, buf[1], sizeof buf[1]),
sockunion2str(&vc->local.nbma, buf[0], sizeof(buf[0])),
sockunion2str(&vc->remote.nbma, buf[1], sizeof(buf[1])),
notifier_active(&vc->notifier_list) ? 'n' : ' ', vc->ipsec,
vc->remote.id);
}
@ -824,11 +824,11 @@ static void interface_config_write_nhrp_map(struct nhrp_cache *c, void *data)
return;
vty_out(vty, " %s nhrp map %s %s\n", ctx->aficmd,
sockunion2str(&c->remote_addr, buf[0], sizeof buf[0]),
sockunion2str(&c->remote_addr, buf[0], sizeof(buf[0])),
c->cur.type == NHRP_CACHE_LOCAL
? "local"
: sockunion2str(&c->cur.peer->vc->remote.nbma, buf[1],
sizeof buf[1]));
sizeof(buf[1])));
}
static int interface_config_write(struct vty *vty)
@ -904,7 +904,7 @@ static int interface_config_write(struct vty *vty)
? "dynamic"
: sockunion2str(
&nhs->proto_addr, buf,
sizeof buf),
sizeof(buf)),
nhs->nbma_fqdn);
}
}

View File

@ -303,7 +303,7 @@ static void vici_recv_sa(struct vici_conn *vici, struct zbuf *msg, int event)
if (ctx.kill_ikesa && ctx.ike_uniqueid) {
debugf(NHRP_DEBUG_COMMON, "VICI: Deleting IKE_SA %u",
ctx.ike_uniqueid);
snprintf(buf, sizeof buf, "%u", ctx.ike_uniqueid);
snprintf(buf, sizeof(buf), "%u", ctx.ike_uniqueid);
vici_submit_request(vici, "terminate", VICI_KEY_VALUE, "ike-id",
strlen(buf), buf, VICI_END);
}
@ -481,8 +481,8 @@ static int vici_reconnect(struct thread *t)
fd = sock_open_unix("/var/run/charon.vici");
if (fd < 0) {
debugf(NHRP_DEBUG_VICI,
"%s: failure connecting VICI socket: %s",
__PRETTY_FUNCTION__, strerror(errno));
"%s: failure connecting VICI socket: %s", __func__,
strerror(errno));
thread_add_timer(master, vici_reconnect, vici, 2,
&vici->t_reconnect);
return 0;
@ -527,8 +527,8 @@ void vici_request_vc(const char *profile, union sockunion *src,
struct vici_conn *vici = &vici_connection;
char buf[2][SU_ADDRSTRLEN];
sockunion2str(src, buf[0], sizeof buf[0]);
sockunion2str(dst, buf[1], sizeof buf[1]);
sockunion2str(src, buf[0], sizeof(buf[0]));
sockunion2str(dst, buf[1], sizeof(buf[1]));
vici_submit_request(vici, "initiate", VICI_KEY_VALUE, "child",
strlen(profile), profile, VICI_KEY_VALUE, "timeout",

View File

@ -232,8 +232,8 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
&route->prefix)), buf,
sizeof(buf));
zlog_debug(
"%s: route %s with cost %u is not best, ignore."
, __PRETTY_FUNCTION__, buf,
"%s: route %s with cost %u is not best, ignore.",
__func__, buf,
route->path.cost);
}
return 0;
@ -246,9 +246,10 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
if (is_debug) {
prefix2str(&route->prefix, buf,
sizeof(buf));
zlog_debug("%s: intra-prefix route %s with cost %u is not best, ignore."
, __PRETTY_FUNCTION__, buf,
route->path.cost);
zlog_debug(
"%s: intra-prefix route %s with cost %u is not best, ignore.",
__func__, buf,
route->path.cost);
}
return 0;
}
@ -762,11 +763,13 @@ void ospf6_abr_old_path_update(struct ospf6_route *old_route,
}
if (IS_OSPF6_DEBUG_ABR || IS_OSPF6_DEBUG_EXAMIN(INTER_PREFIX))
zlog_debug("%s: paths %u nh %u", __PRETTY_FUNCTION__,
old_route->paths ?
listcount(old_route->paths) : 0,
old_route->nh_list ?
listcount(old_route->nh_list) : 0);
zlog_debug("%s: paths %u nh %u", __func__,
old_route->paths
? listcount(old_route->paths)
: 0,
old_route->nh_list
? listcount(old_route->nh_list)
: 0);
if (table->hook_add)
(*table->hook_add)(old_route);
@ -822,9 +825,10 @@ void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa,
prefix2str(&old->prefix, buf,
sizeof(buf));
zlog_debug("%s: old %s updated nh %u",
__PRETTY_FUNCTION__, buf,
old->nh_list ?
listcount(old->nh_list) : 0);
__func__, buf,
old->nh_list ? listcount(
old->nh_list)
: 0);
}
if (table->hook_add)
@ -878,8 +882,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
if (lsa->header->type == htons(OSPF6_LSTYPE_INTER_PREFIX)) {
if (IS_OSPF6_DEBUG_EXAMIN(INTER_PREFIX)) {
is_debug++;
zlog_debug("%s: Examin %s in area %s",
__PRETTY_FUNCTION__, lsa->name, oa->name);
zlog_debug("%s: Examin %s in area %s", __func__,
lsa->name, oa->name);
}
prefix_lsa =
@ -898,8 +902,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
} else if (lsa->header->type == htons(OSPF6_LSTYPE_INTER_ROUTER)) {
if (IS_OSPF6_DEBUG_EXAMIN(INTER_ROUTER)) {
is_debug++;
zlog_debug("%s: Examin %s in area %s",
__PRETTY_FUNCTION__, lsa->name, oa->name);
zlog_debug("%s: Examin %s in area %s", __func__,
lsa->name, oa->name);
}
router_lsa =
@ -946,9 +950,10 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
old = route;
if (is_debug)
zlog_debug("%s: old entry found in paths, adv_router %s",
__PRETTY_FUNCTION__,
adv_router);
zlog_debug(
"%s: old entry found in paths, adv_router %s",
__func__,
adv_router);
break;
}
@ -973,8 +978,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
}
if (OSPF6_LSA_IS_MAXAGE(lsa)) {
if (is_debug)
zlog_debug("%s: LSA %s is MaxAge, ignore",
__PRETTY_FUNCTION__, lsa->name);
zlog_debug("%s: LSA %s is MaxAge, ignore", __func__,
lsa->name);
if (old)
ospf6_abr_old_route_remove(lsa, old, table);
return;
@ -1053,21 +1058,21 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
|| CHECK_FLAG(abr_entry->flag, OSPF6_ROUTE_REMOVE)
|| !CHECK_FLAG(abr_entry->path.router_bits, OSPF6_ROUTER_BIT_B)) {
if (is_debug)
zlog_debug("%s: ABR router entry does not exist, ignore",
__PRETTY_FUNCTION__);
zlog_debug(
"%s: ABR router entry does not exist, ignore",
__func__);
if (old) {
if (old->type == OSPF6_DEST_TYPE_ROUTER &&
oa->intra_brouter_calc) {
if (is_debug)
zlog_debug(
"%s: intra_brouter_calc is on, skip brouter remove: %s (%p)",
__PRETTY_FUNCTION__, buf,
(void *)old);
"%s: intra_brouter_calc is on, skip brouter remove: %s (%p)",
__func__, buf, (void *)old);
} else {
if (is_debug)
zlog_debug("%s: remove old entry: %s %p ",
__PRETTY_FUNCTION__, buf,
(void *)old);
zlog_debug(
"%s: remove old entry: %s %p ",
__func__, buf, (void *)old);
ospf6_route_remove(old, table);
}
}
@ -1142,11 +1147,10 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
if ((ospf6_route_cmp(route, old_route) != 0)) {
if (is_debug) {
prefix2str(&prefix, buf, sizeof(buf));
zlog_debug("%s: old %p %s cost %u new route cost %u are not same",
__PRETTY_FUNCTION__,
(void *)old_route, buf,
old_route->path.cost,
route->path.cost);
zlog_debug(
"%s: old %p %s cost %u new route cost %u are not same",
__func__, (void *)old_route, buf,
old_route->path.cost, route->path.cost);
}
/* Check new route's adv. router is same in one of
@ -1185,14 +1189,15 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
inet_ntop(AF_INET,
&ecmp_path->origin.adv_router,
adv_router, sizeof(adv_router));
zlog_debug("%s: route %s cost %u another path %s added with nh %u, effective paths %u nh %u",
__PRETTY_FUNCTION__, buf,
old_route->path.cost,
adv_router,
listcount(ecmp_path->nh_list),
old_route->paths ?
listcount(old_route->paths) : 0,
listcount(old_route->nh_list));
zlog_debug(
"%s: route %s cost %u another path %s added with nh %u, effective paths %u nh %u",
__func__, buf, old_route->path.cost,
adv_router,
listcount(ecmp_path->nh_list),
old_route->paths
? listcount(old_route->paths)
: 0,
listcount(old_route->nh_list));
}
} else {
/* adv. router exists in the list, update the nhs */
@ -1201,10 +1206,11 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
}
if (is_debug)
zlog_debug("%s: Update route: %s %p old cost %u new cost %u nh %u",
__PRETTY_FUNCTION__, buf, (void *)old_route,
old_route->path.cost, route->path.cost,
listcount(route->nh_list));
zlog_debug(
"%s: Update route: %s %p old cost %u new cost %u nh %u",
__func__, buf, (void *)old_route,
old_route->path.cost, route->path.cost,
listcount(route->nh_list));
/* For Inter-Prefix route: Update RIB/FIB,
* For Inter-Router trigger summary update
@ -1221,9 +1227,10 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
if (is_debug) {
inet_ntop(AF_INET, &route->path.origin.adv_router,
adv_router, sizeof(adv_router));
zlog_debug("%s: Install route: %s cost %u nh %u adv_router %s ",
__PRETTY_FUNCTION__, buf, route->path.cost,
listcount(route->nh_list), adv_router);
zlog_debug(
"%s: Install route: %s cost %u nh %u adv_router %s ",
__func__, buf, route->path.cost,
listcount(route->nh_list), adv_router);
}
path = ospf6_path_dup(&route->path);

View File

@ -61,8 +61,7 @@ static void ospf6_area_lsdb_hook_add(struct ospf6_lsa *lsa)
case OSPF6_LSTYPE_ROUTER:
case OSPF6_LSTYPE_NETWORK:
if (IS_OSPF6_DEBUG_EXAMIN_TYPE(lsa->header->type)) {
zlog_debug("%s Examin LSA %s", __PRETTY_FUNCTION__,
lsa->name);
zlog_debug("%s Examin LSA %s", __func__, lsa->name);
zlog_debug(" Schedule SPF Calculation for %s",
OSPF6_AREA(lsa->lsdb->data)->name);
}

View File

@ -166,7 +166,7 @@ int ospf6_orig_as_external_lsa(struct thread *thread)
if (IS_OSPF6_DEBUG_ASBR)
zlog_debug(
"%s: Send update of AS-External LSA %s seq 0x%x",
__PRETTY_FUNCTION__, lsa->name,
__func__, lsa->name,
ntohl(lsa->header->seqnum));
ospf6_flood_interface(NULL, lsa, oi);
@ -245,7 +245,7 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
sizeof(buf));
zlog_debug(
"%s: route %s cost old %u new %u is not same, replace route",
__PRETTY_FUNCTION__, buf, o_path->cost,
__func__, buf, o_path->cost,
route->path.cost);
}
@ -309,7 +309,7 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
sizeof(buf));
zlog_debug(
"%s: route %s old cost %u new cost %u, delete old entry.",
__PRETTY_FUNCTION__, buf,
__func__, buf,
old_route->path.cost,
route->path.cost);
}
@ -340,8 +340,7 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
sizeof(buf));
zlog_debug(
"%s: old route %s path cost %u e2 %u",
__PRETTY_FUNCTION__, buf,
old_route->path.cost,
__func__, buf, old_route->path.cost,
old_route->path.u.cost_e2);
}
route_found = true;
@ -378,13 +377,11 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
sizeof(buf));
zlog_debug(
"%s: route %s another path added with nh %u, effective paths %u nh %u",
__PRETTY_FUNCTION__, buf,
__func__, buf,
listcount(ecmp_path->nh_list),
old_route->paths
? listcount(
old_route
->paths)
: 0,
old_route->paths ? listcount(
old_route->paths)
: 0,
listcount(old_route->nh_list));
}
} else {
@ -410,9 +407,9 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
AS_EXTERNAL)) {
prefix2str(&old_route->prefix,
buf, sizeof(buf));
zlog_debug("%s: ls_prfix %s asbr_entry not found.",
__PRETTY_FUNCTION__,
buf);
zlog_debug(
"%s: ls_prfix %s asbr_entry not found.",
__func__, buf);
}
continue;
}
@ -422,12 +419,15 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
prefix2str(&route->prefix, buf, sizeof(buf));
zlog_debug("%s: route %s with effective paths %u nh %u",
__PRETTY_FUNCTION__, buf,
old_route->paths ?
listcount(old_route->paths) : 0,
old_route->nh_list ?
listcount(old_route->nh_list) : 0);
zlog_debug(
"%s: route %s with effective paths %u nh %u",
__func__, buf,
old_route->paths
? listcount(old_route->paths)
: 0,
old_route->nh_list
? listcount(old_route->nh_list)
: 0);
}
/* Update RIB/FIB */
@ -532,7 +532,7 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa)
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
prefix2str(&route->prefix, buf, sizeof(buf));
zlog_debug("%s: AS-External %u route add %s cost %u(%u) nh %u",
__PRETTY_FUNCTION__,
__func__,
(route->path.type == OSPF6_PATH_TYPE_EXTERNAL1) ? 1
: 2,
buf, route->path.cost, route->path.u.cost_e2,
@ -621,9 +621,8 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
prefix2str(&prefix, buf, sizeof(buf));
zlog_debug(
"%s: Current route %s cost %u e2 %u, route to del cost %u e2 %u",
__PRETTY_FUNCTION__, buf, route->path.cost,
route->path.u.cost_e2, route_to_del->path.cost,
route_to_del->path.u.cost_e2);
__func__, buf, route->path.cost, route->path.u.cost_e2,
route_to_del->path.cost, route_to_del->path.u.cost_e2);
}
for (ospf6_route_lock(route);
@ -670,8 +669,8 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
sizeof(buf));
zlog_debug(
"%s: route %s to delete is not same, cost %u del cost %u. skip",
__PRETTY_FUNCTION__,
buf, route->path.cost,
__func__, buf,
route->path.cost,
route_to_del->path
.cost);
}
@ -682,8 +681,7 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
prefix2str(&prefix, buf, sizeof(buf));
zlog_debug(
"%s: route %s path found with cost %u nh %u to remove.",
__PRETTY_FUNCTION__, buf,
route->path.cost,
__func__, buf, route->path.cost,
listcount(o_path->nh_list));
}
@ -726,14 +724,15 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
sizeof(buf));
zlog_debug(
"%s: AS-External %u route %s update paths %u nh %u",
__PRETTY_FUNCTION__,
__func__,
(route->path.type
== OSPF6_PATH_TYPE_EXTERNAL1)
? 1
: 2,
buf, listcount(route->paths),
route->nh_list ?
listcount(route->nh_list) : 0);
route->nh_list ? listcount(
route->nh_list)
: 0);
}
if (listcount(route->paths)) {
@ -785,8 +784,7 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
prefix2str(&prefix, buf, sizeof(buf));
zlog_debug(
"%s: route %s to delete is not same, cost %u del cost %u. skip",
__PRETTY_FUNCTION__, buf,
route->path.cost,
__func__, buf, route->path.cost,
route_to_del->path.cost);
}
continue;
@ -802,7 +800,7 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
prefix2str(&route->prefix, buf, sizeof(buf));
zlog_debug(
"%s: AS-External %u route remove %s cost %u(%u) nh %u",
__PRETTY_FUNCTION__,
__func__,
route->path.type == OSPF6_PATH_TYPE_EXTERNAL1
? 1
: 2,
@ -892,8 +890,7 @@ static int ospf6_asbr_routemap_update_timer(struct thread *thread)
if (ospf6->rmap[arg_type].map) {
if (IS_OSPF6_DEBUG_ASBR)
zlog_debug("%s: route-map %s update, reset redist %s",
__PRETTY_FUNCTION__,
ospf6->rmap[arg_type].name,
__func__, ospf6->rmap[arg_type].name,
ZROUTE_NAME(arg_type));
ospf6_zebra_no_redistribute(arg_type);
@ -917,8 +914,8 @@ void ospf6_asbr_distribute_list_update(int type)
args[1] = (void *)((ptrdiff_t)type);
if (IS_OSPF6_DEBUG_ASBR)
zlog_debug("%s: trigger redistribute %s reset thread",
__PRETTY_FUNCTION__, ZROUTE_NAME(type));
zlog_debug("%s: trigger redistribute %s reset thread", __func__,
ZROUTE_NAME(type));
ospf6->t_distribute_update = NULL;
thread_add_timer_msec(master, ospf6_asbr_routemap_update_timer,
@ -943,7 +940,7 @@ static void ospf6_asbr_routemap_update(const char *mapname)
if (IS_OSPF6_DEBUG_ASBR)
zlog_debug(
"%s: route-map %s update, reset redist %s",
__PRETTY_FUNCTION__, mapname,
__func__, mapname,
ZROUTE_NAME(type));
route_map_counter_increment(

View File

@ -258,8 +258,8 @@ void ospf6_install_lsa(struct ospf6_lsa *lsa)
if (IS_OSPF6_DEBUG_LSA_TYPE(lsa->header->type)
|| IS_OSPF6_DEBUG_EXAMIN_TYPE(lsa->header->type))
zlog_debug("%s Install LSA: %s age %d seqnum %x in LSDB.",
__PRETTY_FUNCTION__, lsa->name,
ntohs(lsa->header->age), ntohl(lsa->header->seqnum));
__func__, lsa->name, ntohs(lsa->header->age),
ntohl(lsa->header->seqnum));
/* actually install */
lsa->installed = now;
@ -373,7 +373,7 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa,
if (is_debug)
zlog_debug(
"%s: Send LSA %s (age %d) update now",
__PRETTY_FUNCTION__, lsa->name,
__func__, lsa->name,
ntohs(lsa->header->age));
ospf6_lsupdate_send_neighbor_now(on, lsa);
continue;
@ -1004,7 +1004,7 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from,
if (is_debug)
zlog_debug(
"%s: Current copy of LSA %s is MAXAGE, but new has recent Age.",
old->name, __PRETTY_FUNCTION__);
old->name, __func__);
ospf6_lsa_purge(old);
if (new->header->adv_router

View File

@ -1022,8 +1022,9 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
*/
if (oa->intra_prefix_originate) {
if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
zlog_debug("%s: Re-originate intra prefix LSA, Current full nbrs %u",
__PRETTY_FUNCTION__, oa->full_nbrs);
zlog_debug(
"%s: Re-originate intra prefix LSA, Current full nbrs %u",
__func__, oa->full_nbrs);
if (old)
ospf6_lsa_purge_multi_ls_id(oa, old);
oa->intra_prefix_originate = 0;
@ -1401,9 +1402,10 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
prefix2str(&old_route->prefix, buf,
sizeof(buf));
zlog_debug("%s: route %s cost old %u new %u is not same, replace route",
__PRETTY_FUNCTION__, buf,
o_path->cost, route->path.cost);
zlog_debug(
"%s: route %s cost old %u new %u is not same, replace route",
__func__, buf, o_path->cost,
route->path.cost);
}
/* Remove selected current path's nh from
@ -1458,10 +1460,11 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
prefix2str(&old_route->prefix, buf,
sizeof(buf));
zlog_debug("%s: route %s old cost %u new cost %u, delete old entry.",
__PRETTY_FUNCTION__, buf,
old_route->path.cost,
route->path.cost);
zlog_debug(
"%s: route %s old cost %u new cost %u, delete old entry.",
__func__, buf,
old_route->path.cost,
route->path.cost);
}
if (oa->route_table->hook_remove)
ospf6_route_remove(old_route,
@ -1516,13 +1519,13 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
sizeof(buf));
zlog_debug(
"%s: route %s %p another path added with nh %u, effective paths %u nh %u",
__PRETTY_FUNCTION__, buf,
__func__, buf,
(void *)old_route,
listcount(ecmp_path->nh_list),
old_route->paths ?
listcount(old_route->paths) : 0,
old_route->paths ? listcount(
old_route->paths)
: 0,
listcount(old_route->nh_list));
}
} else {
list_delete_all_node(o_path->nh_list);
@ -1540,9 +1543,9 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
oa->spf_table);
if (ls_entry == NULL) {
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX))
zlog_debug("%s: ls_prfix %s ls_entry not found.",
__PRETTY_FUNCTION__,
buf);
zlog_debug(
"%s: ls_prfix %s ls_entry not found.",
__func__, buf);
continue;
}
lsa = ospf6_lsdb_lookup(o_path->origin.type,
@ -1559,9 +1562,9 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
o_path->origin.id, &adv_prefix);
prefix2str(&adv_prefix, buf,
sizeof(buf));
zlog_debug("%s: adv_router %s lsa not found",
__PRETTY_FUNCTION__,
buf);
zlog_debug(
"%s: adv_router %s lsa not found",
__func__, buf);
}
continue;
}
@ -1587,12 +1590,13 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
prefix2str(&route->prefix, buf, sizeof(buf));
zlog_debug("%s: route %s %p with final effective paths %u nh%u",
__PRETTY_FUNCTION__, buf,
(void *)old_route,
old_route->paths ?
listcount(old_route->paths) : 0,
listcount(old_route->nh_list));
zlog_debug(
"%s: route %s %p with final effective paths %u nh%u",
__func__, buf, (void *)old_route,
old_route->paths
? listcount(old_route->paths)
: 0,
listcount(old_route->nh_list));
}
/* used in intra_route_calculation() to add to
@ -1636,7 +1640,7 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa)
return;
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX))
zlog_debug("%s: LSA %s found", __PRETTY_FUNCTION__, lsa->name);
zlog_debug("%s: LSA %s found", __func__, lsa->name);
oa = OSPF6_AREA(lsa->lsdb->data);
@ -1732,21 +1736,22 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa)
if (old) {
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
prefix2str(&route->prefix, buf, sizeof(buf));
zlog_debug("%s Update route: %s old cost %u new cost %u paths %u nh %u",
__PRETTY_FUNCTION__, buf,
old->path.cost, route->path.cost,
listcount(route->paths),
listcount(route->nh_list));
zlog_debug(
"%s Update route: %s old cost %u new cost %u paths %u nh %u",
__func__, buf, old->path.cost,
route->path.cost,
listcount(route->paths),
listcount(route->nh_list));
}
ospf6_intra_prefix_route_ecmp_path(oa, old, route);
} else {
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
prefix2str(&route->prefix, buf, sizeof(buf));
zlog_debug("%s route %s add with cost %u paths %u nh %u",
__PRETTY_FUNCTION__, buf,
route->path.cost,
listcount(route->paths),
listcount(route->nh_list));
zlog_debug(
"%s route %s add with cost %u paths %u nh %u",
__func__, buf, route->path.cost,
listcount(route->paths),
listcount(route->nh_list));
}
ospf6_route_add(route, oa->route_table);
}
@ -1783,7 +1788,7 @@ static void ospf6_intra_prefix_lsa_remove_update_route(struct ospf6_lsa *lsa,
prefix2str(&route->prefix, buf, sizeof(buf));
zlog_debug(
"%s: route %s path found with cost %u nh %u to remove.",
__PRETTY_FUNCTION__, buf, o_path->cost,
__func__, buf, o_path->cost,
listcount(o_path->nh_list));
}
@ -1819,11 +1824,10 @@ static void ospf6_intra_prefix_lsa_remove_update_route(struct ospf6_lsa *lsa,
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
prefix2str(&route->prefix, buf, sizeof(buf));
zlog_debug("%s: route %s update paths %u nh %u",
__PRETTY_FUNCTION__, buf,
route->paths ? listcount(route->paths) : 0,
route->nh_list ? listcount(route->nh_list)
: 0);
zlog_debug(
"%s: route %s update paths %u nh %u", __func__,
buf, route->paths ? listcount(route->paths) : 0,
route->nh_list ? listcount(route->nh_list) : 0);
}
/* Update Global Route table and
@ -1859,8 +1863,7 @@ void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa)
char buf[PREFIX2STR_BUFFER];
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX))
zlog_debug("%s: %s disappearing", __PRETTY_FUNCTION__,
lsa->name);
zlog_debug("%s: %s disappearing", __func__, lsa->name);
oa = OSPF6_AREA(lsa->lsdb->data);
@ -1917,12 +1920,12 @@ void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa)
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
prefix2str(&route->prefix, buf,
sizeof(buf));
zlog_debug("%s: route remove %s with path type %u cost %u paths %u nh %u",
__PRETTY_FUNCTION__, buf,
route->path.type,
route->path.cost,
listcount(route->paths),
listcount(route->nh_list));
zlog_debug(
"%s: route remove %s with path type %u cost %u paths %u nh %u",
__func__, buf, route->path.type,
route->path.cost,
listcount(route->paths),
listcount(route->nh_list));
}
ospf6_route_remove(route, oa->route_table);
}
@ -2054,8 +2057,8 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(oa->area_id) ||
IS_OSPF6_DEBUG_ROUTE(MEMORY))
zlog_info("%s: border-router calculation for area %s",
__PRETTY_FUNCTION__, oa->name);
zlog_info("%s: border-router calculation for area %s", __func__,
oa->name);
hook_add = oa->ospf6->brouter_table->hook_add;
hook_remove = oa->ospf6->brouter_table->hook_remove;
@ -2161,10 +2164,11 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
if (ospf6_route_lookup(&adv_prefix, oa->spf_table)) {
if (IS_OSPF6_DEBUG_BROUTER) {
zlog_debug("%s: keep inter brouter %s as adv router 0x%x found in spf",
__PRETTY_FUNCTION__,
brouter_name,
brouter->path.origin.adv_router);
zlog_debug(
"%s: keep inter brouter %s as adv router 0x%x found in spf",
__func__, brouter_name,
brouter->path.origin
.adv_router);
ospf6_brouter_debug_print(brouter);
}
UNSET_FLAG(brouter->flag, OSPF6_ROUTE_REMOVE);
@ -2183,9 +2187,9 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
brouter_id)
|| IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(
oa->area_id))
zlog_info("%s: brouter %s disappears via area %s",
__PRETTY_FUNCTION__, brouter_name,
oa->name);
zlog_info(
"%s: brouter %s disappears via area %s",
__func__, brouter_name, oa->name);
/* This is used to protect nbrouter from removed from
* the table. For an example, ospf6_abr_examin_summary,
* removes brouters which are marked for remove.
@ -2201,8 +2205,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
|| IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(
oa->area_id))
zlog_info("%s: brouter %s appears via area %s",
__PRETTY_FUNCTION__, brouter_name,
oa->name);
__func__, brouter_name, oa->name);
/* newly added */
if (hook_add)
@ -2229,7 +2232,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(oa->area_id) ||
IS_OSPF6_DEBUG_ROUTE(MEMORY))
zlog_info("%s: border-router calculation for area %s: done",
__PRETTY_FUNCTION__, oa->name);
__func__, oa->name);
}
static const struct ospf6_lsa_handler router_handler = {

View File

@ -2186,9 +2186,8 @@ int ospf6_lsupdate_send_neighbor_now(struct ospf6_neighbor *on,
if (IS_OSPF6_DEBUG_FLOODING
|| IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, SEND))
zlog_debug("%s: Send lsupdate with lsa %s (age %u)",
__PRETTY_FUNCTION__, lsa->name,
ntohs(lsa->header->age));
zlog_debug("%s: Send lsupdate with lsa %s (age %u)", __func__,
lsa->name, ntohs(lsa->header->age));
ospf6_send_lsupdate(on, NULL, oh);
@ -2244,8 +2243,7 @@ int ospf6_lsupdate_send_interface(struct thread *thread)
if (IS_OSPF6_DEBUG_MESSAGE(
OSPF6_MESSAGE_TYPE_LSUPDATE, SEND))
zlog_debug("%s: LSUpdate length %d",
__PRETTY_FUNCTION__,
ntohs(oh->length));
__func__, ntohs(oh->length));
memset(sendbuf, 0, iobuflen);
oh = (struct ospf6_header *)sendbuf;

View File

@ -71,7 +71,7 @@ struct ospf6_prefix {
#define OSPF6_PREFIX_OPTION_P (1 << 3) /* Propagate (NSSA) */
/* caddr_t OSPF6_PREFIX_BODY (struct ospf6_prefix *); */
#define OSPF6_PREFIX_BODY(x) ((caddr_t)(x) + sizeof (struct ospf6_prefix))
#define OSPF6_PREFIX_BODY(x) ((caddr_t)(x) + sizeof(struct ospf6_prefix))
/* size_t OSPF6_PREFIX_SPACE (int prefixlength); */
#define OSPF6_PREFIX_SPACE(x) ((((x) + 31) / 32) * 4)

View File

@ -1356,7 +1356,7 @@ static int ospf6TrapNbrStateChange(struct ospf6_neighbor *on, int next_state,
smux_trap(ospfv3_variables, array_size(ospfv3_variables),
ospfv3_trap_oid, array_size(ospfv3_trap_oid), ospfv3_oid,
sizeof ospfv3_oid / sizeof(oid), index, 3, ospf6NbrTrapList,
sizeof(ospfv3_oid) / sizeof(oid), index, 3, ospf6NbrTrapList,
array_size(ospf6NbrTrapList), NBRSTATECHANGE);
return 0;
}
@ -1378,7 +1378,7 @@ static int ospf6TrapIfStateChange(struct ospf6_interface *oi, int next_state,
smux_trap(ospfv3_variables, array_size(ospfv3_variables),
ospfv3_trap_oid, array_size(ospfv3_trap_oid), ospfv3_oid,
sizeof ospfv3_oid / sizeof(oid), index, 2, ospf6IfTrapList,
sizeof(ospfv3_oid) / sizeof(oid), index, 2, ospf6IfTrapList,
array_size(ospf6IfTrapList), IFSTATECHANGE);
return 0;
}

View File

@ -351,7 +351,7 @@ static int ospf6_spf_install(struct ospf6_vertex *v,
if (IS_OSPF6_DEBUG_SPF(PROCESS)) {
zlog_debug(
"%s: V lsa %s id %u, route id %u are different",
__PRETTY_FUNCTION__, v->lsa->name,
__func__, v->lsa->name,
ntohl(v->lsa->header->id),
ntohl(route->path.origin.id));
}
@ -995,15 +995,15 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area,
rtr_lsa = ospf6_lsdb_next(end, rtr_lsa);
}
if (IS_OSPF6_DEBUG_SPF(PROCESS))
zlog_debug("%s: adv_router %s num_lsa %u to convert.",
__PRETTY_FUNCTION__, ifbuf, num_lsa);
zlog_debug("%s: adv_router %s num_lsa %u to convert.", __func__,
ifbuf, num_lsa);
if (num_lsa == 1)
return lsa;
if (num_lsa == 0) {
if (IS_OSPF6_DEBUG_SPF(PROCESS))
zlog_debug("%s: adv_router %s not found in LSDB.",
__PRETTY_FUNCTION__, ifbuf);
__func__, ifbuf);
return NULL;
}
@ -1052,7 +1052,7 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area,
inet_ntop(AF_INET, &interface_id, ifbuf, sizeof(ifbuf));
zlog_debug(
"%s: Next Router LSA %s to aggreat with len %u interface_id %s",
__PRETTY_FUNCTION__, rtr_lsa->name,
__func__, rtr_lsa->name,
ntohs(lsa_header->length), ifbuf);
}
@ -1074,9 +1074,9 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area,
if (IS_OSPF6_DEBUG_SPF(PROCESS))
zlog_debug("%s: LSA %s id %u type 0%x len %u num_lsa %u",
__PRETTY_FUNCTION__, lsa->name,
ntohl(lsa->header->id), ntohs(lsa->header->type),
ntohs(lsa->header->length), num_lsa);
__func__, lsa->name, ntohl(lsa->header->id),
ntohs(lsa->header->type), ntohs(lsa->header->length),
num_lsa);
return lsa;
}
@ -1089,7 +1089,7 @@ void ospf6_remove_temp_router_lsa(struct ospf6_area *area)
if (IS_OSPF6_DEBUG_SPF(PROCESS))
zlog_debug(
"%s Remove LSA %s lsa->lock %u lsdb count %u",
__PRETTY_FUNCTION__, lsa->name, lsa->lock,
__func__, lsa->name, lsa->lock,
area->temp_router_lsa_lsdb->count);
ospf6_lsdb_remove(lsa, area->temp_router_lsa_lsdb);
}

Some files were not shown because too many files have changed in this diff Show More