Log more debug in MDP_ROUTE_TABLE request

This commit is contained in:
Andrew Bettison 2018-03-21 18:01:33 +10:30
parent 3cbf60f2b7
commit 9ef7d33d69
4 changed files with 45 additions and 2 deletions

View File

@ -1126,6 +1126,7 @@ static void send_route(
static int routing_table(void **record, void *context)
{
struct subscriber *subscriber = *record;
DEBUGF(mdprequests, " subscriber sid=%s reachable=%s", alloca_tohex_sid_t(subscriber->sid), alloca_reachable_flags(subscriber->reachable));
if (subscriber->reachable != REACHABLE_NONE){
struct routing_state *state = (struct routing_state *)context;
if ((subscriber->reachable & REACHABLE_SELF) == 0 || subscriber != get_my_subscriber(0)){
@ -1597,7 +1598,7 @@ static void mdp_process_packet(struct socket_address *client, struct mdp_header
mdp_interface_packet(client, header, payload);
break;
case MDP_ROUTE_TABLE:
DEBUGF(mdprequests, "Processing MDP_ROUTING_TABLE from %s", alloca_socket_address(client));
DEBUGF(mdprequests, "Processing MDP_ROUTE_TABLE from %s", alloca_socket_address(client));
{
struct routing_state state={
.client = client,

View File

@ -66,6 +66,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <sys/socket.h>
#include <netdb.h>
#include "lang.h" // for FALLTHROUGH
#include "overlay_address.h" // for REACHABLE_ flags
#include "http_server.h"
#include "strbuf_helpers.h"
#include "str.h"
@ -623,6 +624,40 @@ strbuf strbuf_append_file_meta(strbuf sb, const struct file_meta *metap)
return sb;
}
strbuf strbuf_append_reachable_flags(strbuf sb, int flags) {
if (flags == REACHABLE_NONE)
strbuf_puts(sb, "NONE");
else {
const char *sep = "";
if (flags & REACHABLE_SELF) {
strbuf_puts(sb, sep);
strbuf_puts(sb, "SELF");
sep = "|";
}
if (flags & REACHABLE_BROADCAST) {
strbuf_puts(sb, sep);
strbuf_puts(sb, "BROADCAST");
sep = "|";
}
if (flags & REACHABLE_UNICAST) {
strbuf_puts(sb, sep);
strbuf_puts(sb, "UNICAST");
sep = "|";
}
if (flags & REACHABLE_INDIRECT) {
strbuf_puts(sb, sep);
strbuf_puts(sb, "INDIRECT");
sep = "|";
}
if (flags & REACHABLE_ASSUMED) {
strbuf_puts(sb, sep);
strbuf_puts(sb, "ASSUMED");
sep = "|";
}
}
return sb;
}
strbuf strbuf_append_quoted_string(strbuf sb, const char *str)
{
strbuf_putc(sb, '"');

View File

@ -205,6 +205,12 @@ struct file_meta;
strbuf strbuf_append_file_meta(strbuf sb, const struct file_meta *metap);
#define alloca_file_meta(metap) strbuf_str(strbuf_append_file_meta(strbuf_alloca(80), (metap)))
/* Append a representation of routing reachable flags.
* @author Andrew Bettison <andrew@servalproject.com>
*/
strbuf strbuf_append_reachable_flags(strbuf sb, int flags);
#define alloca_reachable_flags(flags) strbuf_str(strbuf_append_reachable_flags(strbuf_alloca(80), (flags)))
/* Append a string using HTTP quoted-string format: delimited by double quotes (") and
* internal double quotes and backslash escaped by leading backslash.
* @author Andrew Bettison <andrew@servalproject.com>

View File

@ -44,7 +44,7 @@ link_matches() {
done
sid="$1"
tfw_log "Looking for link ${sid}, ${link_type}, ${interface_ex}, ${via}"
if ! $GREP "^${sid}:${link_type}:${interface_ex}:${via}:" $_tfw_tmp/stdout; then
if ! $GREP "^${sid}:${link_type}:${interface_ex}:${via}:" "$TFWSTDOUT"; then
tfw_log "Link not found"
return 1
fi
@ -90,6 +90,7 @@ configure_servald_server() {
executeOk_servald config \
set debug.mdprequests yes \
set debug.linkstate yes \
set debug.subscriber yes \
set debug.verbose yes \
set debug.overlayrouting yes \
set log.console.level debug \