Add per-interace dump of sent and received bytes

This commit is contained in:
Jeremy Lakeman 2013-07-15 15:27:41 +09:30
parent 4dd2c8e2a2
commit aa87168d7d
3 changed files with 10 additions and 5 deletions

View File

@ -442,8 +442,9 @@ ATOM(int32_t, mdp_tick_ms, -1, int32_nonneg,, "Override MDP ti
ATOM(bool_t, send_broadcasts, 1, boolean,, "If false, don't send any broadcast packets")
ATOM(bool_t, default_route, 0, boolean,, "If true, use this interface as a default route")
ATOM(bool_t, prefer_unicast, 0, boolean,, "If true, send unicast data as unicast IP packets if available")
ATOM(bool_t, ctsrts, 0, boolean,, "If true, enable CTS/RTS hardware handshaking")
ATOM(int32_t, uartbps, 57600, int32_rs232baudrate,, "Speed of serial UART link speed (which may be different to serial device link speed)")
ATOM(bool_t, debug, 0, boolean,, "If true, log details of every outgoing packet")
ATOM(bool_t, ctsrts, 0, boolean,, "If true, enable CTS/RTS hardware handshaking")
ATOM(int32_t, uartbps, 57600, int32_rs232baudrate,, "Speed of serial UART link speed (which may be different to serial device link speed)")
END_STRUCT
ARRAY(interface_list, NO_DUPLICATES)

View File

@ -391,7 +391,8 @@ overlay_interface_init(const char *name, struct in_addr src_addr, struct in_addr
interface->mtu=1200;
interface->state=INTERFACE_STATE_DOWN;
interface->alarm.poll.fd=0;
interface->debug = ifconfig->debug;
// How often do we announce ourselves on this interface?
int tick_ms=-1;
int packet_interval=-1;
@ -822,6 +823,9 @@ overlay_broadcast_ensemble(overlay_interface *interface,
return WHYF("Cannot send to interface %s as it is down", interface->name);
}
if (interface->debug)
DEBUGF("Sending on %s, len %d: %s", interface->name, len, alloca_tohex(bytes, len>64?64:len));
switch(interface->socket_type){
case SOCK_STREAM:
{

View File

@ -408,8 +408,8 @@ int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, s
else
bzero(&f.recvaddr, sizeof f.recvaddr);
if (config.debug.verbose && config.debug.overlayframes)
DEBUG("Received overlay packet");
if (interface->debug)
DEBUGF("Received on %s, len %d: %s", interface->name, (int)len, alloca_tohex(packet, len>64?64:len));
int ret=parseEnvelopeHeader(&context, interface, (struct sockaddr_in *)recvaddr, b);
if (ret){