summaryrefslogtreecommitdiff
path: root/babeld/message.c
diff options
context:
space:
mode:
authorMatthieu Boutier <boutier@pps.jussieu.fr>2012-01-17 22:46:21 +0100
committerPaul Jakma <paul@quagga.net>2012-03-25 17:06:52 +0100
commit4eedea551290906fc76f3a0c908ae759e78bb68a (patch)
treedcc0782b8ffe445f3a75839b99eabc50194442ef /babeld/message.c
parentd4e46e681434e768b870679b998eb1ac7635fdfc (diff)
babeld: change fprintf(stderr) in term of zlog_err.
Diffstat (limited to 'babeld/message.c')
-rw-r--r--babeld/message.c44
1 files changed, 20 insertions, 24 deletions
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: