From 4eedea551290906fc76f3a0c908ae759e78bb68a Mon Sep 17 00:00:00 2001 From: Matthieu Boutier Date: Tue, 17 Jan 2012 22:46:21 +0100 Subject: babeld: change fprintf(stderr) in term of zlog_err. --- babeld/babel_interface.c | 2 +- babeld/babel_zebra.c | 1 - babeld/message.c | 44 ++++++++++++++++++++------------------------ babeld/route.c | 12 ++++++------ 4 files changed, 27 insertions(+), 32 deletions(-) diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index df68afba..b80bf94e 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -503,7 +503,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) { - fprintf(stderr, "Couldn't reallocate sendbuf.\n"); + zlog_err("Couldn't reallocate sendbuf."); free(tmp); babel_ifp->bufsize = 0; return -1; diff --git a/babeld/babel_zebra.c b/babeld/babel_zebra.c index 6d78ecc6..7ba1adfe 100644 --- a/babeld/babel_zebra.c +++ b/babeld/babel_zebra.c @@ -277,7 +277,6 @@ void babelz_zebra_init(void) static int zebra_config_write (struct vty *vty) { - fprintf(stderr, "\tzebra_config_write\n"); if (! zclient->enable) { vty_out (vty, "no router zebra%s", VTY_NEWLINE); diff --git a/babeld/message.c b/babeld/message.c index 7930a1b1..92c416b9 100644 --- a/babeld/message.c +++ b/babeld/message.c @@ -145,35 +145,34 @@ parse_packet(const unsigned char *from, struct interface *ifp, v4_nh[16], v6_nh[16]; if(!linklocal(from)) { - fprintf(stderr, "Received packet from non-local address %s.\n", - format_address(from)); + zlog_err("Received packet from non-local address %s.", + format_address(from)); return; } if(packet[0] != 42) { - fprintf(stderr, "Received malformed packet on %s from %s.\n", - ifp->name, format_address(from)); + zlog_err("Received malformed packet on %s from %s.", + ifp->name, format_address(from)); return; } if(packet[1] != 2) { - fprintf(stderr, - "Received packet with unknown version %d on %s from %s.\n", - packet[1], ifp->name, format_address(from)); + zlog_err("Received packet with unknown version %d on %s from %s.", + packet[1], ifp->name, format_address(from)); return; } neigh = find_neighbour(from, ifp); if(neigh == NULL) { - fprintf(stderr, "Couldn't allocate neighbour.\n"); + zlog_err("Couldn't allocate neighbour."); return; } DO_NTOHS(bodylen, packet + 2); if(bodylen + 4 > packetlen) { - fprintf(stderr, "Received truncated packet (%d + 4 > %d).\n", - bodylen, packetlen); + zlog_err("Received truncated packet (%d + 4 > %d).", + bodylen, packetlen); bodylen = packetlen - 4; } @@ -188,12 +187,12 @@ parse_packet(const unsigned char *from, struct interface *ifp, continue; } if(i + 1 > bodylen) { - fprintf(stderr, "Received truncated message.\n"); + zlog_err("Received truncated message."); break; } len = message[1]; if(i + len > bodylen) { - fprintf(stderr, "Received truncated message.\n"); + zlog_err("Received truncated message."); break; } @@ -330,7 +329,7 @@ parse_packet(const unsigned char *from, struct interface *ifp, have_router_id = 1; } if(!have_router_id && message[2] != 0) { - fprintf(stderr, "Received prefix with no router id.\n"); + zlog_err("Received prefix with no router id."); goto fail; } debugf(BABEL_DEBUG_COMMON,"Received update%s%s for %s from %s on %s.", @@ -341,8 +340,7 @@ parse_packet(const unsigned char *from, struct interface *ifp, if(message[2] == 0) { if(metric < 0xFFFF) { - fprintf(stderr, - "Received wildcard update with finite metric.\n"); + zlog_err("Received wildcard update with finite metric."); goto done; } retract_neighbour_routes(neigh); @@ -409,8 +407,8 @@ parse_packet(const unsigned char *from, struct interface *ifp, continue; fail: - fprintf(stderr, "Couldn't parse packet (%d, %d) from %s on %s.\n", - message[0], message[1], format_address(from), ifp->name); + zlog_err("Couldn't parse packet (%d, %d) from %s on %s.", + message[0], message[1], format_address(from), ifp->name); goto done; } return; @@ -470,8 +468,8 @@ flushbuf(struct interface *ifp) if(rc < 0) zlog_err("send: %s", safe_strerror(errno)); } else { - fprintf(stderr, "Warning: bucket full, dropping packet to %s.\n", - ifp->name); + zlog_err("Warning: bucket full, dropping packet to %s.", + ifp->name); } } VALGRIND_MAKE_MEM_UNDEFINED(babel_ifp->sendbuf, babel_ifp->bufsize); @@ -705,11 +703,9 @@ flush_unicast(int dofree) if(rc < 0) zlog_err("send(unicast): %s", safe_strerror(errno)); } else { - fprintf(stderr, - "Warning: bucket full, dropping unicast packet" - "to %s if %s.\n", - format_address(unicast_neighbour->address), - unicast_neighbour->ifp->name); + zlog_err("Warning: bucket full, dropping unicast packet to %s if %s.", + format_address(unicast_neighbour->address), + unicast_neighbour->ifp->name); } done: diff --git a/babeld/route.c b/babeld/route.c index aa181be7..aadf80f2 100644 --- a/babeld/route.c +++ b/babeld/route.c @@ -172,8 +172,8 @@ install_route(struct babel_route *route) return; if(!route_feasible(route)) - fprintf(stderr, "WARNING: installing unfeasible route " - "(this shouldn't happen)."); + zlog_err("WARNING: installing unfeasible route " + "(this shouldn't happen)."); rc = kernel_route(ROUTE_ADD, route->src->prefix, route->src->plen, route->nexthop, @@ -224,8 +224,8 @@ switch_routes(struct babel_route *old, struct babel_route *new) return; if(!route_feasible(new)) - fprintf(stderr, "WARNING: switching to unfeasible route " - "(this shouldn't happen)."); + zlog_err("WARNING: switching to unfeasible route " + "(this shouldn't happen)."); rc = kernel_route(ROUTE_MODIFY, old->src->prefix, old->src->plen, old->nexthop, old->neigh->ifp->ifindex, @@ -414,8 +414,8 @@ update_route(const unsigned char *router_id, return NULL; /* I have announced the route */ if(martian_prefix(prefix, plen)) { - fprintf(stderr, "Rejecting martian route to %s through %s.\n", - format_prefix(prefix, plen), format_address(router_id)); + zlog_err("Rejecting martian route to %s through %s.", + format_prefix(prefix, plen), format_address(router_id)); return NULL; } -- cgit v1.2.1