X-Git-Url: http://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=blobdiff_plain;f=prometheus.c;h=045c182bfca6b686a97cf7aab9db2ebd5ffff791;hp=b7b3a04620b9f55b3a6252728a44baf8c7094287;hb=af37be1dccdd5c9b86113a6e02ed794da3102ec4;hpb=62b118c2d21d2ee89872ec6d3e253039728abd5d diff --git a/prometheus.c b/prometheus.c index b7b3a04..045c182 100644 --- a/prometheus.c +++ b/prometheus.c @@ -132,7 +132,7 @@ const int idxtable_treshold2 = 12; /* this is no longer configurable */ const int idxtable_bitmask1 = 3; /* this is no longer configurable */ const int idxtable_bitmask2 = 3; /* this is no longer configurable */ -struct IP *ips = NULL, *ip, *sharedip; +struct IP *ips = NULL, *networks = NULL, *ip, *sharedip; struct Group *groups = NULL, *group; struct Keyword *keyword, *defaultkeyword=NULL, *keywords=NULL; @@ -154,6 +154,10 @@ void write_json_traffic(char *json); void write_htmlandlogs(char *html, char *d, int total, int just_preview); /* implemented in htmlandlogs.c */ +void analyse_topology(char *traceroute); +/* implemented in networks.c */ + + const char *tr_odd_even(void) { row_odd_even = 1 - row_odd_even; @@ -337,10 +341,10 @@ void get_config(char *config_filename) /* leaf discipline for keywords */ for_each(keyword,keywords) { - if(!strcmpi(keyword->leaf_discipline, "")) - { - keyword->leaf_discipline = qos_leaf; - } + if(!strcmpi(keyword->leaf_discipline, "")) + { + keyword->leaf_discipline = qos_leaf; + } } if(strcmpi(cnf, "mark")) @@ -468,6 +472,7 @@ program char *substring; int parent = 1; + int just_networks = FALSE; int just_flush = FALSE; /* deactivates all previous actions */ int nodelay = FALSE; int just_preview = FALSE; /* preview - generate just stats */ @@ -502,6 +507,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); argument("-s") { run=TRUE; just_preview=TRUE; start_shaping=TRUE; } argument("-r") { run=TRUE; } argument("-n") { run=TRUE; nodelay=TRUE; } + argument("-a") { run=TRUE; just_networks=TRUE; } argument("-l") { just_logs=TRUE; } argument("-m") { just_logs=TRUE; } argument("-y") { just_logs=TRUE; } @@ -536,7 +542,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); if(althosts) { - hosts=althosts; + hosts = althosts; } if(just_flush<9) @@ -555,21 +561,26 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); } /*-----------------------------------------------------------------*/ - printf("Parsing class defintion file %s ...\n", hosts); + /* cll1.h - let's allocate brand new character buffer... */ /*-----------------------------------------------------------------*/ - parse_hosts(hosts); + string(str,STRLEN); /*-----------------------------------------------------------------*/ - /* cll1.h - let's allocate brand new character buffer... */ + printf("Parsing class defintion file %s ...\n", hosts); /*-----------------------------------------------------------------*/ - string(str,STRLEN); + parse_hosts(hosts); + if(just_networks) + { + analyse_topology("/usr/sbin/traceroute -n -m 10 -w 2 %s.%d"); + exit(-1); + } /*-----------------------------------------------------------------*/ puts("Resolving shared connections ..."); /*-----------------------------------------------------------------*/ - for_each(ip,ips) if(ip->sharing) + for_each(ip, ips) if(ip->sharing) { - for_each(sharedip,ips) if(eq(sharedip->name, ip->sharing)) + for_each(sharedip, ips) if(eq(sharedip->name, ip->sharing)) { sharedip->traffic += ip->traffic; ip->traffic = 0;