Added debug option to suppress rhizome traffic to make it easier

to see what is going on.
Similarly there is now a debug option to show outgoing packets.
This commit is contained in:
gardners 2012-04-14 06:26:20 +09:30
parent 0f9abea8c7
commit 167c59d50d
3 changed files with 18 additions and 6 deletions

3
dna.c
View File

@ -475,6 +475,7 @@ int setVerbosity(char *optarg) {
debug=strtoll(optarg,NULL,10);
if (strstr(optarg,"interfaces")) debug|=DEBUG_OVERLAYINTERFACES;
if (strstr(optarg,"packetxfer")) debug|=DEBUG_PACKETXFER;
if (strstr(optarg,"packettx")) debug|=DEBUG_PACKETTX;
if (strstr(optarg,"verbose")) debug|=DEBUG_VERBOSE;
if (strstr(optarg,"verbio")) debug|=DEBUG_VERBOSE_IO;
if (strstr(optarg,"peers")) debug|=DEBUG_PEERS;
@ -491,6 +492,8 @@ int setVerbosity(char *optarg) {
if (strstr(optarg,"routing")) debug|=DEBUG_OVERLAYROUTING;
if (strstr(optarg,"security")) debug|=DEBUG_SECURITY;
if (strstr(optarg,"rhizome")) debug|=DEBUG_RHIZOME;
if (strstr(optarg,"norhizome"))
{ debug|=DEBUG_DISABLERHIZOME; debug&=~DEBUG_RHIZOME; }
if (strstr(optarg,"filesync")) debug|=DEBUG_RHIZOMESYNC;
if (strstr(optarg,"monitorroutes")) debug|=DEBUG_OVERLAYROUTEMONITOR;
if (strstr(optarg,"queues")) debug|=DEBUG_QUEUES;

View File

@ -388,6 +388,12 @@ int overlay_broadcast_ensemble(int interface_number,
{
struct sockaddr_in s;
if (debug&DEBUG_PACKETTX)
{
fprintf(stderr,"Sending this packet via interface #%d\n",interface_number);
serval_packetvisualise(stdout,NULL,bytes,len);
}
memset(&s, '\0', sizeof(struct sockaddr_in));
if (recipientaddr) {
bcopy(recipientaddr,&s,sizeof(struct sockaddr_in));
@ -739,7 +745,8 @@ int overlay_tick_interface(int i, long long now)
overlay_stuff_packet_from_queue(i,e,OQ_ORDINARY,now,pax,&frame_pax,MAX_FRAME_PAX);
overlay_stuff_packet_from_queue(i,e,OQ_OPPORTUNISTIC,now,pax,&frame_pax,MAX_FRAME_PAX);
/* 5. XXX Fill the packet up to a suitable size with anything that seems a good idea */
overlay_rhizome_add_advertisements(i,e);
if (!(debug&DEBUG_DISABLERHIZOME))
overlay_rhizome_add_advertisements(i,e);
/* Now send the frame. This takes the form of a special DNA packet with a different
service code, which we setup earlier. */

View File

@ -999,11 +999,13 @@ int overlay_saw_mdp_containing_frame(int interface,overlay_frame *f,long long no
#define DEBUG_OVERLAYABBREVIATIONS 16384
#define DEBUG_OVERLAYROUTING 32768
#define DEBUG_SECURITY 65536
#define DEBUG_RHIZOME 131072
#define DEBUG_OVERLAYROUTEMONITOR 262144
#define DEBUG_QUEUES 524288
#define DEBUG_BROADCASTS 1048576
#define DEBUG_RHIZOMESYNC 2097152
#define DEBUG_RHIZOME (1<<17)
#define DEBUG_OVERLAYROUTEMONITOR (1<<18)
#define DEBUG_QUEUES (1<<19)
#define DEBUG_BROADCASTS (1<<20)
#define DEBUG_RHIZOMESYNC (1<<21)
#define DEBUG_DISABLERHIZOME (1<<22)
#define DEBUG_PACKETTX (1<<23)
int serval_packetvisualise(FILE *f,char *message,unsigned char *packet,int plen);