babeld: change fprintf(stderr) in term of zlog_err.
diff --git a/babeld/message.c b/babeld/message.c
index 7930a1b..92c416b 100644
--- a/babeld/message.c
+++ b/babeld/message.c
@@ -145,35 +145,34 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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: