}
if(i + 1 > alen) {
- flog_err(BABEL_ERR_PACKET, "Received truncated attributes.");
+ flog_err(EC_BABEL_PACKET, "Received truncated attributes.");
return;
}
len = a[i + 1];
if(i + len > alen) {
- flog_err(BABEL_ERR_PACKET, "Received truncated attributes.");
+ flog_err(EC_BABEL_PACKET, "Received truncated attributes.");
return;
}
/* Nothing. */
} else if(type == SUBTLV_DIVERSITY) {
if(len > DIVERSITY_HOPS) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_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. */
- flog_err(BABEL_ERR_PACKET, "Channel information contains 0!");
+ flog_err(EC_BABEL_PACKET, "Channel information contains 0!");
return;
}
memset(channels, 0, DIVERSITY_HOPS);
}
if(i + 1 > alen) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received truncated sub-TLV on Hello message.");
return -1;
}
len = a[i + 1];
if(i + len > alen) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received truncated sub-TLV on Hello message.");
return -1;
}
DO_NTOHL(*hello_send_us, a + i + 2);
ret = 1;
} else {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received incorrect RTT sub-TLV on Hello message.");
}
} else {
}
if(i + 1 > alen) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received truncated sub-TLV on IHU message.");
return -1;
}
len = a[i + 1];
if(i + len > alen) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received truncated sub-TLV on IHU message.");
return -1;
}
ret = 1;
}
else {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received incorrect RTT sub-TLV on IHU message.");
}
} else {
}
if(!linklocal(from)) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received packet from non-local address %s.",
format_address(from));
return;
}
if (babel_packet_examin (packet, packetlen)) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received malformed packet on %s from %s.",
ifp->name, format_address(from));
return;
neigh = find_neighbour(from, ifp);
if(neigh == NULL) {
- flog_err(BABEL_ERR_PACKET, "Couldn't allocate neighbour.");
+ flog_err(EC_BABEL_PACKET, "Couldn't allocate neighbour.");
return;
}
DO_NTOHS(bodylen, packet + 2);
if(bodylen + 4 > packetlen) {
- flog_err(BABEL_ERR_PACKET, "Received truncated packet (%d + 4 > %d).",
+ flog_err(EC_BABEL_PACKET, "Received truncated packet (%d + 4 > %d).",
bodylen, packetlen);
bodylen = packetlen - 4;
}
have_router_id = 1;
}
if(!have_router_id && message[2] != 0) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received prefix with no router id.");
goto fail;
}
if(message[2] == 0) {
if(metric < 0xFFFF) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received wildcard update with finite metric.");
goto done;
}
continue;
fail:
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Couldn't parse packet (%d, %d) from %s on %s.",
message[0], message[1], format_address(from), ifp->name);
goto done;
DO_HTONL(babel_ifp->sendbuf + babel_ifp->buffered_hello + 10, time);
return 1;
} else {
- flog_err(BABEL_ERR_PACKET, "No space left for timestamp sub-TLV "
+ flog_err(EC_BABEL_PACKET, "No space left for timestamp sub-TLV "
"(this shouldn't happen)");
return -1;
}
babel_ifp->sendbuf, babel_ifp->buffered,
(struct sockaddr*)&sin6, sizeof(sin6));
if(rc < 0)
- flog_err(BABEL_ERR_PACKET, "send: %s", safe_strerror(errno));
+ flog_err(EC_BABEL_PACKET, "send: %s", safe_strerror(errno));
} else {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Warning: bucket full, dropping packet to %s.",
ifp->name);
}
if(!unicast_buffer)
unicast_buffer = malloc(UNICAST_BUFSIZE);
if(!unicast_buffer) {
- flog_err(BABEL_ERR_MEMORY, "malloc(unicast_buffer): %s",
+ flog_err(EC_BABEL_MEMORY, "malloc(unicast_buffer): %s",
safe_strerror(errno));
return -1;
}
unicast_buffer, unicast_buffered,
(struct sockaddr*)&sin6, sizeof(sin6));
if(rc < 0)
- flog_err(BABEL_ERR_PACKET, "send(unicast): %s",
+ flog_err(EC_BABEL_PACKET, "send(unicast): %s",
safe_strerror(errno));
} else {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Warning: bucket full, dropping unicast packet to %s if %s.",
format_address(unicast_neighbour->address),
unicast_neighbour->ifp->name);
if(channels_len >= 0) {
accumulate_byte(ifp, 2);
accumulate_byte(ifp, channels_len);
- accumulate_bytes(ifp, channels, channels_len);
+
+ if (channels && channels_len > 0)
+ accumulate_bytes(ifp, channels, channels_len);
}
end_message(ifp, MESSAGE_UPDATE, 10 + (real_plen + 7) / 8 - omit +
channels_size);
again:
babel_ifp->buffered_updates = malloc(n *sizeof(struct buffered_update));
if(babel_ifp->buffered_updates == NULL) {
- flog_err(BABEL_ERR_MEMORY, "malloc(buffered_updates): %s",
+ flog_err(EC_BABEL_MEMORY, "malloc(buffered_updates): %s",
safe_strerror(errno));
if(n > 4) {
/* Try again with a tiny buffer. */
}
route_stream_done(routes);
} else {
- flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream.");
+ flog_err(EC_BABEL_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;
}
void
-update_myseqno()
+update_myseqno(void)
{
myseqno = seqno_plus(myseqno, 1);
}
}
xroute_stream_done(xroutes);
} else {
- flog_err(BABEL_ERR_MEMORY, "Couldn't allocate xroute stream.");
+ flog_err(EC_BABEL_MEMORY, "Couldn't allocate xroute stream.");
}
}