From ade6974defaa83456b36804a9132d5cad65dc27a Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 24 Aug 2018 16:26:43 +0000 Subject: [PATCH] *: style for flog_warn conversions Signed-off-by: Quentin Young --- bgpd/bgp_aspath.c | 7 ++-- bgpd/bgp_attr.c | 48 ++++++++++++++----------- bgpd/bgp_evpn.c | 16 +++++---- bgpd/bgp_packet.c | 21 ++++++----- bgpd/bgp_updgrp_packet.c | 14 ++++---- lib/agentx.c | 4 +-- lib/buffer.c | 15 ++++---- lib/plist.c | 5 +-- lib/sockunion.c | 29 +++++++-------- lib/vrf.c | 4 +-- lib/zclient.c | 78 ++++++++++++++++++++++------------------ ospfd/ospf_apiserver.c | 5 +-- ospfd/ospf_asbr.c | 10 +++--- ospfd/ospf_ext.c | 34 ++++++++++-------- ospfd/ospf_neighbor.c | 4 +-- ospfd/ospf_network.c | 26 +++++++------- ospfd/ospf_nsm.c | 19 +++++----- ospfd/ospf_ri.c | 8 +++-- ospfd/ospf_sr.c | 4 +-- ospfd/ospf_te.c | 72 +++++++++++++++++++++---------------- ospfd/ospfd.c | 7 ++-- 21 files changed, 237 insertions(+), 193 deletions(-) diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index 55e5b03b1..b156cda86 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -38,7 +38,7 @@ #include "bgpd/bgp_errors.h" /* Attr. Flags and Attr. Type Code. */ -#define AS_HEADER_SIZE 2 +#define AS_HEADER_SIZE 2 /* Now FOUR octets are used for AS value. */ #define AS_VALUE_SIZE sizeof (as_t) @@ -1639,8 +1639,9 @@ struct aspath *aspath_reconcile_as4(struct aspath *aspath, if (hops < 0) { if (BGP_DEBUG(as4, AS4)) - flog_warn(BGP_WARN_ASPATH_FEWER_HOPS, - "[AS4] Fewer hops in AS_PATH than NEW_AS_PATH"); + flog_warn( + BGP_WARN_ASPATH_FEWER_HOPS, + "[AS4] Fewer hops in AS_PATH than NEW_AS_PATH"); /* Something's gone wrong. The RFC says we should now ignore * AS4_PATH, * which is daft behaviour - it contains vital loop-detection diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index a993cc71c..062a8a9b4 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -1760,9 +1760,10 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args, { uint8_t val; if ((val = stream_getc(s))) - flog_warn(BGP_WARN_DEFUNCT_SNPA_LEN, - "%s sent non-zero value, %u, for defunct SNPA-length field", - peer->host, val); + flog_warn( + BGP_WARN_DEFUNCT_SNPA_LEN, + "%s sent non-zero value, %u, for defunct SNPA-length field", + peer->host, val); } /* must have nrli_len, what is left of the attribute */ @@ -2378,11 +2379,12 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, /* Check remaining length check.*/ if (endp - BGP_INPUT_PNT(peer) < BGP_ATTR_MIN_LEN) { /* XXX warning: long int format, int arg (arg 5) */ - flog_warn(BGP_WARN_ATTRIBUTE_TOO_SMALL, - "%s: error BGP attribute length %lu is smaller than min len", - peer->host, - (unsigned long)(endp - - stream_pnt(BGP_INPUT(peer)))); + flog_warn( + BGP_WARN_ATTRIBUTE_TOO_SMALL, + "%s: error BGP attribute length %lu is smaller than min len", + peer->host, + (unsigned long)(endp + - stream_pnt(BGP_INPUT(peer)))); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR); @@ -2400,11 +2402,12 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, /* Check whether Extended-Length applies and is in bounds */ if (CHECK_FLAG(flag, BGP_ATTR_FLAG_EXTLEN) && ((endp - startp) < (BGP_ATTR_MIN_LEN + 1))) { - flog_warn(BGP_WARN_EXT_ATTRIBUTE_TOO_SMALL, - "%s: Extended length set, but just %lu bytes of attr header", - peer->host, - (unsigned long)(endp - - stream_pnt(BGP_INPUT(peer)))); + flog_warn( + BGP_WARN_EXT_ATTRIBUTE_TOO_SMALL, + "%s: Extended length set, but just %lu bytes of attr header", + peer->host, + (unsigned long)(endp + - stream_pnt(BGP_INPUT(peer)))); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR); @@ -2422,9 +2425,10 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, List. */ if (CHECK_BITMAP(seen, type)) { - flog_warn(BGP_WARN_ATTRIBUTE_REPEATED, - "%s: error BGP attribute type %d appears twice in a message", - peer->host, type); + flog_warn( + BGP_WARN_ATTRIBUTE_REPEATED, + "%s: error BGP attribute type %d appears twice in a message", + peer->host, type); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_MAL_ATTR); @@ -2440,10 +2444,11 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, attr_endp = BGP_INPUT_PNT(peer) + length; if (attr_endp > endp) { - flog_warn(BGP_WARN_ATTRIBUTE_TOO_LARGE, - "%s: BGP type %d length %d is too large, attribute total length is %d. attr_endp is %p. endp is %p", - peer->host, type, length, size, attr_endp, - endp); + flog_warn( + BGP_WARN_ATTRIBUTE_TOO_LARGE, + "%s: BGP type %d length %d is too large, attribute total length is %d. attr_endp is %p. endp is %p", + peer->host, type, length, size, attr_endp, + endp); /* * RFC 4271 6.3 * If any recognized attribute has an Attribute @@ -2607,7 +2612,8 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, } if (ret == BGP_ATTR_PARSE_WITHDRAW) { - flog_warn(BGP_WARN_ATTRIBUTE_PARSE_WITHDRAW, + flog_warn( + BGP_WARN_ATTRIBUTE_PARSE_WITHDRAW, "%s: Attribute %s, parse error - treating as withdrawal", peer->host, lookup_msg(attr_str, type, NULL)); if (as4_path) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 713179ab9..3bd566e07 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -3683,10 +3683,11 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi, if (attr && (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL))) { if (attr->pmsi_tnl_type != PMSI_TNLTYPE_INGR_REPL) { - flog_warn(BGP_WARN_EVPN_PMSI_PRESENT, - "%u:%s - Rx EVPN Type-3 NLRI with unsupported PTA %d", - peer->bgp->vrf_id, peer->host, - attr->pmsi_tnl_type); + flog_warn( + BGP_WARN_EVPN_PMSI_PRESENT, + "%u:%s - Rx EVPN Type-3 NLRI with unsupported PTA %d", + peer->bgp->vrf_id, peer->host, + attr->pmsi_tnl_type); } } @@ -5401,9 +5402,10 @@ int bgp_evpn_local_vni_del(struct bgp *bgp, vni_t vni) vpn = bgp_evpn_lookup_vni(bgp, vni); if (!vpn) { if (bgp_debug_zebra(NULL)) - flog_warn(BGP_WARN_EVPN_VPN_VNI, - "%u: VNI hash entry for VNI %u not found at DEL", - bgp->vrf_id, vni); + flog_warn( + BGP_WARN_EVPN_VPN_VNI, + "%u: VNI hash entry for VNI %u not found at DEL", + bgp->vrf_id, vni); return 0; } diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index c04116e9e..d8bab6041 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -1457,9 +1457,10 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) /* Attribute total length check. */ if (stream_pnt(s) + 2 > end) { - flog_warn(BGP_WARN_UPDATE_PACKET_SHORT, - "%s [Error] Packet Error (update packet is short for attribute length)", - peer->host); + flog_warn( + BGP_WARN_UPDATE_PACKET_SHORT, + "%s [Error] Packet Error (update packet is short for attribute length)", + peer->host); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_MAL_ATTR); return BGP_Stop; @@ -1470,9 +1471,10 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) /* Attribute length check. */ if (stream_pnt(s) + attribute_len > end) { - flog_warn(BGP_WARN_UPDATE_PACKET_LONG, - "%s [Error] Packet Error (update packet attribute length overflow %d)", - peer->host, attribute_len); + flog_warn( + BGP_WARN_UPDATE_PACKET_LONG, + "%s [Error] Packet Error (update packet attribute length overflow %d)", + peer->host, attribute_len); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_MAL_ATTR); return BGP_Stop; @@ -2102,9 +2104,10 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt, return BGP_Stop; } } else { - flog_warn(BGP_WARN_UNRECOGNIZED_CAPABILITY, - "%s unrecognized capability code: %d - ignored", - peer->host, hdr->code); + flog_warn( + BGP_WARN_UNRECOGNIZED_CAPABILITY, + "%s unrecognized capability code: %d - ignored", + peer->host, hdr->code); } } diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index cba3b0703..f3047369b 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -427,9 +427,10 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt, break; default: /* TODO: handle IPv6 nexthops */ - flog_warn(BGP_WARN_INVALID_NEXTHOP_LENGTH, - "%s: %s: invalid MP nexthop length (AFI IP): %u", - __func__, peer->host, nhlen); + flog_warn( + BGP_WARN_INVALID_NEXTHOP_LENGTH, + "%s: %s: invalid MP nexthop length (AFI IP): %u", + __func__, peer->host, nhlen); stream_free(s); return NULL; } @@ -532,9 +533,10 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt, break; default: /* TODO: handle IPv4 nexthops */ - flog_warn(BGP_WARN_INVALID_NEXTHOP_LENGTH, - "%s: %s: invalid MP nexthop length (AFI IP6): %u", - __func__, peer->host, nhlen); + flog_warn( + BGP_WARN_INVALID_NEXTHOP_LENGTH, + "%s: %s: invalid MP nexthop length (AFI IP6): %u", + __func__, peer->host, nhlen); stream_free(s); return NULL; } diff --git a/lib/agentx.c b/lib/agentx.c index e4d35854f..c319649e3 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -158,8 +158,8 @@ static int agentx_log_callback(int major, int minor, void *serverarg, "snmp[err]: %s", msg ? msg : slm->msg); break; case LOG_WARNING: - flog_warn(LIB_WARN_SNMP, - "snmp[warning]: %s", msg ? msg : slm->msg); + flog_warn(LIB_WARN_SNMP, "snmp[warning]: %s", + msg ? msg : slm->msg); break; case LOG_NOTICE: zlog_notice("snmp[notice]: %s", msg ? msg : slm->msg); diff --git a/lib/buffer.c b/lib/buffer.c index bed42f047..0bf75e4c3 100644 --- a/lib/buffer.c +++ b/lib/buffer.c @@ -378,9 +378,8 @@ buffer_status_t buffer_flush_window(struct buffer *b, int fd, int width, } #else /* IOV_MAX */ if ((nbytes = writev(fd, iov, iov_index)) < 0) - flog_err(LIB_ERR_SOCKET, - "%s: writev to fd %d failed: %s", __func__, fd, - safe_strerror(errno)); + flog_err(LIB_ERR_SOCKET, "%s: writev to fd %d failed: %s", + __func__, fd, safe_strerror(errno)); #endif /* IOV_MAX */ /* Free printed buffer data. */ @@ -440,9 +439,8 @@ in one shot. */ if (ERRNO_IO_RETRY(errno)) /* Calling code should try again later. */ return BUFFER_PENDING; - flog_err(LIB_ERR_SOCKET, - "%s: write error on fd %d: %s", __func__, fd, - safe_strerror(errno)); + flog_err(LIB_ERR_SOCKET, "%s: write error on fd %d: %s", + __func__, fd, safe_strerror(errno)); return BUFFER_ERROR; } @@ -496,9 +494,8 @@ buffer_status_t buffer_write(struct buffer *b, int fd, const void *p, if (ERRNO_IO_RETRY(errno)) nbytes = 0; else { - flog_err(LIB_ERR_SOCKET, - "%s: write error on fd %d: %s", __func__, fd, - safe_strerror(errno)); + flog_err(LIB_ERR_SOCKET, "%s: write error on fd %d: %s", + __func__, fd, safe_strerror(errno)); return BUFFER_ERROR; } } diff --git a/lib/plist.c b/lib/plist.c index b374ca178..f8dd7df0b 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -933,8 +933,9 @@ static int vty_prefix_list_install(struct vty *vty, afi_t afi, const char *name, vty_out(vty, "%% Prefix-list %s prefix changed from %s to %s to match length\n", name, buf, buf_tmp); - zlog_info("Prefix-list %s prefix changed from %s to %s to match length", - name, buf, buf_tmp); + zlog_info( + "Prefix-list %s prefix changed from %s to %s to match length", + name, buf, buf_tmp); p = p_tmp; } diff --git a/lib/sockunion.c b/lib/sockunion.c index e1bbbaa0c..f4e806e92 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -140,8 +140,7 @@ int sockunion_socket(const union sockunion *su) sock = socket(su->sa.sa_family, SOCK_STREAM, 0); if (sock < 0) { char buf[SU_ADDRSTRLEN]; - flog_err(LIB_ERR_SOCKET, - "Can't make socket for %s : %s", + flog_err(LIB_ERR_SOCKET, "Can't make socket for %s : %s", sockunion_log(su, buf, SU_ADDRSTRLEN), safe_strerror(errno)); return -1; @@ -275,8 +274,7 @@ int sockunion_bind(int sock, union sockunion *su, unsigned short port, ret = bind(sock, (struct sockaddr *)su, size); if (ret < 0) { char buf[SU_ADDRSTRLEN]; - flog_err(LIB_ERR_SOCKET, - "can't bind socket for %s : %s", + flog_err(LIB_ERR_SOCKET, "can't bind socket for %s : %s", sockunion_log(su, buf, SU_ADDRSTRLEN), safe_strerror(errno)); } @@ -332,7 +330,7 @@ int sockopt_ttl(int family, int sock, int ttl) if (ret < 0) { flog_err(LIB_ERR_SOCKET, "can't set sockopt IP_TTL %d to socket %d", - ttl, sock); + ttl, sock); return -1; } return 0; @@ -342,9 +340,10 @@ int sockopt_ttl(int family, int sock, int ttl) ret = setsockopt(sock, IPPROTO_IPV6, IPV6_UNICAST_HOPS, (void *)&ttl, sizeof(int)); if (ret < 0) { - flog_err(LIB_ERR_SOCKET, - "can't set sockopt IPV6_UNICAST_HOPS %d to socket %d", - ttl, sock); + flog_err( + LIB_ERR_SOCKET, + "can't set sockopt IPV6_UNICAST_HOPS %d to socket %d", + ttl, sock); return -1; } return 0; @@ -389,9 +388,10 @@ int sockopt_minttl(int family, int sock, int minttl) int ret = setsockopt(sock, IPPROTO_IP, IP_MINTTL, &minttl, sizeof(minttl)); if (ret < 0) - flog_err(LIB_ERR_SOCKET, - "can't set sockopt IP_MINTTL to %d on socket %d: %s", - minttl, sock, safe_strerror(errno)); + flog_err( + LIB_ERR_SOCKET, + "can't set sockopt IP_MINTTL to %d on socket %d: %s", + minttl, sock, safe_strerror(errno)); return ret; } #endif /* IP_MINTTL */ @@ -400,9 +400,10 @@ int sockopt_minttl(int family, int sock, int minttl) int ret = setsockopt(sock, IPPROTO_IPV6, IPV6_MINHOPCOUNT, &minttl, sizeof(minttl)); if (ret < 0) - flog_err(LIB_ERR_SOCKET, - "can't set sockopt IPV6_MINHOPCOUNT to %d on socket %d: %s", - minttl, sock, safe_strerror(errno)); + flog_err( + LIB_ERR_SOCKET, + "can't set sockopt IPV6_MINHOPCOUNT to %d on socket %d: %s", + minttl, sock, safe_strerror(errno)); return ret; } #endif diff --git a/lib/vrf.c b/lib/vrf.c index 18314b4f3..1e538a8c5 100644 --- a/lib/vrf.c +++ b/lib/vrf.c @@ -667,8 +667,8 @@ int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf, char *pathname, vrf->vrf_id, ns->name); else zlog_info( - "VRF %u already configured with NETNS %s", - vrf->vrf_id, ns->name); + "VRF %u already configured with NETNS %s", + vrf->vrf_id, ns->name); return CMD_WARNING_CONFIG_FAILED; } } diff --git a/lib/zclient.c b/lib/zclient.c index cb8172713..340eb0db3 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -249,9 +249,10 @@ static int zclient_flush_data(struct thread *thread) return -1; switch (buffer_flush_available(zclient->wb, zclient->sock)) { case BUFFER_ERROR: - flog_err(LIB_ERR_ZAPI_SOCKET, - "%s: buffer_flush_available failed on zclient fd %d, closing", - __func__, zclient->sock); + flog_err( + LIB_ERR_ZAPI_SOCKET, + "%s: buffer_flush_available failed on zclient fd %d, closing", + __func__, zclient->sock); return zclient_failed(zclient); break; case BUFFER_PENDING: @@ -576,9 +577,8 @@ int zclient_start(struct zclient *zclient) } if (set_nonblocking(zclient->sock) < 0) - flog_err(LIB_ERR_ZAPI_SOCKET, - "%s: set_nonblocking(%d) failed", __func__, - zclient->sock); + flog_err(LIB_ERR_ZAPI_SOCKET, "%s: set_nonblocking(%d) failed", + __func__, zclient->sock); /* Clear fail count. */ zclient->fail = 0; @@ -773,9 +773,10 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api) char buf[PREFIX2STR_BUFFER]; prefix2str(&api->prefix, buf, sizeof(buf)); - flog_err(LIB_ERR_ZAPI_ENCODE, - "%s: prefix %s: can't encode %u nexthops (maximum is %u)", - __func__, buf, api->nexthop_num, MULTIPATH_NUM); + flog_err( + LIB_ERR_ZAPI_ENCODE, + "%s: prefix %s: can't encode %u nexthops (maximum is %u)", + __func__, buf, api->nexthop_num, MULTIPATH_NUM); return -1; } @@ -884,17 +885,19 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) switch (api->prefix.family) { case AF_INET: if (api->prefix.prefixlen > IPV4_MAX_PREFIXLEN) { - flog_err(LIB_ERR_ZAPI_ENCODE, - "%s: V4 prefixlen is %d which should not be more than 32", - __PRETTY_FUNCTION__, api->prefix.prefixlen); + flog_err( + LIB_ERR_ZAPI_ENCODE, + "%s: V4 prefixlen is %d which should not be more than 32", + __PRETTY_FUNCTION__, api->prefix.prefixlen); return -1; } break; case AF_INET6: if (api->prefix.prefixlen > IPV6_MAX_PREFIXLEN) { - flog_err(LIB_ERR_ZAPI_ENCODE, - "%s: v6 prefixlen is %d which should not be more than 128", - __PRETTY_FUNCTION__, api->prefix.prefixlen); + flog_err( + LIB_ERR_ZAPI_ENCODE, + "%s: v6 prefixlen is %d which should not be more than 128", + __PRETTY_FUNCTION__, api->prefix.prefixlen); return -1; } break; @@ -910,9 +913,10 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) api->src_prefix.family = AF_INET6; STREAM_GETC(s, api->src_prefix.prefixlen); if (api->src_prefix.prefixlen > IPV6_MAX_PREFIXLEN) { - flog_err(LIB_ERR_ZAPI_ENCODE, - "%s: SRC Prefix prefixlen received: %d is too large", - __PRETTY_FUNCTION__, api->src_prefix.prefixlen); + flog_err( + LIB_ERR_ZAPI_ENCODE, + "%s: SRC Prefix prefixlen received: %d is too large", + __PRETTY_FUNCTION__, api->src_prefix.prefixlen); return -1; } STREAM_GET(&api->src_prefix.prefix, s, @@ -920,9 +924,10 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) if (api->prefix.family != AF_INET6 || api->src_prefix.prefixlen == 0) { - flog_err(LIB_ERR_ZAPI_ENCODE, - "%s: SRC prefix specified in some manner that makes no sense", - __PRETTY_FUNCTION__); + flog_err( + LIB_ERR_ZAPI_ENCODE, + "%s: SRC prefix specified in some manner that makes no sense", + __PRETTY_FUNCTION__); return -1; } } @@ -972,9 +977,10 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) STREAM_GETC(s, api_nh->label_num); if (api_nh->label_num > MPLS_MAX_LABELS) { - flog_err(LIB_ERR_ZAPI_ENCODE, - "%s: invalid number of MPLS labels (%u)", - __func__, api_nh->label_num); + flog_err( + LIB_ERR_ZAPI_ENCODE, + "%s: invalid number of MPLS labels (%u)", + __func__, api_nh->label_num); return -1; } @@ -1666,11 +1672,12 @@ struct connected *zebra_interface_address_read(int type, struct stream *s, /* carp interfaces on OpenBSD with 0.0.0.0/0 as * "peer" */ char buf[PREFIX_STRLEN]; - flog_err(LIB_ERR_ZAPI_ENCODE, - "warning: interface %s address %s with peer flag set, but no peer address!", - ifp->name, - prefix2str(ifc->address, buf, - sizeof buf)); + flog_err( + LIB_ERR_ZAPI_ENCODE, + "warning: interface %s address %s with peer flag set, but no peer address!", + ifp->name, + prefix2str(ifc->address, buf, + sizeof buf)); UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER); } } @@ -1723,8 +1730,8 @@ zebra_interface_nbr_address_read(int type, struct stream *s, vrf_id_t vrf_id) flog_err(LIB_ERR_ZAPI_ENCODE, "INTERFACE_NBR_%s: Cannot find IF %u in VRF %d", (type == ZEBRA_INTERFACE_NBR_ADDRESS_ADD) ? "ADD" - : "DELETE", - ifindex, vrf_id); + : "DELETE", + ifindex, vrf_id); return NULL; } @@ -2407,10 +2414,11 @@ static int zclient_read(struct thread *thread) /* Length check. */ if (length > STREAM_SIZE(zclient->ibuf)) { struct stream *ns; - flog_err(LIB_ERR_ZAPI_ENCODE, - "%s: message size %u exceeds buffer size %lu, expanding...", - __func__, length, - (unsigned long)STREAM_SIZE(zclient->ibuf)); + flog_err( + LIB_ERR_ZAPI_ENCODE, + "%s: message size %u exceeds buffer size %lu, expanding...", + __func__, length, + (unsigned long)STREAM_SIZE(zclient->ibuf)); ns = stream_new(length); stream_copy(ns, zclient->ibuf); stream_free(zclient->ibuf); diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index 4ae57793d..d4a8a266c 100644 --- a/ospfd/ospf_apiserver.c +++ b/ospfd/ospf_apiserver.c @@ -153,8 +153,9 @@ int ospf_apiserver_init(void) NULL, /* ospf_apiserver_lsa_refresher */ ospf_apiserver_lsa_update, ospf_apiserver_lsa_delete); if (rc != 0) { - flog_warn(OSPF_WARN_OPAQUE_REGISTRATION, - "ospf_apiserver_init: Failed to register opaque type [0/0]"); + flog_warn( + OSPF_WARN_OPAQUE_REGISTRATION, + "ospf_apiserver_init: Failed to register opaque type [0/0]"); } rc = 0; diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index da5f485ef..ba2e04bf7 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -136,11 +136,11 @@ ospf_external_info_add(struct ospf *ospf, uint8_t type, unsigned short instance, inet_ntop(AF_INET, (void *)&nexthop.s_addr, inetbuf, INET6_BUFSIZ); if (IS_DEBUG_OSPF(lsa, LSA_GENERATE)) - zlog_debug( - "Redistribute[%s][%d][%u]: %s/%d discarding old info with NH %s.", - ospf_redist_string(type), instance, - ospf->vrf_id, inet_ntoa(p.prefix), p.prefixlen, - inetbuf); + zlog_debug( + "Redistribute[%s][%d][%u]: %s/%d discarding old info with NH %s.", + ospf_redist_string(type), instance, + ospf->vrf_id, inet_ntoa(p.prefix), + p.prefixlen, inetbuf); XFREE(MTYPE_OSPF_EXTERNAL_INFO, rn->info); rn->info = NULL; } diff --git a/ospfd/ospf_ext.c b/ospfd/ospf_ext.c index 018ca5c0f..1aab61168 100644 --- a/ospfd/ospf_ext.c +++ b/ospfd/ospf_ext.c @@ -760,8 +760,8 @@ static int ospf_ext_link_lsa_update(struct ospf_lsa *lsa) { /* Sanity Check */ if (lsa == NULL) { - flog_warn(OSPF_WARN_LSA_NULL, - "EXT (%s): Abort! LSA is NULL", __func__); + flog_warn(OSPF_WARN_LSA_NULL, "EXT (%s): Abort! LSA is NULL", + __func__); return -1; } @@ -794,8 +794,8 @@ static int ospf_ext_pref_lsa_update(struct ospf_lsa *lsa) /* Sanity Check */ if (lsa == NULL) { - flog_warn(OSPF_WARN_LSA_NULL, - "EXT (%s): Abort! LSA is NULL", __func__); + flog_warn(OSPF_WARN_LSA_NULL, "EXT (%s): Abort! LSA is NULL", + __func__); return -1; } @@ -1190,8 +1190,9 @@ static int ospf_ext_pref_lsa_originate(void *arg) if (CHECK_FLAG(exti->flags, EXT_LPFLG_LSA_ENGAGED)) { if (CHECK_FLAG(exti->flags, EXT_LPFLG_LSA_FORCED_REFRESH)) { - flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED, - "EXT (%s): Refresh instead of Originate", + flog_warn( + OSPF_WARN_EXT_LSA_UNEXPECTED, + "EXT (%s): Refresh instead of Originate", __func__); UNSET_FLAG(exti->flags, EXT_LPFLG_LSA_FORCED_REFRESH); @@ -1247,9 +1248,10 @@ static int ospf_ext_link_lsa_originate(void *arg) if (CHECK_FLAG(exti->flags, EXT_LPFLG_LSA_ENGAGED)) { if (CHECK_FLAG(exti->flags, EXT_LPFLG_LSA_FORCED_REFRESH)) { - flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED, - "EXT (%s): Refresh instead of Originate", - __func__); + flog_warn( + OSPF_WARN_EXT_LSA_UNEXPECTED, + "EXT (%s): Refresh instead of Originate", + __func__); UNSET_FLAG(exti->flags, EXT_LPFLG_LSA_FORCED_REFRESH); ospf_ext_link_lsa_schedule(exti, @@ -1467,9 +1469,10 @@ static void ospf_ext_pref_lsa_schedule(struct ext_itf *exti, /* Set LSA header information */ if (exti->area == NULL) { - flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED, - "EXT (%s): Flooding is Area scope but area is not yet set", - __func__); + flog_warn( + OSPF_WARN_EXT_LSA_UNEXPECTED, + "EXT (%s): Flooding is Area scope but area is not yet set", + __func__); if (OspfEXT.area == NULL) { top = ospf_lookup_by_vrf_id(VRF_DEFAULT); OspfEXT.area = ospf_area_lookup_by_area_id( @@ -1527,9 +1530,10 @@ static void ospf_ext_link_lsa_schedule(struct ext_itf *exti, /* Set LSA header information */ if (exti->area == NULL) { - flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED, - "EXT (%s): Flooding is Area scope but area is not yet set", - __func__); + flog_warn( + OSPF_WARN_EXT_LSA_UNEXPECTED, + "EXT (%s): Flooding is Area scope but area is not yet set", + __func__); if (OspfEXT.area == NULL) { top = ospf_lookup_by_vrf_id(VRF_DEFAULT); OspfEXT.area = ospf_area_lookup_by_area_id( diff --git a/ospfd/ospf_neighbor.c b/ospfd/ospf_neighbor.c index a0fe1c53d..a58bd93b6 100644 --- a/ospfd/ospf_neighbor.c +++ b/ospfd/ospf_neighbor.c @@ -271,8 +271,8 @@ void ospf_nbr_add_self(struct ospf_interface *oi, struct in_addr router_id) /* There is already pseudo neighbor. */ if (IS_DEBUG_OSPF_EVENT) zlog_debug( - "router_id %s already present in neighbor table. node refcount %u", - inet_ntoa(router_id), rn->lock); + "router_id %s already present in neighbor table. node refcount %u", + inet_ntoa(router_id), rn->lock); route_unlock_node(rn); } else rn->info = oi->nbr_self; diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index d893a0210..ed11f4535 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -51,12 +51,13 @@ int ospf_if_add_allspfrouters(struct ospf *top, struct prefix *p, p->u.prefix4, htonl(OSPF_ALLSPFROUTERS), ifindex); if (ret < 0) - flog_err(LIB_ERR_SOCKET, - "can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, " - "ifindex %u, AllSPFRouters): %s; perhaps a kernel limit " - "on # of multicast group memberships has been exceeded?", - top->fd, inet_ntoa(p->u.prefix4), ifindex, - safe_strerror(errno)); + flog_err( + LIB_ERR_SOCKET, + "can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, " + "ifindex %u, AllSPFRouters): %s; perhaps a kernel limit " + "on # of multicast group memberships has been exceeded?", + top->fd, inet_ntoa(p->u.prefix4), ifindex, + safe_strerror(errno)); else { if (IS_DEBUG_OSPF_EVENT) zlog_debug( @@ -101,12 +102,13 @@ int ospf_if_add_alldrouters(struct ospf *top, struct prefix *p, p->u.prefix4, htonl(OSPF_ALLDROUTERS), ifindex); if (ret < 0) - flog_err(LIB_ERR_SOCKET, - "can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, " - "ifindex %u, AllDRouters): %s; perhaps a kernel limit " - "on # of multicast group memberships has been exceeded?", - top->fd, inet_ntoa(p->u.prefix4), ifindex, - safe_strerror(errno)); + flog_err( + LIB_ERR_SOCKET, + "can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, " + "ifindex %u, AllDRouters): %s; perhaps a kernel limit " + "on # of multicast group memberships has been exceeded?", + top->fd, inet_ntoa(p->u.prefix4), ifindex, + safe_strerror(errno)); else zlog_debug( "interface %s [%u] join AllDRouters Multicast group.", diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index 83183071c..985e2efc9 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -796,15 +796,16 @@ int ospf_nsm_event(struct thread *thread) * not * try set next_state. */ - flog_err(OSPF_ERR_FSM_INVALID_STATE, - "NSM[%s:%s]: %s (%s): " - "Warning: action tried to change next_state to %s", - IF_NAME(nbr->oi), inet_ntoa(nbr->router_id), - lookup_msg(ospf_nsm_state_msg, nbr->state, - NULL), - ospf_nsm_event_str[event], - lookup_msg(ospf_nsm_state_msg, func_state, - NULL)); + flog_err( + OSPF_ERR_FSM_INVALID_STATE, + "NSM[%s:%s]: %s (%s): " + "Warning: action tried to change next_state to %s", + IF_NAME(nbr->oi), inet_ntoa(nbr->router_id), + lookup_msg(ospf_nsm_state_msg, nbr->state, + NULL), + ospf_nsm_event_str[event], + lookup_msg(ospf_nsm_state_msg, func_state, + NULL)); } } diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index 37d18767e..974822ba8 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -186,8 +186,9 @@ static int ospf_router_info_register(uint8_t scope) NULL); /* del_lsa_hook */ if (rc != 0) { - flog_warn(OSPF_WARN_OPAQUE_REGISTRATION, - "ospf_router_info_init: Failed to register functions"); + flog_warn( + OSPF_WARN_OPAQUE_REGISTRATION, + "ospf_router_info_init: Failed to register functions"); return rc; } @@ -201,7 +202,8 @@ static int ospf_router_info_unregister() if ((OspfRI.scope != OSPF_OPAQUE_AS_LSA) && (OspfRI.scope != OSPF_OPAQUE_AREA_LSA)) { - assert("Unable to unregister Router Info functions: Wrong scope!" == NULL); + assert("Unable to unregister Router Info functions: Wrong scope!" + == NULL); return -1; } diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index 5ee56838a..2f8ff9909 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -818,8 +818,8 @@ static struct sr_prefix *get_ext_prefix_sid(struct tlv_header *tlvh) psid = (struct ext_subtlv_prefix_sid *)sub_tlvh; if (psid->algorithm != SR_ALGORITHM_SPF) { flog_err(OSPF_ERR_INVALID_ALGORITHM, - "SR (%s): Unsupported Algorithm", - __func__); + "SR (%s): Unsupported Algorithm", + __func__); XFREE(MTYPE_OSPF_SR_PARAMS, srp); return NULL; } diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index 12325f4fb..f3be77195 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -103,8 +103,9 @@ int ospf_mpls_te_init(void) ospf_mpls_te_lsa_refresh, NULL, /* ospf_mpls_te_new_lsa_hook */ NULL /* ospf_mpls_te_del_lsa_hook */); if (rc != 0) { - flog_warn(OSPF_WARN_OPAQUE_REGISTRATION, - "ospf_mpls_te_init: Failed to register Traffic Engineering functions"); + flog_warn( + OSPF_WARN_OPAQUE_REGISTRATION, + "ospf_mpls_te_init: Failed to register Traffic Engineering functions"); return rc; } @@ -140,8 +141,9 @@ static int ospf_mpls_te_register(enum inter_as_mode mode) ospf_mpls_te_lsa_refresh, NULL, NULL); if (rc != 0) { - flog_warn(OSPF_WARN_OPAQUE_REGISTRATION, - "ospf_router_info_init: Failed to register Inter-AS functions"); + flog_warn( + OSPF_WARN_OPAQUE_REGISTRATION, + "ospf_router_info_init: Failed to register Inter-AS functions"); return rc; } @@ -817,8 +819,9 @@ static int is_mandated_params_set(struct mpls_te_link *lp) int rc = 0; if (ntohs(OspfMplsTE.router_addr.header.type) == 0) { - flog_warn(OSPF_WARN_TE_UNEXPECTED, - "MPLS-TE(is_mandated_params_set) Missing Router Address"); + flog_warn( + OSPF_WARN_TE_UNEXPECTED, + "MPLS-TE(is_mandated_params_set) Missing Router Address"); return rc; } @@ -921,9 +924,10 @@ void ospf_mpls_te_update_if(struct interface *ifp) /* Get Link context from interface */ if ((lp = lookup_linkparams_by_ifp(ifp)) == NULL) { - flog_warn(OSPF_WARN_TE_UNEXPECTED, - "OSPF MPLS-TE Update: Did not find Link Parameters context for interface %s", - ifp->name); + flog_warn( + OSPF_WARN_TE_UNEXPECTED, + "OSPF MPLS-TE Update: Did not find Link Parameters context for interface %s", + ifp->name); return; } @@ -965,16 +969,18 @@ static void ospf_mpls_te_ism_change(struct ospf_interface *oi, int old_state) struct mpls_te_link *lp; if ((lp = lookup_linkparams_by_ifp(oi->ifp)) == NULL) { - flog_warn(OSPF_WARN_TE_UNEXPECTED, - "ospf_mpls_te_ism_change: Cannot get linkparams from OI(%s)?", - IF_NAME(oi)); + flog_warn( + OSPF_WARN_TE_UNEXPECTED, + "ospf_mpls_te_ism_change: Cannot get linkparams from OI(%s)?", + IF_NAME(oi)); return; } if (oi->area == NULL || oi->area->ospf == NULL) { - flog_warn(OSPF_WARN_TE_UNEXPECTED, - "ospf_mpls_te_ism_change: Cannot refer to OSPF from OI(%s)?", - IF_NAME(oi)); + flog_warn( + OSPF_WARN_TE_UNEXPECTED, + "ospf_mpls_te_ism_change: Cannot refer to OSPF from OI(%s)?", + IF_NAME(oi)); return; } #ifdef notyet @@ -982,10 +988,11 @@ static void ospf_mpls_te_ism_change(struct ospf_interface *oi, int old_state) && !IPV4_ADDR_SAME(&lp->area->area_id, &oi->area->area_id)) || (lp->area != NULL && oi->area == NULL)) { /* How should we consider this case? */ - flog_warn(OSPF_WARN_TE_UNEXPECTED, - "MPLS-TE: Area for OI(%s) has changed to [%s], flush previous LSAs", - IF_NAME(oi), - oi->area ? inet_ntoa(oi->area->area_id) : "N/A"); + flog_warn( + OSPF_WARN_TE_UNEXPECTED, + "MPLS-TE: Area for OI(%s) has changed to [%s], flush previous LSAs", + IF_NAME(oi), + oi->area ? inet_ntoa(oi->area->area_id) : "N/A"); ospf_mpls_te_lsa_schedule(lp, FLUSH_THIS_LSA); } #endif @@ -1216,8 +1223,9 @@ static int ospf_mpls_te_lsa_originate1(struct ospf_area *area, /* Create new Opaque-LSA/MPLS-TE instance. */ new = ospf_mpls_te_lsa_new(area->ospf, area, lp); if (new == NULL) { - flog_warn(OSPF_WARN_TE_UNEXPECTED, - "ospf_mpls_te_lsa_originate1: ospf_mpls_te_lsa_new() ?"); + flog_warn( + OSPF_WARN_TE_UNEXPECTED, + "ospf_mpls_te_lsa_originate1: ospf_mpls_te_lsa_new() ?"); return rc; } @@ -1317,8 +1325,9 @@ static int ospf_mpls_te_lsa_originate2(struct ospf *top, /* Create new Opaque-LSA/Inter-AS instance. */ new = ospf_mpls_te_lsa_new(top, NULL, lp); if (new == NULL) { - flog_warn(OSPF_WARN_LSA_UNEXPECTED, - "ospf_mpls_te_lsa_originate2: ospf_router_info_lsa_new() ?"); + flog_warn( + OSPF_WARN_LSA_UNEXPECTED, + "ospf_mpls_te_lsa_originate2: ospf_router_info_lsa_new() ?"); return rc; } new->vrf_id = top->vrf_id; @@ -1380,9 +1389,10 @@ static int ospf_mpls_te_lsa_originate_as(void *arg) } if (!is_mandated_params_set(lp)) { - flog_warn(OSPF_WARN_TE_UNEXPECTED, - "ospf_mpls_te_lsa_originate_as: Link(%s) lacks some mandated MPLS-TE parameters.", - lp->ifp ? lp->ifp->name : "?"); + flog_warn( + OSPF_WARN_TE_UNEXPECTED, + "ospf_mpls_te_lsa_originate_as: Link(%s) lacks some mandated MPLS-TE parameters.", + lp->ifp ? lp->ifp->name : "?"); continue; } @@ -1437,8 +1447,9 @@ static struct ospf_lsa *ospf_mpls_te_lsa_refresh(struct ospf_lsa *lsa) /* Check if lp was not disable in the interval */ if (!CHECK_FLAG(lp->flags, LPFLG_LSA_ACTIVE)) { - flog_warn(OSPF_WARN_TE_UNEXPECTED, - "ospf_mpls_te_lsa_refresh: lp was disabled: Flush it!"); + flog_warn( + OSPF_WARN_TE_UNEXPECTED, + "ospf_mpls_te_lsa_refresh: lp was disabled: Flush it!"); lsa->data->ls_age = htons(OSPF_LSA_MAXAGE); /* Flush it anyway. */ } @@ -1522,8 +1533,9 @@ void ospf_mpls_te_lsa_schedule(struct mpls_te_link *lp, enum lsa_opcode opcode) top, OspfMplsTE.interas_areaid); /* Unable to set the area context. Abort! */ if (lp->area == NULL) { - flog_warn(OSPF_WARN_TE_UNEXPECTED, - "MPLS-TE(ospf_mpls_te_lsa_schedule) Area context is null. Abort !"); + flog_warn( + OSPF_WARN_TE_UNEXPECTED, + "MPLS-TE(ospf_mpls_te_lsa_schedule) Area context is null. Abort !"); return; } tmp = SET_OPAQUE_LSID(OPAQUE_TYPE_INTER_AS_LSA, diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index d7406e4e1..a8535fa9c 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -324,9 +324,10 @@ static struct ospf *ospf_new(unsigned short instance, const char *name) new->fd = -1; if ((ospf_sock_init(new)) < 0) { if (new->vrf_id != VRF_UNKNOWN) - flog_err(LIB_ERR_SOCKET, - "%s: ospf_sock_init is unable to open a socket", - __func__); + flog_err( + LIB_ERR_SOCKET, + "%s: ospf_sock_init is unable to open a socket", + __func__); return new; } thread_add_read(master, ospf_read, new, new->fd, &new->t_read); -- 2.39.2