diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-08-03 20:03:29 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-08-14 22:02:05 +0200 |
commit | af4c27286d8eb3f347ff431a17a47a8d07cd8976 (patch) | |
tree | caf5eae55c21f72baec4945cdb2cbc333d99f916 | |
parent | lib: remove still reachable blocks in ferr.c (diff) | |
download | frr-af4c27286d8eb3f347ff431a17a47a8d07cd8976.tar.xz frr-af4c27286d8eb3f347ff431a17a47a8d07cd8976.zip |
*: rename zlog_fer -> flog_err
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
132 files changed, 734 insertions, 734 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index dc47ff002..f17d83905 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -169,7 +169,7 @@ babel_interface_address_add (int cmd, struct zclient *client, if (babel_ifp->ipv4 == NULL) { babel_ifp->ipv4 = malloc(4); if (babel_ifp->ipv4 == NULL) { - zlog_ferr(BABEL_ERR_MEMORY, "not enough memory"); + flog_err(BABEL_ERR_MEMORY, "not enough memory"); } else { memcpy(babel_ifp->ipv4, &prefix->u.prefix4, 4); } @@ -709,7 +709,7 @@ interface_recalculate(struct interface *ifp) tmp = babel_ifp->sendbuf; babel_ifp->sendbuf = realloc(babel_ifp->sendbuf, babel_ifp->bufsize); if(babel_ifp->sendbuf == NULL) { - zlog_ferr(BABEL_ERR_MEMORY, "Couldn't reallocate sendbuf."); + flog_err(BABEL_ERR_MEMORY, "Couldn't reallocate sendbuf."); free(tmp); babel_ifp->bufsize = 0; return -1; @@ -729,7 +729,7 @@ interface_recalculate(struct interface *ifp) rc = setsockopt(protocol_socket, IPPROTO_IPV6, IPV6_JOIN_GROUP, (char*)&mreq, sizeof(mreq)); if(rc < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "setsockopt(IPV6_JOIN_GROUP) on interface '%s': %s", ifp->name, safe_strerror(errno)); /* This is probably due to a missing link-local address, @@ -793,7 +793,7 @@ interface_reset(struct interface *ifp) rc = setsockopt(protocol_socket, IPPROTO_IPV6, IPV6_LEAVE_GROUP, (char*)&mreq, sizeof(mreq)); if(rc < 0) - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "setsockopt(IPV6_LEAVE_GROUP) on interface '%s': %s", ifp->name, safe_strerror(errno)); } @@ -1060,7 +1060,7 @@ DEFUN (show_babel_route, } route_stream_done(routes); } else { - zlog_ferr(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); + flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); } xroutes = xroute_stream(); if(xroutes) { @@ -1072,7 +1072,7 @@ DEFUN (show_babel_route, } xroute_stream_done(xroutes); } else { - zlog_ferr(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); + flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); } return CMD_SUCCESS; } @@ -1107,7 +1107,7 @@ DEFUN (show_babel_route_prefix, } route_stream_done(routes); } else { - zlog_ferr(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); + flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); } xroutes = xroute_stream(); if(xroutes) { @@ -1119,7 +1119,7 @@ DEFUN (show_babel_route_prefix, } xroute_stream_done(xroutes); } else { - zlog_ferr(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); + flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); } return CMD_SUCCESS; } @@ -1165,7 +1165,7 @@ DEFUN (show_babel_route_addr, } route_stream_done(routes); } else { - zlog_ferr(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); + flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); } xroutes = xroute_stream(); if(xroutes) { @@ -1177,7 +1177,7 @@ DEFUN (show_babel_route_addr, } xroute_stream_done(xroutes); } else { - zlog_ferr(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); + flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); } return CMD_SUCCESS; } @@ -1224,7 +1224,7 @@ DEFUN (show_babel_route_addr6, } route_stream_done(routes); } else { - zlog_ferr(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); + flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); } xroutes = xroute_stream(); if(xroutes) { @@ -1236,7 +1236,7 @@ DEFUN (show_babel_route_addr6, } xroute_stream_done(xroutes); } else { - zlog_ferr(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); + flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); } return CMD_SUCCESS; } diff --git a/babeld/babel_main.c b/babeld/babel_main.c index 554244a28..89617c0dc 100644 --- a/babeld/babel_main.c +++ b/babeld/babel_main.c @@ -225,7 +225,7 @@ babel_init_random(void) rc = read_random_bytes(&seed, sizeof(seed)); if(rc < 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, "read(random): %s", + flog_err(LIB_ERR_SYSTEM_CALL, "read(random): %s", safe_strerror(errno)); seed = 42; } @@ -246,13 +246,13 @@ babel_replace_by_null(int fd) fd_null = open("/dev/null", O_RDONLY); if(fd_null < 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, "open(null): %s", safe_strerror(errno)); + flog_err(LIB_ERR_SYSTEM_CALL, "open(null): %s", safe_strerror(errno)); exit(1); } rc = dup2(fd_null, fd); if(rc < 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, "dup2(null, 0): %s", + flog_err(LIB_ERR_SYSTEM_CALL, "dup2(null, 0): %s", safe_strerror(errno)); exit(1); } @@ -272,11 +272,11 @@ babel_load_state_file(void) fd = open(state_file, O_RDONLY); if(fd < 0 && errno != ENOENT) - zlog_ferr(LIB_ERR_SYSTEM_CALL, "open(babel-state: %s)", + flog_err(LIB_ERR_SYSTEM_CALL, "open(babel-state: %s)", safe_strerror(errno)); rc = unlink(state_file); if(fd >= 0 && rc < 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, "unlink(babel-state): %s", + flog_err(LIB_ERR_SYSTEM_CALL, "unlink(babel-state): %s", safe_strerror(errno)); /* If we couldn't unlink it, it's probably stale. */ goto fini; @@ -288,7 +288,7 @@ babel_load_state_file(void) long t; rc = read(fd, buf, 99); if(rc < 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, "read(babel-state): %s", + flog_err(LIB_ERR_SYSTEM_CALL, "read(babel-state): %s", safe_strerror(errno)); } else { buf[rc] = '\0'; @@ -297,7 +297,7 @@ babel_load_state_file(void) unsigned char sid[8]; rc = parse_eui64(buf2, sid); if(rc < 0) { - zlog_ferr(BABEL_ERR_CONFIG, "Couldn't parse babel-state."); + flog_err(BABEL_ERR_CONFIG, "Couldn't parse babel-state."); } else { struct timeval realnow; debugf(BABEL_DEBUG_COMMON, @@ -307,13 +307,13 @@ babel_load_state_file(void) if(memcmp(sid, myid, 8) == 0) myseqno = seqno_plus(s, 1); else - zlog_ferr(BABEL_ERR_CONFIG, + flog_err(BABEL_ERR_CONFIG, "ID mismatch in babel-state. id=%s; old=%s", format_eui64(myid), format_eui64(sid)); } } else { - zlog_ferr(BABEL_ERR_CONFIG, "Couldn't parse babel-state."); + flog_err(BABEL_ERR_CONFIG, "Couldn't parse babel-state."); } } goto fini; @@ -353,7 +353,7 @@ babel_save_state_file(void) debugf(BABEL_DEBUG_COMMON, "Save state file."); fd = open(state_file, O_WRONLY | O_TRUNC | O_CREAT, 0644); if(fd < 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, "creat(babel-state): %s", + flog_err(LIB_ERR_SYSTEM_CALL, "creat(babel-state): %s", safe_strerror(errno)); unlink(state_file); } else { @@ -364,12 +364,12 @@ babel_save_state_file(void) format_eui64(myid), (int)myseqno, (long)realnow.tv_sec); if(rc < 0 || rc >= 100) { - zlog_ferr(BABEL_ERR_CONFIG, "write(babel-state): overflow."); + flog_err(BABEL_ERR_CONFIG, "write(babel-state): overflow."); unlink(state_file); } else { rc = write(fd, buf, rc); if(rc < 0) { - zlog_ferr(BABEL_ERR_CONFIG, "write(babel-state): %s", + flog_err(BABEL_ERR_CONFIG, "write(babel-state): %s", safe_strerror(errno)); unlink(state_file); } diff --git a/babeld/babeld.c b/babeld/babeld.c index dd0767142..b05f26919 100644 --- a/babeld/babeld.c +++ b/babeld/babeld.c @@ -145,7 +145,7 @@ babel_create_routing_process (void) /* Make socket for Babel protocol. */ protocol_socket = babel_socket(protocol_port); if (protocol_socket < 0) { - zlog_ferr(LIB_ERR_SOCKET, "Couldn't create link local socket: %s", + flog_err(LIB_ERR_SOCKET, "Couldn't create link local socket: %s", safe_strerror(errno)); goto fail; } @@ -179,7 +179,7 @@ babel_read_protocol (struct thread *thread) (struct sockaddr*)&sin6, sizeof(sin6)); if(rc < 0) { if(errno != EAGAIN && errno != EINTR) { - zlog_ferr(LIB_ERR_SOCKET, "recv: %s", safe_strerror(errno)); + flog_err(LIB_ERR_SOCKET, "recv: %s", safe_strerror(errno)); } } else { FOR_ALL_INTERFACES(vrf, ifp) { @@ -255,12 +255,12 @@ babel_get_myid(void) return; } - zlog_ferr(BABEL_ERR_CONFIG, + flog_err(BABEL_ERR_CONFIG, "Warning: couldn't find router id -- using random value."); rc = read_random_bytes(myid, 8); if(rc < 0) { - zlog_ferr(BABEL_ERR_CONFIG, "read(random): %s (cannot assign an ID)", + flog_err(BABEL_ERR_CONFIG, "read(random): %s (cannot assign an ID)", safe_strerror(errno)); exit(1); } @@ -519,7 +519,7 @@ resize_receive_buffer(int size) if(receive_buffer == NULL) { receive_buffer = malloc(size); if(receive_buffer == NULL) { - zlog_ferr(BABEL_ERR_MEMORY, "malloc(receive_buffer): %s", + flog_err(BABEL_ERR_MEMORY, "malloc(receive_buffer): %s", safe_strerror(errno)); return -1; } @@ -528,7 +528,7 @@ resize_receive_buffer(int size) unsigned char *new; new = realloc(receive_buffer, size); if(new == NULL) { - zlog_ferr(BABEL_ERR_MEMORY, "realloc(receive_buffer): %s", + flog_err(BABEL_ERR_MEMORY, "realloc(receive_buffer): %s", safe_strerror(errno)); return -1; } diff --git a/babeld/message.c b/babeld/message.c index c6b72f827..09eaca7a4 100644 --- a/babeld/message.c +++ b/babeld/message.c @@ -141,12 +141,12 @@ parse_update_subtlv(const unsigned char *a, int alen, } if(i + 1 > alen) { - zlog_ferr(BABEL_ERR_PACKET, "Received truncated attributes."); + flog_err(BABEL_ERR_PACKET, "Received truncated attributes."); return; } len = a[i + 1]; if(i + len > alen) { - zlog_ferr(BABEL_ERR_PACKET, "Received truncated attributes."); + flog_err(BABEL_ERR_PACKET, "Received truncated attributes."); return; } @@ -154,14 +154,14 @@ parse_update_subtlv(const unsigned char *a, int alen, /* Nothing. */ } else if(type == SUBTLV_DIVERSITY) { if(len > DIVERSITY_HOPS) { - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Received overlong channel information (%d > %d).n", len, DIVERSITY_HOPS); len = DIVERSITY_HOPS; } if(memchr(a + i + 2, 0, len) != NULL) { /* 0 is reserved. */ - zlog_ferr(BABEL_ERR_PACKET, "Channel information contains 0!"); + flog_err(BABEL_ERR_PACKET, "Channel information contains 0!"); return; } memset(channels, 0, DIVERSITY_HOPS); @@ -189,13 +189,13 @@ parse_hello_subtlv(const unsigned char *a, int alen, } if(i + 1 > alen) { - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Received truncated sub-TLV on Hello message."); return -1; } len = a[i + 1]; if(i + len > alen) { - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Received truncated sub-TLV on Hello message."); return -1; } @@ -207,7 +207,7 @@ parse_hello_subtlv(const unsigned char *a, int alen, DO_NTOHL(*hello_send_us, a + i + 2); ret = 1; } else { - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Received incorrect RTT sub-TLV on Hello message."); } } else { @@ -235,13 +235,13 @@ parse_ihu_subtlv(const unsigned char *a, int alen, } if(i + 1 > alen) { - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Received truncated sub-TLV on IHU message."); return -1; } len = a[i + 1]; if(i + len > alen) { - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Received truncated sub-TLV on IHU message."); return -1; } @@ -255,7 +255,7 @@ parse_ihu_subtlv(const unsigned char *a, int alen, ret = 1; } else { - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Received incorrect RTT sub-TLV on IHU message."); } } else { @@ -345,14 +345,14 @@ parse_packet(const unsigned char *from, struct interface *ifp, } if(!linklocal(from)) { - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Received packet from non-local address %s.", format_address(from)); return; } if (babel_packet_examin (packet, packetlen)) { - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Received malformed packet on %s from %s.", ifp->name, format_address(from)); return; @@ -360,14 +360,14 @@ parse_packet(const unsigned char *from, struct interface *ifp, neigh = find_neighbour(from, ifp); if(neigh == NULL) { - zlog_ferr(BABEL_ERR_PACKET, "Couldn't allocate neighbour."); + flog_err(BABEL_ERR_PACKET, "Couldn't allocate neighbour."); return; } DO_NTOHS(bodylen, packet + 2); if(bodylen + 4 > packetlen) { - zlog_ferr(BABEL_ERR_PACKET, "Received truncated packet (%d + 4 > %d).", + flog_err(BABEL_ERR_PACKET, "Received truncated packet (%d + 4 > %d).", bodylen, packetlen); bodylen = packetlen - 4; } @@ -516,7 +516,7 @@ parse_packet(const unsigned char *from, struct interface *ifp, have_router_id = 1; } if(!have_router_id && message[2] != 0) { - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Received prefix with no router id."); goto fail; } @@ -528,7 +528,7 @@ parse_packet(const unsigned char *from, struct interface *ifp, if(message[2] == 0) { if(metric < 0xFFFF) { - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Received wildcard update with finite metric."); goto done; } @@ -621,7 +621,7 @@ parse_packet(const unsigned char *from, struct interface *ifp, continue; fail: - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Couldn't parse packet (%d, %d) from %s on %s.", message[0], message[1], format_address(from), ifp->name); goto done; @@ -710,7 +710,7 @@ fill_rtt_message(struct interface *ifp) DO_HTONL(babel_ifp->sendbuf + babel_ifp->buffered_hello + 10, time); return 1; } else { - zlog_ferr(BABEL_ERR_PACKET, "No space left for timestamp sub-TLV " + flog_err(BABEL_ERR_PACKET, "No space left for timestamp sub-TLV " "(this shouldn't happen)"); return -1; } @@ -745,9 +745,9 @@ flushbuf(struct interface *ifp) babel_ifp->sendbuf, babel_ifp->buffered, (struct sockaddr*)&sin6, sizeof(sin6)); if(rc < 0) - zlog_ferr(BABEL_ERR_PACKET, "send: %s", safe_strerror(errno)); + flog_err(BABEL_ERR_PACKET, "send: %s", safe_strerror(errno)); } else { - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Warning: bucket full, dropping packet to %s.", ifp->name); } @@ -870,7 +870,7 @@ start_unicast_message(struct neighbour *neigh, int type, int len) if(!unicast_buffer) unicast_buffer = malloc(UNICAST_BUFSIZE); if(!unicast_buffer) { - zlog_ferr(BABEL_ERR_MEMORY, "malloc(unicast_buffer): %s", + flog_err(BABEL_ERR_MEMORY, "malloc(unicast_buffer): %s", safe_strerror(errno)); return -1; } @@ -1007,10 +1007,10 @@ flush_unicast(int dofree) unicast_buffer, unicast_buffered, (struct sockaddr*)&sin6, sizeof(sin6)); if(rc < 0) - zlog_ferr(BABEL_ERR_PACKET, "send(unicast): %s", + flog_err(BABEL_ERR_PACKET, "send(unicast): %s", safe_strerror(errno)); } else { - zlog_ferr(BABEL_ERR_PACKET, + flog_err(BABEL_ERR_PACKET, "Warning: bucket full, dropping unicast packet to %s if %s.", format_address(unicast_neighbour->address), unicast_neighbour->ifp->name); @@ -1318,7 +1318,7 @@ buffer_update(struct interface *ifp, again: babel_ifp->buffered_updates = malloc(n *sizeof(struct buffered_update)); if(babel_ifp->buffered_updates == NULL) { - zlog_ferr(BABEL_ERR_MEMORY, "malloc(buffered_updates): %s", + flog_err(BABEL_ERR_MEMORY, "malloc(buffered_updates): %s", safe_strerror(errno)); if(n > 4) { /* Try again with a tiny buffer. */ @@ -1382,7 +1382,7 @@ send_update(struct interface *ifp, int urgent, } route_stream_done(routes); } else { - zlog_ferr(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); + flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); } set_timeout(&babel_ifp->update_timeout, babel_ifp->update_interval); babel_ifp->last_update_time = babel_now.tv_sec; @@ -1460,7 +1460,7 @@ send_self_update(struct interface *ifp) } xroute_stream_done(xroutes); } else { - zlog_ferr(BABEL_ERR_MEMORY, "Couldn't allocate xroute stream."); + flog_err(BABEL_ERR_MEMORY, "Couldn't allocate xroute stream."); } } diff --git a/babeld/neighbour.c b/babeld/neighbour.c index d10ec15a8..c1592fb18 100644 --- a/babeld/neighbour.c +++ b/babeld/neighbour.c @@ -90,7 +90,7 @@ find_neighbour(const unsigned char *address, struct interface *ifp) neigh = malloc(sizeof(struct neighbour)); if(neigh == NULL) { - zlog_ferr(BABEL_ERR_MEMORY, "malloc(neighbour): %s", + flog_err(BABEL_ERR_MEMORY, "malloc(neighbour): %s", safe_strerror(errno)); return NULL; } diff --git a/babeld/route.c b/babeld/route.c index da2523469..ceeaa1057 100644 --- a/babeld/route.c +++ b/babeld/route.c @@ -399,14 +399,14 @@ install_route(struct babel_route *route) return; if(!route_feasible(route)) - zlog_ferr(BABEL_ERR_ROUTE, "WARNING: installing unfeasible route " + flog_err(BABEL_ERR_ROUTE, "WARNING: installing unfeasible route " "(this shouldn't happen)."); i = find_route_slot(route->src->prefix, route->src->plen, NULL); assert(i >= 0 && i < route_slots); if(routes[i] != route && routes[i]->installed) { - zlog_ferr(BABEL_ERR_ROUTE, + flog_err(BABEL_ERR_ROUTE, "WARNING: attempting to install duplicate route " "(this shouldn't happen)."); return; @@ -418,7 +418,7 @@ install_route(struct babel_route *route) metric_to_kernel(route_metric(route)), NULL, 0, 0); if(rc < 0) { int save = errno; - zlog_ferr(BABEL_ERR_ROUTE, "kernel_route(ADD): %s", + flog_err(BABEL_ERR_ROUTE, "kernel_route(ADD): %s", safe_strerror(errno)); if(save != EEXIST) return; @@ -441,7 +441,7 @@ uninstall_route(struct babel_route *route) route->neigh->ifp->ifindex, metric_to_kernel(route_metric(route)), NULL, 0, 0); if(rc < 0) - zlog_ferr(BABEL_ERR_ROUTE, "kernel_route(FLUSH): %s", + flog_err(BABEL_ERR_ROUTE, "kernel_route(FLUSH): %s", safe_strerror(errno)); route->installed = 0; @@ -465,7 +465,7 @@ switch_routes(struct babel_route *old, struct babel_route *new) return; if(!route_feasible(new)) - zlog_ferr(BABEL_ERR_ROUTE, "WARNING: switching to unfeasible route " + flog_err(BABEL_ERR_ROUTE, "WARNING: switching to unfeasible route " "(this shouldn't happen)."); rc = kernel_route(ROUTE_MODIFY, old->src->prefix, old->src->plen, @@ -474,7 +474,7 @@ switch_routes(struct babel_route *old, struct babel_route *new) new->nexthop, new->neigh->ifp->ifindex, metric_to_kernel(route_metric(new))); if(rc < 0) { - zlog_ferr(BABEL_ERR_ROUTE, "kernel_route(MODIFY): %s", + flog_err(BABEL_ERR_ROUTE, "kernel_route(MODIFY): %s", safe_strerror(errno)); return; } @@ -503,7 +503,7 @@ change_route_metric(struct babel_route *route, route->nexthop, route->neigh->ifp->ifindex, new); if(rc < 0) { - zlog_ferr(BABEL_ERR_ROUTE, "kernel_route(MODIFY metric): %s", + flog_err(BABEL_ERR_ROUTE, "kernel_route(MODIFY metric): %s", safe_strerror(errno)); return; } @@ -798,7 +798,7 @@ update_route(const unsigned char *router_id, return NULL; if(martian_prefix(prefix, plen)) { - zlog_ferr(BABEL_ERR_ROUTE, "Rejecting martian route to %s through %s.", + flog_err(BABEL_ERR_ROUTE, "Rejecting martian route to %s through %s.", format_prefix(prefix, plen), format_address(nexthop)); return NULL; } @@ -906,7 +906,7 @@ update_route(const unsigned char *router_id, route->next = NULL; new_route = insert_route(route); if(new_route == NULL) { - zlog_ferr(BABEL_ERR_ROUTE, "Couldn't insert route."); + flog_err(BABEL_ERR_ROUTE, "Couldn't insert route."); free(route); return NULL; } diff --git a/babeld/source.c b/babeld/source.c index 6145743a4..d6dd84895 100644 --- a/babeld/source.c +++ b/babeld/source.c @@ -59,7 +59,7 @@ find_source(const unsigned char *id, const unsigned char *p, unsigned char plen, src = malloc(sizeof(struct source)); if(src == NULL) { - zlog_ferr(BABEL_ERR_MEMORY, "malloc(source): %s", safe_strerror(errno)); + flog_err(BABEL_ERR_MEMORY, "malloc(source): %s", safe_strerror(errno)); return NULL; } diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 373a909f4..6acd4c8cf 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -997,7 +997,7 @@ bgp_attr_flags_diagnose(struct bgp_attr_parser_args *args, for (i = 0; i <= 2; i++) /* O,T,P, but not E */ if (CHECK_FLAG(desired_flags, attr_flag_str[i].key) != CHECK_FLAG(real_flags, attr_flag_str[i].key)) { - zlog_ferr( + flog_err( BGP_ERR_ATTR_FLAG, "%s attribute must%s be flagged as \"%s\"", lookup_msg(attr_str, attr_code, NULL), @@ -1062,7 +1062,7 @@ static int bgp_attr_flag_invalid(struct bgp_attr_parser_args *args) */ if (!CHECK_FLAG(BGP_ATTR_FLAG_OPTIONAL, flags) && !CHECK_FLAG(BGP_ATTR_FLAG_TRANS, flags)) { - zlog_ferr( + flog_err( BGP_ERR_ATTR_FLAG, "%s well-known attributes must have transitive flag set (%x)", lookup_msg(attr_str, attr_code, NULL), flags); @@ -1075,7 +1075,7 @@ static int bgp_attr_flag_invalid(struct bgp_attr_parser_args *args) */ if (CHECK_FLAG(flags, BGP_ATTR_FLAG_PARTIAL)) { if (!CHECK_FLAG(flags, BGP_ATTR_FLAG_OPTIONAL)) { - zlog_ferr(BGP_ERR_ATTR_FLAG, + flog_err(BGP_ERR_ATTR_FLAG, "%s well-known attribute " "must NOT have the partial flag set (%x)", lookup_msg(attr_str, attr_code, NULL), flags); @@ -1083,7 +1083,7 @@ static int bgp_attr_flag_invalid(struct bgp_attr_parser_args *args) } if (CHECK_FLAG(flags, BGP_ATTR_FLAG_OPTIONAL) && !CHECK_FLAG(flags, BGP_ATTR_FLAG_TRANS)) { - zlog_ferr(BGP_ERR_ATTR_FLAG, + flog_err(BGP_ERR_ATTR_FLAG, "%s optional + transitive attribute " "must NOT have the partial flag set (%x)", lookup_msg(attr_str, attr_code, NULL), flags); @@ -1118,7 +1118,7 @@ static bgp_attr_parse_ret_t bgp_attr_origin(struct bgp_attr_parser_args *args) field contains the erroneous attribute (type, length and value). */ if (length != 1) { - zlog_ferr(BGP_ERR_ATTR_LEN, + flog_err(BGP_ERR_ATTR_LEN, "Origin attribute length is not one %d", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, args->total); @@ -1132,7 +1132,7 @@ static bgp_attr_parse_ret_t bgp_attr_origin(struct bgp_attr_parser_args *args) contains the unrecognized attribute (type, length and value). */ if ((attr->origin != BGP_ORIGIN_IGP) && (attr->origin != BGP_ORIGIN_EGP) && (attr->origin != BGP_ORIGIN_INCOMPLETE)) { - zlog_ferr(BGP_ERR_ATTR_ORIGIN, + flog_err(BGP_ERR_ATTR_ORIGIN, "Origin attribute value is invalid %d", attr->origin); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_INVAL_ORIGIN, args->total); @@ -1161,7 +1161,7 @@ static int bgp_attr_aspath(struct bgp_attr_parser_args *args) /* In case of IBGP, length will be zero. */ if (!attr->aspath) { - zlog_ferr(BGP_ERR_ATTR_MAL_AS_PATH, + flog_err(BGP_ERR_ATTR_MAL_AS_PATH, "Malformed AS path from %s, length is %d", peer->host, length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_MAL_AS_PATH, @@ -1191,7 +1191,7 @@ static bgp_attr_parse_ret_t bgp_attr_aspath_check(struct peer *const peer, && !aspath_left_confed_check(attr->aspath)) || (peer->sort == BGP_PEER_EBGP && aspath_confed_check(attr->aspath))) { - zlog_ferr(BGP_ERR_ATTR_MAL_AS_PATH, "Malformed AS path from %s", + flog_err(BGP_ERR_ATTR_MAL_AS_PATH, "Malformed AS path from %s", peer->host); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_MAL_AS_PATH); @@ -1202,7 +1202,7 @@ static bgp_attr_parse_ret_t bgp_attr_aspath_check(struct peer *const peer, if (CHECK_FLAG(peer->flags, PEER_FLAG_ENFORCE_FIRST_AS)) { if (peer->sort == BGP_PEER_EBGP && !aspath_firstas_check(attr->aspath, peer->as)) { - zlog_ferr(BGP_ERR_ATTR_FIRST_AS, + flog_err(BGP_ERR_ATTR_FIRST_AS, "%s incorrect first AS (must be %u)", peer->host, peer->as); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, @@ -1236,7 +1236,7 @@ static int bgp_attr_as4_path(struct bgp_attr_parser_args *args, /* In case of IBGP, length will be zero. */ if (!*as4_path) { - zlog_ferr(BGP_ERR_ATTR_MAL_AS_PATH, + flog_err(BGP_ERR_ATTR_MAL_AS_PATH, "Malformed AS4 path from %s, length is %d", peer->host, length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_MAL_AS_PATH, @@ -1260,7 +1260,7 @@ static bgp_attr_parse_ret_t bgp_attr_nexthop(struct bgp_attr_parser_args *args) /* Check nexthop attribute length. */ if (length != 4) { - zlog_ferr(BGP_ERR_ATTR_LEN, + flog_err(BGP_ERR_ATTR_LEN, "Nexthop attribute length isn't four [%d]", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, @@ -1285,7 +1285,7 @@ static bgp_attr_parse_ret_t bgp_attr_nexthop(struct bgp_attr_parser_args *args) { char buf[INET_ADDRSTRLEN]; inet_ntop(AF_INET, &nexthop_n, buf, INET_ADDRSTRLEN); - zlog_ferr(BGP_ERR_ATTR_MARTIAN_NH, "Martian nexthop %s", buf); + flog_err(BGP_ERR_ATTR_MARTIAN_NH, "Martian nexthop %s", buf); return bgp_attr_malformed( args, BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP, args->total); } @@ -1305,7 +1305,7 @@ static bgp_attr_parse_ret_t bgp_attr_med(struct bgp_attr_parser_args *args) /* Length check. */ if (length != 4) { - zlog_ferr(BGP_ERR_ATTR_LEN, + flog_err(BGP_ERR_ATTR_LEN, "MED attribute length isn't four [%d]", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, @@ -1329,7 +1329,7 @@ bgp_attr_local_pref(struct bgp_attr_parser_args *args) /* Length check. */ if (length != 4) { - zlog_ferr(BGP_ERR_ATTR_LEN, + flog_err(BGP_ERR_ATTR_LEN, "LOCAL_PREF attribute length isn't 4 [%u]", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, args->total); @@ -1359,7 +1359,7 @@ static int bgp_attr_atomic(struct bgp_attr_parser_args *args) /* Length check. */ if (length != 0) { - zlog_ferr(BGP_ERR_ATTR_LEN, + flog_err(BGP_ERR_ATTR_LEN, "ATOMIC_AGGREGATE attribute length isn't 0 [%u]", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, @@ -1386,7 +1386,7 @@ static int bgp_attr_aggregator(struct bgp_attr_parser_args *args) wantedlen = 8; if (length != wantedlen) { - zlog_ferr(BGP_ERR_ATTR_LEN, + flog_err(BGP_ERR_ATTR_LEN, "AGGREGATOR attribute length isn't %u [%u]", wantedlen, length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, @@ -1416,7 +1416,7 @@ bgp_attr_as4_aggregator(struct bgp_attr_parser_args *args, const bgp_size_t length = args->length; if (length != 8) { - zlog_ferr(BGP_ERR_ATTR_LEN, + flog_err(BGP_ERR_ATTR_LEN, "New Aggregator length is not 8 [%d]", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, 0); @@ -1576,7 +1576,7 @@ bgp_attr_originator_id(struct bgp_attr_parser_args *args) /* Length check. */ if (length != 4) { - zlog_ferr(BGP_ERR_ATTR_LEN, "Bad originator ID length %d", + flog_err(BGP_ERR_ATTR_LEN, "Bad originator ID length %d", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, @@ -1600,7 +1600,7 @@ bgp_attr_cluster_list(struct bgp_attr_parser_args *args) /* Check length. */ if (length % 4) { - zlog_ferr(BGP_ERR_ATTR_LEN, "Bad cluster list length %d", + flog_err(BGP_ERR_ATTR_LEN, "Bad cluster list length %d", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, @@ -2070,7 +2070,7 @@ static bgp_attr_parse_ret_t bgp_attr_psid_sub(int32_t type, if (type == BGP_PREFIX_SID_LABEL_INDEX) { if (length != BGP_PREFIX_SID_LABEL_INDEX_LENGTH) { - zlog_ferr( + flog_err( BGP_ERR_ATTR_LEN, "Prefix SID label index length is %d instead of %d", length, BGP_PREFIX_SID_LABEL_INDEX_LENGTH); @@ -2106,7 +2106,7 @@ static bgp_attr_parse_ret_t bgp_attr_psid_sub(int32_t type, /* Placeholder code for the IPv6 SID type */ else if (type == BGP_PREFIX_SID_IPV6) { if (length != BGP_PREFIX_SID_IPV6_LENGTH) { - zlog_ferr(BGP_ERR_ATTR_LEN, + flog_err(BGP_ERR_ATTR_LEN, "Prefix SID IPv6 length is %d instead of %d", length, BGP_PREFIX_SID_IPV6_LENGTH); return bgp_attr_malformed(args, @@ -2129,7 +2129,7 @@ static bgp_attr_parse_ret_t bgp_attr_psid_sub(int32_t type, length -= 2; if (length % BGP_PREFIX_SID_ORIGINATOR_SRGB_LENGTH) { - zlog_ferr( + flog_err( BGP_ERR_ATTR_LEN, "Prefix SID Originator SRGB length is %d, it must be a multiple of %d ", length, BGP_PREFIX_SID_ORIGINATOR_SRGB_LENGTH); @@ -2179,7 +2179,7 @@ bgp_attr_prefix_sid(int32_t tlength, struct bgp_attr_parser_args *args, tlength -= length + 3; if (tlength < 0) { - zlog_ferr( + flog_err( BGP_ERR_ATTR_LEN, "Prefix SID internal length %d causes us to read beyond the total Prefix SID length", length); @@ -2207,7 +2207,7 @@ bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args) * can only support that. */ if (length < 2) { - zlog_ferr(BGP_ERR_ATTR_LEN, + flog_err(BGP_ERR_ATTR_LEN, "Bad PMSI tunnel attribute length %d", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, args->total); @@ -2215,14 +2215,14 @@ bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args) stream_getc(peer->curr); /* Flags */ tnl_type = stream_getc(peer->curr); if (tnl_type > PMSI_TNLTYPE_MAX) { - zlog_ferr(BGP_ERR_ATTR_PMSI_TYPE, + flog_err(BGP_ERR_ATTR_PMSI_TYPE, "Invalid PMSI tunnel attribute type %d", tnl_type); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_OPT_ATTR_ERR, args->total); } if (tnl_type == PMSI_TNLTYPE_INGR_REPL) { if (length != 9) { - zlog_ferr(BGP_ERR_ATTR_PMSI_LEN, + flog_err(BGP_ERR_ATTR_PMSI_LEN, "Bad PMSI tunnel attribute length %d for IR", length); return bgp_attr_malformed( @@ -2824,7 +2824,7 @@ size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, afi_t afi, break; default: if (safi != SAFI_FLOWSPEC) - zlog_ferr( + flog_err( BGP_ERR_ATTR_NH_SEND_LEN, "Bad nexthop when sending to %s, AFI %u SAFI %u nhlen %d", peer->host, afi, safi, attr->mp_nexthop_len); diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 6ebfb7d78..b190e0923 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -173,7 +173,7 @@ static struct vrf_irt_node *vrf_import_rt_new(struct ecommunity_val *rt) bgp_def = bgp_get_default(); if (!bgp_def) { - zlog_ferr(BGP_ERR_NO_DFLT, + flog_err(BGP_ERR_NO_DFLT, "vrf import rt new - def instance not created yet"); return NULL; } @@ -204,7 +204,7 @@ static void vrf_import_rt_free(struct vrf_irt_node *irt) bgp_def = bgp_get_default(); if (!bgp_def) { - zlog_ferr(BGP_ERR_NO_DFLT, + flog_err(BGP_ERR_NO_DFLT, "vrf import rt free - def instance not created yet"); return; } @@ -226,7 +226,7 @@ static struct vrf_irt_node *lookup_vrf_import_rt(struct ecommunity_val *rt) bgp_def = bgp_get_default(); if (!bgp_def) { - zlog_ferr( + flog_err( BGP_ERR_NO_DFLT, "vrf import rt lookup - def instance not created yet"); return NULL; @@ -624,7 +624,7 @@ static int bgp_zebra_send_remote_vtep(struct bgp *bgp, struct bgpevpn *vpn, if (is_evpn_prefix_ipaddr_v4(p)) stream_put_in_addr(s, &p->prefix.imet_addr.ip.ipaddr_v4); else if (is_evpn_prefix_ipaddr_v6(p)) { - zlog_ferr( + flog_err( BGP_ERR_VTEP_INVALID, "Bad remote IP when trying to %s remote VTEP for VNI %u", add ? "ADD" : "DEL", vpn->vni); @@ -1295,7 +1295,7 @@ static int update_evpn_type4_route_entry(struct bgp *bgp, * We shouldn't see the same route from any other vtep. */ if (remote_ri) { - zlog_ferr( + flog_err( BGP_ERR_ES_INVALID, "%u ERROR: local es route for ESI: %s Vtep %s also learnt from remote", bgp->vrf_id, @@ -1383,7 +1383,7 @@ static int update_evpn_type4_route(struct bgp *bgp, &attr, 1, &ri, &route_changed); if (ret != 0) { - zlog_ferr( + flog_err( BGP_ERR_ES_INVALID, "%u ERROR: Failed to updated ES route ESI: %s VTEP %s", bgp->vrf_id, @@ -2225,7 +2225,7 @@ static int delete_routes_for_es(struct bgp *bgp, struct evpnes *es) build_evpn_type4_prefix(&p, &es->esi, es->originator_ip.ipaddr_v4); ret = delete_evpn_type4_route(bgp, es, &p); if (ret) { - zlog_ferr(BGP_ERR_EVPN_ROUTE_DELETE, + flog_err(BGP_ERR_EVPN_ROUTE_DELETE, "%u failed to delete type-4 route for ESI %s", bgp->vrf_id, esi_to_str(&es->esi, buf, sizeof(buf))); } @@ -2884,7 +2884,7 @@ static int install_uninstall_routes_for_es(struct bgp *bgp, bgp, es, evp, ri); if (ret) { - zlog_ferr( + flog_err( BGP_ERR_EVPN_FAIL, "Failed to %s EVPN %s route in ESI %s", install ? "install" @@ -2964,7 +2964,7 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install) bgp_vrf, evp, ri); if (ret) { - zlog_ferr( + flog_err( BGP_ERR_EVPN_FAIL, "Failed to %s EVPN %s route in VRF %s", install ? "install" @@ -3038,7 +3038,7 @@ static int install_uninstall_routes_for_vni(struct bgp *bgp, bgp, vpn, evp, ri); if (ret) { - zlog_ferr( + flog_err( BGP_ERR_EVPN_FAIL, "%u: Failed to %s EVPN %s route in VNI %u", bgp->vrf_id, @@ -3141,7 +3141,7 @@ static int install_uninstall_route_in_es(struct bgp *bgp, struct evpnes *es, ret = uninstall_evpn_route_entry_in_es(bgp, es, evp, ri); if (ret) { - zlog_ferr( + flog_err( BGP_ERR_EVPN_FAIL, "%u: Failed to %s EVPN %s route in ESI %s", bgp->vrf_id, install ? "install" : "uninstall", "ES", @@ -3184,7 +3184,7 @@ static int install_uninstall_route_in_vrfs(struct bgp *bgp_def, afi_t afi, ri); if (ret) { - zlog_ferr(BGP_ERR_EVPN_FAIL, + flog_err(BGP_ERR_EVPN_FAIL, "%u: Failed to %s prefix %s in VRF %s", bgp_def->vrf_id, install ? "install" : "uninstall", @@ -3220,7 +3220,7 @@ static int install_uninstall_route_in_vnis(struct bgp *bgp, afi_t afi, ret = uninstall_evpn_route_entry(bgp, vpn, evp, ri); if (ret) { - zlog_ferr( + flog_err( BGP_ERR_EVPN_FAIL, "%u: Failed to %s EVPN %s route in VNI %u", bgp->vrf_id, install ? "install" : "uninstall", @@ -3606,7 +3606,7 @@ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi, */ if (psize != 33 && psize != 37 && psize != 49 && psize != 36 && psize != 40 && psize != 52) { - zlog_ferr(BGP_ERR_EVPN_ROUTE_INVALID, + flog_err(BGP_ERR_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-2 NLRI with invalid length %d", peer->bgp->vrf_id, peer->host, psize); return -1; @@ -3643,7 +3643,7 @@ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi, memcpy(&p.prefix.macip_addr.mac.octet, pfx, ETH_ALEN); pfx += ETH_ALEN; } else { - zlog_ferr( + flog_err( BGP_ERR_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-2 NLRI with unsupported MAC address length %d", peer->bgp->vrf_id, peer->host, macaddr_len); @@ -3655,7 +3655,7 @@ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi, ipaddr_len = *pfx++; if (ipaddr_len != 0 && ipaddr_len != IPV4_MAX_BITLEN && ipaddr_len != IPV6_MAX_BITLEN) { - zlog_ferr( + flog_err( BGP_ERR_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-2 NLRI with unsupported IP address length %d", peer->bgp->vrf_id, peer->host, ipaddr_len); @@ -3717,7 +3717,7 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi, * IP len (1) and IP (4 or 16). */ if (psize != 17 && psize != 29) { - zlog_ferr(BGP_ERR_EVPN_ROUTE_INVALID, + flog_err(BGP_ERR_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-3 NLRI with invalid length %d", peer->bgp->vrf_id, peer->host, psize); return -1; @@ -3759,7 +3759,7 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi, p.prefix.imet_addr.ip.ipa_type = IPADDR_V4; memcpy(&p.prefix.imet_addr.ip.ip.addr, pfx, IPV4_MAX_BYTELEN); } else { - zlog_ferr( + flog_err( BGP_ERR_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-3 NLRI with unsupported IP address length %d", peer->bgp->vrf_id, peer->host, ipaddr_len); @@ -3796,7 +3796,7 @@ static int process_type4_route(struct peer *peer, afi_t afi, safi_t safi, * RD (8), ESI (10), ip-len (1), ip (4 or 16) */ if (psize != 23 && psize != 35) { - zlog_ferr(BGP_ERR_EVPN_ROUTE_INVALID, + flog_err(BGP_ERR_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-4 NLRI with invalid length %d", peer->bgp->vrf_id, peer->host, psize); return -1; @@ -3818,7 +3818,7 @@ static int process_type4_route(struct peer *peer, afi_t afi, safi_t safi, if (ipaddr_len == IPV4_MAX_BITLEN) { memcpy(&vtep_ip, pfx, IPV4_MAX_BYTELEN); } else { - zlog_ferr( + flog_err( BGP_ERR_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-4 NLRI with unsupported IP address length %d", peer->bgp->vrf_id, peer->host, ipaddr_len); @@ -3861,7 +3861,7 @@ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi, * Note that the IP and GW should both be IPv4 or both IPv6. */ if (psize != 34 && psize != 58) { - zlog_ferr(BGP_ERR_EVPN_ROUTE_INVALID, + flog_err(BGP_ERR_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-5 NLRI with invalid length %d", peer->bgp->vrf_id, peer->host, psize); return -1; @@ -3894,7 +3894,7 @@ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi, /* Fetch IP prefix length. */ ippfx_len = *pfx++; if (ippfx_len > IPV6_MAX_BITLEN) { - zlog_ferr( + flog_err( BGP_ERR_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-5 NLRI with invalid IP Prefix length %d", peer->bgp->vrf_id, peer->host, ippfx_len); @@ -4127,7 +4127,7 @@ void bgp_evpn_withdraw_type5_route(struct bgp *bgp_vrf, struct prefix *p, build_type5_prefix_from_ip_prefix(&evp, p); ret = delete_evpn_type5_route(bgp_vrf, &evp); if (ret) { - zlog_ferr( + flog_err( BGP_ERR_EVPN_ROUTE_DELETE, "%u failed to delete type-5 route for prefix %s in vrf %s", bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf)), @@ -4174,7 +4174,7 @@ void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf, struct prefix *p, build_type5_prefix_from_ip_prefix(&evp, p); ret = update_evpn_type5_route(bgp_vrf, &evp, src_attr); if (ret) - zlog_ferr(BGP_ERR_EVPN_ROUTE_CREATE, + flog_err(BGP_ERR_EVPN_ROUTE_CREATE, "%u: Failed to create type-5 route for prefix %s", bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf))); } @@ -4734,7 +4734,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr, if (process_type2_route(peer, afi, safi, withdraw ? NULL : attr, pnt, psize, addpath_id)) { - zlog_ferr( + flog_err( BGP_ERR_EVPN_FAIL, "%u:%s - Error in processing EVPN type-2 NLRI size %d", peer->bgp->vrf_id, peer->host, psize); @@ -4746,7 +4746,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr, if (process_type3_route(peer, afi, safi, withdraw ? NULL : attr, pnt, psize, addpath_id)) { - zlog_ferr( + flog_err( BGP_ERR_PKT_PROCESS, "%u:%s - Error in processing EVPN type-3 NLRI size %d", peer->bgp->vrf_id, peer->host, psize); @@ -4758,7 +4758,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr, if (process_type4_route(peer, afi, safi, withdraw ? NULL : attr, pnt, psize, addpath_id)) { - zlog_ferr( + flog_err( BGP_ERR_PKT_PROCESS, "%u:%s - Error in processing EVPN type-4 NLRI size %d", peer->bgp->vrf_id, peer->host, psize); @@ -4769,7 +4769,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr, case BGP_EVPN_IP_PREFIX_ROUTE: if (process_type5_route(peer, afi, safi, attr, pnt, psize, addpath_id, withdraw)) { - zlog_ferr( + flog_err( BGP_ERR_PKT_PROCESS, "%u:%s - Error in processing EVPN type-5 NLRI size %d", peer->bgp->vrf_id, peer->host, psize); @@ -5233,7 +5233,7 @@ int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni, struct ethaddr *mac, char buf[ETHER_ADDR_STRLEN]; char buf2[INET6_ADDRSTRLEN]; - zlog_ferr( + flog_err( BGP_ERR_EVPN_ROUTE_CREATE, "%u:Failed to create Type-2 route, VNI %u %s MAC %s IP %s (flags: 0x%x)", bgp->vrf_id, vpn->vni, @@ -5276,7 +5276,7 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, struct ethaddr *rmac, */ bgp_def = bgp_get_default(); if (!bgp_def) { - zlog_ferr( + flog_err( BGP_ERR_NO_DFLT, "Cannot process L3VNI %u ADD - default BGP instance not yet created", l3vni); @@ -5294,15 +5294,15 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, struct ethaddr *rmac, BGP_INSTANCE_TYPE_VRF); switch (ret) { case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: - zlog_ferr(BGP_ERR_MULTI_INSTANCE, + flog_err(BGP_ERR_MULTI_INSTANCE, "'bgp multiple-instance' not present\n"); return -1; case BGP_ERR_AS_MISMATCH: - zlog_ferr(BGP_ERR_EVPN_AS_MISMATCH, + flog_err(BGP_ERR_EVPN_AS_MISMATCH, "BGP is already running; AS is %u\n", as); return -1; case BGP_ERR_INSTANCE_MISMATCH: - zlog_ferr(BGP_ERR_EVPN_INSTANCE_MISMATCH, + flog_err(BGP_ERR_EVPN_INSTANCE_MISMATCH, "BGP instance name and AS number mismatch\n"); return -1; } @@ -5364,7 +5364,7 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id) bgp_vrf = bgp_lookup_by_vrf_id(vrf_id); if (!bgp_vrf) { - zlog_ferr( + flog_err( BGP_ERR_NO_DFLT, "Cannot process L3VNI %u Del - Could not find BGP instance", l3vni); @@ -5373,7 +5373,7 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id) bgp_def = bgp_get_default(); if (!bgp_def) { - zlog_ferr( + flog_err( BGP_ERR_NO_DFLT, "Cannot process L3VNI %u Del - Could not find default BGP instance", l3vni); @@ -5504,7 +5504,7 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni, if (!vpn) { vpn = bgp_evpn_new(bgp, vni, originator_ip, tenant_vrf_id); if (!vpn) { - zlog_ferr( + flog_err( BGP_ERR_VNI, "%u: Failed to allocate VNI entry for VNI %u - at Add", bgp->vrf_id, vni); @@ -5528,7 +5528,7 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni, /* Create EVPN type-3 route and schedule for processing. */ build_evpn_type3_prefix(&p, vpn->originator_ip); if (update_evpn_route(bgp, vpn, &p, 0)) { - zlog_ferr(BGP_ERR_EVPN_ROUTE_CREATE, + flog_err(BGP_ERR_EVPN_ROUTE_CREATE, "%u: Type3 route creation failure for VNI %u", bgp->vrf_id, vni); return -1; @@ -5558,7 +5558,7 @@ int bgp_evpn_local_es_del(struct bgp *bgp, struct evpnes *es = NULL; if (!bgp->esihash) { - zlog_ferr(BGP_ERR_ES_CREATE, "%u: ESI hash not yet created", + flog_err(BGP_ERR_ES_CREATE, "%u: ESI hash not yet created", bgp->vrf_id); return -1; } @@ -5595,7 +5595,7 @@ int bgp_evpn_local_es_add(struct bgp *bgp, struct prefix_evpn p; if (!bgp->esihash) { - zlog_ferr(BGP_ERR_ES_CREATE, "%u: ESI hash not yet created", + flog_err(BGP_ERR_ES_CREATE, "%u: ESI hash not yet created", bgp->vrf_id); return -1; } @@ -5605,7 +5605,7 @@ int bgp_evpn_local_es_add(struct bgp *bgp, if (!es) { es = bgp_evpn_es_new(bgp, esi, originator_ip); if (!es) { - zlog_ferr( + flog_err( BGP_ERR_ES_CREATE, "%u: Failed to allocate ES entry for ESI %s - at Local ES Add", bgp->vrf_id, esi_to_str(esi, buf, sizeof(buf))); @@ -5617,7 +5617,7 @@ int bgp_evpn_local_es_add(struct bgp *bgp, build_evpn_type4_prefix(&p, esi, originator_ip->ipaddr_v4); if (update_evpn_type4_route(bgp, es, &p)) { - zlog_ferr(BGP_ERR_EVPN_ROUTE_CREATE, + flog_err(BGP_ERR_EVPN_ROUTE_CREATE, "%u: Type4 route creation failure for ESI %s", bgp->vrf_id, esi_to_str(esi, buf, sizeof(buf))); return -1; diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index d88359849..3828ce216 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -1893,7 +1893,7 @@ static struct bgpevpn *evpn_create_update_vni(struct bgp *bgp, vni_t vni) */ vpn = bgp_evpn_new(bgp, vni, bgp->router_id, 0); if (!vpn) { - zlog_ferr( + flog_err( BGP_ERR_VNI, "%u: Failed to allocate VNI entry for VNI %u - at Config", bgp->vrf_id, vni); diff --git a/bgpd/bgp_flowspec.c b/bgpd/bgp_flowspec.c index b586e86a2..6695596c6 100644 --- a/bgpd/bgp_flowspec.c +++ b/bgpd/bgp_flowspec.c @@ -104,13 +104,13 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr, safi = packet->safi; if (afi == AFI_IP6) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "BGP flowspec IPv6 not supported"); return -1; } if (packet->length >= FLOWSPEC_NLRI_SIZELIMIT) { - zlog_ferr(BGP_ERR_FLOWSPEC_PACKET, + flog_err(BGP_ERR_FLOWSPEC_PACKET, "BGP flowspec nlri length maximum reached (%u)", packet->length); return -1; @@ -128,13 +128,13 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr, /* When packet overflow occur return immediately. */ if (pnt + psize > lim) { - zlog_ferr(BGP_ERR_FLOWSPEC_PACKET, + flog_err(BGP_ERR_FLOWSPEC_PACKET, "Flowspec NLRI length inconsistent ( size %u seen)", psize); return -1; } if (bgp_fs_nlri_validate(pnt, psize) < 0) { - zlog_ferr(BGP_ERR_FLOWSPEC_PACKET, + flog_err(BGP_ERR_FLOWSPEC_PACKET, "Bad flowspec format or NLRI options not supported"); return -1; } @@ -188,7 +188,7 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL, NULL, 0, NULL); if (ret) { - zlog_ferr(BGP_ERR_FLOWSPEC_INSTALLATION, + flog_err(BGP_ERR_FLOWSPEC_INSTALLATION, "Flowspec NLRI failed to be %s.", attr ? "added" : "withdrawn"); return -1; diff --git a/bgpd/bgp_flowspec_util.c b/bgpd/bgp_flowspec_util.c index c7432773b..9f92a3c3a 100644 --- a/bgpd/bgp_flowspec_util.c +++ b/bgpd/bgp_flowspec_util.c @@ -68,7 +68,7 @@ static int bgp_flowspec_call_non_opaque_decode(uint8_t *nlri_content, int len, len, mval, error); if (*error < 0) - zlog_ferr(BGP_ERR_FLOWSPEC_PACKET, + flog_err(BGP_ERR_FLOWSPEC_PACKET, "%s: flowspec_op_decode error %d", __func__, *error); else @@ -447,7 +447,7 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len, len - offset, prefix, &error); if (error < 0) - zlog_ferr(BGP_ERR_FLOWSPEC_PACKET, + flog_err(BGP_ERR_FLOWSPEC_PACKET, "%s: flowspec_ip_address error %d", __func__, error); else @@ -542,7 +542,7 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len, len - offset, &bpem->tcpflags, &error); if (error < 0) - zlog_ferr(BGP_ERR_FLOWSPEC_PACKET, + flog_err(BGP_ERR_FLOWSPEC_PACKET, "%s: flowspec_tcpflags_decode error %d", __func__, error); else @@ -557,7 +557,7 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len, len - offset, &bpem->fragment, &error); if (error < 0) - zlog_ferr(BGP_ERR_FLOWSPEC_PACKET, + flog_err(BGP_ERR_FLOWSPEC_PACKET, "%s: flowspec_fragment_type_decode error %d", __func__, error); else @@ -565,7 +565,7 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len, offset += ret; break; default: - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: unknown type %d\n", + flog_err(LIB_ERR_DEVELOPMENT, "%s: unknown type %d\n", __func__, type); } } diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index e12bf2792..d90e6983a 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -166,7 +166,7 @@ static struct peer *peer_xfer_conn(struct peer *from_peer) * runs in our pthread. */ if (peer->curr) { - zlog_ferr( + flog_err( BGP_ERR_PKT_PROCESS, "[%s] Dropping pending packet on connection transfer:", peer->host); @@ -245,7 +245,7 @@ static struct peer *peer_xfer_conn(struct peer *from_peer) } if (bgp_getsockname(peer) < 0) { - zlog_ferr( + flog_err( LIB_ERR_SOCKET, "%%bgp_getsockname() failed for %s peer %s fd %d (from_peer fd %d)", (CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER) @@ -258,7 +258,7 @@ static struct peer *peer_xfer_conn(struct peer *from_peer) } if (from_peer->status > Active) { if (bgp_getsockname(from_peer) < 0) { - zlog_ferr( + flog_err( LIB_ERR_SOCKET, "%%bgp_getsockname() failed for %s from_peer %s fd %d (peer fd %d)", @@ -1286,7 +1286,7 @@ static int bgp_connect_check(struct thread *thread) static int bgp_connect_success(struct peer *peer) { if (peer->fd < 0) { - zlog_ferr(BGP_ERR_CONNECT, + flog_err(BGP_ERR_CONNECT, "bgp_connect_success peer's fd is negative value %d", peer->fd); bgp_stop(peer); @@ -1294,7 +1294,7 @@ static int bgp_connect_success(struct peer *peer) } if (bgp_getsockname(peer) < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: bgp_getsockname(): failed for peer %s, fd %d", __FUNCTION__, peer->host, peer->fd); bgp_notify_send(peer, BGP_NOTIFY_FSM_ERR, @@ -1354,7 +1354,7 @@ int bgp_start(struct peer *peer) if (BGP_PEER_START_SUPPRESSED(peer)) { if (bgp_debug_neighbor_events(peer)) - zlog_ferr(BGP_ERR_FSM, + flog_err(BGP_ERR_FSM, "%s [FSM] Trying to start suppressed peer" " - this is never supposed to happen!", peer->host); @@ -1389,7 +1389,7 @@ int bgp_start(struct peer *peer) if (peer->bgp->vrf_id == VRF_UNKNOWN) { if (bgp_debug_neighbor_events(peer)) - zlog_ferr( + flog_err( BGP_ERR_FSM, "%s [FSM] In a VRF that is not initialised yet", peer->host); @@ -1444,7 +1444,7 @@ int bgp_start(struct peer *peer) "%s [FSM] Non blocking connect waiting result, fd %d", peer->host, peer->fd); if (peer->fd < 0) { - zlog_ferr(BGP_ERR_FSM, + flog_err(BGP_ERR_FSM, "bgp_start peer's fd is negative value %d", peer->fd); return -1; @@ -1492,7 +1492,7 @@ static int bgp_fsm_open(struct peer *peer) peer and change to Idle status. */ static int bgp_fsm_event_error(struct peer *peer) { - zlog_ferr(BGP_ERR_FSM, + flog_err(BGP_ERR_FSM, "%s [FSM] unexpected packet received in state %s", peer->host, lookup_msg(bgp_status_msg, peer->status, NULL)); @@ -1526,7 +1526,7 @@ static int bgp_establish(struct peer *peer) other = peer->doppelganger; peer = peer_xfer_conn(peer); if (!peer) { - zlog_ferr(BGP_ERR_CONNECT, "%%Neighbor failed in xfer_conn"); + flog_err(BGP_ERR_CONNECT, "%%Neighbor failed in xfer_conn"); return -1; } @@ -1685,7 +1685,7 @@ static int bgp_fsm_update(struct peer *peer) /* This is empty event. */ static int bgp_ignore(struct peer *peer) { - zlog_ferr( + flog_err( BGP_ERR_FSM, "%s [FSM] Ignoring event %s in state %s, prior events %s, %s, fd %d", peer->host, bgp_event_str[peer->cur_event], @@ -1698,7 +1698,7 @@ static int bgp_ignore(struct peer *peer) /* This is to handle unexpected events.. */ static int bgp_fsm_exeption(struct peer *peer) { - zlog_ferr( + flog_err( BGP_ERR_FSM, "%s [FSM] Unexpected event %s in state %s, prior events %s, %s, fd %d", peer->host, bgp_event_str[peer->cur_event], @@ -1973,7 +1973,7 @@ int bgp_event_update(struct peer *peer, int event) * code. */ if (!dyn_nbr && !passive_conn && peer->bgp) { - zlog_ferr( + flog_err( BGP_ERR_FSM, "%s [FSM] Failure handling event %s in state %s, " "prior events %s, %s, fd %d", diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 87ba4af01..311f98001 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -402,7 +402,7 @@ static uint16_t bgp_read(struct peer *peer) SET_FLAG(status, BGP_IO_TRANS_ERR); /* Fatal error; tear down session */ } else if (nbytes < 0) { - zlog_ferr(BGP_ERR_UPDATE_RCV, + flog_err(BGP_ERR_UPDATE_RCV, "%s [Error] bgp_read_packet error: %s", peer->host, safe_strerror(errno)); diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c index 6969c262a..633e58933 100644 --- a/bgpd/bgp_label.c +++ b/bgpd/bgp_label.c @@ -245,7 +245,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, /* sanity check against packet data */ if ((pnt + psize) > lim) { - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error / L-U (prefix length %d exceeds packet size %u)", peer->host, prefixlen, (uint)(lim - pnt)); @@ -258,7 +258,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, /* There needs to be at least one label */ if (prefixlen < 24) { - zlog_ferr(BGP_ERR_UPDATE_RCV, + flog_err(BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error" " (wrong label length %d)", peer->host, prefixlen); @@ -286,7 +286,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, * be logged locally, and the prefix SHOULD be * ignored. */ - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s: IPv4 labeled-unicast NLRI is multicast address %s, ignoring", peer->host, inet_ntoa(p.u.prefix4)); @@ -299,7 +299,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, if (IN6_IS_ADDR_LINKLOCAL(&p.u.prefix6)) { char buf[BUFSIZ]; - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s: IPv6 labeled-unicast NLRI is link-local address %s, ignoring", peer->host, @@ -312,7 +312,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, if (IN6_IS_ADDR_MULTICAST(&p.u.prefix6)) { char buf[BUFSIZ]; - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s: IPv6 unicast NLRI is multicast address %s, ignoring", peer->host, @@ -336,7 +336,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, /* Packet length consistency check. */ if (pnt != lim) { - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error / L-U (%zu data remaining after parsing)", peer->host, lim - pnt); diff --git a/bgpd/bgp_labelpool.c b/bgpd/bgp_labelpool.c index dd3b8d5b8..8d15649ea 100644 --- a/bgpd/bgp_labelpool.c +++ b/bgpd/bgp_labelpool.c @@ -127,7 +127,7 @@ static wq_item_status lp_cbq_docallback(struct work_queue *wq, void *data) if (lcbq->label == MPLS_LABEL_NONE) { /* shouldn't happen */ - zlog_ferr(BGP_ERR_LABEL, "%s: error: label==MPLS_LABEL_NONE", + flog_err(BGP_ERR_LABEL, "%s: error: label==MPLS_LABEL_NONE", __func__); return WQ_SUCCESS; } @@ -338,7 +338,7 @@ void bgp_lp_get( if (rc) { /* shouldn't happen */ - zlog_ferr(BGP_ERR_LABEL, + flog_err(BGP_ERR_LABEL, "%s: can't insert new LCB into ledger list", __func__); XFREE(MTYPE_BGP_LABEL_CB, lcb); @@ -427,7 +427,7 @@ void bgp_lp_event_chunk(uint8_t keep, uint32_t first, uint32_t last) struct lp_fifo *lf; if (last < first) { - zlog_ferr(BGP_ERR_LABEL, + flog_err(BGP_ERR_LABEL, "%s: zebra label chunk invalid: first=%u, last=%u", __func__, first, last); return; diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index f7cb2dae3..8eb1c9e25 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -386,7 +386,7 @@ int main(int argc, char **argv) multipath_num = atoi(optarg); if (multipath_num > MULTIPATH_NUM || multipath_num <= 0) { - zlog_ferr( + flog_err( BGP_ERR_MULTIPATH, "Multipath Number specified must be less than %d and greater than 0", MULTIPATH_NUM); diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 6c26ba782..c2cb20b06 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -151,7 +151,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, psize = PSIZE(prefixlen); if (prefixlen < VPN_PREFIXLEN_MIN_BYTES * 8) { - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error / VPN (prefix length %d less than VPN min length)", peer->host, prefixlen); @@ -160,7 +160,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, /* sanity check against packet data */ if ((pnt + psize) > lim) { - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error / VPN (prefix length %d exceeds packet size %u)", peer->host, prefixlen, (uint)(lim - pnt)); @@ -169,7 +169,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, /* sanity check against storage for the IP address portion */ if ((psize - VPN_PREFIXLEN_MIN_BYTES) > (ssize_t)sizeof(p.u)) { - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error / VPN (psize %d exceeds storage size %zu)", peer->host, @@ -180,7 +180,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, /* Sanity check against max bitlen of the address family */ if ((psize - VPN_PREFIXLEN_MIN_BYTES) > prefix_blen(&p)) { - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error / VPN (psize %d exceeds family (%u) max byte len %u)", peer->host, @@ -218,7 +218,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, #endif default: - zlog_ferr(BGP_ERR_UPDATE_RCV, "Unknown RD type %d", + flog_err(BGP_ERR_UPDATE_RCV, "Unknown RD type %d", type); break; /* just report */ } @@ -241,7 +241,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, } /* Packet length consistency check. */ if (pnt != lim) { - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error / VPN (%zu data remaining after parsing)", peer->host, lim - pnt); @@ -366,7 +366,7 @@ int vpn_leak_label_callback( return 0; } /* Shouldn't happen: different label allocation */ - zlog_ferr(BGP_ERR_LABEL, + flog_err(BGP_ERR_LABEL, "%s: %s had label %u but got new assignment %u", __func__, vp->bgp->name_pretty, vp->tovpn_label, label); diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 5b830a23a..db50ae828 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -98,7 +98,7 @@ static int bgp_md5_set_connect(int socket, union sockunion *su, #if HAVE_DECL_TCP_MD5SIG if (bgpd_privs.change(ZPRIVS_RAISE)) { - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not raise privs", __func__); return ret; } @@ -106,7 +106,7 @@ static int bgp_md5_set_connect(int socket, union sockunion *su, ret = bgp_md5_set_socket(socket, su, password); if (bgpd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not lower privs", __func__); #endif /* HAVE_TCP_MD5SIG */ @@ -120,7 +120,7 @@ static int bgp_md5_set_password(struct peer *peer, const char *password) struct bgp_listener *listener; if (bgpd_privs.change(ZPRIVS_RAISE)) { - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not raise privs", __func__); return -1; } @@ -137,7 +137,7 @@ static int bgp_md5_set_password(struct peer *peer, const char *password) } if (bgpd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not lower privs", __func__); return ret; @@ -164,7 +164,7 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock) if (!peer->gtsm_hops && (peer_sort(peer) == BGP_PEER_EBGP)) { ret = sockopt_ttl(peer->su.sa.sa_family, bgp_sock, peer->ttl); if (ret) { - zlog_ferr( + flog_err( LIB_ERR_SOCKET, "%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d", __func__, @@ -180,7 +180,7 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock) */ ret = sockopt_ttl(peer->su.sa.sa_family, bgp_sock, MAXTTL); if (ret) { - zlog_ferr( + flog_err( LIB_ERR_SOCKET, "%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d", __func__, @@ -192,7 +192,7 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock) ret = sockopt_minttl(peer->su.sa.sa_family, bgp_sock, MAXTTL + 1 - peer->gtsm_hops); if (ret) { - zlog_ferr( + flog_err( LIB_ERR_SOCKET, "%s: Can't set MinTTL on peer (rtrid %s) socket, err = %d", __func__, @@ -238,7 +238,7 @@ static int bgp_get_instance_for_inc_conn(int sock, struct bgp **bgp_inst) rc = getsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, name, &name_len); if (rc != 0) { #if defined(HAVE_CUMULUS) - zlog_ferr( + flog_err( LIB_ERR_SOCKET, "[Error] BGP SO_BINDTODEVICE get failed (%s), sock %d", safe_strerror(errno), sock); @@ -296,7 +296,7 @@ static int bgp_accept(struct thread *thread) /* Register accept thread. */ accept_sock = THREAD_FD(thread); if (accept_sock < 0) { - zlog_ferr(LIB_ERR_SOCKET, "accept_sock is nevative value %d", + flog_err(LIB_ERR_SOCKET, "accept_sock is nevative value %d", accept_sock); return -1; } @@ -308,7 +308,7 @@ static int bgp_accept(struct thread *thread) /* Accept client connection. */ bgp_sock = sockunion_accept(accept_sock, &su); if (bgp_sock < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "[Error] BGP socket accept failed (%s)", safe_strerror(errno)); return -1; @@ -560,12 +560,12 @@ int bgp_connect(struct peer *peer) return 0; } if (bgpd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); /* Make socket for the peer. */ peer->fd = vrf_sockunion_socket(&peer->su, peer->bgp->vrf_id, bgp_get_bound_name(peer)); if (bgpd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (peer->fd < 0) return -1; @@ -585,14 +585,14 @@ int bgp_connect(struct peer *peer) #ifdef IPTOS_PREC_INTERNETCONTROL if (bgpd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not raise privs", __func__); if (sockunion_family(&peer->su) == AF_INET) setsockopt_ipv4_tos(peer->fd, IPTOS_PREC_INTERNETCONTROL); else if (sockunion_family(&peer->su) == AF_INET6) setsockopt_ipv6_tclass(peer->fd, IPTOS_PREC_INTERNETCONTROL); if (bgpd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not lower privs", __func__); #endif @@ -641,7 +641,7 @@ int bgp_getsockname(struct peer *peer) if (bgp_nexthop_set(peer->su_local, peer->su_remote, &peer->nexthop, peer)) { #if defined(HAVE_CUMULUS) - zlog_ferr( + flog_err( BGP_ERR_NH_UPD, "%s: nexthop_set failed, resetting connection - intf %p", peer->host, peer->nexthop.ifp); @@ -662,7 +662,7 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen, sockopt_reuseport(sock); if (bgpd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not raise privs", __func__); #ifdef IPTOS_PREC_INTERNETCONTROL @@ -677,17 +677,17 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen, ret = bind(sock, sa, salen); en = errno; if (bgpd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not lower privs", __func__); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, "bind: %s", safe_strerror(en)); + flog_err(LIB_ERR_SOCKET, "bind: %s", safe_strerror(en)); return ret; } ret = listen(sock, SOMAXCONN); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, "listen: %s", safe_strerror(errno)); + flog_err(LIB_ERR_SOCKET, "listen: %s", safe_strerror(errno)); return ret; } @@ -724,13 +724,13 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address) port_str[sizeof(port_str) - 1] = '\0'; if (bgpd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); ret = vrf_getaddrinfo(address, port_str, &req, &ainfo_save, bgp->vrf_id); if (bgpd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (ret != 0) { - zlog_ferr(LIB_ERR_SOCKET, "getaddrinfo: %s", gai_strerror(ret)); + flog_err(LIB_ERR_SOCKET, "getaddrinfo: %s", gai_strerror(ret)); return -1; } @@ -742,15 +742,15 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address) continue; if (bgpd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); sock = vrf_socket(ainfo->ai_family, ainfo->ai_socktype, ainfo->ai_protocol, bgp->vrf_id, (bgp->inst_type == BGP_INSTANCE_TYPE_VRF ? bgp->name : NULL)); if (bgpd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (sock < 0) { - zlog_ferr(LIB_ERR_SOCKET, "socket: %s", + flog_err(LIB_ERR_SOCKET, "socket: %s", safe_strerror(errno)); continue; } @@ -768,11 +768,11 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address) } freeaddrinfo(ainfo_save); if (count == 0 && bgp->inst_type != BGP_INSTANCE_TYPE_VRF) { - zlog_ferr( + flog_err( LIB_ERR_SOCKET, "%s: no usable addresses please check other programs usage of specified port %d", __func__, port); - zlog_ferr(LIB_ERR_SOCKET, "%s: Program cannot continue", + flog_err(LIB_ERR_SOCKET, "%s: Program cannot continue", __func__); exit(-1); } diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index d8d337930..0c0c07995 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -344,7 +344,7 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id) bgp = bgp_lookup_by_vrf_id(vrf_id); if (!bgp) { - zlog_ferr( + flog_err( BGP_ERR_NH_UPD, "parse nexthop update: instance not found for vrf_id %u", vrf_id); diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index af3275d3e..7fbc03024 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -521,7 +521,7 @@ static as_t bgp_capability_as4(struct peer *peer, struct capability_header *hdr) SET_FLAG(peer->cap, PEER_CAP_AS4_RCV); if (hdr->length != CAPABILITY_CODE_AS4_LEN) { - zlog_ferr(BGP_ERR_PKT_OPEN, + flog_err(BGP_ERR_PKT_OPEN, "%s AS4 capability has incorrect data length %d", peer->host, hdr->length); return 0; @@ -1186,7 +1186,7 @@ int bgp_open_option_parse(struct peer *peer, uint8_t length, int *mp_capability) && !peer->afc_nego[AFI_IP6][SAFI_ENCAP] && !peer->afc_nego[AFI_IP6][SAFI_FLOWSPEC] && !peer->afc_nego[AFI_L2VPN][SAFI_EVPN]) { - zlog_ferr(BGP_ERR_PKT_OPEN, + flog_err(BGP_ERR_PKT_OPEN, "%s [Error] Configured AFI/SAFIs do not " "overlap with received MP capabilities", peer->host); diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 0e02baa26..3c49b9692 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -1091,7 +1091,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) /* Just in case we have a silly peer who sends AS4 capability set to 0 */ if (CHECK_FLAG(peer->cap, PEER_CAP_AS4_RCV) && !as4) { - zlog_ferr(BGP_ERR_PKT_OPEN, + flog_err(BGP_ERR_PKT_OPEN, "%s bad OPEN, got AS4 capability, but AS4 set to 0", peer->host); bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR, @@ -1106,7 +1106,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) * BGP_AS_TRANS, for some unknown reason. */ if (as4 == BGP_AS_TRANS) { - zlog_ferr( + flog_err( BGP_ERR_PKT_OPEN, "%s [AS4] NEW speaker using AS_TRANS for AS4, not allowed", peer->host); @@ -1136,7 +1136,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) if (CHECK_FLAG(peer->cap, PEER_CAP_AS4_RCV) && as4 != remote_as) { /* raise error, log this, close session */ - zlog_ferr( + flog_err( BGP_ERR_PKT_OPEN, "%s bad OPEN, got AS4 capability, but remote_as %u" " mismatch with 16bit 'myasn' %u in open", @@ -1304,7 +1304,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) /* Get sockname. */ if ((ret = bgp_getsockname(peer)) < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: bgp_getsockname() failed for peer: %s", __FUNCTION__, peer->host); return BGP_Stop; @@ -1319,7 +1319,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) || peer->afc_nego[AFI_IP][SAFI_ENCAP]) { if (!peer->nexthop.v4.s_addr) { #if defined(HAVE_CUMULUS) - zlog_ferr( + flog_err( BGP_ERR_SND_FAIL, "%s: No local IPv4 addr resetting connection, fd %d", peer->host, peer->fd); @@ -1336,7 +1336,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) || peer->afc_nego[AFI_IP6][SAFI_ENCAP]) { if (IN6_IS_ADDR_UNSPECIFIED(&peer->nexthop.v6_global)) { #if defined(HAVE_CUMULUS) - zlog_ferr( + flog_err( BGP_ERR_SND_FAIL, "%s: No local IPv6 addr resetting connection, fd %d", peer->host, peer->fd); @@ -1399,7 +1399,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) /* Status must be Established. */ if (peer->status != Established) { - zlog_ferr(BGP_ERR_INVALID_STATUS, + flog_err(BGP_ERR_INVALID_STATUS, "%s [FSM] Update packet received under status %s", peer->host, lookup_msg(bgp_status_msg, peer->status, NULL)); @@ -1423,7 +1423,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) Attribute Length + 23 exceeds the message Length), then the Error Subcode is set to Malformed Attribute List. */ if (stream_pnt(s) + 2 > end) { - zlog_ferr(BGP_ERR_UPDATE_RCV, + flog_err(BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error" " (packet length is short for unfeasible length)", peer->host); @@ -1437,7 +1437,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) /* Unfeasible Route Length check. */ if (stream_pnt(s) + withdraw_len > end) { - zlog_ferr(BGP_ERR_UPDATE_RCV, + flog_err(BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error" " (packet unfeasible length overflow %d)", peer->host, withdraw_len); @@ -1511,7 +1511,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) ret = bgp_dump_attr(&attr, peer->rcvd_attr_str, BUFSIZ); if (attr_parse_ret == BGP_ATTR_PARSE_WITHDRAW) - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s rcvd UPDATE with errors in attr(s)!! Withdrawing route.", peer->host); @@ -1572,7 +1572,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) } if (nlri_ret < 0) { - zlog_ferr(BGP_ERR_UPDATE_RCV, + flog_err(BGP_ERR_UPDATE_RCV, "%s [Error] Error parsing NLRI", peer->host); if (peer->status == Established) bgp_notify_send( @@ -1744,7 +1744,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size) /* If peer does not have the capability, send notification. */ if (!CHECK_FLAG(peer->cap, PEER_CAP_REFRESH_ADV)) { - zlog_ferr(BGP_ERR_NO_CAP, + flog_err(BGP_ERR_NO_CAP, "%s [Error] BGP route refresh is not enabled", peer->host); bgp_notify_send(peer, BGP_NOTIFY_HEADER_ERR, @@ -1754,7 +1754,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size) /* Status must be Established. */ if (peer->status != Established) { - zlog_ferr( + flog_err( BGP_ERR_INVALID_STATUS, "%s [Error] Route refresh packet received under status %s", peer->host, @@ -2135,7 +2135,7 @@ int bgp_capability_receive(struct peer *peer, bgp_size_t size) /* If peer does not have the capability, send notification. */ if (!CHECK_FLAG(peer->cap, PEER_CAP_DYNAMIC_ADV)) { - zlog_ferr(BGP_ERR_NO_CAP, + flog_err(BGP_ERR_NO_CAP, "%s [Error] BGP dynamic capability is not enabled", peer->host); bgp_notify_send(peer, BGP_NOTIFY_HEADER_ERR, @@ -2145,7 +2145,7 @@ int bgp_capability_receive(struct peer *peer, bgp_size_t size) /* Status must be Established. */ if (peer->status != Established) { - zlog_ferr( + flog_err( BGP_ERR_NO_CAP, "%s [Error] Dynamic capability packet received under status %s", peer->host, @@ -2227,7 +2227,7 @@ int bgp_process_packet(struct thread *thread) memory_order_relaxed); mprc = bgp_open_receive(peer, size); if (mprc == BGP_Stop) - zlog_ferr( + flog_err( BGP_ERR_PKT_OPEN, "%s: BGP OPEN receipt failed for peer: %s", __FUNCTION__, peer->host); @@ -2238,7 +2238,7 @@ int bgp_process_packet(struct thread *thread) peer->readtime = monotime(NULL); mprc = bgp_update_receive(peer, size); if (mprc == BGP_Stop) - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s: BGP UPDATE receipt failed for peer: %s", __FUNCTION__, peer->host); @@ -2248,7 +2248,7 @@ int bgp_process_packet(struct thread *thread) memory_order_relaxed); mprc = bgp_notify_receive(peer, size); if (mprc == BGP_Stop) - zlog_ferr( + flog_err( BGP_ERR_NOTIFY_RCV, "%s: BGP NOTIFY receipt failed for peer: %s", __FUNCTION__, peer->host); @@ -2259,7 +2259,7 @@ int bgp_process_packet(struct thread *thread) memory_order_relaxed); mprc = bgp_keepalive_receive(peer, size); if (mprc == BGP_Stop) - zlog_ferr( + flog_err( BGP_ERR_KEEP_RCV, "%s: BGP KEEPALIVE receipt failed for peer: %s", __FUNCTION__, peer->host); @@ -2270,7 +2270,7 @@ int bgp_process_packet(struct thread *thread) memory_order_relaxed); mprc = bgp_route_refresh_receive(peer, size); if (mprc == BGP_Stop) - zlog_ferr( + flog_err( BGP_ERR_RFSH_RCV, "%s: BGP ROUTEREFRESH receipt failed for peer: %s", __FUNCTION__, peer->host); @@ -2280,7 +2280,7 @@ int bgp_process_packet(struct thread *thread) memory_order_relaxed); mprc = bgp_capability_receive(peer, size); if (mprc == BGP_Stop) - zlog_ferr( + flog_err( BGP_ERR_CAP_RCV, "%s: BGP CAPABILITY receipt failed for peer: %s", __FUNCTION__, peer->host); diff --git a/bgpd/bgp_pbr.c b/bgpd/bgp_pbr.c index fd1e209b0..129c143a6 100644 --- a/bgpd/bgp_pbr.c +++ b/bgpd/bgp_pbr.c @@ -653,7 +653,7 @@ static int bgp_pbr_build_and_validate_entry(struct prefix *p, action_count++; if (action_count > ACTIONS_MAX_NUM) { if (BGP_DEBUG(pbr, PBR_ERROR)) - zlog_ferr(BGP_ERR_FLOWSPEC_PACKET, + flog_err(BGP_ERR_FLOWSPEC_PACKET, "%s: flowspec actions exceeds limit (max %u)", __func__, action_count); break; @@ -2252,7 +2252,7 @@ void bgp_pbr_update_entry(struct bgp *bgp, struct prefix *p, if (!bgp_zebra_tm_chunk_obtained()) { if (BGP_DEBUG(pbr, PBR_ERROR)) - zlog_ferr(BGP_ERR_TABLE_CHUNK, + flog_err(BGP_ERR_TABLE_CHUNK, "%s: table chunk not obtained yet", __func__); return; @@ -2260,7 +2260,7 @@ void bgp_pbr_update_entry(struct bgp *bgp, struct prefix *p, if (bgp_pbr_build_and_validate_entry(p, info, &api) < 0) { if (BGP_DEBUG(pbr, PBR_ERROR)) - zlog_ferr(BGP_ERR_FLOWSPEC_INSTALLATION, + flog_err(BGP_ERR_FLOWSPEC_INSTALLATION, "%s: cancel updating entry %p in bgp pbr", __func__, info); return; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 1cf166607..25d2614e0 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4203,7 +4203,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, /* Prefix length check. */ if (p.prefixlen > prefix_blen(&p) * 8) { - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error (wrong prefix length %d for afi %u)", peer->host, p.prefixlen, packet->afi); @@ -4215,7 +4215,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, /* When packet overflow occur return immediately. */ if (pnt + psize > lim) { - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error (prefix length %d overflows packet)", peer->host, p.prefixlen); @@ -4225,7 +4225,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, /* Defensive coding, double-check the psize fits in a struct * prefix */ if (psize > (ssize_t)sizeof(p.u)) { - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error (prefix length %d too large for prefix storage %zu)", peer->host, p.prefixlen, sizeof(p.u)); @@ -4247,7 +4247,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, * be logged locally, and the prefix SHOULD be * ignored. */ - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s: IPv4 unicast NLRI is multicast address %s, ignoring", peer->host, inet_ntoa(p.u.prefix4)); @@ -4260,7 +4260,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, if (IN6_IS_ADDR_LINKLOCAL(&p.u.prefix6)) { char buf[BUFSIZ]; - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s: IPv6 unicast NLRI is link-local address %s, ignoring", peer->host, @@ -4272,7 +4272,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, if (IN6_IS_ADDR_MULTICAST(&p.u.prefix6)) { char buf[BUFSIZ]; - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s: IPv6 unicast NLRI is multicast address %s, ignoring", peer->host, @@ -4302,7 +4302,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, /* Packet length consistency check. */ if (pnt != lim) { - zlog_ferr( + flog_err( BGP_ERR_UPDATE_RCV, "%s [Error] Update packet error (prefix length mismatch with total length)", peer->host); diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index 2e4648a60..37740671c 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -1631,7 +1631,7 @@ void update_group_adjust_peer(struct peer_af *paf) if (!updgrp) { updgrp = update_group_create(paf); if (!updgrp) { - zlog_ferr(BGP_ERR_UPDGRP_CREATE, + flog_err(BGP_ERR_UPDGRP_CREATE, "couldn't create update group for peer %s", paf->peer->host); return; diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index 55253d695..c0761503f 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -787,7 +787,7 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp) * NLRI then * return */ if (space_remaining < space_needed) { - zlog_ferr( + flog_err( BGP_ERR_UPDGRP_ATTR_LEN, "u%" PRIu64 ":s%" PRIu64 " attributes too long, cannot send UPDATE", diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index ddd9aa230..e12d9ec34 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -10755,7 +10755,7 @@ static void bgp_show_all_instances_neighbors_vty(struct vty *vty, for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp)) { if (use_json) { if (!(json = json_object_new_object())) { - zlog_ferr( + flog_err( BGP_ERR_JSON_MEM_ERROR, "Unable to allocate memory for JSON object"); vty_out(vty, diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index a70af867f..59659c918 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1078,7 +1078,7 @@ int bgp_zebra_get_table_range(uint32_t chunk_size, return -1; ret = tm_get_table_chunk(zclient, chunk_size, start, end); if (ret < 0) { - zlog_ferr(BGP_ERR_TABLE_CHUNK, + flog_err(BGP_ERR_TABLE_CHUNK, "BGP: Error getting table chunk %u", chunk_size); return -1; } @@ -2383,7 +2383,7 @@ static int bgp_zebra_process_local_macip(int command, struct zclient *zclient, ipa_len = stream_getl(s); if (ipa_len != 0 && ipa_len != IPV4_MAX_BYTELEN && ipa_len != IPV6_MAX_BYTELEN) { - zlog_ferr(BGP_ERR_MACIP_LEN, + flog_err(BGP_ERR_MACIP_LEN, "%u:Recv MACIP %s with invalid IP addr length %d", vrf_id, (command == ZEBRA_MACIP_ADD) ? "Add" : "Del", ipa_len); @@ -2476,12 +2476,12 @@ static void bgp_zebra_process_label_chunk( STREAM_GETL(s, last); if (zclient->redist_default != proto) { - zlog_ferr(BGP_ERR_LM_ERROR, "Got LM msg with wrong proto %u", + flog_err(BGP_ERR_LM_ERROR, "Got LM msg with wrong proto %u", proto); return; } if (zclient->instance != instance) { - zlog_ferr(BGP_ERR_LM_ERROR, "Got LM msg with wrong instance %u", + flog_err(BGP_ERR_LM_ERROR, "Got LM msg with wrong instance %u", proto); return; } @@ -2490,7 +2490,7 @@ static void bgp_zebra_process_label_chunk( first < MPLS_LABEL_UNRESERVED_MIN || last > MPLS_LABEL_UNRESERVED_MAX) { - zlog_ferr(BGP_ERR_LM_ERROR, "%s: Invalid Label chunk: %u - %u", + flog_err(BGP_ERR_LM_ERROR, "%s: Invalid Label chunk: %u - %u", __func__, first, last); return; } diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 9d44b148c..555dd2a49 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -1804,7 +1804,7 @@ static int peer_activate_af(struct peer *peer, afi_t afi, safi_t safi) int active; if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) { - zlog_ferr(BGP_ERR_PEER_GROUP, "%s was called for peer-group %s", + flog_err(BGP_ERR_PEER_GROUP, "%s was called for peer-group %s", __func__, peer->host); return 1; } @@ -1918,7 +1918,7 @@ static int non_peergroup_deactivate_af(struct peer *peer, afi_t afi, safi_t safi) { if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) { - zlog_ferr(BGP_ERR_PEER_GROUP, "%s was called for peer-group %s", + flog_err(BGP_ERR_PEER_GROUP, "%s was called for peer-group %s", __func__, peer->host); return 1; } @@ -1931,7 +1931,7 @@ static int non_peergroup_deactivate_af(struct peer *peer, afi_t afi, peer->afc[afi][safi] = 0; if (peer_af_delete(peer, afi, safi) != 0) { - zlog_ferr(BGP_ERR_PEER_DELETE, + flog_err(BGP_ERR_PEER_DELETE, "couldn't delete af structure for peer %s", peer->host); return 1; @@ -1982,7 +1982,7 @@ int peer_deactivate(struct peer *peer, afi_t afi, safi_t safi) group = peer->group; if (peer_af_delete(peer, afi, safi) != 0) { - zlog_ferr(BGP_ERR_PEER_DELETE, + flog_err(BGP_ERR_PEER_DELETE, "couldn't delete af structure for peer %s", peer->host); } diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index ae04385a5..355cf9205 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -3934,7 +3934,7 @@ void *rfapi_rfp_init_group_config_ptr_vty(void *rfp_start_val, size); break; default: - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: Unknown group type=%d", + flog_err(LIB_ERR_DEVELOPMENT, "%s: Unknown group type=%d", __func__, type); /* should never happen */ assert("Unknown type" == NULL); @@ -4049,7 +4049,7 @@ void *rfapi_rfp_get_group_config_ptr_name( criteria, search_cb); break; default: - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: Unknown group type=%d", + flog_err(LIB_ERR_DEVELOPMENT, "%s: Unknown group type=%d", __func__, type); /* should never happen */ assert("Unknown type" == NULL); diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 7bf7ff85a..ac3b6da23 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -3029,7 +3029,7 @@ static void rfapiBgpInfoFilteredImportEncap( break; default: - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi); + flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi); return; } @@ -3486,7 +3486,7 @@ void rfapiBgpInfoFilteredImportVPN( break; default: - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi); + flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi); return; } @@ -3891,7 +3891,7 @@ rfapiBgpInfoFilteredImportFunction(safi_t safi) default: /* not expected */ - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad safi %d", __func__, + flog_err(LIB_ERR_DEVELOPMENT, "%s: bad safi %d", __func__, safi); return rfapiBgpInfoFilteredImportBadSafi; } diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c index be2ef3471..69426670a 100644 --- a/bgpd/rfapi/vnc_export_bgp.c +++ b/bgpd/rfapi/vnc_export_bgp.c @@ -188,7 +188,7 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct route_node *rn, if (!afi) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of route node", __func__); return; } @@ -335,7 +335,7 @@ void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct route_node *rn, struct prefix ce_nexthop; if (!afi) { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi", __func__); + flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi", __func__); return; } @@ -700,7 +700,7 @@ void vnc_direct_bgp_add_prefix(struct bgp *bgp, afi_t afi = family2afi(rn->p.family); if (!afi) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of route node", __func__); return; } @@ -810,7 +810,7 @@ void vnc_direct_bgp_del_prefix(struct bgp *bgp, afi_t afi = family2afi(rn->p.family); if (!afi) { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: can't get afi route node", + flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi route node", __func__); return; } @@ -926,7 +926,7 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd) afi_t afi = family2afi(rfd->vn_addr.addr_family); if (!afi) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of nve vn addr", __func__); return; } @@ -979,7 +979,7 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd) if (afi == AFI_IP || afi == AFI_IP6) { rt = import_table->imported_vpn[afi]; } else { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", + flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi); return; } @@ -1072,7 +1072,7 @@ void vnc_direct_bgp_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd) afi_t afi = family2afi(rfd->vn_addr.addr_family); if (!afi) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of nve vn addr", __func__); return; } @@ -1120,7 +1120,7 @@ void vnc_direct_bgp_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd) if (afi == AFI_IP || afi == AFI_IP6) { rt = import_table->imported_vpn[afi]; } else { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", + flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi); return; } @@ -1296,7 +1296,7 @@ static void vnc_direct_bgp_add_group_afi(struct bgp *bgp, if (afi == AFI_IP || afi == AFI_IP6) { rt = import_table->imported_vpn[afi]; } else { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi); + flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi); return; } @@ -1640,7 +1640,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi, struct attr *iattr; if (!afi) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of route node", __func__); return; } @@ -1760,7 +1760,7 @@ void vnc_direct_bgp_rh_del_route(struct bgp *bgp, afi_t afi, struct vnc_export_info *eti; if (!afi) { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: can't get afi route node", + flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi route node", __func__); return; } diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c index 92749a3e6..72363f7cf 100644 --- a/bgpd/rfapi/vnc_import_bgp.c +++ b/bgpd/rfapi/vnc_import_bgp.c @@ -603,7 +603,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve( */ if (!afi) { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix", + flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix", __func__); return; } @@ -720,7 +720,7 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp, } if (!afi) { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix", + flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix", __func__); return; } @@ -908,7 +908,7 @@ vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix, assert(rfg); if (!afi) { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix", + flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix", __func__); return; } @@ -2632,7 +2632,7 @@ void vnc_import_bgp_add_route(struct bgp *bgp, struct prefix *prefix, VNC_RHNCK(enter); if (!afi) { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix", + flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix", __func__); return; } diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c index caecf2e2c..a2871188e 100644 --- a/bgpd/rfapi/vnc_zebra.c +++ b/bgpd/rfapi/vnc_zebra.c @@ -571,7 +571,7 @@ static void vnc_zebra_add_del_prefix(struct bgp *bgp, return; if (rn->p.family != AF_INET && rn->p.family != AF_INET6) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "%s: invalid route node addr family", __func__); return; } @@ -644,7 +644,7 @@ static void vnc_zebra_add_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd, return; if (afi != AFI_IP && afi != AFI_IP6) { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: invalid vn addr family", + flog_err(LIB_ERR_DEVELOPMENT, "%s: invalid vn addr family", __func__); return; } @@ -742,12 +742,12 @@ static void vnc_zebra_add_del_group_afi(struct bgp *bgp, if (afi == AFI_IP || afi == AFI_IP6) { rt = import_table->imported_vpn[afi]; } else { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi); + flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi); return; } if (!family) { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: computed bad family: %d", + flog_err(LIB_ERR_DEVELOPMENT, "%s: computed bad family: %d", __func__, family); return; } diff --git a/eigrpd/eigrp_hello.c b/eigrpd/eigrp_hello.c index f3c3cdef0..d438db28d 100644 --- a/eigrpd/eigrp_hello.c +++ b/eigrpd/eigrp_hello.c @@ -421,7 +421,7 @@ void eigrp_sw_version_initialize(void) ret = sscanf(ver_string, "%" SCNu32 ".%" SCNu32, &FRR_MAJOR, &FRR_MINOR); if (ret != 2) - zlog_ferr(EIGRP_ERR_PACKET, + flog_err(EIGRP_ERR_PACKET, "Did not Properly parse %s, please fix VERSION string", VERSION); } diff --git a/eigrpd/eigrp_neighbor.c b/eigrpd/eigrp_neighbor.c index 9585fa01e..b10673d9e 100644 --- a/eigrpd/eigrp_neighbor.c +++ b/eigrpd/eigrp_neighbor.c @@ -336,7 +336,7 @@ int eigrp_nbr_count_get(void) void eigrp_nbr_hard_restart(struct eigrp_neighbor *nbr, struct vty *vty) { if (nbr == NULL) { - zlog_ferr(EIGRP_ERR_CONFIG, + flog_err(EIGRP_ERR_CONFIG, "Nbr Hard restart: Neighbor not specified."); return; } diff --git a/eigrpd/eigrp_network.c b/eigrpd/eigrp_network.c index baf634601..0706ed8bc 100644 --- a/eigrpd/eigrp_network.c +++ b/eigrpd/eigrp_network.c @@ -62,7 +62,7 @@ int eigrp_sock_init(void) #endif if (eigrpd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "eigrp_sock_init: could not raise privs, %s", safe_strerror(errno)); @@ -70,10 +70,10 @@ int eigrp_sock_init(void) if (eigrp_sock < 0) { int save_errno = errno; if (eigrpd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "eigrp_sock_init: could not lower privs, %s", safe_strerror(errno)); - zlog_ferr(LIB_ERR_SOCKET, "eigrp_read_sock_init: socket: %s", + flog_err(LIB_ERR_SOCKET, "eigrp_read_sock_init: socket: %s", safe_strerror(save_errno)); exit(1); } @@ -85,7 +85,7 @@ int eigrp_sock_init(void) if (ret < 0) { int save_errno = errno; if (eigrpd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "eigrp_sock_init: could not lower privs, %s", safe_strerror(errno)); zlog_warn("Can't set IP_HDRINCL option for fd %d: %s", @@ -98,7 +98,7 @@ int eigrp_sock_init(void) if (ret < 0) { int save_errno = errno; if (eigrpd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "eigrpd_sock_init: could not lower privs, %s", safe_strerror(errno)); zlog_warn("can't set sockopt IP_TOS %d to socket %d: %s", tos, @@ -117,7 +117,7 @@ int eigrp_sock_init(void) zlog_warn("Can't set pktinfo option for fd %d", eigrp_sock); if (eigrpd_privs.change(ZPRIVS_LOWER)) { - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "eigrp_sock_init: could not lower privs, %s", safe_strerror(errno)); } @@ -132,7 +132,7 @@ void eigrp_adjust_sndbuflen(struct eigrp *eigrp, unsigned int buflen) if (eigrp->maxsndbuflen >= buflen) return; if (eigrpd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s", __func__, safe_strerror(errno)); /* Now we try to set SO_SNDBUF to what our caller has requested @@ -152,7 +152,7 @@ void eigrp_adjust_sndbuflen(struct eigrp *eigrp, unsigned int buflen) else zlog_warn("%s: failed to get SO_SNDBUF", __func__); if (eigrpd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s", __func__, safe_strerror(errno)); } diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c index 8f83778e5..6338e5cf7 100644 --- a/eigrpd/eigrp_packet.c +++ b/eigrpd/eigrp_packet.c @@ -348,13 +348,13 @@ int eigrp_write(struct thread *thread) /* Get one packet from queue. */ ep = eigrp_fifo_next(ei->obuf); if (!ep) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "%s: Interface %s no packet on queue?", __PRETTY_FUNCTION__, ei->ifp->name); goto out; } if (ep->length < EIGRP_HEADER_LEN) { - zlog_ferr(EIGRP_ERR_PACKET, + flog_err(EIGRP_ERR_PACKET, "%s: Packet just has a header?", __PRETTY_FUNCTION__); eigrp_header_dump((struct eigrp_header *)ep->s->data); eigrp_packet_delete(ei); @@ -1214,7 +1214,7 @@ uint16_t eigrp_add_internalTLV_to_stream(struct stream *s, stream_putw(s, length); break; default: - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "%s: Unexpected prefix length: %d", __PRETTY_FUNCTION__, pe->destination->prefixlen); return 0; diff --git a/eigrpd/eigrp_reply.c b/eigrpd/eigrp_reply.c index 226271d5f..b6e6352de 100644 --- a/eigrpd/eigrp_reply.c +++ b/eigrpd/eigrp_reply.c @@ -170,7 +170,7 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph, if (!dest) { char buf[PREFIX_STRLEN]; - zlog_ferr(EIGRP_ERR_PACKET, + flog_err(EIGRP_ERR_PACKET, "%s: Received prefix %s which we do not know about", __PRETTY_FUNCTION__, prefix2str(&dest_addr, buf, sizeof(buf))); diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c index 58aa23d48..61eee99f6 100644 --- a/eigrpd/eigrp_topology.c +++ b/eigrpd/eigrp_topology.c @@ -412,7 +412,7 @@ eigrp_topology_update_distance(struct eigrp_fsm_action_message *msg) } break; default: - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: Please implement handler", + flog_err(LIB_ERR_DEVELOPMENT, "%s: Please implement handler", __PRETTY_FUNCTION__); break; } diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c index 735b319c1..29525173e 100644 --- a/eigrpd/eigrpd.c +++ b/eigrpd/eigrpd.c @@ -162,7 +162,7 @@ static struct eigrp *eigrp_new(const char *AS) eigrp->networks = eigrp_topology_new(); if ((eigrp_socket = eigrp_sock_init()) < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "eigrp_new: fatal error: eigrp_sock_init was unable to open a socket"); exit(1); } diff --git a/isisd/isis_bpf.c b/isisd/isis_bpf.c index b5a09aff2..fc0432979 100644 --- a/isisd/isis_bpf.c +++ b/isisd/isis_bpf.c @@ -188,7 +188,7 @@ int isis_sock_init(struct isis_circuit *circuit) int retval = ISIS_OK; if (isisd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s", __func__, safe_strerror(errno)); retval = open_bpf_dev(circuit); @@ -209,7 +209,7 @@ int isis_sock_init(struct isis_circuit *circuit) end: if (isisd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s", __func__, safe_strerror(errno)); return retval; diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 04247e8e1..7cf83f20f 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -567,7 +567,7 @@ int isis_circuit_up(struct isis_circuit *circuit) return ISIS_OK; if (circuit->area->lsp_mtu > isis_circuit_pdu_size(circuit)) { - zlog_ferr( + flog_err( ISIS_ERR_CONFIG, "Interface MTU %zu on %s is too low to support area lsp mtu %u!", isis_circuit_pdu_size(circuit), @@ -579,7 +579,7 @@ int isis_circuit_up(struct isis_circuit *circuit) if (circuit->circ_type == CIRCUIT_T_BROADCAST) { circuit->circuit_id = isis_circuit_id_gen(isis, circuit->interface); if (!circuit->circuit_id) { - zlog_ferr( + flog_err( ISIS_ERR_CONFIG, "There are already 255 broadcast circuits active!"); return ISIS_ERROR; diff --git a/isisd/isis_csm.c b/isisd/isis_csm.c index 691d2a43f..aae90b008 100644 --- a/isisd/isis_csm.c +++ b/isisd/isis_csm.c @@ -138,11 +138,11 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg) case IF_UP_FROM_Z: isis_circuit_if_add(circuit, (struct interface *)arg); if (isis_circuit_up(circuit) != ISIS_OK) { - zlog_ferr( + flog_err( ISIS_ERR_CONFIG, "Could not bring up %s because of invalid config.", circuit->interface->name); - zlog_ferr( + flog_err( ISIS_ERR_CONFIG, "Clearing config for %s. Please re-examine it.", circuit->interface->name); diff --git a/isisd/isis_dlpi.c b/isisd/isis_dlpi.c index 1dc4d7ad2..bb3a0c045 100644 --- a/isisd/isis_dlpi.c +++ b/isisd/isis_dlpi.c @@ -469,7 +469,7 @@ int isis_sock_init(struct isis_circuit *circuit) int retval = ISIS_OK; if (isisd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s", __func__, safe_strerror(errno)); retval = open_dlpi_dev(circuit); @@ -490,7 +490,7 @@ int isis_sock_init(struct isis_circuit *circuit) end: if (isisd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s", __func__, safe_strerror(errno)); return retval; diff --git a/isisd/isis_events.c b/isisd/isis_events.c index ad0fbc97e..52a0b9fac 100644 --- a/isisd/isis_events.c +++ b/isisd/isis_events.c @@ -157,7 +157,7 @@ void isis_circuit_is_type_set(struct isis_circuit *circuit, int newtype) return; /* No change */ if (!(newtype & circuit->area->is_type)) { - zlog_ferr( + flog_err( ISIS_ERR_CONFIG, "ISIS-Evt (%s) circuit type change - invalid level %s because area is %s", circuit->area->area_tag, circuit_t2string(newtype), diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 14a88e9e8..66c97ae89 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -454,7 +454,7 @@ void lsp_update(struct isis_lsp *lsp, struct isis_lsp_hdr *hdr, struct isis_area *area, int level, bool confusion) { if (lsp->own_lsp) { - zlog_ferr( + flog_err( LIB_ERR_DEVELOPMENT, "ISIS-Upd (%s): BUG updating LSP %s still marked as own LSP", area->area_tag, rawlspid_print(lsp->hdr.lsp_id)); @@ -1244,7 +1244,7 @@ static int lsp_regenerate(struct isis_area *area, int level) lsp = lsp_search(lspid, lspdb); if (!lsp) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "ISIS-Upd (%s): lsp_regenerate: no L%d LSP found!", area->area_tag, level); return ISIS_ERROR; @@ -1613,7 +1613,7 @@ static int lsp_regenerate_pseudo(struct isis_circuit *circuit, int level) lsp = lsp_search(lsp_id, lspdb); if (!lsp) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "lsp_regenerate_pseudo: no l%d LSP %s found!", level, rawlspid_print(lsp_id)); return ISIS_ERROR; diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index c9cf87508..5c4e3a35b 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -88,7 +88,7 @@ static int ack_lsp(struct isis_lsp_hdr *hdr, struct isis_circuit *circuit, retval = circuit->tx(circuit, level); if (retval != ISIS_OK) - zlog_ferr(ISIS_ERR_PACKET, + flog_err(ISIS_ERR_PACKET, "ISIS-Upd (%s): Send L%d LSP PSNP on %s failed", circuit->area->area_tag, level, circuit->interface->name); @@ -617,7 +617,7 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit, } if (!p2p_hello && !(level & iih.circ_type)) { - zlog_ferr(ISIS_ERR_PACKET, + flog_err(ISIS_ERR_PACKET, "Level %d LAN Hello with Circuit Type %d", level, iih.circ_type); return ISIS_ERROR; @@ -1354,7 +1354,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) /* Verify that at least the 8 bytes fixed header have been received */ if (stream_get_endp(circuit->rcv_stream) < ISIS_FIXED_HDR_LEN) { - zlog_ferr(ISIS_ERR_PACKET, "PDU is too short to be IS-IS."); + flog_err(ISIS_ERR_PACKET, "PDU is too short to be IS-IS."); return ISIS_ERROR; } @@ -1369,13 +1369,13 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) uint8_t max_area_addrs = stream_getc(circuit->rcv_stream); if (idrp == ISO9542_ESIS) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "No support for ES-IS packet IDRP=%" PRIx8, idrp); return ISIS_ERROR; } if (idrp != ISO10589_ISIS) { - zlog_ferr(ISIS_ERR_PACKET, "Not an IS-IS packet IDRP=%" PRIx8, + flog_err(ISIS_ERR_PACKET, "Not an IS-IS packet IDRP=%" PRIx8, idrp); return ISIS_ERROR; } @@ -1386,7 +1386,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) } if (id_len != 0 && id_len != ISIS_SYS_ID_LEN) { - zlog_ferr( + flog_err( ISIS_ERR_PACKET, "IDFieldLengthMismatch: ID Length field in a received PDU %" PRIu8 ", while the parameter for this IS is %u", @@ -1401,7 +1401,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) } if (length != expected_length) { - zlog_ferr(ISIS_ERR_PACKET, + flog_err(ISIS_ERR_PACKET, "Exepected fixed header length = %" PRIu8 " but got %" PRIu8, expected_length, length); @@ -1409,7 +1409,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) } if (stream_get_endp(circuit->rcv_stream) < length) { - zlog_ferr( + flog_err( ISIS_ERR_PACKET, "PDU is too short to contain fixed header of given PDU type."); return ISIS_ERROR; @@ -1428,7 +1428,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) /* either 3 or 0 */ if (max_area_addrs != 0 && max_area_addrs != isis->max_area_addrs) { - zlog_ferr( + flog_err( ISIS_ERR_PACKET, "maximumAreaAddressesMismatch: maximumAreaAdresses in a received PDU %" PRIu8 " while the parameter for this IS is %u", @@ -1653,7 +1653,7 @@ int send_hello(struct isis_circuit *circuit, int level) retval = circuit->tx(circuit, level); if (retval != ISIS_OK) - zlog_ferr(ISIS_ERR_PACKET, + flog_err(ISIS_ERR_PACKET, "ISIS-Adj (%s): Send L%d IIH on %s failed", circuit->area->area_tag, level, circuit->interface->name); @@ -1851,7 +1851,7 @@ int send_csnp(struct isis_circuit *circuit, int level) int retval = circuit->tx(circuit, level); if (retval != ISIS_OK) { - zlog_ferr(ISIS_ERR_PACKET, + flog_err(ISIS_ERR_PACKET, "ISIS-Snp (%s): Send L%d CSNP on %s failed", circuit->area->area_tag, level, circuit->interface->name); @@ -2016,7 +2016,7 @@ static int send_psnp(int level, struct isis_circuit *circuit) int retval = circuit->tx(circuit, level); if (retval != ISIS_OK) { - zlog_ferr(ISIS_ERR_PACKET, + flog_err(ISIS_ERR_PACKET, "ISIS-Snp (%s): Send L%d PSNP on %s failed", circuit->area->area_tag, level, circuit->interface->name); @@ -2124,7 +2124,7 @@ int send_lsp(struct thread *thread) * than * the circuit's MTU. So handle and log this case here. */ if (stream_get_endp(lsp->pdu) > stream_get_size(circuit->snd_stream)) { - zlog_ferr( + flog_err( ISIS_ERR_PACKET, "ISIS-Upd (%s): Can't send L%d LSP %s, seq 0x%08" PRIx32 ", cksum 0x%04" PRIx16 ", lifetime %" PRIu16 @@ -2160,7 +2160,7 @@ int send_lsp(struct thread *thread) clear_srm = 0; retval = circuit->tx(circuit, lsp->level); if (retval != ISIS_OK) { - zlog_ferr(ISIS_ERR_PACKET, + flog_err(ISIS_ERR_PACKET, "ISIS-Upd (%s): Send L%d LSP on %s failed %s", circuit->area->area_tag, lsp->level, circuit->interface->name, diff --git a/isisd/isis_pfpacket.c b/isisd/isis_pfpacket.c index f27ca2889..f38354cca 100644 --- a/isisd/isis_pfpacket.c +++ b/isisd/isis_pfpacket.c @@ -186,7 +186,7 @@ int isis_sock_init(struct isis_circuit *circuit) int retval = ISIS_OK; if (isisd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s", __func__, safe_strerror(errno)); retval = open_packet_socket(circuit); @@ -211,7 +211,7 @@ int isis_sock_init(struct isis_circuit *circuit) end: if (isisd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s", __func__, safe_strerror(errno)); return retval; diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 8654fd4ee..341921146 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -438,7 +438,7 @@ static void isis_vertex_id_init(struct isis_vertex *vertex, union isis_N *n, } else if (VTYPE_IP(vtype)) { memcpy(&vertex->N.ip, &n->ip, sizeof(n->ip)); } else { - zlog_ferr(LIB_ERR_DEVELOPMENT, "Unknown Vertex Type"); + flog_err(LIB_ERR_DEVELOPMENT, "Unknown Vertex Type"); } } diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index 434d0b35e..494d1bacd 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -484,7 +484,7 @@ start_child(enum ldpd_process p, char *argv0, int fd_async, int fd_sync) nullfd = open("/dev/null", O_RDONLY | O_NOCTTY); if (nullfd == -1) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "%s: failed to open /dev/null: %s", __func__, safe_strerror(errno)); } else { diff --git a/lib/agentx.c b/lib/agentx.c index 80422c480..8e6493d4d 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -142,19 +142,19 @@ static int agentx_log_callback(int major, int minor, void *serverarg, msg[strlen(msg) - 1] = '\0'; switch (slm->priority) { case LOG_EMERG: - zlog_ferr(LIB_ERR_SNMP, + flog_err(LIB_ERR_SNMP, "snmp[emerg]: %s", msg ? msg : slm->msg); break; case LOG_ALERT: - zlog_ferr(LIB_ERR_SNMP, + flog_err(LIB_ERR_SNMP, "snmp[alert]: %s", msg ? msg : slm->msg); break; case LOG_CRIT: - zlog_ferr(LIB_ERR_SNMP, + flog_err(LIB_ERR_SNMP, "snmp[crit]: %s", msg ? msg : slm->msg); break; case LOG_ERR: - zlog_ferr(LIB_ERR_SNMP, + flog_err(LIB_ERR_SNMP, "snmp[err]: %s", msg ? msg : slm->msg); break; case LOG_WARNING: diff --git a/lib/buffer.c b/lib/buffer.c index acdaf07bb..c292e4341 100644 --- a/lib/buffer.c +++ b/lib/buffer.c @@ -343,7 +343,7 @@ buffer_status_t buffer_flush_window(struct buffer *b, int fd, int width, iov_alloc * sizeof(*iov)); } else { /* This should absolutely never occur. */ - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "%s: corruption detected: iov_small overflowed; " "head %p, tail %p, head->next %p", __func__, (void *)b->head, @@ -458,7 +458,7 @@ in one shot. */ while (written > 0) { struct buffer_data *d; if (!(d = b->head)) { - zlog_ferr( + flog_err( LIB_ERR_DEVELOPMENT, "%s: corruption detected: buffer queue empty, but written is %lu", __func__, (unsigned long)written); diff --git a/lib/command.c b/lib/command.c index ca916c604..5e1589280 100644 --- a/lib/command.c +++ b/lib/command.c @@ -2417,7 +2417,7 @@ static int set_log_file(struct vty *vty, const char *fname, int loglevel) cwd[MAXPATHLEN] = '\0'; if (getcwd(cwd, MAXPATHLEN) == NULL) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "config_log_file: Unable to alloc mem!"); return CMD_WARNING_CONFIG_FAILED; } diff --git a/lib/frr_zmq.c b/lib/frr_zmq.c index c479543ce..02d9b68bc 100644 --- a/lib/frr_zmq.c +++ b/lib/frr_zmq.c @@ -141,7 +141,7 @@ static int frrzmq_read_msg(struct thread *t) return 0; out_err: - zlog_ferr(LIB_ERR_ZMQ, "ZeroMQ read error: %s(%d)", strerror(errno), + flog_err(LIB_ERR_ZMQ, "ZeroMQ read error: %s(%d)", strerror(errno), errno); if (cb->read.cb_error) cb->read.cb_error(cb->read.arg, cb->zmqsock); @@ -255,7 +255,7 @@ static int frrzmq_write_msg(struct thread *t) return 0; out_err: - zlog_ferr(LIB_ERR_ZMQ, "ZeroMQ write error: %s(%d)", strerror(errno), + flog_err(LIB_ERR_ZMQ, "ZeroMQ write error: %s(%d)", strerror(errno), errno); if (cb->write.cb_error) cb->write.cb_error(cb->write.arg, cb->zmqsock); @@ -297,7 +297,7 @@ DECLARE_QOBJ_TYPE(interface) #define IFNAME_RB_INSERT(vrf, ifp) \ if (RB_INSERT(if_name_head, &vrf->ifaces_by_name, (ifp))) \ - zlog_ferr( \ + flog_err( \ LIB_ERR_INTERFACE, \ "%s(%s): corruption detected -- interface with this " \ "name exists already in VRF %u!", \ @@ -305,7 +305,7 @@ DECLARE_QOBJ_TYPE(interface) #define IFNAME_RB_REMOVE(vrf, ifp) \ if (RB_REMOVE(if_name_head, &vrf->ifaces_by_name, (ifp)) == NULL) \ - zlog_ferr( \ + flog_err( \ LIB_ERR_INTERFACE, \ "%s(%s): corruption detected -- interface with this " \ "name doesn't exist in VRF %u!", \ @@ -313,7 +313,7 @@ DECLARE_QOBJ_TYPE(interface) #define IFINDEX_RB_INSERT(vrf, ifp) \ if (RB_INSERT(if_index_head, &vrf->ifaces_by_index, (ifp))) \ - zlog_ferr( \ + flog_err( \ LIB_ERR_INTERFACE, \ "%s(%u): corruption detected -- interface with this " \ "ifindex exists already in VRF %u!", \ @@ -321,7 +321,7 @@ DECLARE_QOBJ_TYPE(interface) #define IFINDEX_RB_REMOVE(vrf, ifp) \ if (RB_REMOVE(if_index_head, &vrf->ifaces_by_index, (ifp)) == NULL) \ - zlog_ferr( \ + flog_err( \ LIB_ERR_INTERFACE, \ "%s(%u): corruption detected -- interface with this " \ "ifindex doesn't exist in VRF %u!", \ diff --git a/lib/libfrr.c b/lib/libfrr.c index d9e51f67c..a49372675 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -829,7 +829,7 @@ static void frr_terminal_close(int isexit) nullfd = open("/dev/null", O_RDONLY | O_NOCTTY); if (nullfd == -1) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "%s: failed to open /dev/null: %s", __func__, safe_strerror(errno)); } else { @@ -902,7 +902,7 @@ void frr_run(struct thread_master *master) } else if (di->daemon_mode) { int nullfd = open("/dev/null", O_RDONLY | O_NOCTTY); if (nullfd == -1) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "%s: failed to open /dev/null: %s", __func__, safe_strerror(errno)); } else { @@ -633,7 +633,7 @@ void zlog_backtrace(int priority) size = backtrace(array, array_size(array)); if (size <= 0 || (size_t)size > array_size(array)) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "Cannot get backtrace, returned invalid # of frames %d " "(valid range is between 1 and %lu)", size, (unsigned long)(array_size(array))); @@ -641,7 +641,7 @@ void zlog_backtrace(int priority) } zlog(priority, "Backtrace for %d stack frames:", size); if (!(strings = backtrace_symbols(array, size))) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "Cannot get backtrace symbols (out of memory?)"); for (i = 0; i < size; i++) zlog(priority, "[bt %d] %p", i, array[i]); @@ -715,7 +715,7 @@ void _zlog_assert_failed(const char *assertion, const char *file, void memory_oom(size_t size, const char *name) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "out of memory: failed to allocate %zu bytes for %s" "object", size, name); @@ -867,7 +867,7 @@ int zlog_rotate(void) save_errno = errno; umask(oldumask); if (zl->fp == NULL) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "Log rotate failed: cannot open file %s for append: %s", zl->filename, safe_strerror(save_errno)); ret = -1; @@ -987,7 +987,7 @@ static const struct zebra_desc_table *zroute_lookup(unsigned int zroute) unsigned int i; if (zroute >= array_size(route_types)) { - zlog_ferr(LIB_ERR_DEVELOPMENT, "unknown zebra route type: %u", + flog_err(LIB_ERR_DEVELOPMENT, "unknown zebra route type: %u", zroute); return &unknown; } @@ -1002,7 +1002,7 @@ static const struct zebra_desc_table *zroute_lookup(unsigned int zroute) return &route_types[i]; } } - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "internal error: cannot find route type %u in table!", zroute); return &unknown; @@ -1021,7 +1021,7 @@ char zebra_route_char(unsigned int zroute) const char *zserv_command_string(unsigned int command) { if (command >= array_size(command_types)) { - zlog_ferr(LIB_ERR_DEVELOPMENT, "unknown zserv command type: %u", + flog_err(LIB_ERR_DEVELOPMENT, "unknown zserv command type: %u", command); return unknown.string; } @@ -86,7 +86,7 @@ extern void zlog_notice(const char *format, ...) PRINTF_ATTRIBUTE(1, 2); extern void zlog_debug(const char *format, ...) PRINTF_ATTRIBUTE(1, 2); /* For logs which have error codes associated with them */ -#define zlog_ferr(ferr_id, format, ...) \ +#define flog_err(ferr_id, format, ...) \ zlog_err("[EC %d] " format, ferr_id, ##__VA_ARGS__) diff --git a/lib/netns_linux.c b/lib/netns_linux.c index 3a24e511a..61ae45008 100644 --- a/lib/netns_linux.c +++ b/lib/netns_linux.c @@ -219,7 +219,7 @@ static int ns_enable_internal(struct ns *ns, void (*func)(ns_id_t, void *)) } if (!ns_is_enabled(ns)) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "Can not enable NS %u: %s!", ns->ns_id, safe_strerror(errno)); return 0; @@ -227,7 +227,7 @@ static int ns_enable_internal(struct ns *ns, void (*func)(ns_id_t, void *)) /* Non default NS. leave */ if (ns->ns_id == NS_UNKNOWN) { - zlog_ferr(LIB_ERR_NS, + flog_err(LIB_ERR_NS, "Can not enable NS %s %u: Invalid NSID", ns->name, ns->ns_id); return 0; @@ -472,7 +472,7 @@ void ns_init(void) if (have_netns_enabled < 0) { ns_default_ns_fd = open(NS_DEFAULT_NAME, O_RDONLY); if (ns_default_ns_fd == -1) - zlog_ferr(LIB_ERR_NS, + flog_err(LIB_ERR_NS, "NS initialization failure %d(%s)", errno, safe_strerror(errno)); } else { @@ -495,7 +495,7 @@ void ns_init_management(ns_id_t default_ns_id, ns_id_t internal_ns) ns_init(); default_ns = ns_get_created_internal(NULL, NULL, default_ns_id); if (!default_ns) { - zlog_ferr(LIB_ERR_NS, "%s: failed to create the default NS!", + flog_err(LIB_ERR_NS, "%s: failed to create the default NS!", __func__); exit(1); } @@ -513,7 +513,7 @@ void ns_init_management(ns_id_t default_ns_id, ns_id_t internal_ns) /* Enable the default NS. */ if (!ns_enable(default_ns, NULL)) { - zlog_ferr(LIB_ERR_NS, "%s: failed to enable the default NS!", + flog_err(LIB_ERR_NS, "%s: failed to enable the default NS!", __func__); exit(1); } diff --git a/lib/pid_output.c b/lib/pid_output.c index 21687e48c..5132e2f12 100644 --- a/lib/pid_output.c +++ b/lib/pid_output.c @@ -42,7 +42,7 @@ pid_t pid_output(const char *path) oldumask = umask(0777 & ~PIDFILE_MASK); fd = open(path, O_RDWR | O_CREAT, PIDFILE_MASK); if (fd < 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "Can't create pid lock file %s (%s), exiting", path, safe_strerror(errno)); umask(oldumask); @@ -59,7 +59,7 @@ pid_t pid_output(const char *path) lock.l_whence = SEEK_SET; if (fcntl(fd, F_SETLK, &lock) < 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "Could not lock pid_file %s (%s), exiting", path, safe_strerror(errno)); exit(1); @@ -68,11 +68,11 @@ pid_t pid_output(const char *path) sprintf(buf, "%d\n", (int)pid); pidsize = strlen(buf); if ((tmp = write(fd, buf, pidsize)) != (int)pidsize) - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "Could not write pid %d to pid_file %s, rc was %d: %s", (int)pid, path, tmp, safe_strerror(errno)); else if (ftruncate(fd, pidsize) < 0) - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "Could not truncate pid_file %s to %u bytes: %s", path, (unsigned int)pidsize, safe_strerror(errno)); diff --git a/lib/prefix.c b/lib/prefix.c index fe4f360fb..a7f4fda1b 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -657,7 +657,7 @@ void prefix_copy(struct prefix *dest, const struct prefix *src) memcpy((void *)dest->u.prefix_flowspec.ptr, (void *)src->u.prefix_flowspec.ptr, len); } else { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "prefix_copy(): Unknown address family %d", src->family); assert(0); diff --git a/lib/sigevent.c b/lib/sigevent.c index c6a8fcbd1..be904e982 100644 --- a/lib/sigevent.c +++ b/lib/sigevent.c @@ -84,7 +84,7 @@ int quagga_sigevent_process(void) sigdelset(&newmask, SIGKILL); if ((sigprocmask(SIG_BLOCK, &newmask, &oldmask)) < 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "quagga_signal_timer: couldnt block signals!"); return -1; } diff --git a/lib/skiplist.c b/lib/skiplist.c index d2b3acc97..a36bf4713 100644 --- a/lib/skiplist.c +++ b/lib/skiplist.c @@ -183,7 +183,7 @@ int skiplist_insert(register struct skiplist *l, register void *key, /* DEBUG */ if (!key) { - zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: key is 0, value is %p", + flog_err(LIB_ERR_DEVELOPMENT, "%s: key is 0, value is %p", __func__, value); } diff --git a/lib/sockopt.c b/lib/sockopt.c index 1e45f20aa..c19e84d12 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -62,7 +62,7 @@ int getsockopt_so_sendbuf(const int sock) int ret = getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&optval, &optlen); if (ret < 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "fd %d: can't getsockopt SO_SNDBUF: %d (%s)", sock, errno, safe_strerror(errno)); return ret; @@ -672,7 +672,7 @@ int sockopt_tcp_signature(int sock, union sockunion *su, const char *password) if (ENOENT == errno) ret = 0; else - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "sockopt_tcp_signature: setsockopt(%d): %s", sock, safe_strerror(errno)); } diff --git a/lib/sockunion.c b/lib/sockunion.c index edd6b84c5..60597b588 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -367,13 +367,13 @@ int sockopt_mark_default(int sock, int mark, struct zebra_privs_t *cap) int ret; if (cap->change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "routing_socket: Can't raise privileges"); ret = setsockopt(sock, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)); if (cap->change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "routing_socket: Can't lower privileges"); return ret; @@ -467,14 +467,14 @@ void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *), /* The default VRF always exists. */ default_vrf = vrf_get(VRF_DEFAULT, VRF_DEFAULT_NAME); if (!default_vrf) { - zlog_ferr(LIB_ERR_VRF_START, + flog_err(LIB_ERR_VRF_START, "vrf_init: failed to create the default VRF!"); exit(1); } /* Enable the default VRF. */ if (!vrf_enable(default_vrf)) { - zlog_ferr(LIB_ERR_VRF_START, + flog_err(LIB_ERR_VRF_START, "vrf_init: failed to enable the default VRF!"); exit(1); } @@ -545,7 +545,7 @@ int vrf_socket(int domain, int type, int protocol, vrf_id_t vrf_id, ret = vrf_switch_to_netns(vrf_id); if (ret < 0) - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: Can't switch to VRF %u (%s)", __func__, vrf_id, safe_strerror(errno)); @@ -560,7 +560,7 @@ int vrf_socket(int domain, int type, int protocol, vrf_id_t vrf_id, save_errno = errno; ret2 = vrf_switchback_to_initial(); if (ret2 < 0) - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: Can't switchback from VRF %u (%s)", __func__, vrf_id, safe_strerror(errno)); errno = save_errno; @@ -766,14 +766,14 @@ DEFUN_NOSH (vrf_netns, return CMD_WARNING_CONFIG_FAILED; if (vrf_daemon_privs && vrf_daemon_privs->change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: Can't raise privileges", + flog_err(LIB_ERR_PRIVILEGES, "%s: Can't raise privileges", __func__); ret = vrf_netns_handler_create(vty, vrf, pathname, NS_UNKNOWN, NS_UNKNOWN); if (vrf_daemon_privs && vrf_daemon_privs->change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: Can't lower privileges", + flog_err(LIB_ERR_PRIVILEGES, "%s: Can't lower privileges", __func__); return ret; } @@ -912,14 +912,14 @@ int vrf_getaddrinfo(const char *node, const char *service, ret = vrf_switch_to_netns(vrf_id); if (ret < 0) - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: Can't switch to VRF %u (%s)", __func__, vrf_id, safe_strerror(errno)); ret = getaddrinfo(node, service, hints, res); save_errno = errno; ret2 = vrf_switchback_to_initial(); if (ret2 < 0) - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: Can't switchback from VRF %u (%s)", __func__, vrf_id, safe_strerror(errno)); errno = save_errno; @@ -932,7 +932,7 @@ int vrf_ioctl(vrf_id_t vrf_id, int d, unsigned long request, char *params) ret = vrf_switch_to_netns(vrf_id); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: Can't switch to VRF %u (%s)", __func__, vrf_id, safe_strerror(errno)); return 0; @@ -941,7 +941,7 @@ int vrf_ioctl(vrf_id_t vrf_id, int d, unsigned long request, char *params) saved_errno = errno; ret = vrf_switchback_to_initial(); if (ret < 0) - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: Can't switchback from VRF %u (%s)", __func__, vrf_id, safe_strerror(errno)); errno = saved_errno; @@ -955,14 +955,14 @@ int vrf_sockunion_socket(const union sockunion *su, vrf_id_t vrf_id, ret = vrf_switch_to_netns(vrf_id); if (ret < 0) - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: Can't switch to VRF %u (%s)", __func__, vrf_id, safe_strerror(errno)); ret = sockunion_socket(su); save_errno = errno; ret2 = vrf_switchback_to_initial(); if (ret2 < 0) - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: Can't switchback from VRF %u (%s)", __func__, vrf_id, safe_strerror(errno)); errno = save_errno; @@ -1330,7 +1330,7 @@ static int vty_telnet_option(struct vty *vty, unsigned char *buf, int nbytes) TELNET_NAWS_SB_LEN, (unsigned long)vty->sb_len); else if (sizeof(vty->sb_buf) < TELNET_NAWS_SB_LEN) - zlog_ferr( + flog_err( LIB_ERR_DEVELOPMENT, "Bug detected: sizeof(vty->sb_buf) %lu < %d, too small to handle the telnet NAWS option", (unsigned long)sizeof(vty->sb_buf), @@ -1973,7 +1973,7 @@ static void vty_serv_sock_addrinfo(const char *hostname, unsigned short port) ret = getaddrinfo(hostname, port_str, &req, &ainfo); if (ret != 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "getaddrinfo failed: %s", gai_strerror(ret)); exit(1); } @@ -2034,7 +2034,7 @@ static void vty_serv_un(const char *path) /* Make UNIX domain socket. */ sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "Cannot create unix stream socket: %s", safe_strerror(errno)); return; @@ -2054,7 +2054,7 @@ static void vty_serv_un(const char *path) ret = bind(sock, (struct sockaddr *)&serv, len); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "Cannot bind path %s: %s", path, safe_strerror(errno)); close(sock); /* Avoid sd leak. */ @@ -2063,7 +2063,7 @@ static void vty_serv_un(const char *path) ret = listen(sock, 5); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "listen(fd %d) failed: %s", sock, safe_strerror(errno)); close(sock); /* Avoid sd leak. */ @@ -2080,7 +2080,7 @@ static void vty_serv_un(const char *path) if ((int)ids.gid_vty > 0) { /* set group of socket */ if (chown(path, -1, ids.gid_vty)) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "vty_serv_un: could chown socket, %s", safe_strerror(errno)); } @@ -2413,7 +2413,7 @@ static void vty_read_file(FILE *confp) nl = strchr(vty->error_buf, '\n'); if (nl) *nl = '\0'; - zlog_ferr(LIB_ERR_VTY, + flog_err(LIB_ERR_VTY, "ERROR: %s on config line %u: %s", message, line_num, vty->error_buf); } @@ -2488,7 +2488,7 @@ bool vty_read_config(const char *config_file, char *config_default_dir) if (config_file != NULL) { if (!IS_DIRECTORY_SEP(config_file[0])) { if (getcwd(cwd, MAXPATHLEN) == NULL) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "Failure to determine Current Working Directory %d!", errno); exit(1); @@ -2511,7 +2511,7 @@ bool vty_read_config(const char *config_file, char *config_default_dir) zlog_warn( "WARNING: using backup configuration file!"); else { - zlog_ferr(LIB_ERR_VTY, + flog_err(LIB_ERR_VTY, "can't open configuration file [%s]", config_file); exit(1); @@ -2559,7 +2559,7 @@ bool vty_read_config(const char *config_file, char *config_default_dir) "WARNING: using backup configuration file!"); fullpath = config_default_dir; } else { - zlog_ferr(LIB_ERR_VTY, + flog_err(LIB_ERR_VTY, "can't open configuration file [%s]", config_default_dir); goto tmp_free_and_out; @@ -3074,13 +3074,13 @@ static void vty_save_cwd(void) * Hence not worrying about it too much. */ if (!chdir(SYSCONFDIR)) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "Failure to chdir to %s, errno: %d", SYSCONFDIR, errno); exit(-1); } if (getcwd(cwd, MAXPATHLEN) == NULL) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "Failure to getcwd, errno: %d", errno); exit(-1); } diff --git a/lib/zclient.c b/lib/zclient.c index 105435fb2..c501ac49c 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -313,7 +313,7 @@ int zclient_read_header(struct stream *s, int sock, uint16_t *size, STREAM_GETW(s, *cmd); if (*version != ZSERV_VERSION || *marker != ZEBRA_HEADER_MARKER) { - zlog_ferr(LIB_ERR_ZAPI_MISSMATCH, + flog_err(LIB_ERR_ZAPI_MISSMATCH, "%s: socket %d version mismatch, marker %d, version %d", __func__, sock, *marker, *version); return -1; @@ -1046,7 +1046,7 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api) char buf[PREFIX2STR_BUFFER]; prefix2str(&api->prefix, buf, sizeof(buf)); - zlog_ferr(LIB_ERR_ZAPI_ENCODE, + flog_err(LIB_ERR_ZAPI_ENCODE, "%s: prefix %s: can't encode " "%u labels (maximum is %u)", __func__, buf, @@ -1672,7 +1672,7 @@ static void link_params_set_value(struct stream *s, struct if_link_params *iflp) for (i = 0; i < bwclassnum && i < MAX_CLASS_TYPE; i++) iflp->unrsv_bw[i] = stream_getf(s); if (i < bwclassnum) - zlog_ferr(LIB_ERR_ZAPI_MISSMATCH, + flog_err(LIB_ERR_ZAPI_MISSMATCH, "%s: received %d > %d (MAX_CLASS_TYPE) bw entries" " - outdated library?", __func__, bwclassnum, MAX_CLASS_TYPE); @@ -1704,7 +1704,7 @@ struct interface *zebra_interface_link_params_read(struct stream *s) struct interface *ifp = if_lookup_by_index(ifindex, VRF_DEFAULT); if (ifp == NULL) { - zlog_ferr(LIB_ERR_ZAPI_ENCODE, + flog_err(LIB_ERR_ZAPI_ENCODE, "%s: unknown ifindex %u, shouldn't happen", __func__, ifindex); return NULL; @@ -2041,7 +2041,7 @@ static int zclient_read_sync_response(struct zclient *zclient, size); } if (ret != 0) { - zlog_ferr(LIB_ERR_ZAPI_ENCODE, + flog_err(LIB_ERR_ZAPI_ENCODE, "%s: Invalid Sync Message Reply", __func__); return -1; } @@ -2084,13 +2084,13 @@ int lm_label_manager_connect(struct zclient *zclient) ret = writen(zclient->sock, s->data, stream_get_endp(s)); if (ret < 0) { - zlog_ferr(LIB_ERR_ZAPI_SOCKET, "Can't write to zclient sock"); + flog_err(LIB_ERR_ZAPI_SOCKET, "Can't write to zclient sock"); close(zclient->sock); zclient->sock = -1; return -1; } if (ret == 0) { - zlog_ferr(LIB_ERR_ZAPI_SOCKET, "Zclient sock closed"); + flog_err(LIB_ERR_ZAPI_SOCKET, "Zclient sock closed"); close(zclient->sock); zclient->sock = -1; return -1; @@ -2111,11 +2111,11 @@ int lm_label_manager_connect(struct zclient *zclient) /* sanity */ if (proto != zclient->redist_default) - zlog_ferr(LIB_ERR_ZAPI_ENCODE, + flog_err(LIB_ERR_ZAPI_ENCODE, "Wrong proto (%u) in LM connect response. Should be %u", proto, zclient->redist_default); if (instance != zclient->instance) - zlog_ferr(LIB_ERR_ZAPI_ENCODE, + flog_err(LIB_ERR_ZAPI_ENCODE, "Wrong instId (%u) in LM connect response. Should be %u", instance, zclient->instance); @@ -2206,14 +2206,14 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep, ret = writen(zclient->sock, s->data, stream_get_endp(s)); if (ret < 0) { - zlog_ferr(LIB_ERR_ZAPI_SOCKET, + flog_err(LIB_ERR_ZAPI_SOCKET, "Can't write to zclient sock"); close(zclient->sock); zclient->sock = -1; return -1; } if (ret == 0) { - zlog_ferr(LIB_ERR_ZAPI_SOCKET, + flog_err(LIB_ERR_ZAPI_SOCKET, "Zclient sock closed"); close(zclient->sock); zclient->sock = -1; @@ -2235,11 +2235,11 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep, /* sanities */ if (proto != zclient->redist_default) - zlog_ferr(LIB_ERR_ZAPI_ENCODE, + flog_err(LIB_ERR_ZAPI_ENCODE, "Wrong proto (%u) in get chunk response. Should be %u", proto, zclient->redist_default); if (instance != zclient->instance) - zlog_ferr(LIB_ERR_ZAPI_ENCODE, + flog_err(LIB_ERR_ZAPI_ENCODE, "Wrong instId (%u) in get chunk response Should be %u", instance, zclient->instance); @@ -2251,14 +2251,14 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep, /* not owning this response */ if (keep != response_keep) { - zlog_ferr(LIB_ERR_ZAPI_ENCODE, + flog_err(LIB_ERR_ZAPI_ENCODE, "Invalid Label chunk: %u - %u, keeps mismatch %u != %u", *start, *end, keep, response_keep); } /* sanity */ if (*start > *end || *start < MPLS_LABEL_UNRESERVED_MIN || *end > MPLS_LABEL_UNRESERVED_MAX) { - zlog_ferr(LIB_ERR_ZAPI_ENCODE, + flog_err(LIB_ERR_ZAPI_ENCODE, "Invalid Label chunk: %u - %u", *start, *end); return -1; } @@ -2309,13 +2309,13 @@ int lm_release_label_chunk(struct zclient *zclient, uint32_t start, ret = writen(zclient->sock, s->data, stream_get_endp(s)); if (ret < 0) { - zlog_ferr(LIB_ERR_ZAPI_SOCKET, "Can't write to zclient sock"); + flog_err(LIB_ERR_ZAPI_SOCKET, "Can't write to zclient sock"); close(zclient->sock); zclient->sock = -1; return -1; } if (ret == 0) { - zlog_ferr(LIB_ERR_ZAPI_SOCKET, + flog_err(LIB_ERR_ZAPI_SOCKET, "Zclient sock connection closed"); close(zclient->sock); zclient->sock = -1; @@ -2419,14 +2419,14 @@ int tm_get_table_chunk(struct zclient *zclient, uint32_t chunk_size, ret = writen(zclient->sock, s->data, stream_get_endp(s)); if (ret < 0) { - zlog_ferr(LIB_ERR_ZAPI_SOCKET, + flog_err(LIB_ERR_ZAPI_SOCKET, "%s: can't write to zclient->sock", __func__); close(zclient->sock); zclient->sock = -1; return -1; } if (ret == 0) { - zlog_ferr(LIB_ERR_ZAPI_SOCKET, + flog_err(LIB_ERR_ZAPI_SOCKET, "%s: zclient->sock connection closed", __func__); close(zclient->sock); zclient->sock = -1; @@ -2513,7 +2513,7 @@ int zebra_send_pw(struct zclient *zclient, int command, struct zapi_pw *pw) stream_write(s, (uint8_t *)&pw->nexthop.ipv6, 16); break; default: - zlog_ferr(LIB_ERR_ZAPI_ENCODE, + flog_err(LIB_ERR_ZAPI_ENCODE, "%s: unknown af", __func__); return -1; } @@ -2616,14 +2616,14 @@ static int zclient_read(struct thread *thread) command = stream_getw(zclient->ibuf); if (marker != ZEBRA_HEADER_MARKER || version != ZSERV_VERSION) { - zlog_ferr(LIB_ERR_ZAPI_MISSMATCH, + flog_err(LIB_ERR_ZAPI_MISSMATCH, "%s: socket %d version mismatch, marker %d, version %d", __func__, zclient->sock, marker, version); return zclient_failed(zclient); } if (length < ZEBRA_HEADER_SIZE) { - zlog_ferr(LIB_ERR_ZAPI_MISSMATCH, + flog_err(LIB_ERR_ZAPI_MISSMATCH, "%s: socket %d message length %u is less than %d ", __func__, zclient->sock, length, ZEBRA_HEADER_SIZE); return zclient_failed(zclient); diff --git a/nhrpd/resolver.c b/nhrpd/resolver.c index 6515a9709..dfa5dc3df 100644 --- a/nhrpd/resolver.c +++ b/nhrpd/resolver.c @@ -194,7 +194,7 @@ void resolver_resolve(struct resolver_query *query, int af, union sockunion *)) { if (query->callback != NULL) { - zlog_ferr(NHRP_ERR_RESOLVER, + flog_err(NHRP_ERR_RESOLVER, "Trying to resolve '%s', but previous query was not finished yet", hostname); return; diff --git a/nhrpd/vici.c b/nhrpd/vici.c index dae29e535..7cd703414 100644 --- a/nhrpd/vici.c +++ b/nhrpd/vici.c @@ -214,7 +214,7 @@ static void parse_sa_message(struct vici_message_ctx *ctx, if (str2sockunion(buf, &sactx->local.host) < 0) - zlog_ferr(NHRP_ERR_SWAN, + flog_err(NHRP_ERR_SWAN, "VICI: bad strongSwan local-host: %s", buf); } else if (blob_equal(key, "local-id") @@ -232,7 +232,7 @@ static void parse_sa_message(struct vici_message_ctx *ctx, if (str2sockunion(buf, &sactx->remote.host) < 0) - zlog_ferr(NHRP_ERR_SWAN, + flog_err(NHRP_ERR_SWAN, "VICI: bad strongSwan remote-host: %s", buf); } else if (blob_equal(key, "remote-id") @@ -277,7 +277,7 @@ static void parse_cmd_response(struct vici_message_ctx *ctx, case VICI_KEY_VALUE: if (blob_equal(key, "errmsg") && blob2buf(val, buf, sizeof(buf))) - zlog_ferr(NHRP_ERR_SWAN, "VICI: strongSwan: %s", buf); + flog_err(NHRP_ERR_SWAN, "VICI: strongSwan: %s", buf); break; default: break; @@ -336,7 +336,7 @@ static void vici_recv_message(struct vici_conn *vici, struct zbuf *msg) break; case VICI_EVENT_UNKNOWN: case VICI_CMD_UNKNOWN: - zlog_ferr(NHRP_ERR_SWAN, + flog_err(NHRP_ERR_SWAN, "VICI: StrongSwan does not support mandatory events (unpatched?)"); break; case VICI_EVENT_CONFIRM: diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index bed2d0210..228a525e7 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -1559,7 +1559,7 @@ int ospf6_receive(struct thread *thread) /* receive message */ len = ospf6_recvmsg(&src, &dst, &ifindex, iovector); if (len > iobuflen) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "Excess message read"); return 0; } @@ -1708,7 +1708,7 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst, /* send message */ len = ospf6_sendmsg(src, dst, &oi->interface->ifindex, iovector); if (len != ntohs(oh->length)) - zlog_ferr(LIB_ERR_DEVELOPMENT, "Could not send entire message"); + flog_err(LIB_ERR_DEVELOPMENT, "Could not send entire message"); } static uint32_t ospf6_packet_max(struct ospf6_interface *oi) diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 57414a2d0..8c2b68fe7 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -77,19 +77,19 @@ static void ospf6_set_checksum(void) int ospf6_serv_sock(void) { if (ospf6d_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "ospf6_serv_sock: could not raise privs"); ospf6_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_OSPFIGP); if (ospf6_sock < 0) { zlog_warn("Network: can't create OSPF6 socket."); if (ospf6d_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "ospf6_sock_init: could not lower privs"); return -1; } if (ospf6d_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "ospf6_sock_init: could not lower privs"); /* set socket options */ @@ -124,7 +124,7 @@ int ospf6_sso(ifindex_t ifindex, struct in6_addr *group, int option) ret = setsockopt(ospf6_sock, IPPROTO_IPV6, option, &mreq6, sizeof(mreq6)); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "Network: setsockopt (%d) on ifindex %d failed: %s", option, ifindex, safe_strerror(errno)); return ret; diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index b1ac67ae7..a099eead4 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -574,8 +574,8 @@ static void route_table_assert(struct ospf6_route_table *table) if (link_error == 0 && num == table->count) return; - zlog_ferr(LIB_ERR_DEVELOPMENT, "PANIC !!"); - zlog_ferr(LIB_ERR_DEVELOPMENT, "Something has gone wrong with ospf6_route_table[%p]", table); + flog_err(LIB_ERR_DEVELOPMENT, "PANIC !!"); + flog_err(LIB_ERR_DEVELOPMENT, "Something has gone wrong with ospf6_route_table[%p]", table); zlog_debug("table count = %d, real number = %d", table->count, num); zlog_debug("DUMP START"); for (r = ospf6_route_head(table); r; r = ospf6_route_next(r)) { diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index c64f56ba3..9c13c51b1 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -273,7 +273,7 @@ static void ospf6_nexthop_calc(struct ospf6_vertex *w, struct ospf6_vertex *v, ifindex = (VERTEX_IS_TYPE(NETWORK, v) ? ospf6_spf_get_ifindex_from_nh(v) : ROUTER_LSDESC_GET_IFID(lsdesc)); if (ifindex == 0) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "No nexthop ifindex at vertex %s", v->name); return; } diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 8f1b009cc..06a84dcb9 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -363,7 +363,7 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request) ret = zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); if (ret < 0) - zlog_ferr(LIB_ERR_ZAPI_SOCKET, + flog_err(LIB_ERR_ZAPI_SOCKET, "zclient_route_send() %s failed: %s", (type == REM ? "delete" : "add"), safe_strerror(errno)); diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index c3f919ef1..6dadc05bb 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -215,7 +215,7 @@ int main(int argc, char **argv) ospf', when quagga(ospfd) is restarted */ if (!ospf_get_instance(instance)) { - zlog_ferr(OSPF_ERR_INIT_FAIL, "OSPF instance init failed: %s", + flog_err(OSPF_ERR_INIT_FAIL, "OSPF instance init failed: %s", strerror(errno)); exit(1); } diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index c51533865..eac4453ed 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -187,7 +187,7 @@ int ospf_sock_init(struct ospf *ospf) return -1; } if (ospfd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "ospf_sock_init: could not raise privs, %s", safe_strerror(errno)); @@ -197,7 +197,7 @@ int ospf_sock_init(struct ospf *ospf) int save_errno = errno; if (ospfd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "ospf_sock_init: could not lower privs, %s", safe_strerror(save_errno)); @@ -244,7 +244,7 @@ int ospf_sock_init(struct ospf *ospf) ospf->fd = ospf_sock; out: if (ospfd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "ospf_sock_init: could not lower privs, %s", safe_strerror(errno)); diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 074e385fa..f1d4a39db 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -231,7 +231,7 @@ void ospf_fifo_free(struct ospf_fifo *fifo) void ospf_packet_add(struct ospf_interface *oi, struct ospf_packet *op) { if (!oi->obuf) { - zlog_ferr( + flog_err( OSPF_ERR_PKT_PROCESS, "ospf_packet_add(interface %s in state %d [%s], packet type %s, " "destination %s) called with NULL obuf, ignoring " @@ -255,7 +255,7 @@ static void ospf_packet_add_top(struct ospf_interface *oi, struct ospf_packet *op) { if (!oi->obuf) { - zlog_ferr( + flog_err( OSPF_ERR_PKT_PROCESS, "ospf_packet_add(interface %s in state %d [%s], packet type %s, " "destination %s) called with NULL obuf, ignoring " @@ -1918,7 +1918,7 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph, char buf2[INET_ADDRSTRLEN]; char buf3[INET_ADDRSTRLEN]; - zlog_ferr(OSPF_ERR_ROUTER_LSA_MISMATCH, + flog_err(OSPF_ERR_ROUTER_LSA_MISMATCH, "Incoming Router-LSA from %s with " "Adv-ID[%s] != LS-ID[%s]", inet_ntop(AF_INET, &ospfh->router_id, @@ -1928,7 +1928,7 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph, inet_ntop(AF_INET, &lsa->data->adv_router, buf3, INET_ADDRSTRLEN)); - zlog_ferr( + flog_err( OSPF_ERR_DOMAIN_CORRUPT, "OSPF domain compromised by attack or corruption. " "Verify correct operation of -ALL- OSPF routers."); diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index 629edbf37..6cb697f3a 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -821,7 +821,7 @@ static struct sr_prefix *get_ext_prefix_sid(struct tlv_header *tlvh) case EXT_SUBTLV_PREFIX_SID: psid = (struct ext_subtlv_prefix_sid *)sub_tlvh; if (psid->algorithm != SR_ALGORITHM_SPF) { - zlog_ferr(OSPF_ERR_SR_INVALID_ALGORITHM, + flog_err(OSPF_ERR_SR_INVALID_ALGORITHM, "SR (%s): Unsupported Algorithm", __func__); XFREE(MTYPE_OSPF_SR_PARAMS, srp); @@ -1102,7 +1102,7 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa) return; if (OspfSR.neighbors == NULL) { - zlog_ferr(OSPF_ERR_SR_INVALID_DB, + flog_err(OSPF_ERR_SR_INVALID_DB, "SR (%s): Abort! no valid SR DataBase", __func__); return; } @@ -1113,14 +1113,14 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa) /* Sanity check */ if (srn == NULL) { - zlog_ferr(OSPF_ERR_SR_NODE_CREATE, + flog_err(OSPF_ERR_SR_NODE_CREATE, "SR (%s): Abort! can't create SR node in hash table", __func__); return; } if ((srn->instance != 0) && (srn->instance != ntohl(lsah->id.s_addr))) { - zlog_ferr(OSPF_ERR_SR_INVALID_LSA_ID, + flog_err(OSPF_ERR_SR_INVALID_LSA_ID, "SR (%s): Abort! Wrong " "LSA ID 4.0.0.%u for SR node %s/%u", __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), @@ -1213,7 +1213,7 @@ void ospf_sr_ri_lsa_delete(struct ospf_lsa *lsa) /* Sanity check */ if (OspfSR.neighbors == NULL) { - zlog_ferr(OSPF_ERR_SR_INVALID_DB, + flog_err(OSPF_ERR_SR_INVALID_DB, "SR (%s): Abort! no valid SR Data Base", __func__); return; } @@ -1223,14 +1223,14 @@ void ospf_sr_ri_lsa_delete(struct ospf_lsa *lsa) /* Sanity check */ if (srn == NULL) { - zlog_ferr(OSPF_ERR_SR_NODE_CREATE, + flog_err(OSPF_ERR_SR_NODE_CREATE, "SR (%s): Abort! no entry in SRDB for SR Node %s", __func__, inet_ntoa(lsah->adv_router)); return; } if ((srn->instance != 0) && (srn->instance != ntohl(lsah->id.s_addr))) { - zlog_ferr( + flog_err( OSPF_ERR_SR_INVALID_LSA_ID, "SR (%s): Abort! Wrong LSA ID 4.0.0.%u for SR node %s", __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), @@ -1260,7 +1260,7 @@ void ospf_sr_ext_link_lsa_update(struct ospf_lsa *lsa) /* Sanity check */ if (OspfSR.neighbors == NULL) { - zlog_ferr(OSPF_ERR_SR_INVALID_DB, + flog_err(OSPF_ERR_SR_INVALID_DB, "SR (%s): Abort! no valid SR DataBase", __func__); return; } @@ -1272,7 +1272,7 @@ void ospf_sr_ext_link_lsa_update(struct ospf_lsa *lsa) /* Sanity check */ if (srn == NULL) { - zlog_ferr(OSPF_ERR_SR_NODE_CREATE, + flog_err(OSPF_ERR_SR_NODE_CREATE, "SR (%s): Abort! can't create SR node in hash table", __func__); return; @@ -1312,7 +1312,7 @@ void ospf_sr_ext_link_lsa_delete(struct ospf_lsa *lsa) /* Sanity check */ if (OspfSR.neighbors == NULL) { - zlog_ferr(OSPF_ERR_SR_INVALID_DB, + flog_err(OSPF_ERR_SR_INVALID_DB, "SR (%s): Abort! no valid SR DataBase", __func__); return; } @@ -1370,7 +1370,7 @@ void ospf_sr_ext_prefix_lsa_update(struct ospf_lsa *lsa) /* Sanity check */ if (OspfSR.neighbors == NULL) { - zlog_ferr(OSPF_ERR_SR_INVALID_DB, + flog_err(OSPF_ERR_SR_INVALID_DB, "SR (%s): Abort! no valid SR DataBase", __func__); return; } @@ -1382,7 +1382,7 @@ void ospf_sr_ext_prefix_lsa_update(struct ospf_lsa *lsa) /* Sanity check */ if (srn == NULL) { - zlog_ferr(OSPF_ERR_SR_NODE_CREATE, + flog_err(OSPF_ERR_SR_NODE_CREATE, "SR (%s): Abort! can't create SR node in hash table", __func__); return; @@ -1423,7 +1423,7 @@ void ospf_sr_ext_prefix_lsa_delete(struct ospf_lsa *lsa) /* Sanity check */ if (OspfSR.neighbors == NULL) { - zlog_ferr(OSPF_ERR_SR_INVALID_DB, + flog_err(OSPF_ERR_SR_INVALID_DB, "SR (%s): Abort! no valid SR DataBase", __func__); return; } diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index c4bb1ca55..bee68622f 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -2089,7 +2089,7 @@ static int ospf_vrf_enable(struct vrf *vrf) if (old_vrf_id != ospf->vrf_id) { if (ospfd_privs.change(ZPRIVS_RAISE)) - zlog_ferr( + flog_err( LIB_ERR_PRIVILEGES, "ospf_vrf_link: could not raise privs"); @@ -2103,7 +2103,7 @@ static int ospf_vrf_enable(struct vrf *vrf) ret = ospf_sock_init(ospf); if (ospfd_privs.change(ZPRIVS_LOWER)) - zlog_ferr( + flog_err( LIB_ERR_PRIVILEGES, "ospf_sock_init: could not lower privs"); diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index 96ec35be7..c137fc1f6 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -97,7 +97,7 @@ static int igmp_sock_open(struct in_addr ifaddr, struct interface *ifp, } if (!join) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "IGMP socket fd=%d could not join any group on interface address %s", fd, inet_ntoa(ifaddr)); close(fd); @@ -698,7 +698,7 @@ static void sock_close(struct igmp_sock *igmp) THREAD_OFF(igmp->t_igmp_read); if (close(igmp->fd)) { - zlog_ferr( + flog_err( LIB_ERR_SOCKET, "Failure closing IGMP socket %s fd=%d on interface %s: errno=%d: %s", inet_ntoa(igmp->ifaddr), igmp->fd, diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index 38f26f7ae..7b21376c9 100644 --- a/pimd/pim_igmpv3.c +++ b/pimd/pim_igmpv3.c @@ -1584,7 +1584,7 @@ void igmp_v3_send_query(struct igmp_group *group, int fd, const char *ifname, msg_size = IGMP_V3_SOURCES_OFFSET + (num_sources << 2); if (msg_size > query_buf_size) { - zlog_ferr( + flog_err( LIB_ERR_DEVELOPMENT, "%s %s: unable to send: msg_size=%zd larger than query_buf_size=%d", __FILE__, __PRETTY_FUNCTION__, msg_size, diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 9b0599caf..6028e5ba1 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -57,7 +57,7 @@ static int pim_mroute_set(struct pim_instance *pim, int enable) */ if (pim->vrf_id != VRF_DEFAULT) { if (pimd_privs.change(ZPRIVS_RAISE)) - zlog_ferr( + flog_err( LIB_ERR_PRIVILEGES, "pim_mroute_socket_enable: could not raise privs, %s", safe_strerror(errno)); @@ -75,7 +75,7 @@ static int pim_mroute_set(struct pim_instance *pim, int enable) } if (pimd_privs.change(ZPRIVS_LOWER)) - zlog_ferr( + flog_err( LIB_ERR_PRIVILEGES, "pim_mroute_socket_enable: could not lower privs, %s", safe_strerror(errno)); @@ -712,7 +712,7 @@ int pim_mroute_socket_enable(struct pim_instance *pim) int fd; if (pimd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "pim_mroute_socket_enable: could not raise privs, %s", safe_strerror(errno)); @@ -736,7 +736,7 @@ int pim_mroute_socket_enable(struct pim_instance *pim) #endif if (pimd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "pim_mroute_socket_enable: could not lower privs, %s", safe_strerror(errno)); diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index c15b87f92..7fcf42e8c 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -518,7 +518,7 @@ static void pim_msdp_sa_local_del_on_up_del(struct pim_instance *pim, * the flow. Accounting for such cases requires lot of * changes; perhaps * address this in the next release? - XXX */ - zlog_ferr( + flog_err( LIB_ERR_DEVELOPMENT, "MSDP sa %s SPT teardown is causing the local entry to be removed", sa->sg_str); diff --git a/pimd/pim_msdp_packet.c b/pimd/pim_msdp_packet.c index 5c950e8dc..2b3f45c70 100644 --- a/pimd/pim_msdp_packet.c +++ b/pimd/pim_msdp_packet.c @@ -147,7 +147,7 @@ static void pim_msdp_connect_check(struct pim_msdp_peer *mp) /* If getsockopt is fail, this is fatal error. */ if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "can't get sockopt for nonblocking connect"); pim_msdp_peer_reset_tcp_conn(mp, "connect-failed"); return; @@ -484,7 +484,7 @@ static void pim_msdp_pkt_sa_rx_one(struct pim_msdp_peer *mp, struct in_addr rp) if (prefix_len != 32) { /* ignore SA update if the prefix length is not 32 */ - zlog_ferr(PIM_ERR_MSDP_PACKET, + flog_err(PIM_ERR_MSDP_PACKET, "rxed sa update with invalid prefix length %d", prefix_len); return; diff --git a/pimd/pim_msdp_socket.c b/pimd/pim_msdp_socket.c index d5bd34557..6f334ca75 100644 --- a/pimd/pim_msdp_socket.c +++ b/pimd/pim_msdp_socket.c @@ -43,7 +43,7 @@ static void pim_msdp_update_sock_send_buffer_size(int fd) socklen_t optlen = sizeof(optval); if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &optval, &optlen) < 0) { - zlog_ferr(LIB_ERR_SOCKET, "getsockopt of SO_SNDBUF failed %s\n", + flog_err(LIB_ERR_SOCKET, "getsockopt of SO_SNDBUF failed %s\n", safe_strerror(errno)); return; } @@ -51,7 +51,7 @@ static void pim_msdp_update_sock_send_buffer_size(int fd) if (optval < size) { if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)) < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "Couldn't increase send buffer: %s\n", safe_strerror(errno)); } @@ -73,7 +73,7 @@ static int pim_msdp_sock_accept(struct thread *thread) /* re-register accept thread */ accept_sock = THREAD_FD(thread); if (accept_sock < 0) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "accept_sock is negative value %d", accept_sock); return -1; } @@ -84,7 +84,7 @@ static int pim_msdp_sock_accept(struct thread *thread) /* accept client connection. */ msdp_sock = sockunion_accept(accept_sock, &su); if (msdp_sock < 0) { - zlog_ferr(LIB_ERR_SOCKET, "pim_msdp_sock_accept failed (%s)", + flog_err(LIB_ERR_SOCKET, "pim_msdp_sock_accept failed (%s)", safe_strerror(errno)); return -1; } @@ -94,7 +94,7 @@ static int pim_msdp_sock_accept(struct thread *thread) if (!mp || !PIM_MSDP_PEER_IS_LISTENER(mp)) { ++pim->msdp.rejected_accepts; if (PIM_DEBUG_MSDP_EVENTS) { - zlog_ferr(PIM_ERR_MSDP_PACKET, + flog_err(PIM_ERR_MSDP_PACKET, "msdp peer connection refused from %s", sockunion2str(&su, buf, SU_ADDRSTRLEN)); } @@ -140,7 +140,7 @@ int pim_msdp_sock_listen(struct pim_instance *pim) sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) { - zlog_ferr(LIB_ERR_SOCKET, "socket: %s", safe_strerror(errno)); + flog_err(LIB_ERR_SOCKET, "socket: %s", safe_strerror(errno)); return sock; } @@ -159,14 +159,14 @@ int pim_msdp_sock_listen(struct pim_instance *pim) struct interface *ifp = if_lookup_by_name(pim->vrf->name, pim->vrf_id); if (!ifp) { - zlog_ferr(LIB_ERR_INTERFACE, + flog_err(LIB_ERR_INTERFACE, "%s: Unable to lookup vrf interface: %s", __PRETTY_FUNCTION__, pim->vrf->name); close(sock); return -1; } if (pim_socket_bind(sock, ifp)) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: Unable to bind to socket: %s", __PRETTY_FUNCTION__, safe_strerror(errno)); close(sock); @@ -175,7 +175,7 @@ int pim_msdp_sock_listen(struct pim_instance *pim) } if (pimd_privs.change(ZPRIVS_RAISE)) { - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "pim_msdp_socket: could not raise privs, %s", safe_strerror(errno)); } @@ -184,13 +184,13 @@ int pim_msdp_sock_listen(struct pim_instance *pim) rc = bind(sock, (struct sockaddr *)&sin, socklen); if (pimd_privs.change(ZPRIVS_LOWER)) { - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "pim_msdp_socket: could not lower privs, %s", safe_strerror(errno)); } if (rc < 0) { - zlog_ferr(LIB_ERR_SOCKET, "pim_msdp_socket bind to port %d: %s", + flog_err(LIB_ERR_SOCKET, "pim_msdp_socket bind to port %d: %s", ntohs(sin.sin_port), safe_strerror(errno)); close(sock); return rc; @@ -198,7 +198,7 @@ int pim_msdp_sock_listen(struct pim_instance *pim) rc = listen(sock, 3 /* backlog */); if (rc < 0) { - zlog_ferr(LIB_ERR_SOCKET, "pim_msdp_socket listen: %s", + flog_err(LIB_ERR_SOCKET, "pim_msdp_socket listen: %s", safe_strerror(errno)); close(sock); return rc; @@ -239,7 +239,7 @@ int pim_msdp_sock_connect(struct pim_msdp_peer *mp) /* Make socket for the peer. */ mp->fd = sockunion_socket(&mp->su_peer); if (mp->fd < 0) { - zlog_ferr(LIB_ERR_SOCKET, "pim_msdp_socket socket failure: %s", + flog_err(LIB_ERR_SOCKET, "pim_msdp_socket socket failure: %s", safe_strerror(errno)); return -1; } @@ -248,13 +248,13 @@ int pim_msdp_sock_connect(struct pim_msdp_peer *mp) struct interface *ifp = if_lookup_by_name(mp->pim->vrf->name, mp->pim->vrf_id); if (!ifp) { - zlog_ferr(LIB_ERR_INTERFACE, + flog_err(LIB_ERR_INTERFACE, "%s: Unable to lookup vrf interface: %s", __PRETTY_FUNCTION__, mp->pim->vrf->name); return -1; } if (pim_socket_bind(mp->fd, ifp)) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: Unable to bind to socket: %s", __PRETTY_FUNCTION__, safe_strerror(errno)); close(mp->fd); @@ -273,7 +273,7 @@ int pim_msdp_sock_connect(struct pim_msdp_peer *mp) /* source bind */ rc = sockunion_bind(mp->fd, &mp->su_local, 0, &mp->su_local); if (rc < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "pim_msdp_socket connect bind failure: %s", safe_strerror(errno)); close(mp->fd); diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c index 0aaf6127d..11d847636 100644 --- a/pimd/pim_neighbor.c +++ b/pimd/pim_neighbor.c @@ -800,7 +800,7 @@ void pim_neighbor_update(struct pim_neighbor *neigh, if (neigh->prefix_list == addr_list) { if (addr_list) { - zlog_ferr( + flog_err( LIB_ERR_DEVELOPMENT, "%s: internal error: trying to replace same prefix list=%p", __PRETTY_FUNCTION__, (void *)addr_list); diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index 6fb0b2892..b103da2e1 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -116,7 +116,7 @@ void pim_sock_delete(struct interface *ifp, const char *delete_message) delete_message); if (!ifp->info) { - zlog_ferr(PIM_ERR_CONFIG, + flog_err(PIM_ERR_CONFIG, "%s: %s: but PIM not enabled on interface %s (!)", __PRETTY_FUNCTION__, delete_message, ifp->name); return; diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index 77e76c3b0..efcca6599 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -111,7 +111,7 @@ void pim_rp_init(struct pim_instance *pim) rp_info = XCALLOC(MTYPE_PIM_RP, sizeof(*rp_info)); if (!str2prefix("224.0.0.0/4", &rp_info->group)) { - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "Unable to convert 224.0.0.0/4 to prefix"); list_delete_and_null(&pim->rp_list); route_table_finish(pim->rp_table); @@ -233,7 +233,7 @@ static struct rp_info *pim_rp_find_match_group(struct pim_instance *pim, rn = route_node_match(pim->rp_table, group); if (!rn) { - zlog_ferr( + flog_err( LIB_ERR_DEVELOPMENT, "%s: BUG We should have found default group information\n", __PRETTY_FUNCTION__); @@ -622,7 +622,7 @@ int pim_rp_del(struct pim_instance *pim, const char *rp, rn = route_node_get(pim->rp_table, &rp_info->group); if (rn) { if (rn->info != rp_info) - zlog_ferr( + flog_err( LIB_ERR_DEVELOPMENT, "Expected rn->info to be equal to rp_info"); diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c index 44e051804..2a93b4ad7 100644 --- a/pimd/pim_sock.c +++ b/pimd/pim_sock.c @@ -47,14 +47,14 @@ int pim_socket_raw(int protocol) int fd; if (pimd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "pim_sockek_raw: could not raise privs, %s", safe_strerror(errno)); fd = socket(AF_INET, SOCK_RAW, protocol); if (pimd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "pim_socket_raw: could not lower privs, %s", safe_strerror(errno)); @@ -72,16 +72,16 @@ void pim_socket_ip_hdr(int fd) const int on = 1; if (pimd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s", __PRETTY_FUNCTION__, safe_strerror(errno)); if (setsockopt(fd, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on))) - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: Could not turn on IP_HDRINCL option: %s", __PRETTY_FUNCTION__, safe_strerror(errno)); if (pimd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s", __PRETTY_FUNCTION__, safe_strerror(errno)); } @@ -95,14 +95,14 @@ int pim_socket_bind(int fd, struct interface *ifp) #ifdef SO_BINDTODEVICE if (pimd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s", __PRETTY_FUNCTION__, safe_strerror(errno)); ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, ifp->name, strlen(ifp->name)); if (pimd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s", + flog_err(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s", __PRETTY_FUNCTION__, safe_strerror(errno)); #endif @@ -165,7 +165,7 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, struct interface *ifp, fd, errno, safe_strerror(errno)); } #else - zlog_ferr( + flog_err( LIB_ERR_DEVELOPMENT, "%s %s: Missing IP_PKTINFO and IP_RECVDSTADDR: unable to get dst addr from recvmsg()", __FILE__, __PRETTY_FUNCTION__); @@ -303,7 +303,7 @@ int pim_socket_join(int fd, struct in_addr group, struct in_addr ifaddr, sizeof(ifaddr_str))) sprintf(ifaddr_str, "<ifaddr?>"); - zlog_ferr( + flog_err( LIB_ERR_SOCKET, "Failure socket joining fd=%d group %s on interface address %s: errno=%d: %s", fd, group_str, ifaddr_str, errno, safe_strerror(errno)); diff --git a/pimd/pim_ssm.c b/pimd/pim_ssm.c index f10cef9ce..8347878d3 100644 --- a/pimd/pim_ssm.c +++ b/pimd/pim_ssm.c @@ -73,7 +73,7 @@ static int pim_is_grp_standard_ssm(struct prefix *group) if (first) { if (!str2prefix(PIM_SSM_STANDARD_RANGE, &group_ssm)) - zlog_ferr(LIB_ERR_DEVELOPMENT, + flog_err(LIB_ERR_DEVELOPMENT, "%s: Failure to Read Group Address: %s", __PRETTY_FUNCTION__, PIM_SSM_STANDARD_RANGE); diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c index 3cb49079b..6e8542793 100644 --- a/pimd/pim_ssmpingd.c +++ b/pimd/pim_ssmpingd.c @@ -83,7 +83,7 @@ static int ssmpingd_socket(struct in_addr addr, int port, int mttl) fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fd < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: could not create socket: errno=%d: %s", __PRETTY_FUNCTION__, errno, safe_strerror(errno)); return -1; @@ -126,7 +126,7 @@ static int ssmpingd_socket(struct in_addr addr, int port, int mttl) safe_strerror(errno)); } #else - zlog_ferr( + flog_err( LIB_ERR_DEVELOPMENT, "%s %s: missing IP_PKTINFO and IP_RECVDSTADDR: unable to get dst addr from recvmsg()", __FILE__, __PRETTY_FUNCTION__); diff --git a/pimd/pim_time.c b/pimd/pim_time.c index ed2942d59..a15695c9e 100644 --- a/pimd/pim_time.c +++ b/pimd/pim_time.c @@ -35,7 +35,7 @@ static int gettime_monotonic(struct timeval *tv) result = gettimeofday(tv, 0); if (result) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "%s: gettimeofday() failure: errno=%d: %s", __PRETTY_FUNCTION__, errno, safe_strerror(errno)); } @@ -52,7 +52,7 @@ int64_t pim_time_monotonic_sec() struct timeval now_tv; if (gettime_monotonic(&now_tv)) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "%s: gettime_monotonic() failure: errno=%d: %s", __PRETTY_FUNCTION__, errno, safe_strerror(errno)); return -1; @@ -71,7 +71,7 @@ int64_t pim_time_monotonic_dsec() int64_t now_dsec; if (gettime_monotonic(&now_tv)) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "%s: gettime_monotonic() failure: errno=%d: %s", __PRETTY_FUNCTION__, errno, safe_strerror(errno)); return -1; @@ -89,7 +89,7 @@ int64_t pim_time_monotonic_usec(void) int64_t now_dsec; if (gettime_monotonic(&now_tv)) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "%s: gettime_monotonic() failure: errno=%d: %s", __PRETTY_FUNCTION__, errno, safe_strerror(errno)); return -1; diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index 8b67fb7f5..68e50d4b0 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -123,7 +123,7 @@ void zclient_lookup_new(void) { zlookup = zclient_new_notify(master, &zclient_options_default); if (!zlookup) { - zlog_ferr(LIB_ERR_ZAPI_SOCKET, "%s: zclient_new() failure", + flog_err(LIB_ERR_ZAPI_SOCKET, "%s: zclient_new() failure", __PRETTY_FUNCTION__); return; } @@ -170,7 +170,7 @@ static int zclient_read_nexthop(struct pim_instance *pim, err = zclient_read_header(s, zlookup->sock, &length, &marker, &version, &vrf_id, &command); if (err < 0) { - zlog_ferr(LIB_ERR_ZAPI_MISSMATCH, + flog_err(LIB_ERR_ZAPI_MISSMATCH, "%s: zclient_read_header() failed", __PRETTY_FUNCTION__); zclient_lookup_failed(zlookup); @@ -315,7 +315,7 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim, /* Check socket. */ if (zlookup->sock < 0) { - zlog_ferr(LIB_ERR_ZAPI_SOCKET, + flog_err(LIB_ERR_ZAPI_SOCKET, "%s: zclient lookup socket is not connected", __PRETTY_FUNCTION__); zclient_lookup_failed(zlookup); @@ -337,7 +337,7 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim, ret = writen(zlookup->sock, s->data, stream_get_endp(s)); if (ret < 0) { - zlog_ferr( + flog_err( LIB_ERR_SOCKET, "%s: writen() failure: %d writing to zclient lookup socket", __PRETTY_FUNCTION__, errno); @@ -345,7 +345,7 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim, return -2; } if (ret == 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: connection closed on zclient lookup socket", __PRETTY_FUNCTION__); zclient_lookup_failed(zlookup); @@ -515,7 +515,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil) count = stream_get_endp(s); ret = writen(zlookup->sock, s->data, count); if (ret <= 0) { - zlog_ferr( + flog_err( LIB_ERR_SOCKET, "%s: writen() failure: %d writing to zclient lookup socket", __PRETTY_FUNCTION__, errno); @@ -535,7 +535,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil) err = zclient_read_header(s, zlookup->sock, &length, &marker, &version, &vrf_id, &command); if (err < 0) { - zlog_ferr(LIB_ERR_ZAPI_MISSMATCH, + flog_err(LIB_ERR_ZAPI_MISSMATCH, "%s: zclient_read_header() failed", __PRETTY_FUNCTION__); zclient_lookup_failed(zlookup); @@ -552,7 +552,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil) more.src = c_oil->oil.mfcc_origin; more.grp = c_oil->oil.mfcc_mcastgrp; - zlog_ferr( + flog_err( LIB_ERR_ZAPI_MISSMATCH, "%s: Received wrong %s(%s) information requested", __PRETTY_FUNCTION__, pim_str_sg_dump(&more), diff --git a/pimd/pimd.c b/pimd/pimd.c index f5ec37285..dd0c7e3c2 100644 --- a/pimd/pimd.c +++ b/pimd/pimd.c @@ -85,7 +85,7 @@ static void pim_free() void pim_init() { if (!inet_aton(PIM_ALL_PIM_ROUTERS, &qpim_all_pim_routers_addr)) { - zlog_ferr( + flog_err( LIB_ERR_SOCKET, "%s %s: could not solve %s to group address: errno=%d: %s", __FILE__, __PRETTY_FUNCTION__, PIM_ALL_PIM_ROUTERS, diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index ce0af49e5..5568ba334 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -865,7 +865,7 @@ static int rip_interface_wakeup(struct thread *t) /* Join to multicast group. */ if (rip_multicast_join(ifp, rip->sock) < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "multicast join failed, interface %s not running", ifp->name); return 0; diff --git a/ripd/ripd.c b/ripd/ripd.c index a0e38a7cd..2ba11a8ae 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -1058,7 +1058,7 @@ static void rip_auth_md5_set(struct stream *s, struct rip_interface *ri, /* Check packet length. */ if (len < (RIP_HEADER_SIZE + RIP_RTE_SIZE)) { - zlog_ferr(RIP_ERR_PACKET, + flog_err(RIP_ERR_PACKET, "rip_auth_md5_set(): packet length %ld is less than minimum length.", len); return; @@ -1341,7 +1341,7 @@ static int rip_create_socket(void) /* Make datagram socket. */ sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (sock < 0) { - zlog_ferr(LIB_ERR_SOCKET, "Cannot create UDP socket: %s", + flog_err(LIB_ERR_SOCKET, "Cannot create UDP socket: %s", safe_strerror(errno)); exit(1); } @@ -1358,7 +1358,7 @@ static int rip_create_socket(void) #endif if (ripd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "rip_create_socket: could not raise privs"); setsockopt_so_recvbuf(sock, RIP_UDP_RCV_BUF); if ((ret = bind(sock, (struct sockaddr *)&addr, sizeof(addr))) < 0) @@ -1366,10 +1366,10 @@ static int rip_create_socket(void) { int save_errno = errno; if (ripd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "rip_create_socket: could not lower privs"); - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s: Can't bind socket %d to %s port %d: %s", __func__, sock, inet_ntoa(addr.sin_addr), (int)ntohs(addr.sin_port), safe_strerror(save_errno)); @@ -1379,7 +1379,7 @@ static int rip_create_socket(void) } if (ripd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "rip_create_socket: could not lower privs"); return sock; diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index 804cb2659..5a5123bc2 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -73,7 +73,7 @@ static int ripng_multicast_join(struct interface *ifp) * for this call as a workaround. */ if (ripngd_privs.change(ZPRIVS_RAISE)) - zlog_ferr( + flog_err( LIB_ERR_PRIVILEGES, "ripng_multicast_join: could not raise privs"); @@ -82,7 +82,7 @@ static int ripng_multicast_join(struct interface *ifp) save_errno = errno; if (ripngd_privs.change(ZPRIVS_LOWER)) - zlog_ferr( + flog_err( LIB_ERR_PRIVILEGES, "ripng_multicast_join: could not lower privs"); @@ -647,7 +647,7 @@ static int ripng_interface_wakeup(struct thread *t) /* Join to multicast group. */ if (ripng_multicast_join(ifp) < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "multicast join failed, interface %s not running", ifp->name); return 0; diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 7472ec696..e29d6ae5c 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -95,7 +95,7 @@ static int ripng_make_socket(void) sock = socket(AF_INET6, SOCK_DGRAM, 0); if (sock < 0) { - zlog_ferr(LIB_ERR_SOCKET, "Can't make ripng socket"); + flog_err(LIB_ERR_SOCKET, "Can't make ripng socket"); return sock; } @@ -126,20 +126,20 @@ static int ripng_make_socket(void) ripaddr.sin6_port = htons(RIPNG_PORT_DEFAULT); if (ripngd_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "ripng_make_socket: could not raise privs"); ret = bind(sock, (struct sockaddr *)&ripaddr, sizeof(ripaddr)); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, "Can't bind ripng socket: %s.", + flog_err(LIB_ERR_SOCKET, "Can't bind ripng socket: %s.", safe_strerror(errno)); if (ripngd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "ripng_make_socket: could not lower privs"); goto error; } if (ripngd_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "ripng_make_socket: could not lower privs"); return sock; @@ -207,12 +207,12 @@ int ripng_send_packet(caddr_t buf, int bufsize, struct sockaddr_in6 *to, if (ret < 0) { if (to) - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "RIPng send fail on %s to %s: %s", ifp->name, inet6_ntoa(to->sin6_addr), safe_strerror(errno)); else - zlog_ferr(LIB_ERR_SOCKET, "RIPng send fail on %s: %s", + flog_err(LIB_ERR_SOCKET, "RIPng send fail on %s: %s", ifp->name, safe_strerror(errno)); } diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c index 2325c2546..0e917c397 100644 --- a/watchfrr/watchfrr.c +++ b/watchfrr/watchfrr.c @@ -249,7 +249,7 @@ static pid_t run_background(char *shell_cmd) switch (child = fork()) { case -1: - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "fork failed, cannot run command [%s]: %s", shell_cmd, safe_strerror(errno)); return -1; @@ -265,14 +265,14 @@ static pid_t run_background(char *shell_cmd) char dashc[] = "-c"; char *const argv[4] = {shell, dashc, shell_cmd, NULL}; execv("/bin/sh", argv); - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "execv(/bin/sh -c '%s') failed: %s", shell_cmd, safe_strerror(errno)); _exit(127); } default: /* Parent process: we will reap the child later. */ - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "Forked background command [pid %d]: %s", (int)child, shell_cmd); return child; @@ -331,7 +331,7 @@ static void sigchild(void) switch (child = waitpid(-1, &status, WNOHANG)) { case -1: - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "waitpid failed: %s", safe_strerror(errno)); return; case 0: @@ -355,7 +355,7 @@ static void sigchild(void) * completed. */ gettimeofday(&restart->time, NULL); } else { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "waitpid returned status for an unknown child process %d", (int)child); name = "(unknown)"; @@ -376,7 +376,7 @@ static void sigchild(void) zlog_debug("%s %s process %d exited normally", what, name, (int)child); } else - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "cannot interpret %s %s process %d wait status 0x%x", what, name, (int)child, status); phase_check(); @@ -488,7 +488,7 @@ static int wakeup_init(struct thread *t_wakeup) dmn->t_wakeup = NULL; if (try_connect(dmn) < 0) { SET_WAKEUP_DOWN(dmn); - zlog_ferr(WATCHFRR_ERR_CONNECTION, + flog_err(WATCHFRR_ERR_CONNECTION, "%s state -> down : initial connection attempt failed", dmn->name); dmn->state = DAEMON_DOWN; @@ -499,7 +499,7 @@ static int wakeup_init(struct thread *t_wakeup) static void daemon_down(struct daemon *dmn, const char *why) { if (IS_UP(dmn) || (dmn->state == DAEMON_INIT)) - zlog_ferr(WATCHFRR_ERR_CONNECTION, + flog_err(WATCHFRR_ERR_CONNECTION, "%s state -> down : %s", dmn->name, why); else if (gs.loglevel > LOG_DEBUG) zlog_debug("%s still down : %s", dmn->name, why); @@ -693,7 +693,7 @@ static int try_connect(struct daemon *dmn) of creating a socket. */ if (access(addr.sun_path, W_OK) < 0) { if (errno != ENOENT) - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "%s: access to socket %s denied: %s", dmn->name, addr.sun_path, safe_strerror(errno)); @@ -701,14 +701,14 @@ static int try_connect(struct daemon *dmn) } if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s(%s): cannot make socket: %s", __func__, addr.sun_path, safe_strerror(errno)); return -1; } if (set_nonblocking(sock) < 0 || set_cloexec(sock) < 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "%s(%s): set_nonblocking/cloexec(%d) failed", __func__, addr.sun_path, sock); close(sock); @@ -747,7 +747,7 @@ static int try_connect(struct daemon *dmn) static int phase_hanging(struct thread *t_hanging) { gs.t_phase_hanging = NULL; - zlog_ferr(WATCHFRR_ERR_CONNECTION, + flog_err(WATCHFRR_ERR_CONNECTION, "Phase [%s] hanging for %ld seconds, aborting phased restart", phase_str[gs.phase], PHASE_TIMEOUT); gs.phase = PHASE_NONE; @@ -863,7 +863,7 @@ static int wakeup_unresponsive(struct thread *t_wakeup) dmn->t_wakeup = NULL; if (dmn->state != DAEMON_UNRESPONSIVE) - zlog_ferr(WATCHFRR_ERR_CONNECTION, + flog_err(WATCHFRR_ERR_CONNECTION, "%s: no longer unresponsive (now %s), " "wakeup should have been cancelled!", dmn->name, state_str[dmn->state]); @@ -880,7 +880,7 @@ static int wakeup_no_answer(struct thread *t_wakeup) dmn->t_wakeup = NULL; dmn->state = DAEMON_UNRESPONSIVE; - zlog_ferr(WATCHFRR_ERR_CONNECTION, + flog_err(WATCHFRR_ERR_CONNECTION, "%s state -> unresponsive : no response yet to ping " "sent %ld seconds ago", dmn->name, gs.timeout); diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c index 7045d5128..3e7a87d0a 100644 --- a/zebra/if_ioctl.c +++ b/zebra/if_ioctl.c @@ -176,14 +176,14 @@ static int if_getaddrs(void) ret = getifaddrs(&ifap); if (ret != 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, "getifaddrs(): %s", + flog_err(LIB_ERR_SYSTEM_CALL, "getifaddrs(): %s", safe_strerror(errno)); return -1; } for (ifapfree = ifap; ifap; ifap = ifap->ifa_next) { if (ifap->ifa_addr == NULL) { - zlog_ferr( + flog_err( LIB_ERR_INTERFACE, "%s: nonsensical ifaddr with NULL ifa_addr, ifname %s", __func__, @@ -193,7 +193,7 @@ static int if_getaddrs(void) ifp = if_lookup_by_name(ifap->ifa_name, VRF_DEFAULT); if (ifp == NULL) { - zlog_ferr(LIB_ERR_INTERFACE, + flog_err(LIB_ERR_INTERFACE, "if_getaddrs(): Can't lookup interface %s\n", ifap->ifa_name); continue; diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c index 64412fba9..3b3064490 100644 --- a/zebra/if_ioctl_solaris.c +++ b/zebra/if_ioctl_solaris.c @@ -60,7 +60,7 @@ static int interface_list_ioctl(int af) char *buf = NULL; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); sock = socket(af, SOCK_DGRAM, 0); if (sock < 0) { @@ -69,7 +69,7 @@ static int interface_list_ioctl(int af) safe_strerror(errno)); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); return -1; } @@ -81,7 +81,7 @@ calculate_lifc_len: /* must hold privileges to enter here */ save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (ret < 0) { zlog_warn("interface_list_ioctl: SIOCGLIFNUM failed %s", @@ -111,7 +111,7 @@ calculate_lifc_len: /* must hold privileges to enter here */ lifconf.lifc_buf = buf; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); ret = ioctl(sock, SIOCGLIFCONF, &lifconf); @@ -123,13 +123,13 @@ calculate_lifc_len: /* must hold privileges to enter here */ zlog_warn("SIOCGLIFCONF: %s", safe_strerror(errno)); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); goto end; } if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); /* Allocate interface. */ lifreq = lifconf.lifc_req; diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 26aef2bb0..e09d30a20 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -80,7 +80,7 @@ static void set_ifindex(struct interface *ifp, ifindex_t ifi_index, if (((oifp = if_lookup_by_index_per_ns(zns, ifi_index)) != NULL) && (oifp != ifp)) { if (ifi_index == IFINDEX_INTERNAL) - zlog_ferr( + flog_err( LIB_ERR_INTERFACE, "Netlink is setting interface %s ifindex to reserved internal value %u", ifp->name, ifi_index); @@ -90,7 +90,7 @@ static void set_ifindex(struct interface *ifp, ifindex_t ifi_index, "interface index %d was renamed from %s to %s", ifi_index, oifp->name, ifp->name); if (if_is_up(oifp)) - zlog_ferr( + flog_err( LIB_ERR_INTERFACE, "interface rename detected on up interface: index %d was renamed from %s to %s, results are uncertain!", ifi_index, oifp->name, ifp->name); @@ -310,7 +310,7 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb, vrf = vrf_get((vrf_id_t)ifi->ifi_index, name); // It would create vrf if (!vrf) { - zlog_ferr(LIB_ERR_INTERFACE, "VRF %s id %u not created", + flog_err(LIB_ERR_INTERFACE, "VRF %s id %u not created", name, ifi->ifi_index); return; } @@ -332,7 +332,7 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb, /* Enable the created VRF. */ if (!vrf_enable(vrf)) { - zlog_ferr(LIB_ERR_INTERFACE, + flog_err(LIB_ERR_INTERFACE, "Failed to enable VRF %s id %u", name, ifi->ifi_index); return; @@ -376,7 +376,7 @@ static int get_iflink_speed(struct interface *interface) /* use ioctl to get IP address of an interface */ if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); sd = vrf_socket(PF_INET, SOCK_DGRAM, IPPROTO_IP, interface->vrf_id, NULL); if (sd < 0) { @@ -388,7 +388,7 @@ static int get_iflink_speed(struct interface *interface) /* Get the current link state for the interface */ rc = vrf_ioctl(interface->vrf_id, sd, SIOCETHTOOL, (char *)&ifdata); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (rc < 0) { if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( @@ -917,7 +917,7 @@ int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id, int startup) ifp = if_lookup_by_index_per_ns(zns, ifa->ifa_index); if (ifp == NULL) { - zlog_ferr( + flog_err( LIB_ERR_INTERFACE, "netlink_interface_addr can't find interface by index %d", ifa->ifa_index); diff --git a/zebra/interface.c b/zebra/interface.c index 9811badfc..763931d35 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -719,7 +719,7 @@ void if_delete_update(struct interface *ifp) struct zebra_if *zif; if (if_is_up(ifp)) { - zlog_ferr( + flog_err( LIB_ERR_INTERFACE, "interface %s vrf %u index %d is still up while being deleted.", ifp->name, ifp->vrf_id, ifp->ifindex); diff --git a/zebra/ioctl.c b/zebra/ioctl.c index aee3abf31..842b96d75 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -56,21 +56,21 @@ int if_ioctl(unsigned long request, caddr_t buffer) int err = 0; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock < 0) { int save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); - zlog_ferr(LIB_ERR_SOCKET, "Cannot create UDP socket: %s", + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_SOCKET, "Cannot create UDP socket: %s", safe_strerror(save_errno)); exit(1); } if ((ret = ioctl(sock, request, buffer)) < 0) err = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); close(sock); if (ret < 0) { @@ -88,14 +88,14 @@ int vrf_if_ioctl(unsigned long request, caddr_t buffer, vrf_id_t vrf_id) int err = 0; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); sock = vrf_socket(AF_INET, SOCK_DGRAM, 0, vrf_id, NULL); if (sock < 0) { int save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); - zlog_ferr(LIB_ERR_SOCKET, "Cannot create UDP socket: %s", + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_SOCKET, "Cannot create UDP socket: %s", safe_strerror(save_errno)); exit(1); } @@ -103,7 +103,7 @@ int vrf_if_ioctl(unsigned long request, caddr_t buffer, vrf_id_t vrf_id) if (ret < 0) err = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); close(sock); if (ret < 0) { @@ -121,14 +121,14 @@ static int if_ioctl_ipv6(unsigned long request, caddr_t buffer) int err = 0; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); sock = socket(AF_INET6, SOCK_DGRAM, 0); if (sock < 0) { int save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_SOCKET, "Cannot create IPv6 datagram socket: %s", safe_strerror(save_errno)); exit(1); @@ -137,7 +137,7 @@ static int if_ioctl_ipv6(unsigned long request, caddr_t buffer) if ((ret = ioctl(sock, request, buffer)) < 0) err = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); close(sock); if (ret < 0) { @@ -415,7 +415,7 @@ void if_get_flags(struct interface *ifp) ret = vrf_if_ioctl(SIOCGIFFLAGS, (caddr_t)&ifreq, ifp->vrf_id); if (ret < 0) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "vrf_if_ioctl(SIOCGIFFLAGS) failed: %s", safe_strerror(errno)); return; @@ -434,7 +434,7 @@ void if_get_flags(struct interface *ifp) /* Seems not all interfaces implement this ioctl */ if (if_ioctl(SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "if_ioctl(SIOCGIFMEDIA) failed: %s", safe_strerror(errno)); else if (ifmr.ifm_status & IFM_AVALID) /* Link state is valid */ diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c index 1e24e3fbf..09e9213cc 100644 --- a/zebra/ioctl_solaris.c +++ b/zebra/ioctl_solaris.c @@ -59,14 +59,14 @@ int if_ioctl(unsigned long request, caddr_t buffer) int err; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock < 0) { int save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); - zlog_ferr(LIB_ERR_SOCKET, "Cannot create UDP socket: %s", + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_SOCKET, "Cannot create UDP socket: %s", safe_strerror(save_errno)); exit(1); } @@ -75,7 +75,7 @@ int if_ioctl(unsigned long request, caddr_t buffer) err = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); close(sock); @@ -94,14 +94,14 @@ int if_ioctl_ipv6(unsigned long request, caddr_t buffer) int err; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); sock = socket(AF_INET6, SOCK_DGRAM, 0); if (sock < 0) { int save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_SOCKET, "Cannot create IPv6 datagram socket: %s", safe_strerror(save_errno)); exit(1); @@ -111,7 +111,7 @@ int if_ioctl_ipv6(unsigned long request, caddr_t buffer) err = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); close(sock); diff --git a/zebra/ipforward_proc.c b/zebra/ipforward_proc.c index feafbb27c..fc2762441 100644 --- a/zebra/ipforward_proc.c +++ b/zebra/ipforward_proc.c @@ -78,14 +78,14 @@ int ipforward_on(void) FILE *fp; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges, %s", + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges, %s", safe_strerror(errno)); fp = fopen(proc_ipv4_forwarding, "w"); if (fp == NULL) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges, %s", safe_strerror(errno)); return -1; @@ -96,7 +96,7 @@ int ipforward_on(void) fclose(fp); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges, %s", + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges, %s", safe_strerror(errno)); return ipforward(); @@ -107,14 +107,14 @@ int ipforward_off(void) FILE *fp; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges, %s", + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges, %s", safe_strerror(errno)); fp = fopen(proc_ipv4_forwarding, "w"); if (fp == NULL) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges, %s", safe_strerror(errno)); return -1; @@ -125,7 +125,7 @@ int ipforward_off(void) fclose(fp); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges, %s", + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges, %s", safe_strerror(errno)); return ipforward(); @@ -161,14 +161,14 @@ int ipforward_ipv6_on(void) FILE *fp; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges, %s", + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges, %s", safe_strerror(errno)); fp = fopen(proc_ipv6_forwarding, "w"); if (fp == NULL) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges, %s", safe_strerror(errno)); return -1; @@ -179,7 +179,7 @@ int ipforward_ipv6_on(void) fclose(fp); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges, %s", + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges, %s", safe_strerror(errno)); return ipforward_ipv6(); @@ -191,14 +191,14 @@ int ipforward_ipv6_off(void) FILE *fp; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges, %s", + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges, %s", safe_strerror(errno)); fp = fopen(proc_ipv6_forwarding, "w"); if (fp == NULL) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges, %s", safe_strerror(errno)); return -1; @@ -209,7 +209,7 @@ int ipforward_ipv6_off(void) fclose(fp); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges, %s", + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges, %s", safe_strerror(errno)); return ipforward_ipv6(); diff --git a/zebra/ipforward_solaris.c b/zebra/ipforward_solaris.c index 9fc46b25d..43b1fac5f 100644 --- a/zebra/ipforward_solaris.c +++ b/zebra/ipforward_solaris.c @@ -70,7 +70,7 @@ static int solaris_nd(const int cmd, const char *parameter, const int value) else if (cmd == ND_GET) snprintf(nd_buf, ND_BUFFER_SIZE, "%s", parameter); else { - zlog_ferr(LIB_ERR_SYSTEM_CALL, + flog_err(LIB_ERR_SYSTEM_CALL, "internal error - inappropriate command given to " "solaris_nd()%s:%d", __FILE__, __LINE__); @@ -83,20 +83,20 @@ static int solaris_nd(const int cmd, const char *parameter, const int value) strioctl.ic_dp = nd_buf; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "solaris_nd: Can't raise privileges"); if ((fd = open(device, O_RDWR)) < 0) { zlog_warn("failed to open device %s - %s", device, safe_strerror(errno)); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "solaris_nd: Can't lower privileges"); return -1; } if (ioctl(fd, I_STR, &strioctl) < 0) { int save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "solaris_nd: Can't lower privileges"); close(fd); zlog_warn("ioctl I_STR failed on device %s - %s", device, @@ -105,7 +105,7 @@ static int solaris_nd(const int cmd, const char *parameter, const int value) } close(fd); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "solaris_nd: Can't lower privileges"); if (cmd == ND_GET) { diff --git a/zebra/ipforward_sysctl.c b/zebra/ipforward_sysctl.c index 8e34ed73b..f0eaa1ace 100644 --- a/zebra/ipforward_sysctl.c +++ b/zebra/ipforward_sysctl.c @@ -55,15 +55,15 @@ int ipforward_on(void) len = sizeof ipforwarding; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); if (sysctl(mib, MIB_SIZ, NULL, NULL, &ipforwarding, len) < 0) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); zlog_warn("Can't set ipforwarding on"); return -1; } if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); return ipforwarding; } @@ -74,15 +74,15 @@ int ipforward_off(void) len = sizeof ipforwarding; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); if (sysctl(mib, MIB_SIZ, NULL, NULL, &ipforwarding, len) < 0) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); zlog_warn("Can't set ipforwarding on"); return -1; } if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); return ipforwarding; } @@ -102,15 +102,15 @@ int ipforward_ipv6(void) len = sizeof ip6forwarding; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); if (sysctl(mib_ipv6, MIB_SIZ, &ip6forwarding, &len, 0, 0) < 0) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); zlog_warn("can't get ip6forwarding value"); return -1; } if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); return ip6forwarding; } @@ -121,15 +121,15 @@ int ipforward_ipv6_on(void) len = sizeof ip6forwarding; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); if (sysctl(mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len) < 0) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); zlog_warn("can't get ip6forwarding value"); return -1; } if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); return ip6forwarding; } @@ -140,15 +140,15 @@ int ipforward_ipv6_off(void) len = sizeof ip6forwarding; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); if (sysctl(mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len) < 0) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); zlog_warn("can't get ip6forwarding value"); return -1; } if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); return ip6forwarding; } diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 8efbdcf48..630eee592 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -82,7 +82,7 @@ int irdp_sock_init(void) int sock; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "irdp_sock_init: could not raise privs, %s", safe_strerror(errno)); @@ -90,7 +90,7 @@ int irdp_sock_init(void) save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "irdp_sock_init: could not lower privs, %s", safe_strerror(errno)); diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index 31467e51e..c36c95897 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -95,13 +95,13 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp) src = ip->ip_src; if (len != iplen) { - zlog_ferr(ZEBRA_ERR_IRDP_LEN_MISMATCH, + flog_err(ZEBRA_ERR_IRDP_LEN_MISMATCH, "IRDP: RX length doesnt match IP length"); return; } if (iplen < ICMP_MINLEN) { - zlog_ferr(ZEBRA_ERR_IRDP_LEN_MISMATCH, + flog_err(ZEBRA_ERR_IRDP_LEN_MISMATCH, "IRDP: RX ICMP packet too short from %s\n", inet_ntoa(src)); return; @@ -112,7 +112,7 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp) + len of IP-header) 14+20 */ if (iplen > IRDP_RX_BUF - 34) { - zlog_ferr(ZEBRA_ERR_IRDP_LEN_MISMATCH, + flog_err(ZEBRA_ERR_IRDP_LEN_MISMATCH, "IRDP: RX ICMP packet too long from %s\n", inet_ntoa(src)); return; diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index de0e8af66..e9f440832 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -163,7 +163,7 @@ static int netlink_recvbuf(struct nlsock *nl, uint32_t newsize) ret = getsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF, &oldsize, &oldlen); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "Can't get %s receive buffer size: %s", nl->name, safe_strerror(errno)); return -1; @@ -171,18 +171,18 @@ static int netlink_recvbuf(struct nlsock *nl, uint32_t newsize) /* Try force option (linux >= 2.6.14) and fall back to normal set */ if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "routing_socket: Can't raise privileges"); ret = setsockopt(nl->sock, SOL_SOCKET, SO_RCVBUFFORCE, &nl_rcvbufsize, sizeof(nl_rcvbufsize)); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "routing_socket: Can't lower privileges"); if (ret < 0) ret = setsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF, &nl_rcvbufsize, sizeof(nl_rcvbufsize)); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "Can't set %s receive buffer size: %s", nl->name, safe_strerror(errno)); return -1; @@ -190,7 +190,7 @@ static int netlink_recvbuf(struct nlsock *nl, uint32_t newsize) ret = getsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF, &newsize, &newlen); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "Can't get %s receive buffer size: %s", nl->name, safe_strerror(errno)); return -1; @@ -212,13 +212,13 @@ static int netlink_socket(struct nlsock *nl, unsigned long groups, int save_errno; if (zserv_privs.change(ZPRIVS_RAISE)) { - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); return -1; } sock = ns_socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE, ns_id); if (sock < 0) { - zlog_ferr(LIB_ERR_SOCKET, "Can't open %s socket: %s", nl->name, + flog_err(LIB_ERR_SOCKET, "Can't open %s socket: %s", nl->name, safe_strerror(errno)); return -1; } @@ -231,10 +231,10 @@ static int netlink_socket(struct nlsock *nl, unsigned long groups, ret = bind(sock, (struct sockaddr *)&snl, sizeof snl); save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "Can't bind %s socket to group 0x%x: %s", nl->name, snl.nl_groups, safe_strerror(save_errno)); close(sock); @@ -245,7 +245,7 @@ static int netlink_socket(struct nlsock *nl, unsigned long groups, namelen = sizeof snl; ret = getsockname(sock, (struct sockaddr *)&snl, (socklen_t *)&namelen); if (ret < 0 || namelen != sizeof snl) { - zlog_ferr(LIB_ERR_SOCKET, "Can't get %s socket name: %s", + flog_err(LIB_ERR_SOCKET, "Can't get %s socket name: %s", nl->name, safe_strerror(errno)); close(sock); return -1; @@ -297,7 +297,7 @@ static int netlink_information_fetch(struct nlmsghdr *h, ns_id_t ns_id, * this message type or not ask for * it to be sent up to us */ - zlog_ferr(ZEBRA_ERR_UNKNOWN_NLMSG, + flog_err(ZEBRA_ERR_UNKNOWN_NLMSG, "Unknown netlink nlmsg_type %s(%d) vrf %u\n", nl_msg_type_to_str(h->nlmsg_type), h->nlmsg_type, ns_id); @@ -707,7 +707,7 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int), continue; if (errno == EWOULDBLOCK || errno == EAGAIN) break; - zlog_ferr(ZEBRA_ERR_RECVMSG_OVERRUN, + flog_err(ZEBRA_ERR_RECVMSG_OVERRUN, "%s recvmsg overrun: %s", nl->name, safe_strerror(errno)); /* @@ -720,12 +720,12 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int), } if (status == 0) { - zlog_ferr(LIB_ERR_SOCKET, "%s EOF", nl->name); + flog_err(LIB_ERR_SOCKET, "%s EOF", nl->name); return -1; } if (msg.msg_namelen != sizeof snl) { - zlog_ferr(ZEBRA_ERR_NETLINK_LENGTH_ERROR, + flog_err(ZEBRA_ERR_NETLINK_LENGTH_ERROR, "%s sender address length error: length %d", nl->name, msg.msg_namelen); return -1; @@ -800,7 +800,7 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int), if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) { - zlog_ferr( + flog_err( ZEBRA_ERR_NETLINK_LENGTH_ERROR, "%s error: message truncated", nl->name); @@ -855,7 +855,7 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int), err->msg.nlmsg_seq, err->msg.nlmsg_pid); } else - zlog_ferr( + flog_err( ZEBRA_ERR_UNEXPECTED_MESSAGE, "%s error: %s, type=%s(%u), seq=%u, pid=%u", nl->name, @@ -896,12 +896,12 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int), /* After error care. */ if (msg.msg_flags & MSG_TRUNC) { - zlog_ferr(ZEBRA_ERR_NETLINK_LENGTH_ERROR, + flog_err(ZEBRA_ERR_NETLINK_LENGTH_ERROR, "%s error: message truncated", nl->name); continue; } if (status) { - zlog_ferr(ZEBRA_ERR_NETLINK_LENGTH_ERROR, + flog_err(ZEBRA_ERR_NETLINK_LENGTH_ERROR, "%s error: data remnant size %d", nl->name, status); return -1; @@ -958,11 +958,11 @@ int netlink_talk(int (*filter)(struct nlmsghdr *, ns_id_t, int startup), /* Send message to netlink interface. */ if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); status = sendmsg(nl->sock, &msg, 0); save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND) { zlog_debug("%s: >> netlink message dump [sent]", __func__); @@ -970,7 +970,7 @@ int netlink_talk(int (*filter)(struct nlmsghdr *, ns_id_t, int startup), } if (status < 0) { - zlog_ferr(LIB_ERR_SOCKET, "netlink_talk sendmsg() error: %s", + flog_err(LIB_ERR_SOCKET, "netlink_talk sendmsg() error: %s", safe_strerror(save_errno)); return -1; } @@ -994,7 +994,7 @@ int netlink_request(struct nlsock *nl, struct nlmsghdr *n) /* Check netlink socket. */ if (nl->sock < 0) { - zlog_ferr(LIB_ERR_SOCKET, "%s socket isn't active.", nl->name); + flog_err(LIB_ERR_SOCKET, "%s socket isn't active.", nl->name); return -1; } @@ -1008,7 +1008,7 @@ int netlink_request(struct nlsock *nl, struct nlmsghdr *n) /* Raise capabilities and send message, then lower capabilities. */ if (zserv_privs.change(ZPRIVS_RAISE)) { - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); return -1; } @@ -1017,10 +1017,10 @@ int netlink_request(struct nlsock *nl, struct nlmsghdr *n) save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, "%s sendto failed: %s", nl->name, + flog_err(LIB_ERR_SOCKET, "%s sendto failed: %s", nl->name, safe_strerror(save_errno)); return -1; } @@ -1095,7 +1095,7 @@ void kernel_init(struct zebra_ns *zns) /* Register kernel socket. */ if (fcntl(zns->netlink.sock, F_SETFL, O_NONBLOCK) < 0) - zlog_ferr(LIB_ERR_SOCKET, "Can't set %s socket flags: %s", + flog_err(LIB_ERR_SOCKET, "Can't set %s socket flags: %s", zns->netlink.name, safe_strerror(errno)); if (fcntl(zns->netlink_cmd.sock, F_SETFL, O_NONBLOCK) < 0) diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 9e4f09f0e..79721cf87 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -409,7 +409,7 @@ int ifm_read(struct if_msghdr *ifm) /* paranoia: sanity check structure */ if (ifm->ifm_msglen < sizeof(struct if_msghdr)) { - zlog_ferr(ZEBRA_ERR_NETLINK_LENGTH_ERROR, + flog_err(ZEBRA_ERR_NETLINK_LENGTH_ERROR, "ifm_read: ifm->ifm_msglen %d too short\n", ifm->ifm_msglen); return -1; @@ -1386,7 +1386,7 @@ static int kernel_read(struct thread *thread) static void routing_socket(struct zebra_ns *zns) { if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "routing_socket: Can't raise privileges"); routing_sock = @@ -1394,7 +1394,7 @@ static void routing_socket(struct zebra_ns *zns) if (routing_sock < 0) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "routing_socket: Can't lower privileges"); zlog_warn("Can't init kernel routing socket"); return; @@ -1408,7 +1408,7 @@ static void routing_socket(struct zebra_ns *zns) zlog_warn ("Can't set O_NONBLOCK to routing socket");*/ if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "routing_socket: Can't lower privileges"); /* kernel_read needs rewrite. */ diff --git a/zebra/label_manager.c b/zebra/label_manager.c index c6a32343d..e53764c77 100644 --- a/zebra/label_manager.c +++ b/zebra/label_manager.c @@ -83,7 +83,7 @@ static int relay_response_back(void) ret = zclient_read_header(src, zclient->sock, &size, &marker, &version, &vrf_id, &resp_cmd); if (ret < 0 && errno != EAGAIN) { - zlog_ferr(ZEBRA_ERR_LM_RESPONSE, + flog_err(ZEBRA_ERR_LM_RESPONSE, "Error reading Label Manager response: %s", strerror(errno)); return -1; @@ -103,7 +103,7 @@ static int relay_response_back(void) /* lookup the client to relay the msg to */ zserv = zserv_find_client(proto, instance); if (!zserv) { - zlog_ferr( + flog_err( ZEBRA_ERR_LM_NO_SUCH_CLIENT, "Error relaying LM response: can't find client %s, instance %u", proto_str, instance); @@ -119,7 +119,7 @@ static int relay_response_back(void) /* send response back */ ret = writen(zserv->sock, dst->data, stream_get_endp(dst)); if (ret <= 0) { - zlog_ferr(ZEBRA_ERR_LM_RELAY_FAILED, + flog_err(ZEBRA_ERR_LM_RELAY_FAILED, "Error relaying LM response to %s instance %u: %s", proto_str, instance, strerror(errno)); return -1; @@ -187,7 +187,7 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv, unsigned short instance; if (zclient->sock < 0) { - zlog_ferr(ZEBRA_ERR_LM_NO_SOCKET, + flog_err(ZEBRA_ERR_LM_NO_SOCKET, "Unable to relay LM request: no socket"); reply_error(cmd, zserv, vrf_id); return -1; @@ -216,7 +216,7 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv, /* check & set client instance if unset */ if (zserv->instance && zserv->instance != instance) { - zlog_ferr(ZEBRA_ERR_LM_BAD_INSTANCE, + flog_err(ZEBRA_ERR_LM_BAD_INSTANCE, "Client instance(%u) != msg instance(%u)", zserv->instance, instance); return -1; @@ -239,7 +239,7 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv, /* Send request to external label manager */ ret = writen(zclient->sock, dst->data, stream_get_endp(dst)); if (ret <= 0) { - zlog_ferr(ZEBRA_ERR_LM_RELAY_FAILED, + flog_err(ZEBRA_ERR_LM_RELAY_FAILED, "Error relaying LM request from %s instance %u: %s", proto_str, instance, strerror(errno)); reply_error(cmd, zserv, vrf_id); @@ -269,7 +269,7 @@ static int lm_zclient_connect(struct thread *t) return 0; if (zclient_socket_connect(zclient) < 0) { - zlog_ferr(ZEBRA_ERR_LM_CLIENT_CONNECTION_FAILED, + flog_err(ZEBRA_ERR_LM_CLIENT_CONNECTION_FAILED, "Error connecting synchronous zclient!"); thread_add_timer(zebrad.master, lm_zclient_connect, zclient, CONNECTION_DELAY, &zclient->t_connect); @@ -401,7 +401,7 @@ struct label_manager_chunk *assign_label_chunk(uint8_t proto, ->end + 1; if (lmc->start > MPLS_LABEL_UNRESERVED_MAX - size + 1) { - zlog_ferr(ZEBRA_ERR_LM_EXHAUSTED_LABELS, + flog_err(ZEBRA_ERR_LM_EXHAUSTED_LABELS, "Reached max labels. Start: %u, size: %u", lmc->start, size); XFREE(MTYPE_LM_CHUNK, lmc); @@ -441,7 +441,7 @@ int release_label_chunk(uint8_t proto, unsigned short instance, uint32_t start, if (lmc->end != end) continue; if (lmc->proto != proto || lmc->instance != instance) { - zlog_ferr(ZEBRA_ERR_LM_DAEMON_MISMATCH, + flog_err(ZEBRA_ERR_LM_DAEMON_MISMATCH, "%s: Daemon mismatch!!", __func__); continue; } @@ -452,7 +452,7 @@ int release_label_chunk(uint8_t proto, unsigned short instance, uint32_t start, break; } if (ret != 0) - zlog_ferr(ZEBRA_ERR_LM_UNRELEASED_CHUNK, + flog_err(ZEBRA_ERR_LM_UNRELEASED_CHUNK, "%s: Label chunk not released!!", __func__); return ret; diff --git a/zebra/main.c b/zebra/main.c index 9453e54b6..5e7c69382 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -289,7 +289,7 @@ int main(int argc, char **argv) multipath_num = atoi(optarg); if (multipath_num > MULTIPATH_NUM || multipath_num <= 0) { - zlog_ferr( + flog_err( ZEBRA_ERR_BAD_MULTIPATH_NUM, "Multipath Number specified must be less than %d and greater than 0", MULTIPATH_NUM); diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c index e629e7387..8910aa8f6 100644 --- a/zebra/rt_socket.c +++ b/zebra/rt_socket.c @@ -212,7 +212,7 @@ static int kernel_rtm_ipv4(int cmd, const struct prefix *p, */ case ZEBRA_ERR_RTEXIST: if (cmd != RTM_ADD) - zlog_ferr( + flog_err( LIB_ERR_SYSTEM_CALL, "%s: rtm_write() returned %d for command %d", __func__, error, cmd); @@ -226,7 +226,7 @@ static int kernel_rtm_ipv4(int cmd, const struct prefix *p, case ZEBRA_ERR_RTNOEXIST: case ZEBRA_ERR_RTUNREACH: default: - zlog_ferr( + flog_err( LIB_ERR_SYSTEM_CALL, "%s: %s: rtm_write() unexpectedly returned %d for command %s", __func__, @@ -404,7 +404,7 @@ enum dp_req_result kernel_route_rib(struct route_node *rn, } if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); if (old) route |= kernel_rtm(RTM_DELETE, p, old); @@ -413,7 +413,7 @@ enum dp_req_result kernel_route_rib(struct route_node *rn, route |= kernel_rtm(RTM_ADD, p, new); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (new) { kernel_route_rib_pass_fail( diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 03eb1566a..c76a0df26 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -374,7 +374,7 @@ static void rtadv_send_packet(int sock, struct interface *ifp) ret = sendmsg(sock, &msg, 0); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "%s(%u): Tx RA failed, socket %u error %d (%s)", ifp->name, ifp->ifindex, sock, errno, safe_strerror(errno)); @@ -631,14 +631,14 @@ static int rtadv_make_socket(ns_id_t ns_id) struct icmp6_filter filter; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "rtadv_make_socket: could not raise privs, %s", safe_strerror(errno)); sock = ns_socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6, ns_id); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, + flog_err(LIB_ERR_PRIVILEGES, "rtadv_make_socket: could not lower privs, %s", safe_strerror(errno)); diff --git a/zebra/rule_socket.c b/zebra/rule_socket.c index e06906ff4..620410de0 100644 --- a/zebra/rule_socket.c +++ b/zebra/rule_socket.c @@ -44,14 +44,14 @@ enum dp_req_result kernel_add_pbr_rule(struct zebra_pbr_rule *rule) { - zlog_ferr(LIB_ERR_UNAVAILABLE, "%s not Implemented for this platform", + flog_err(LIB_ERR_UNAVAILABLE, "%s not Implemented for this platform", __PRETTY_FUNCTION__); return DP_REQUEST_FAILURE; } enum dp_req_result kernel_del_pbr_rule(struct zebra_pbr_rule *rule) { - zlog_ferr(LIB_ERR_UNAVAILABLE, "%s not Implemented for this platform", + flog_err(LIB_ERR_UNAVAILABLE, "%s not Implemented for this platform", __PRETTY_FUNCTION__); return DP_REQUEST_FAILURE; } diff --git a/zebra/table_manager.c b/zebra/table_manager.c index ecff9bd85..43b5c7d59 100644 --- a/zebra/table_manager.c +++ b/zebra/table_manager.c @@ -147,7 +147,7 @@ struct table_manager_chunk *assign_table_chunk(uint8_t proto, uint16_t instance, #endif /* SUNOS_5 */ tmc->start = start; if (RT_TABLE_ID_UNRESERVED_MAX - size + 1 < start) { - zlog_ferr(ZEBRA_ERR_TM_EXHAUSTED_IDS, + flog_err(ZEBRA_ERR_TM_EXHAUSTED_IDS, "Reached max table id. Start/Size %u/%u", start, size); XFREE(MTYPE_TM_CHUNK, tmc); @@ -186,7 +186,7 @@ int release_table_chunk(uint8_t proto, uint16_t instance, uint32_t start, if (tmc->end != end) continue; if (tmc->proto != proto || tmc->instance != instance) { - zlog_ferr(ZEBRA_ERR_TM_DAEMON_MISMATCH, + flog_err(ZEBRA_ERR_TM_DAEMON_MISMATCH, "%s: Daemon mismatch!!", __func__); continue; } @@ -196,7 +196,7 @@ int release_table_chunk(uint8_t proto, uint16_t instance, uint32_t start, break; } if (ret != 0) - zlog_ferr(ZEBRA_ERR_TM_UNRELEASED_CHUNK, + flog_err(ZEBRA_ERR_TM_UNRELEASED_CHUNK, "%s: Table chunk not released!!", __func__); return ret; diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 369dcfeec..a74c6bc4b 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1058,7 +1058,7 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS) STREAM_GET(&p.u.prefix6, s, IPV6_MAX_BYTELEN); l += IPV6_MAX_BYTELEN; } else { - zlog_ferr( + flog_err( ZEBRA_ERR_UNKNOWN_FAMILY, "rnh_register: Received unknown family type %d\n", p.family); @@ -1137,7 +1137,7 @@ static void zread_rnh_unregister(ZAPI_HANDLER_ARGS) STREAM_GET(&p.u.prefix6, s, IPV6_MAX_BYTELEN); l += IPV6_MAX_BYTELEN; } else { - zlog_ferr( + flog_err( ZEBRA_ERR_UNKNOWN_FAMILY, "rnh_register: Received unknown family type %d\n", p.family); @@ -1174,7 +1174,7 @@ static void zread_fec_register(ZAPI_HANDLER_ARGS) * registration */ if (hdr->length < ZEBRA_MIN_FEC_LENGTH) { - zlog_ferr( + flog_err( ZEBRA_ERR_IRDP_LEN_MISMATCH, "fec_register: Received a fec register of hdr->length %d, it is of insufficient size to properly decode", hdr->length); @@ -1186,7 +1186,7 @@ static void zread_fec_register(ZAPI_HANDLER_ARGS) memset(&p, 0, sizeof(p)); STREAM_GETW(s, p.family); if (p.family != AF_INET && p.family != AF_INET6) { - zlog_ferr( + flog_err( ZEBRA_ERR_UNKNOWN_FAMILY, "fec_register: Received unknown family type %d\n", p.family); @@ -1234,7 +1234,7 @@ static void zread_fec_unregister(ZAPI_HANDLER_ARGS) * fec unregistration */ if (hdr->length < ZEBRA_MIN_FEC_LENGTH) { - zlog_ferr( + flog_err( ZEBRA_ERR_IRDP_LEN_MISMATCH, "fec_unregister: Received a fec unregister of hdr->length %d, it is of insufficient size to properly decode", hdr->length); @@ -1249,7 +1249,7 @@ static void zread_fec_unregister(ZAPI_HANDLER_ARGS) memset(&p, 0, sizeof(p)); STREAM_GETW(s, p.family); if (p.family != AF_INET && p.family != AF_INET6) { - zlog_ferr( + flog_err( ZEBRA_ERR_UNKNOWN_FAMILY, "fec_unregister: Received unknown family type %d\n", p.family); @@ -2382,7 +2382,7 @@ static void zread_table_manager_connect(struct zserv *client, /* accept only dynamic routing protocols */ if ((proto >= ZEBRA_ROUTE_MAX) || (proto <= ZEBRA_ROUTE_STATIC)) { - zlog_ferr(ZEBRA_ERR_TM_WRONG_PROTO, + flog_err(ZEBRA_ERR_TM_WRONG_PROTO, "client %d has wrong protocol %s", client->sock, zebra_route_string(proto)); zsend_table_manager_connect_response(client, vrf_id, 1); @@ -2422,7 +2422,7 @@ static void zread_label_manager_connect(struct zserv *client, /* accept only dynamic routing protocols */ if ((proto >= ZEBRA_ROUTE_MAX) || (proto <= ZEBRA_ROUTE_STATIC)) { - zlog_ferr(ZEBRA_ERR_TM_WRONG_PROTO, + flog_err(ZEBRA_ERR_TM_WRONG_PROTO, "client %d has wrong protocol %s", client->sock, zebra_route_string(proto)); zsend_label_manager_connect_response(client, vrf_id, 1); @@ -2452,7 +2452,7 @@ static int msg_client_id_mismatch(const char *op, struct zserv *client, uint8_t proto, unsigned int instance) { if (proto != client->proto) { - zlog_ferr(ZEBRA_ERR_PROTO_OR_INSTANCE_MISMATCH, + flog_err(ZEBRA_ERR_PROTO_OR_INSTANCE_MISMATCH, "%s: msg vs client proto mismatch, client=%u msg=%u", op, client->proto, proto); /* TODO: fail when BGP sets proto and instance */ @@ -2460,7 +2460,7 @@ static int msg_client_id_mismatch(const char *op, struct zserv *client, } if (instance != client->instance) { - zlog_ferr( + flog_err( ZEBRA_ERR_PROTO_OR_INSTANCE_MISMATCH, "%s: msg vs client instance mismatch, client=%u msg=%u", op, client->instance, instance); @@ -2496,7 +2496,7 @@ static void zread_get_label_chunk(struct zserv *client, struct stream *msg, lmc = assign_label_chunk(client->proto, client->instance, keep, size); if (!lmc) - zlog_ferr( + flog_err( ZEBRA_ERR_LM_CANNOT_ASSIGN_CHUNK, "Unable to assign Label Chunk of size %u to %s instance %u", size, zebra_route_string(client->proto), @@ -2555,7 +2555,7 @@ static void zread_label_manager_request(ZAPI_HANDLER_ARGS) else { /* Sanity: don't allow 'unidentified' requests */ if (!client->proto) { - zlog_ferr( + flog_err( ZEBRA_ERR_LM_ALIENS, "Got label request from an unidentified client"); return; @@ -2584,7 +2584,7 @@ static void zread_get_table_chunk(struct zserv *client, struct stream *msg, tmc = assign_table_chunk(client->proto, client->instance, size); if (!tmc) - zlog_ferr(ZEBRA_ERR_TM_CANNOT_ASSIGN_CHUNK, + flog_err(ZEBRA_ERR_TM_CANNOT_ASSIGN_CHUNK, "%s: Unable to assign Table Chunk of size %u", __func__, size); else @@ -2623,7 +2623,7 @@ static void zread_table_manager_request(ZAPI_HANDLER_ARGS) else { /* Sanity: don't allow 'unidentified' requests */ if (!client->proto) { - zlog_ferr( + flog_err( ZEBRA_ERR_TM_ALIENS, "Got table request from an unidentified client"); return; diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index 8b1463c9b..1cb14abbf 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -1518,7 +1518,7 @@ static inline void zfpm_init_message_format(const char *format) if (!strcmp("netlink", format)) { if (!have_netlink) { - zlog_ferr( + flog_err( ZEBRA_ERR_NETLINK_NOT_AVAILABLE, "FPM netlink message format is not available"); return; @@ -1529,7 +1529,7 @@ static inline void zfpm_init_message_format(const char *format) if (!strcmp("protobuf", format)) { if (!have_protobuf) { - zlog_ferr( + flog_err( ZEBRA_ERR_PROTOBUF_NOT_AVAILABLE, "FPM protobuf message format is not available"); return; diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index a778dc9af..cd41537a1 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -918,7 +918,7 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data) UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED); switch (kernel_add_lsp(lsp)) { case DP_REQUEST_QUEUED: - zlog_ferr( + flog_err( ZEBRA_ERR_DP_INVALID_RC, "No current DataPlane interfaces can return this, please fix"); break; @@ -935,7 +935,7 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data) switch (kernel_del_lsp(lsp)) { case DP_REQUEST_QUEUED: - zlog_ferr( + flog_err( ZEBRA_ERR_DP_INVALID_RC, "No current DataPlane interfaces can return this, please fix"); break; @@ -975,7 +975,7 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data) switch (kernel_upd_lsp(lsp)) { case DP_REQUEST_QUEUED: - zlog_ferr( + flog_err( ZEBRA_ERR_DP_INVALID_RC, "No current DataPlane interfaces can return this, please fix"); break; @@ -1055,7 +1055,7 @@ static int lsp_processq_add(zebra_lsp_t *lsp) return 0; if (zebrad.lsp_process_q == NULL) { - zlog_ferr(ZEBRA_ERR_WQ_NONEXISTENT, + flog_err(ZEBRA_ERR_WQ_NONEXISTENT, "%s: work_queue does not exist!", __func__); return -1; } @@ -1698,7 +1698,7 @@ static int mpls_processq_init(struct zebra_t *zebra) { zebra->lsp_process_q = work_queue_new(zebra->master, "LSP processing"); if (!zebra->lsp_process_q) { - zlog_ferr(ZEBRA_ERR_WQ_NONEXISTENT, + flog_err(ZEBRA_ERR_WQ_NONEXISTENT, "%s: could not initialise work queue!", __func__); return -1; } @@ -1834,7 +1834,7 @@ int zebra_mpls_fec_register(struct zebra_vrf *zvrf, struct prefix *p, fec = fec_add(table, p, MPLS_INVALID_LABEL, 0, label_index); if (!fec) { prefix2str(p, buf, BUFSIZ); - zlog_ferr( + flog_err( ZEBRA_ERR_FEC_ADD_FAILED, "Failed to add FEC %s upon register, client %s", buf, zebra_route_string(client->proto)); @@ -1915,7 +1915,7 @@ int zebra_mpls_fec_unregister(struct zebra_vrf *zvrf, struct prefix *p, fec = fec_find(table, p); if (!fec) { prefix2str(p, buf, BUFSIZ); - zlog_ferr(ZEBRA_ERR_FEC_RM_FAILED, + flog_err(ZEBRA_ERR_FEC_RM_FAILED, "Failed to find FEC %s upon unregister, client %s", buf, zebra_route_string(client->proto)); return -1; @@ -2047,7 +2047,7 @@ int zebra_mpls_static_fec_add(struct zebra_vrf *zvrf, struct prefix *p, MPLS_INVALID_LABEL_INDEX); if (!fec) { prefix2str(p, buf, BUFSIZ); - zlog_ferr(ZEBRA_ERR_FEC_ADD_FAILED, + flog_err(ZEBRA_ERR_FEC_ADD_FAILED, "Failed to add FEC %s upon config", buf); return -1; } @@ -2095,7 +2095,7 @@ int zebra_mpls_static_fec_del(struct zebra_vrf *zvrf, struct prefix *p) fec = fec_find(table, p); if (!fec) { prefix2str(p, buf, BUFSIZ); - zlog_ferr(ZEBRA_ERR_FEC_RM_FAILED, + flog_err(ZEBRA_ERR_FEC_RM_FAILED, "Failed to find FEC %s upon delete", buf); return -1; } diff --git a/zebra/zebra_mpls_openbsd.c b/zebra/zebra_mpls_openbsd.c index 91e1d7118..159106313 100644 --- a/zebra/zebra_mpls_openbsd.c +++ b/zebra/zebra_mpls_openbsd.c @@ -118,13 +118,13 @@ static int kernel_send_rtmsg_v4(int action, mpls_label_t in_label, } if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); ret = writev(kr_state.fd, iov, iovcnt); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (ret == -1) - zlog_ferr(LIB_ERR_SOCKET, "%s: %s", __func__, + flog_err(LIB_ERR_SOCKET, "%s: %s", __func__, safe_strerror(errno)); return ret; @@ -227,13 +227,13 @@ static int kernel_send_rtmsg_v6(int action, mpls_label_t in_label, } if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); ret = writev(kr_state.fd, iov, iovcnt); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (ret == -1) - zlog_ferr(LIB_ERR_SOCKET, "%s: %s", __func__, + flog_err(LIB_ERR_SOCKET, "%s: %s", __func__, safe_strerror(errno)); return ret; @@ -401,7 +401,7 @@ static int kmpw_install(struct zebra_pw *pw) strlcpy(ifr.ifr_name, pw->ifname, sizeof(ifr.ifr_name)); ifr.ifr_data = (caddr_t)&imr; if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s", + flog_err(LIB_ERR_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s", safe_strerror(errno)); return -1; } @@ -419,7 +419,7 @@ static int kmpw_uninstall(struct zebra_pw *pw) strlcpy(ifr.ifr_name, pw->ifname, sizeof(ifr.ifr_name)); ifr.ifr_data = (caddr_t)&imr; if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) { - zlog_ferr(LIB_ERR_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s", + flog_err(LIB_ERR_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s", safe_strerror(errno)); return -1; } diff --git a/zebra/zebra_netns_id.c b/zebra/zebra_netns_id.c index 698ac2986..119bff0b7 100644 --- a/zebra/zebra_netns_id.c +++ b/zebra/zebra_netns_id.c @@ -88,7 +88,7 @@ static int send_receive(int sock, struct nlmsghdr *nlh, unsigned int seq, ret = sendto(sock, (const void *)nlh, (size_t)nlh->nlmsg_len, 0, (struct sockaddr *)&snl, (socklen_t)sizeof(snl)); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, "netlink( %u) sendmsg() error: %s", + flog_err(LIB_ERR_SOCKET, "netlink( %u) sendmsg() error: %s", sock, safe_strerror(errno)); return -1; } @@ -109,18 +109,18 @@ static int send_receive(int sock, struct nlmsghdr *nlh, unsigned int seq, }; ret = recvmsg(sock, &msg, 0); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "netlink recvmsg: error %d (errno %u)", ret, errno); return -1; } if (msg.msg_flags & MSG_TRUNC) { - zlog_ferr(ZEBRA_ERR_NETLINK_LENGTH_ERROR, + flog_err(ZEBRA_ERR_NETLINK_LENGTH_ERROR, "netlink recvmsg : error message truncated"); return -1; } /* nlh already points to buf */ if (nlh->nlmsg_seq != seq) { - zlog_ferr( + flog_err( ZEBRA_ERR_NETLINK_BAD_SEQUENCE, "netlink recvmsg: bad sequence number %x (expected %x)", seq, nlh->nlmsg_seq); @@ -175,7 +175,7 @@ ns_id_t zebra_ns_id_get(const char *netnspath) /* netlink socket */ sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock < 0) { - zlog_ferr(LIB_ERR_SOCKET, "netlink( %u) socket() error: %s", + flog_err(LIB_ERR_SOCKET, "netlink( %u) socket() error: %s", sock, safe_strerror(errno)); close(fd); return NS_UNKNOWN; @@ -186,7 +186,7 @@ ns_id_t zebra_ns_id_get(const char *netnspath) snl.nl_pid = 0; /* AUTO PID */ ret = bind(sock, (struct sockaddr *)&snl, sizeof(snl)); if (ret < 0) { - zlog_ferr(LIB_ERR_SOCKET, + flog_err(LIB_ERR_SOCKET, "netlink( %u) socket() bind error: %s", sock, safe_strerror(errno)); close(sock); @@ -261,7 +261,7 @@ ns_id_t zebra_ns_id_get(const char *netnspath) if (ret <= 0) { if (errno != EEXIST && ret != 0) { - zlog_ferr( + flog_err( LIB_ERR_SOCKET, "netlink( %u) recvfrom() error 2 when reading: %s", fd, safe_strerror(errno)); diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c index 8195e493f..2b2da599a 100644 --- a/zebra/zebra_netns_notify.c +++ b/zebra/zebra_netns_notify.c @@ -77,10 +77,10 @@ static void zebra_ns_notify_create_context_from_entry_name(const char *name) return; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); ns_id = zebra_ns_id_get(netnspath); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (ns_id == NS_UNKNOWN) return; ns_id_external = ns_map_nsid_with_external(ns_id, true); @@ -98,11 +98,11 @@ static void zebra_ns_notify_create_context_from_entry_name(const char *name) return; } if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); ret = vrf_netns_handler_create(NULL, vrf, netnspath, ns_id_external, ns_id); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (ret != CMD_SUCCESS) { zlog_warn("NS notify : failed to create NS %s", netnspath); ns_map_nsid_with_external(ns_id, false); @@ -170,19 +170,19 @@ static int zebra_ns_ready_read(struct thread *t) if (--zns_info->retries == 0) stop_retry = 1; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); err = ns_switch_to_netns(netnspath); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (err < 0) return zebra_ns_continue_read(zns_info, stop_retry); /* go back to default ns */ if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); err = ns_switchback_to_initial(); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); if (err < 0) return zebra_ns_continue_read(zns_info, stop_retry); diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c index 8676d3aec..7bf5ced93 100644 --- a/zebra/zebra_ns.c +++ b/zebra/zebra_ns.c @@ -316,10 +316,10 @@ int zebra_ns_init(void) dzns = zebra_ns_alloc(); if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); ns_id = zebra_ns_id_get_default(); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); ns_id_external = ns_map_nsid_with_external(ns_id, true); ns_init_management(ns_id_external, ns_id); diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index 6e2880ea0..b71234be0 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -504,7 +504,7 @@ static int zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt, dest_str, src_str); if (str2prefix(dest_str, &dest_prefix) == 0) { - zlog_ferr(ZEBRA_ERR_PREFIX_PARSE_ERROR, + flog_err(ZEBRA_ERR_PREFIX_PARSE_ERROR, "%s: Peer addr %s not found", __func__, dest_str); return -1; } @@ -512,7 +512,7 @@ static int zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt, memset(&src_prefix, 0, sizeof(struct prefix)); if (strcmp(ZEBRA_PTM_INVALID_SRC_IP, src_str)) { if (str2prefix(src_str, &src_prefix) == 0) { - zlog_ferr(ZEBRA_ERR_PREFIX_PARSE_ERROR, + flog_err(ZEBRA_ERR_PREFIX_PARSE_ERROR, "%s: Local addr %s not found", __func__, src_str); return -1; diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 993f1baf5..b477cd470 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1126,12 +1126,12 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re, hook_call(rib_update, rn, "installing in kernel"); switch (kernel_route_rib(rn, p, src_p, old, re)) { case DP_REQUEST_QUEUED: - zlog_ferr( + flog_err( ZEBRA_ERR_DP_INVALID_RC, "No current known DataPlane interfaces can return this, please fix"); break; case DP_REQUEST_FAILURE: - zlog_ferr( + flog_err( ZEBRA_ERR_DP_INSTALL_FAIL, "No current known Rib Install Failure cases, please fix"); break; @@ -1166,12 +1166,12 @@ void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re) hook_call(rib_update, rn, "uninstalling from kernel"); switch (kernel_route_rib(rn, p, src_p, re, NULL)) { case DP_REQUEST_QUEUED: - zlog_ferr( + flog_err( ZEBRA_ERR_DP_INVALID_RC, "No current known DataPlane interfaces can return this, please fix"); break; case DP_REQUEST_FAILURE: - zlog_ferr( + flog_err( ZEBRA_ERR_DP_INSTALL_FAIL, "No current known RIB Install Failure cases, please fix"); break; @@ -1945,7 +1945,7 @@ void rib_queue_add(struct route_node *rn) } if (zebrad.ribq == NULL) { - zlog_ferr(ZEBRA_ERR_WQ_NONEXISTENT, + flog_err(ZEBRA_ERR_WQ_NONEXISTENT, "%s: work_queue does not exist!", __func__); return; } @@ -2001,7 +2001,7 @@ static void rib_queue_init(struct zebra_t *zebra) if (!(zebra->ribq = work_queue_new(zebra->master, "route_node processing"))) { - zlog_ferr(ZEBRA_ERR_WQ_NONEXISTENT, + flog_err(ZEBRA_ERR_WQ_NONEXISTENT, "%s: could not initialise work queue!", __func__); return; } @@ -2015,7 +2015,7 @@ static void rib_queue_init(struct zebra_t *zebra) zebra->ribq->spec.hold = ZEBRA_RIB_PROCESS_HOLD_TIME; if (!(zebra->mq = meta_queue_new())) { - zlog_ferr(ZEBRA_ERR_WQ_NONEXISTENT, + flog_err(ZEBRA_ERR_WQ_NONEXISTENT, "%s: could not initialise meta queue!", __func__); return; } @@ -2243,7 +2243,7 @@ void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id) /* Lookup table. */ table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id); if (!table) { - zlog_ferr(ZEBRA_ERR_TABLE_LOOKUP_FAILED, + flog_err(ZEBRA_ERR_TABLE_LOOKUP_FAILED, "%s:%u zebra_vrf_table() returned NULL", __func__, vrf_id); return; @@ -2291,7 +2291,7 @@ void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id) rib_dest_t *dest; if (NULL == (table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id))) { - zlog_ferr(ZEBRA_ERR_TABLE_LOOKUP_FAILED, + flog_err(ZEBRA_ERR_TABLE_LOOKUP_FAILED, "%s:%u zebra_vrf_table() returned NULL", __func__, vrf_id); return; diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 6f742e8f1..156600c10 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -858,7 +858,7 @@ static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type, stream_put(s, &rn->p.u.prefix6, IPV6_MAX_BYTELEN); break; default: - zlog_ferr(ZEBRA_ERR_RNH_UNKNOWN_FAMILY, + flog_err(ZEBRA_ERR_RNH_UNKNOWN_FAMILY, "%s: Unknown family (%d) notification attempted\n", __FUNCTION__, rn->p.family); break; diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 8e1d5f967..d979be4a3 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -1802,7 +1802,7 @@ static int zvni_gw_macip_add(struct interface *ifp, zebra_vni_t *zvni, if (!mac) { mac = zvni_mac_add(zvni, macaddr); if (!mac) { - zlog_ferr(ZEBRA_ERR_MAC_ADD_FAILED, + flog_err(ZEBRA_ERR_MAC_ADD_FAILED, "Failed to add MAC %s intf %s(%u) VID %u", prefix_mac2str(macaddr, buf, sizeof(buf)), ifp->name, ifp->ifindex, vxl->access_vlan); @@ -1822,7 +1822,7 @@ static int zvni_gw_macip_add(struct interface *ifp, zebra_vni_t *zvni, if (!n) { n = zvni_neigh_add(zvni, ip, macaddr); if (!n) { - zlog_ferr( + flog_err( ZEBRA_ERR_MAC_ADD_FAILED, "Failed to add neighbor %s MAC %s intf %s(%u) -> VNI %u", ipaddr2str(ip, buf2, sizeof(buf2)), @@ -2086,7 +2086,7 @@ static int zvni_local_neigh_update(zebra_vni_t *zvni, /* New neighbor - create */ n = zvni_neigh_add(zvni, ip, macaddr); if (!n) { - zlog_ferr( + flog_err( ZEBRA_ERR_MAC_ADD_FAILED, "Failed to add neighbor %s MAC %s intf %s(%u) -> VNI %u", ipaddr2str(ip, buf2, sizeof(buf2)), @@ -3903,7 +3903,7 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf, vni_t vni, /* Delete the hash entry. */ if (zvni_del(zvni)) { - zlog_ferr(ZEBRA_ERR_VNI_DEL_FAILED, + flog_err(ZEBRA_ERR_VNI_DEL_FAILED, "Failed to del VNI hash %p, VNI %u", zvni, zvni->vni); return -1; @@ -5279,7 +5279,7 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS) zvtep = zvni_vtep_find(zvni, &vtep_ip); if (!zvtep) { if (zvni_vtep_add(zvni, &vtep_ip) == NULL) { - zlog_ferr( + flog_err( ZEBRA_ERR_VTEP_ADD_FAILED, "Failed to add remote VTEP, VNI %u zvni %p", vni, zvni); @@ -5687,7 +5687,7 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp, if (!mac) { mac = zvni_mac_add(zvni, macaddr); if (!mac) { - zlog_ferr(ZEBRA_ERR_MAC_ADD_FAILED, + flog_err(ZEBRA_ERR_MAC_ADD_FAILED, "Failed to add MAC %s intf %s(%u) VID %u", prefix_mac2str(macaddr, buf, sizeof(buf)), ifp->name, ifp->ifindex, vid); @@ -5846,7 +5846,7 @@ void zebra_vxlan_remote_vtep_add(ZAPI_HANDLER_ARGS) /* Locate VNI hash entry - expected to exist. */ zvni = zvni_lookup(vni); if (!zvni) { - zlog_ferr( + flog_err( ZEBRA_ERR_VTEP_ADD_FAILED, "Failed to locate VNI hash upon remote VTEP ADD, VNI %u", vni); @@ -5855,7 +5855,7 @@ void zebra_vxlan_remote_vtep_add(ZAPI_HANDLER_ARGS) ifp = zvni->vxlan_if; if (!ifp) { - zlog_ferr( + flog_err( ZEBRA_ERR_VTEP_ADD_FAILED, "VNI %u hash %p doesn't have intf upon remote VTEP ADD", zvni->vni, zvni); @@ -5874,7 +5874,7 @@ void zebra_vxlan_remote_vtep_add(ZAPI_HANDLER_ARGS) continue; if (zvni_vtep_add(zvni, &vtep_ip) == NULL) { - zlog_ferr(ZEBRA_ERR_VTEP_ADD_FAILED, + flog_err(ZEBRA_ERR_VTEP_ADD_FAILED, "Failed to add remote VTEP, VNI %u zvni %p", vni, zvni); continue; @@ -6295,7 +6295,7 @@ int zebra_vxlan_if_del(struct interface *ifp) /* Delete the hash entry. */ if (zvni_del(zvni)) { - zlog_ferr(ZEBRA_ERR_VNI_DEL_FAILED, + flog_err(ZEBRA_ERR_VNI_DEL_FAILED, "Failed to del VNI hash %p, IF %s(%u) VNI %u", zvni, ifp->name, ifp->ifindex, zvni->vni); return -1; @@ -6511,7 +6511,7 @@ int zebra_vxlan_if_add(struct interface *ifp) if (!zvni) { zvni = zvni_add(vni); if (!zvni) { - zlog_ferr( + flog_err( ZEBRA_ERR_VNI_ADD_FAILED, "Failed to add VNI hash, IF %s(%u) VNI %u", ifp->name, ifp->ifindex, vni); diff --git a/zebra/zserv.c b/zebra/zserv.c index 3b802ba51..553331867 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -793,7 +793,7 @@ void zserv_start(char *path) zserv_privs.change(ZPRIVS_LOWER); if (sa.ss_family != AF_UNIX && zserv_privs.change(ZPRIVS_RAISE)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't raise privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't raise privileges"); ret = bind(zebrad.sock, (struct sockaddr *)&sa, sa_len); if (ret < 0) { @@ -806,7 +806,7 @@ void zserv_start(char *path) return; } if (sa.ss_family != AF_UNIX && zserv_privs.change(ZPRIVS_LOWER)) - zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges"); + flog_err(LIB_ERR_PRIVILEGES, "Can't lower privileges"); ret = listen(zebrad.sock, 5); if (ret < 0) { |