summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_aspath.c6
-rw-r--r--bgpd/bgp_attr.c17
-rw-r--r--bgpd/bgp_attr_evpn.h1
-rw-r--r--bgpd/bgp_clist.c2
-rw-r--r--bgpd/bgp_damp.c40
-rw-r--r--bgpd/bgp_dump.c16
-rw-r--r--bgpd/bgp_evpn.c10
-rw-r--r--bgpd/bgp_fsm.c2
-rw-r--r--bgpd/bgp_nht.c25
-rw-r--r--bgpd/bgp_open.c6
-rw-r--r--bgpd/bgp_packet.c2
-rw-r--r--bgpd/bgp_route.c13
-rw-r--r--bgpd/bgp_snmp.c4
-rw-r--r--bgpd/bgp_vty.c34
-rw-r--r--bgpd/bgp_zebra.c87
-rw-r--r--bgpd/bgpd.c33
16 files changed, 155 insertions, 143 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index 7b8b8d94a..f73d6e300 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -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);
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index f00bb2b3c..33466957b 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -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;
diff --git a/bgpd/bgp_attr_evpn.h b/bgpd/bgp_attr_evpn.h
index a8a35e817..25654ba70 100644
--- a/bgpd/bgp_attr_evpn.h
+++ b/bgpd/bgp_attr_evpn.h
@@ -34,7 +34,6 @@
#define MAX_ET 0xffffffff
-unsigned long eth_tag_id;
struct attr;
/* EVPN ESI */
diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c
index 18369002b..5c461dbe7 100644
--- a/bgpd/bgp_clist.c
+++ b/bgpd/bgp_clist.c
@@ -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) {
diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c
index b0fee079d..792f3cea7 100644
--- a/bgpd/bgp_damp.c
+++ b/bgpd/bgp_damp.c
@@ -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;
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c
index 298f9d021..c448b9894 100644
--- a/bgpd/bgp_dump.c
+++ b/bgpd/bgp_dump.c
@@ -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 */
}
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index 206680c40..664d62fd1 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -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;
}
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index b483d39bb..a44effaac 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -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 */
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 55b44de6f..dfa9ac939 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -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;
}
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 906083f75..81bb45aa7 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -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;
}
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 3132c8b86..0e251dced 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1348,7 +1348,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
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;
}
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index c6a9aa722..bcd87eb01 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -2924,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;
}
@@ -3730,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);
@@ -3878,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);
}
@@ -5036,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);
@@ -5085,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);
}
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 70e4a3fa0..d50716105 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -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;
}
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 29d3b3878..fc841c6c1 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -10657,28 +10657,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",
@@ -11841,15 +11844,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, ",
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index bb718c355..f3ab60849 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -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);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 851457472..8cc409607 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -3226,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);
}
@@ -3398,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);
}
@@ -4030,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,
@@ -4136,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);
@@ -6846,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) {
@@ -6861,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;