bwm-tools-devel Mailing List for Bandwidth Management Tools (Page 2)
Brought to you by:
nkukard
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(11) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(52) |
Feb
|
Mar
|
Apr
(6) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
(3) |
Mar
(9) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: SVN C. <sv...@li...> - 2005-01-26 16:30:14
|
Author: nkukard Date: 2005-01-26 18:29:04 +0200 (Wed, 26 Jan 2005) New Revision: 65 Modified: trunk/bwmd/flow.c Log: * Updated the way packets are processed in prioritization, packets are now processed fairly Modified: trunk/bwmd/flow.c =================================================================== --- trunk/bwmd/flow.c 2005-01-21 11:38:31 UTC (rev 64) +++ trunk/bwmd/flow.c 2005-01-26 16:29:04 UTC (rev 65) @@ -177,15 +177,17 @@ // Function to process a flow queue, returns number of packets accepted -static int processPktQueue(struct runnerData_t *runnerData, struct pktQueue_t *pktQueue) +static unsigned int processPktQueue(struct runnerData_t *runnerData, struct pktQueue_t *pktQueue, + unsigned int pkts) { int status; GList *packets; int exceeded = 0; int i; // Differences in queue when we done - int acceptLen = 0, queuedLen = 0; - int acceptSize = 0, queuedSize = 0; + unsigned int acceptLen = 0, queuedLen = 0; + unsigned int acceptSize = 0, queuedSize = 0; + unsigned int processed; // Lock, hijack packets, unlock @@ -194,8 +196,8 @@ pktQueue->packets = NULL; g_mutex_unlock(pktQueue->lock); - // Check that we within our boundaries - while (!exceeded) + // Check that we within our boundaries and will not accept too many packets + while (!exceeded && pkts > (acceptLen + queuedLen)) { struct packet_t *packet; GList *pktQueueItem; @@ -322,6 +324,7 @@ { float delta; + // Get the fraction of time passed since last update, predict below to 1 second delta = flow->curThroughputAge / 1000000.0; @@ -454,7 +457,9 @@ g_mutex_unlock(pktQueue->lock); - return acceptLen; + processed = acceptLen + queuedLen; + + return processed; } @@ -464,19 +469,6 @@ { struct runnerData_t *runnerData = (struct runnerData_t*) data; - - // Our processing function - void processQueue(void *data, void *user_data) - { - struct pktQueue_t *pktQueue = (struct pktQueue_t*) data; - struct runnerData_t *aRunnerData = (struct runnerData_t*) user_data; - - - // Check if we found a flow with a queue - // NOTE: The function below returns the number of packets processed - processPktQueue(aRunnerData,pktQueue); - } - logMessage(LOG_DEBUG, "Flow runner started...\n"); @@ -485,7 +477,7 @@ { GTimeVal mytime; unsigned char i; - GList *queueChangeList = NULL; + GList *queueChangeList[NUM_PRIO_BANDS]; g_mutex_lock(runnerData->bandSignalLock); @@ -502,11 +494,13 @@ // Hijack the queue change list items for (i = 0; i < NUM_PRIO_BANDS; i++) { + queueChangeList[i] = NULL; + // Zero runner data if it is non-NULL if (runnerData->queueChangeList[i]) { // Copy list item over - queueChangeList = g_list_concat(queueChangeList,runnerData->queueChangeList[i]); + queueChangeList[i] = g_list_concat(queueChangeList[i],runnerData->queueChangeList[i]); // Blank used list... copy uses directly runnerData->queueChangeList[i] = NULL; } @@ -518,10 +512,31 @@ // Process list if it is non-NULL - if (queueChangeList) + for (i = 0; i < NUM_PRIO_BANDS; i++) { - g_list_foreach(queueChangeList,processQueue,runnerData); - g_list_free(queueChangeList); + // Loop while there are still items to be processed + while (queueChangeList[i]) + { + GList *item = g_list_first(queueChangeList[i]); + + // Loop with all queues that need items to be processed + while (item) + { + struct pktQueue_t *pktQueue; + unsigned int processed = 0; + + // Just a harmless error check + if ((pktQueue = (struct pktQueue_t*) item->data)) + processed = processPktQueue(runnerData,pktQueue,1); // Process 1 packet at a time + + // Next queue + item = g_list_next(item); + + // If nothing was processed remove ourselves from the change list + if (!processed) + queueChangeList[i] = g_list_remove(queueChangeList[i],(void *) pktQueue); + } + } } } |
From: SVN C. <sv...@li...> - 2005-01-21 11:38:40
|
Author: nkukard Date: 2005-01-21 13:38:31 +0200 (Fri, 21 Jan 2005) New Revision: 64 Modified: trunk/bwmd/flow.c Log: * Small code cleanup that seems to of gotten lost Modified: trunk/bwmd/flow.c =================================================================== --- trunk/bwmd/flow.c 2005-01-21 11:30:59 UTC (rev 63) +++ trunk/bwmd/flow.c 2005-01-21 11:38:31 UTC (rev 64) @@ -322,9 +322,7 @@ { float delta; - // flow->curThroughputAge -= 2000000; - - // Get the fraction of time passed since last update + // Get the fraction of time passed since last update, predict below to 1 second delta = flow->curThroughputAge / 1000000.0; // Calculate throughput @@ -340,11 +338,6 @@ // Calculate queue size flow->softQueueSize = (flow->softQueueSize + flow->curQueueSize) / 2; - if (strcmp(flow->flowName,"saix_in") == 0) - fprintf(stderr,"%s: curThroughput: %f\tsoftQueueSize:%u\n", - flow->flowName, - flow->curThroughput, - flow->softQueueSize); flow->curThroughputAge = 0; } |
From: SVN C. <sv...@li...> - 2005-01-21 11:31:12
|
Author: nkukard Date: 2005-01-21 13:30:59 +0200 (Fri, 21 Jan 2005) New Revision: 63 Modified: trunk/TODO trunk/bwmd/autoclass.c trunk/bwmd/flow.c trunk/bwmd/ipq.c trunk/include/flow.h trunk/lib/xmlConf.c Log: * Made running totals a little softer Modified: trunk/TODO =================================================================== --- trunk/TODO 2005-01-21 11:29:32 UTC (rev 62) +++ trunk/TODO 2005-01-21 11:30:59 UTC (rev 63) @@ -17,4 +17,3 @@ * bwm_firewall to generate automatic MARK values for flows * fix findFlowByName & findGroupByName, these 2 functions are similar and i'm sure can be merged * have the location of iptables-restore automatically discovered using ./configure, with override options -* Change IPC mechanism used by bwmd and bwm_monitor to use more accurate flow->curThroughput Modified: trunk/bwmd/autoclass.c =================================================================== --- trunk/bwmd/autoclass.c 2005-01-21 11:29:32 UTC (rev 62) +++ trunk/bwmd/autoclass.c 2005-01-21 11:30:59 UTC (rev 63) @@ -172,6 +172,7 @@ * - PRIO 10 * - high drop probability */ + prio = 10; } else if (tos == IPTOS_THROUGHPUT) { @@ -195,6 +196,7 @@ * - PRIO 90 * - high drop probability */ + prio = 90; } return prio; Modified: trunk/bwmd/flow.c =================================================================== --- trunk/bwmd/flow.c 2005-01-21 11:29:32 UTC (rev 62) +++ trunk/bwmd/flow.c 2005-01-21 11:30:59 UTC (rev 63) @@ -296,16 +296,15 @@ g_mutex_lock(flow->lock); - flow->running.pktCount++; - flow->running.pktSize += PKT_SIZE(packet); flow->curCredit -= PKT_SIZE(packet); flow->accumThroughput += PKT_SIZE(packet); + flow->accumPackets++; // If we can burst ... if (flow->burstRate > 0) flow->curBurstCredit -= PKT_SIZE(packet); - // We bursted + // We bursted - this must be direct and not an average if (bursted) flow->running.pktBursted++; @@ -323,23 +322,30 @@ { float delta; - // Get the fraction of time passed since last update, divide this by 1000000 to predict - // approx values below if 1s had passed + // flow->curThroughputAge -= 2000000; + + // Get the fraction of time passed since last update delta = flow->curThroughputAge / 1000000.0; - flow->curThroughputAge = 0; // Calculate throughput flow->curThroughput = (flow->curThroughput + (flow->accumThroughput / delta)) / 2; + flow->running.pktSize = flow->curThroughput; flow->accumThroughput = 0; - // Calculate average queue size - flow->avgQueueSize = (flow->avgQueueSize + (flow->curQueueSize / delta)) / 2; -#if 0 - fprintf(stderr,"%s: curThroughput: %f\tavgQueueSize:%u\n", + // Calculate packet rate + flow->curPacketRate = (flow->curPacketRate + (flow->accumPackets / delta)) / 2; + flow->running.pktCount = flow->curPacketRate; + flow->accumPackets = 0; + + // Calculate queue size + flow->softQueueSize = (flow->softQueueSize + flow->curQueueSize) / 2; + + if (strcmp(flow->flowName,"saix_in") == 0) + fprintf(stderr,"%s: curThroughput: %f\tsoftQueueSize:%u\n", flow->flowName, flow->curThroughput, - flow->avgQueueSize); -#endif + flow->softQueueSize); + flow->curThroughputAge = 0; } // Set this as the last time we updated our throughput Modified: trunk/bwmd/ipq.c =================================================================== --- trunk/bwmd/ipq.c 2005-01-21 11:29:32 UTC (rev 62) +++ trunk/bwmd/ipq.c 2005-01-21 11:30:59 UTC (rev 63) @@ -174,7 +174,7 @@ // FIXME - this is based on the flow's queue size, it should be configurable to the queue's queue size maxQueueSize = P_FLOW(foundQueue,maxQueueSize); curQueueSize = P_FLOW(foundQueue,curQueueSize); - avgQueueSize = P_FLOW(foundQueue,avgQueueSize); + avgQueueSize = P_FLOW(foundQueue,softQueueSize); // Check if we have limits to exceed if (maxQueueSize && curQueueSize > 0 && avgQueueSize > 0) Modified: trunk/include/flow.h =================================================================== --- trunk/include/flow.h 2005-01-21 11:29:32 UTC (rev 62) +++ trunk/include/flow.h 2005-01-21 11:30:59 UTC (rev 63) @@ -110,21 +110,24 @@ struct pktStat_t counter; // This is the counter which is logged to file GList *groups; + // Credit stuff... this is used in calculating current credit double usCredit; // Credits for maxRate per microsecond long int curCredit; // Current available credit for maxRate, if we burst we will be < 0 - double usBurstCredit; long int curBurstCredit; // Curent burstable credit available + // Throughput and internal stats + unsigned int curThroughputAge; // How many microseconds since last throughput update + struct timeval lastThroughputUpdate; // Last time the throughput was updated unsigned int accumThroughput; // Accumulated throughput + unsigned int accumPackets; // Accumulated packets float curThroughput; // Current throughput - unsigned int curThroughputAge; // How many microseconds since last throughput update - unsigned int avgQueueSize; // Average queue size - struct timeval lastThroughputUpdate; // Last time the throughput was updated + unsigned int curPacketRate; // Current throughput + unsigned int softQueueSize; // Queue size unsigned int accumMs; // Accumulated number of microseconds struct timeval lastCreditCalc; // Last "timeval" that we calculated additional credit - struct pktStat_t running; // This is the running counter + struct pktStat_t running; // This is the running counter used for stats & logging int lastDumpTimestamp; int counterTimeout; // STATIC - length between file logs Modified: trunk/lib/xmlConf.c =================================================================== --- trunk/lib/xmlConf.c 2005-01-21 11:29:32 UTC (rev 62) +++ trunk/lib/xmlConf.c 2005-01-21 11:30:59 UTC (rev 63) @@ -727,8 +727,10 @@ gettimeofday(&flow->lastThroughputUpdate,NULL); flow->curThroughputAge = 0; flow->accumThroughput = 0; + flow->accumPackets = 0; flow->curThroughput = 0; - flow->avgQueueSize = 0; + flow->curPacketRate = 0; + flow->softQueueSize = 0; // Set last time we calculated credit and the rest... flow->accumMs = 0; gettimeofday(&flow->lastCreditCalc,NULL); |
From: SVN C. <sv...@li...> - 2005-01-21 11:29:47
|
Author: nkukard Date: 2005-01-21 13:29:32 +0200 (Fri, 21 Jan 2005) New Revision: 62 Modified: trunk/bwmd/bwmd.c Log: * Code cleanup Modified: trunk/bwmd/bwmd.c =================================================================== --- trunk/bwmd/bwmd.c 2005-01-21 09:34:56 UTC (rev 61) +++ trunk/bwmd/bwmd.c 2005-01-21 11:29:32 UTC (rev 62) @@ -171,7 +171,8 @@ if (!daemonize) - printf("BWMD: Loaded %i flows and %i queues\n",g_list_length(flowData.flows),g_list_length(flowData.pktQueues)); + printf("BWMD: Loaded %i flows and %i queues\n",g_list_length(flowData.flows), + g_list_length(flowData.pktQueues)); // Time to load our modules @@ -223,7 +224,7 @@ // Check if we must become a daemon if (daemonize) { - initSyslog("BWM", LOG_DEBUG); + initSyslog("bwmd", LOG_DEBUG); daemon(0,0); } // Create our threads to run |
From: SVN C. <sv...@li...> - 2005-01-21 09:35:12
|
Author: nkukard Date: 2005-01-21 11:34:56 +0200 (Fri, 21 Jan 2005) New Revision: 61 Modified: trunk/bwmd/flow.c trunk/include/flow.h trunk/lib/xmlConf.c Log: * Modified formula for getting average values, this one should be alot more precise Modified: trunk/bwmd/flow.c =================================================================== --- trunk/bwmd/flow.c 2005-01-21 09:00:31 UTC (rev 60) +++ trunk/bwmd/flow.c 2005-01-21 09:34:56 UTC (rev 61) @@ -299,7 +299,7 @@ flow->running.pktCount++; flow->running.pktSize += PKT_SIZE(packet); flow->curCredit -= PKT_SIZE(packet); - flow->curThroughput += PKT_SIZE(packet); + flow->accumThroughput += PKT_SIZE(packet); // If we can burst ... if (flow->burstRate > 0) @@ -319,28 +319,27 @@ flow->curThroughputAge += curTime.tv_usec - flow->lastThroughputUpdate.tv_usec; // 2 seconds - if (flow->curThroughputAge >= 2000000) + if (flow->curThroughputAge >= 250000) { float delta; - // flow->curThroughputAge -= 2000000; - - // Get the fraction of time passed since last update + // Get the fraction of time passed since last update, divide this by 1000000 to predict + // approx values below if 1s had passed delta = flow->curThroughputAge / 1000000.0; + flow->curThroughputAge = 0; // Calculate throughput - flow->curThroughput /= delta; - + flow->curThroughput = (flow->curThroughput + (flow->accumThroughput / delta)) / 2; + flow->accumThroughput = 0; + // Calculate average queue size - flow->avgQueueSize = (flow->avgQueueSize + flow->curQueueSize) / delta; - /* - fprintf(stderr,"%s: curThroughput: %f, avgQueueSize: %li, delta: %f\n", + flow->avgQueueSize = (flow->avgQueueSize + (flow->curQueueSize / delta)) / 2; +#if 0 + fprintf(stderr,"%s: curThroughput: %f\tavgQueueSize:%u\n", flow->flowName, flow->curThroughput, - flow->avgQueueSize, - delta); - */ - flow->curThroughputAge = 0; + flow->avgQueueSize); +#endif } // Set this as the last time we updated our throughput @@ -445,7 +444,8 @@ // Check if we havn't already gotten the queue listed // FIXME: check if we can't just add, high flow queue if (!g_list_find(runnerData->queueChangeList[pktQueue->prio],pktQueue)) - runnerData->queueChangeList[pktQueue->prio] = g_list_append(runnerData->queueChangeList[pktQueue->prio],pktQueue); + runnerData->queueChangeList[pktQueue->prio] = g_list_append( + runnerData->queueChangeList[pktQueue->prio],pktQueue); g_cond_signal(runnerData->bandSignalCond); g_mutex_unlock(runnerData->bandSignalLock); } Modified: trunk/include/flow.h =================================================================== --- trunk/include/flow.h 2005-01-21 09:00:31 UTC (rev 60) +++ trunk/include/flow.h 2005-01-21 09:34:56 UTC (rev 61) @@ -116,6 +116,7 @@ double usBurstCredit; long int curBurstCredit; // Curent burstable credit available + unsigned int accumThroughput; // Accumulated throughput float curThroughput; // Current throughput unsigned int curThroughputAge; // How many microseconds since last throughput update unsigned int avgQueueSize; // Average queue size Modified: trunk/lib/xmlConf.c =================================================================== --- trunk/lib/xmlConf.c 2005-01-21 09:00:31 UTC (rev 60) +++ trunk/lib/xmlConf.c 2005-01-21 09:34:56 UTC (rev 61) @@ -726,6 +726,7 @@ // Setup throughput stuff... gettimeofday(&flow->lastThroughputUpdate,NULL); flow->curThroughputAge = 0; + flow->accumThroughput = 0; flow->curThroughput = 0; flow->avgQueueSize = 0; // Set last time we calculated credit and the rest... |
From: SVN C. <sv...@li...> - 2005-01-21 09:00:42
|
Author: nkukard Date: 2005-01-21 11:00:31 +0200 (Fri, 21 Jan 2005) New Revision: 60 Modified: trunk/TODO Log: * Another TODO Modified: trunk/TODO =================================================================== --- trunk/TODO 2005-01-21 08:10:48 UTC (rev 59) +++ trunk/TODO 2005-01-21 09:00:31 UTC (rev 60) @@ -17,3 +17,4 @@ * bwm_firewall to generate automatic MARK values for flows * fix findFlowByName & findGroupByName, these 2 functions are similar and i'm sure can be merged * have the location of iptables-restore automatically discovered using ./configure, with override options +* Change IPC mechanism used by bwmd and bwm_monitor to use more accurate flow->curThroughput |
From: SVN C. <sv...@li...> - 2005-01-21 08:11:03
|
Author: nkukard Date: 2005-01-21 10:10:48 +0200 (Fri, 21 Jan 2005) New Revision: 59 Modified: trunk/doc/bwmtools.texi trunk/doc/stamp-vti trunk/doc/version.texi Log: * Minor documentation fixed, added explanation of prio-classifier parameter Modified: trunk/doc/bwmtools.texi =================================================================== --- trunk/doc/bwmtools.texi 2005-01-21 06:54:49 UTC (rev 58) +++ trunk/doc/bwmtools.texi 2005-01-21 08:10:48 UTC (rev 59) @@ -89,32 +89,32 @@ for small to large enterprises@dots{} @* @itemize - @item Traffic Shaping @itemize @item Hierarchical flows Allows you to embed flows within flows to form complex traffic shaping rules. +@* @item Parent burst thresholds Parent burst thresholds allow child flows to burst until their parent flow has reached a specific utilization threshold. @end itemize - +@* @item Graphing @itemize @item RRD Tool file support Generation of rrdtool files which can be used to create custom graphs. +@* @item Builtin RRD Tool graphing support BWM Tools can generate pretty looking graphs all by itself. Parameters for graphing are discussed in the Graphing section. @end itemize - +@* @item Logging @itemize @item Logging of traffic BWM Tools logs can log traffic stats to file at pre-defined intervals for use in reporting or graphing. @end itemize - @end itemize @@ -128,11 +128,11 @@ @* @itemize @item -glib2 >= 2.4.0 +glib2 >= 2.2.0 @item -libxml2 >= 2.6.0 +libxml2 >= 2.5.0 @item -rrdtool >= 1.0.49 (only required for graphing) +rrdtool >= 1.0.49 (required for graphing) @end itemize @* Next you need to download BWM Tools, compile it and install @@ -753,7 +753,55 @@ time increments the traffic statistics are logged to file. For example, if this parameter is set to 60, @command{bwmd} will log traffic stats to file every 60 seconds. Minimum value for this parameter is 30. +@* +@item +@cindex prio-classifier +@code{prio-classifier="@dots{}"} - Optional parameter to specify an automatic +traffic prioritization classifier. This parameter defaults to the @dfn{none} +classifier, where no prioritization takes place. Available classifiers are +discussed below@dots{} +@* +@itemize +@item The "@dfn{port}" classifier +With this classification prioritization happens automatically with the following +ports mapped to their corrosponding priorities. +(1 = highest, 100 = lowest)@dots{} +@*@* +@cindex traffic priority +TCP Traffic +@table @samp +@item port 113 (AUTH) +@samp{Priority 20} +@item port 22, 23 (SSH, TELNET) +@samp{Priority 25} +@item port 80, 443, 8080, 3128, 3130 (HTTP, HTTPS, PROXY PORTS) +@samp{Priority 65} +@item port 2401 (CVS) +@samp{Priority 70} +@item port 110, 143 (POP3, IMAP4) +@samp{Priority 75} +@item port 20, 21 (FTP) +@samp{Priority 80} +@end table +@* +UDP Traffic +@table @samp +@item port 53 (DNS) +@samp{Priority 10} +@item port 123 (NTP) +@samp{Priority 15} +@item port 1645/6, 1812/3 (RADIUS) +@samp{Priority 30} +@item port 33434-33465 (Normally traceroute) +@samp{Priority 5} +@end table +@* +The default priority for traffic not matching any of the above is 50. @end itemize +@item The "@dfn{none}" classifier +This is the default classifier, no priorization will occur and all trafic will +be dumped in the default priority 50 queue. +@end itemize Between the opening and closing tags, classes defined in the @code{<global>} section can be listed, if you want to list multiple classes use one per line, @@ -786,48 +834,14 @@ @item @cindex prio @code{prio="@dots{}"} - Mandatory parameter to specify the priority of the -matched traffic. +matched traffic. (1 = highest, 100 = lowest). @* @item @cindex nfmark @code{nfmark="@dots{}"} - Mandatory parameter to specify the mark value of the traffic. @end itemize -@* -Queue classifaction normally happens automatically with the following -priorities (1 = highest, 100 = lowest)@dots{} @*@* -@cindex traffic priority -TCP Traffic -@table @samp -@item port 113 (AUTH) -@samp{Priority 20} -@item port 22, 23 (SSH, TELNET) -@samp{Priority 25} -@item port 80, 443, 8080, 3128, 3130 (HTTP, HTTPS, PROXY PORTS) -@samp{Priority 65} -@item port 2401 (CVS) -@samp{Priority 70} -@item port 110, 143 (POP3, IMAP4) -@samp{Priority 75} -@item port 20, 21 (FTP) -@samp{Priority 80} -@end table -@* -UDP Traffic -@table @samp -@item port 53 (DNS) -@samp{Priority 10} -@item port 123 (NTP) -@samp{Priority 15} -@item port 1645/6, 1812/3 (RADIUS) -@samp{Priority 30} -@item port 33434-33465 (Normally traceroute) -@samp{Priority 5} -@end table -@* -The default priority for traffic not matching any of the above is 50. -@*@* Below is an example of using the @code{<queue> @dots{} </queue>} tags to give VNC traffic highest priority@dots{} @* Modified: trunk/doc/stamp-vti =================================================================== --- trunk/doc/stamp-vti 2005-01-21 06:54:49 UTC (rev 58) +++ trunk/doc/stamp-vti 2005-01-21 08:10:48 UTC (rev 59) @@ -1,4 +1,4 @@ -@set UPDATED 19 January 2005 +@set UPDATED 21 January 2005 @set UPDATED-MONTH January 2005 @set EDITION devel @set VERSION devel Modified: trunk/doc/version.texi =================================================================== --- trunk/doc/version.texi 2005-01-21 06:54:49 UTC (rev 58) +++ trunk/doc/version.texi 2005-01-21 08:10:48 UTC (rev 59) @@ -1,4 +1,4 @@ -@set UPDATED 19 January 2005 +@set UPDATED 21 January 2005 @set UPDATED-MONTH January 2005 @set EDITION devel @set VERSION devel |
From: SVN C. <sv...@li...> - 2005-01-21 06:54:59
|
Author: nkukard Date: 2005-01-21 08:54:49 +0200 (Fri, 21 Jan 2005) New Revision: 58 Modified: trunk/lib/xmlConf.c Log: * Default for prio-classifier is set below Modified: trunk/lib/xmlConf.c =================================================================== --- trunk/lib/xmlConf.c 2005-01-21 06:52:34 UTC (rev 57) +++ trunk/lib/xmlConf.c 2005-01-21 06:54:49 UTC (rev 58) @@ -932,7 +932,7 @@ char *p; long int statsLen, maxQueueSize, maxQueueLen, maxRate, burstRate, reportTimeout; unsigned long int nfmark; - unsigned char prioClassifier = AUTOCLASS_PORT; + unsigned char prioClassifier; float parent_th; |
From: SVN C. <sv...@li...> - 2005-01-21 06:52:48
|
Author: nkukard Date: 2005-01-21 08:52:34 +0200 (Fri, 21 Jan 2005) New Revision: 57 Modified: trunk/bwmd/ipq.c Log: * Another small cleanup, some stuff isn't needed in trunk Modified: trunk/bwmd/ipq.c =================================================================== --- trunk/bwmd/ipq.c 2005-01-21 06:49:07 UTC (rev 56) +++ trunk/bwmd/ipq.c 2005-01-21 06:52:34 UTC (rev 57) @@ -157,86 +157,10 @@ foundQueue = foundFlow->pktQueues[prio]; } - // Lock flow before we fuck with it g_mutex_lock(foundQueue->lock); g_mutex_lock(P_FLOW(foundQueue,lock)); - -/* This is my current work on implementing RED - nk...@lb... */ -#if 0 - { - /* Saved variables */ - unsigned int avg; // Average queue size - unsigned long int q_time; // Last time a packet was received - unsigned int count; // Packets since last one marked - /* Fixed params */ - Wq; // Weight of queue - min_th; // Min threshold of queue - max_th; // Max threshold of queue - max_p; // Max value for Pb - /* Other */ - float Pa; // Current packet marking probability - q; // Current queue size - time; // Current time - float Pb; - - - avg = 0; - count = -1; - - - LOOP WITH PACKETS - - calculate new average - - if queue is non empty - { - // Exponential weighted moving average (EWMA) - avg = (1 - Wq) * avg + Wq * q; - } - else - { - } - - if (min_th <= avg && avg < max_th) - { - count++; - - Pb = max_p * (avg - min_p) / (max_th - min_th); - // Favour small packets - Pb = Pb * (packet_size / max_packet_size); - - Pa = Pb / (1 - count & Pb); - - // FIXME - mark packet with Pa - mark packet - count = 0; - } - else if (max_th <= avg) - { - // FIXME - mark packet; - count = 0; - } - else - count = -1; - - if queue is empty - q_time = time(); - - CONTINUE LOOP - - - - } -#endif - - - - - - - // Check first of all if we fucked over our one of our queue limits if (will_exceed_pkt_queue(foundQueue,PKT_SIZE(packet)) || will_exceed_flow_queue(foundQueue->parentFlow,PKT_SIZE(packet))) @@ -247,22 +171,10 @@ long int maxQueueSize, curQueueSize, avgQueueSize; - /* Check if we must use our queue's size or parent flow queue size */ -#if 0 - if (foundQueue->maxSize) - { - maxQueueSize = foundQueue->maxSize; - curQueueSize = foundQueue->curSize; - } - else - { -#endif - maxQueueSize = P_FLOW(foundQueue,maxQueueSize); - curQueueSize = P_FLOW(foundQueue,curQueueSize); - avgQueueSize = P_FLOW(foundQueue,avgQueueSize); -#if 0 - } -#endif + // FIXME - this is based on the flow's queue size, it should be configurable to the queue's queue size + maxQueueSize = P_FLOW(foundQueue,maxQueueSize); + curQueueSize = P_FLOW(foundQueue,curQueueSize); + avgQueueSize = P_FLOW(foundQueue,avgQueueSize); // Check if we have limits to exceed if (maxQueueSize && curQueueSize > 0 && avgQueueSize > 0) @@ -273,22 +185,12 @@ // nice soft curve flow based on average queue size, starts slow, increases fast will hit 100% probability at 75% - // FIXME - this is based on the flow's queue size, it should be configurable to the queue's queue size - //avgProb = powf((P_FLOW(foundQueue,avgQueueSize) / maxQueueSize * 1.25),3); avgProb = powf((((float) avgQueueSize / (float) maxQueueSize) * 1.25),3); - // current queue size & threshold curve... sort of flatish, but starting slowish - curProb = powf(((float) curQueueSize / (float) maxQueueSize) + powf(((float) min_th / (float) 150),3),2) / 2; + curProb = powf(((float) curQueueSize / (float) maxQueueSize) + + powf(((float) min_th / (float) 150),3),2) / 2; prob = avgProb + curProb; // Check if we should drop packet drop = drand < prob; -/* - logMessage(LOG_DEBUG, "%s: Packet Drop Probability: %f (%li:%li) %f (%li:%li)\t%f\t%i\n", - P_FLOW(foundQueue,flowName), - avgProb,avgQueueSize,maxQueueSize, - curProb,curQueueSize,maxQueueSize, - avgProb + curProb, - drop); -*/ } } @@ -340,7 +242,8 @@ // Check if we havn't already gotten the queue listed // FIXME: check if we can't just add, high flow queue if (!g_list_find(runnerData->queueChangeList[foundQueue->prio],foundQueue)) - runnerData->queueChangeList[foundQueue->prio] = g_list_append(runnerData->queueChangeList[foundQueue->prio],foundQueue); + runnerData->queueChangeList[foundQueue->prio] = g_list_append( + runnerData->queueChangeList[foundQueue->prio],foundQueue); runnerData->queueChanged = 1; // This basically signals immediate attention by the flow runner g_cond_signal(runnerData->bandSignalCond); g_mutex_unlock(runnerData->bandSignalLock); |
From: SVN C. <sv...@li...> - 2005-01-21 06:49:18
|
Author: nkukard Date: 2005-01-21 08:49:07 +0200 (Fri, 21 Jan 2005) New Revision: 56 Modified: trunk/bwmd/ipq.c Log: * Small code cleanup Modified: trunk/bwmd/ipq.c =================================================================== --- trunk/bwmd/ipq.c 2005-01-21 06:46:58 UTC (rev 55) +++ trunk/bwmd/ipq.c 2005-01-21 06:49:07 UTC (rev 56) @@ -32,10 +32,7 @@ #include "libipq.h" -#define QUEUE_HEAD 1 -#define QUEUE_TAIL 2 - // Destroy the ipq handle static void destroyIPQHandle(struct ipq_handle *h) { @@ -95,8 +92,6 @@ int status; int result; int drop = 0; - // Default to inserting at queue tail - unsigned char queuePos = QUEUE_TAIL; // Our find functions @@ -301,13 +296,7 @@ // Check if we must pass the packet if (!drop) { - // Lock, queue... adjust stats - if (queuePos == QUEUE_TAIL) - foundQueue->packets = g_list_append(foundQueue->packets,packet); - else if (queuePos == QUEUE_HEAD) - { - // FIXME - APPEND TO LAST QUEUE - } + foundQueue->packets = g_list_append(foundQueue->packets,packet); foundQueue->curSize += PKT_SIZE(packet); P_FLOW(foundQueue,curQueueSize) += PKT_SIZE(packet); |
From: SVN C. <sv...@li...> - 2005-01-21 06:47:16
|
Author: nkukard Date: 2005-01-21 08:46:58 +0200 (Fri, 21 Jan 2005) New Revision: 55 Modified: trunk/bwmd/autoclass.c trunk/bwmd/ipq.c trunk/include/autoclass.h trunk/include/flow.h trunk/lib/xmlConf.c Log: * Misc optimizations and pre-tos work Modified: trunk/bwmd/autoclass.c =================================================================== --- trunk/bwmd/autoclass.c 2005-01-21 06:45:35 UTC (rev 54) +++ trunk/bwmd/autoclass.c 2005-01-21 06:46:58 UTC (rev 55) @@ -22,86 +22,204 @@ */ #include "autoclass.h" +#include "flow.h" -// Band calculation functions, tcp -long int tcpPortToBand(long int bandNum, u_int16_t port) + +// Auto classify by port +static unsigned char autoClassify_port(struct ip_packet_t *ip_packet, unsigned char prioClassifier) { - long int ret = bandNum; + unsigned char prio = 0; + + + // Priority calculation functions, tcp + static unsigned char tcpPortToPrio(u_int16_t port) + { + unsigned char ret = 0; + + + // Decide band to pump packet into + switch (port) + { + // AUTH + case 113: + ret = 20; + break; + // SSH + case 22: + // TELNET + case 23: + ret = 25; + break; + // HTTP + case 80: + // PROXY? + case 8080: + case 3128: + case 3130: + // HTTPS + case 443: + ret = 65; + break; + // CVS + case 2401: + ret = 70; + break; + // POP3 + case 110: + // IMAP + case 143: + ret = 75; + break; + // FTP + case 20: + case 21: + ret = 80; + break; + }; + + return ret; + } + + + // Priority calculation functions, udp + static unsigned char udpPortToPrio(u_int16_t port) + { + unsigned char ret = 0; - // Decide band to pump packet into - switch (port) + // Decide band to pump packet into + switch (port) + { + // DNS + case 53: + ret = 10; + break; + // NTP + case 123: + ret = 15; + break; + // RADIUS + case 1645: + case 1646: + case 1812: + case 1813: + ret = 30; + break; + default: + // Traceroute + if (port >= 33434 && port <= 33465) + ret = 5; + break; + }; + + return ret; + } + + + // Process a TCP packet + if (ip_packet->protocol == IPPROTO_TCP) { - // AUTH - case 113: - ret = 20; - break; - // SSH - case 22: - // TELNET - case 23: - ret = 25; - break; - // HTTP - case 80: - // PROXY? - case 8080: - case 3128: - case 3130: - // HTTPS - case 443: - ret = 65; - break; - // CVS - case 2401: - ret = 70; - break; - // POP3 - case 110: - // IMAP - case 143: - ret = 75; - break; - // FTP - case 20: - case 21: - ret = 80; - break; - }; + struct tcphdr *tcph = (struct tcphdr *) (ip_packet + (ip_packet->ihl * 4)); +/* + fprintf(stderr," tcp -> sport = %i, dport = %i, prec = 0x%x\n", ntohs(tcph->source), + ntohs(tcph->dest), IPTOS_PREC(ip_packet->tos)); +*/ + if (!(prio = tcpPortToPrio(ntohs(tcph->dest)))) + prio = tcpPortToPrio(ntohs(tcph->source)); + } - return ret; + // Process a ICMP packet + else if (ip_packet->protocol == IPPROTO_ICMP) + { +// struct icmphdr *icmph = (struct icmphdr *) (ip_packet + (ip_packet->ihl * 4)); + +/* + fprintf(stderr,"something: icmp = %i, type = %i\n", icmph->code, icmph->type); +*/ + prio = 5; + } + + // Process a UDP packet + else if (ip_packet->protocol == IPPROTO_UDP) + { + struct udphdr *udph = (struct udphdr *) (ip_packet + (ip_packet->ihl * 4)); +/* + fprintf(stderr," udp -> sport = %i, dport = %i\n", ntohs(udph->source), + ntohs(udph->dest)); +*/ + if (!(prio = udpPortToPrio(ntohs(udph->dest)))) + prio = udpPortToPrio(ntohs(udph->source)); + } + + return prio; } + -// Band calculation functions, udp -long int udpPortToBand(long int bandNum, u_int16_t port) +// Auto classify by ip header TOS value +static unsigned char autoClassify_tos(struct ip_packet_t *ip_packet, unsigned char prioClassifier) { - long int ret = bandNum; - - - // Decide band to pump packet into - switch (port) + unsigned char prio = 0; + // Get type of service + unsigned char tos = IPTOS_TOS(ip_packet->tos); + + + // Decide what we doing... + if (tos == IPTOS_LOWDELAY) { - // DNS - case 53: - ret = 10; - break; - // NTP - case 123: - ret = 15; - break; - // RADIUS - case 1645: - case 1646: - case 1812: - case 1813: - ret = 30; - break; - }; - - if (port >= 33434 && port <= 33465) - ret = 5; - - return ret; +/* + * 1. LOW DELAY + * - PRIO 10 + * - high drop probability + */ + } + else if (tos == IPTOS_THROUGHPUT) + { +/* + * 2. THROUGHPUT + * - long queue? + * - low drop probability + */ + } + else if (tos == IPTOS_RELIABILITY) + { +/* + * 3. RELIABILITY + * - low drop probability + */ + } + else if (tos == IPTOS_MINCOST) + { +/* + * 4. MIN COST + * - PRIO 90 + * - high drop probability + */ + } + + return prio; } + +// Auto classify packet and return priority (1 - best, 100 - worst) +unsigned char autoClassify(struct ip_packet_t *ip_packet, unsigned char prioClassifier) +{ + unsigned char prio; + + + // Classify by port + if (prioClassifier == AUTOCLASS_PORT) + prio = autoClassify_port(ip_packet,prioClassifier); + // Classify by TOS + else if (prioClassifier == AUTOCLASS_TOS) + prio = autoClassify_tos(ip_packet,prioClassifier); + // Default - this will basically match if we have AUTOCLASS_NONE + else + prio = 50; + + return prio; +} + + + + Modified: trunk/bwmd/ipq.c =================================================================== --- trunk/bwmd/ipq.c 2005-01-21 06:45:35 UTC (rev 54) +++ trunk/bwmd/ipq.c 2005-01-21 06:46:58 UTC (rev 55) @@ -22,6 +22,7 @@ */ +#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -31,7 +32,10 @@ #include "libipq.h" +#define QUEUE_HEAD 1 +#define QUEUE_TAIL 2 + // Destroy the ipq handle static void destroyIPQHandle(struct ipq_handle *h) { @@ -91,6 +95,8 @@ int status; int result; int drop = 0; + // Default to inserting at queue tail + unsigned char queuePos = QUEUE_TAIL; // Our find functions @@ -138,94 +144,171 @@ if (!foundQueue) { struct ip_packet_t *ip_packet = (struct ip_packet_t *) packet->payload->payload; - long int bandNum = -1; - + unsigned char prio = 0; + /* fprintf(stderr,"auto packet queue -> protocol = %i, src = %i.%i.%i.%i, dest = %i.%i.%i.%i, tos = 0x%x\n", ip_packet->protocol, ip_packet->u_saddr.addr.a, ip_packet->u_saddr.addr.b, ip_packet->u_saddr.addr.c, ip_packet->u_saddr.addr.d, ip_packet->u_daddr.addr.a, ip_packet->u_daddr.addr.b, ip_packet->u_daddr.addr.c, ip_packet->u_daddr.addr.d, IPTOS_PREC(ip_packet->tos)); -*/ - // Process a TCP packet - if (ip_packet->protocol == IPPROTO_TCP) - { - struct tcphdr *tcph = (struct tcphdr *) (packet->payload->payload + (ip_packet->ihl * 4)); -/* - fprintf(stderr," tcp -> sport = %i, dport = %i, prec = 0x%x\n", ntohs(tcph->source), - ntohs(tcph->dest), IPTOS_PREC(ip_packet->tos)); */ - bandNum = tcpPortToBand(bandNum,ntohs(tcph->dest)); - if (bandNum == -1) - bandNum = tcpPortToBand(bandNum,ntohs(tcph->source)); + + prio = autoClassify(ip_packet,foundFlow->prioClassifier); + + // If we didn't get anything set band number to 50, 50/50 + if (prio == 0) + prio = 50; + foundQueue = foundFlow->pktQueues[prio]; + } + + + // Lock flow before we fuck with it + g_mutex_lock(foundQueue->lock); + g_mutex_lock(P_FLOW(foundQueue,lock)); + + +/* This is my current work on implementing RED - nk...@lb... */ +#if 0 + { + /* Saved variables */ + unsigned int avg; // Average queue size + unsigned long int q_time; // Last time a packet was received + unsigned int count; // Packets since last one marked + /* Fixed params */ + Wq; // Weight of queue + min_th; // Min threshold of queue + max_th; // Max threshold of queue + max_p; // Max value for Pb + /* Other */ + float Pa; // Current packet marking probability + q; // Current queue size + time; // Current time + float Pb; + + + avg = 0; + count = -1; + + + LOOP WITH PACKETS + + calculate new average + + if queue is non empty + { + // Exponential weighted moving average (EWMA) + avg = (1 - Wq) * avg + Wq * q; } + else + { + } - // Process a ICMP packet - if (ip_packet->protocol == IPPROTO_ICMP) + if (min_th <= avg && avg < max_th) { -/* - struct icmphdr *icmph = (struct icmphdr *) (packet->payload->payload + (ip_packet->ihl * 4)); + count++; - fprintf(stderr,"something: icmp = %i, type = %i\n", icmph->code, icmph->type); -*/ - bandNum = 5; + Pb = max_p * (avg - min_p) / (max_th - min_th); + // Favour small packets + Pb = Pb * (packet_size / max_packet_size); + + Pa = Pb / (1 - count & Pb); + + // FIXME - mark packet with Pa + mark packet + count = 0; } - - // Process a UDP packet - if (ip_packet->protocol == IPPROTO_UDP) + else if (max_th <= avg) { - struct udphdr *udph = (struct udphdr *) (packet->payload->payload + (ip_packet->ihl * 4)); -/* - fprintf(stderr," udp -> sport = %i, dport = %i\n", ntohs(udph->source), - ntohs(udph->dest)); -*/ - bandNum = udpPortToBand(bandNum,ntohs(udph->dest)); - if (bandNum == -1) - bandNum = udpPortToBand(bandNum,ntohs(udph->source)); + // FIXME - mark packet; + count = 0; } - - // If we didn't get anything set band number to 50, 50/50 - if (bandNum == -1) - bandNum = 50; + else + count = -1; - foundQueue = foundFlow->pktQueues[bandNum]; + if queue is empty + q_time = time(); + + CONTINUE LOOP + + + } +#endif + + + + + + - - // Lock flow before we fuck with it - g_mutex_lock(foundQueue->lock); - g_mutex_lock(P_FLOW(foundQueue,lock)); - // Check first of all if we fucked over our one of our queue limits if (will_exceed_pkt_queue(foundQueue,PKT_SIZE(packet)) || will_exceed_flow_queue(foundQueue->parentFlow,PKT_SIZE(packet))) drop = 1; + // Or checkif we fell over our soft curve, slow start algo + else + { + long int maxQueueSize, curQueueSize, avgQueueSize; + /* Check if we must use our queue's size or parent flow queue size */ #if 0 - // Check second of all if we fucked our min threshold over - else if (TH_EXCEEDED(foundQueue,min_th)) - { - int j = 1 + (int) (10.0 * rand() / (RAND_MAX + 1.0)); - - if (TH_EXCEEDED(foundQueue,max_th)) + if (foundQueue->maxSize) { - if (j > 5) - drop = 1; + maxQueueSize = foundQueue->maxSize; + curQueueSize = foundQueue->curSize; } else { - if (j < 3) - drop = 1; +#endif + maxQueueSize = P_FLOW(foundQueue,maxQueueSize); + curQueueSize = P_FLOW(foundQueue,curQueueSize); + avgQueueSize = P_FLOW(foundQueue,avgQueueSize); +#if 0 } - } #endif + + // Check if we have limits to exceed + if (maxQueueSize && curQueueSize > 0 && avgQueueSize > 0) + { + float avgProb = 0, curProb = 0, prob = 0; + int min_th = 10; + double drand = drand48(); + + // nice soft curve flow based on average queue size, starts slow, increases fast will hit 100% probability at 75% + // FIXME - this is based on the flow's queue size, it should be configurable to the queue's queue size + //avgProb = powf((P_FLOW(foundQueue,avgQueueSize) / maxQueueSize * 1.25),3); + avgProb = powf((((float) avgQueueSize / (float) maxQueueSize) * 1.25),3); + // current queue size & threshold curve... sort of flatish, but starting slowish + curProb = powf(((float) curQueueSize / (float) maxQueueSize) + powf(((float) min_th / (float) 150),3),2) / 2; + prob = avgProb + curProb; + // Check if we should drop packet + drop = drand < prob; +/* + logMessage(LOG_DEBUG, "%s: Packet Drop Probability: %f (%li:%li) %f (%li:%li)\t%f\t%i\n", + P_FLOW(foundQueue,flowName), + avgProb,avgQueueSize,maxQueueSize, + curProb,curQueueSize,maxQueueSize, + avgProb + curProb, + drop); +*/ + } + + } + // Check if we must pass the packet if (!drop) { // Lock, queue... adjust stats - foundQueue->packets = g_list_append(foundQueue->packets,packet); + if (queuePos == QUEUE_TAIL) + foundQueue->packets = g_list_append(foundQueue->packets,packet); + else if (queuePos == QUEUE_HEAD) + { + // FIXME - APPEND TO LAST QUEUE + } + foundQueue->curSize += PKT_SIZE(packet); P_FLOW(foundQueue,curQueueSize) += PKT_SIZE(packet); foundQueue->curLen++; @@ -327,7 +410,6 @@ break; case IPQM_PACKET: - // Get packet details... g_mutex_lock(runnerData->IPQLock); m = ipq_get_packet(buf); Modified: trunk/include/autoclass.h =================================================================== --- trunk/include/autoclass.h 2005-01-21 06:45:35 UTC (rev 54) +++ trunk/include/autoclass.h 2005-01-21 06:46:58 UTC (rev 55) @@ -26,12 +26,17 @@ #include <stdlib.h> +#include "flow.h" -// Band calculation functions, tcp -long int tcpPortToBand(long int bandNum, u_int16_t port); -// Band calculation functions, udp -long int udpPortToBand(long int bandNum, u_int16_t port); +// Classificaiton types... +#define AUTOCLASS_NONE 0 +#define AUTOCLASS_PORT 1 +#define AUTOCLASS_TOS 2 +// Auto classify packet and return priority (1 - best, 100 - worst) +unsigned char autoClassify(struct ip_packet_t *ip_packet, unsigned char prioClassifier); + + #endif Modified: trunk/include/flow.h =================================================================== --- trunk/include/flow.h 2005-01-21 06:45:35 UTC (rev 54) +++ trunk/include/flow.h 2005-01-21 06:46:58 UTC (rev 55) @@ -90,7 +90,7 @@ // Shaping struct flow_t *parent; // STATIC, not specified, determined - pointer to parent - int prio; // STATIC - Flow priority + unsigned char prioClassifier; // STATIC - Flow priority auto classifier unsigned long int nfmark; // STATIC - nfmark value i must match auto to queues long int maxQueueSize; // STATIC - max length in bytes of queue long int maxQueueLen; // STATIC - and/or length in items @@ -118,6 +118,7 @@ float curThroughput; // Current throughput unsigned int curThroughputAge; // How many microseconds since last throughput update + unsigned int avgQueueSize; // Average queue size struct timeval lastThroughputUpdate; // Last time the throughput was updated unsigned int accumMs; // Accumulated number of microseconds Modified: trunk/lib/xmlConf.c =================================================================== --- trunk/lib/xmlConf.c 2005-01-21 06:45:35 UTC (rev 54) +++ trunk/lib/xmlConf.c 2005-01-21 06:46:58 UTC (rev 55) @@ -29,6 +29,7 @@ #include <time.h> #include <libxml/xmlmemory.h> #include <libxml/parser.h> +#include "autoclass.h" #include "common.h" #include "flow.h" #include "xmlConf.h" @@ -415,6 +416,8 @@ done = 1; if (!done && !xmlStrcmp(key,"report-timeout")) done = 1; + if (!done && !xmlStrcmp(key,"prio-classifier")) + done = 1; if (!done && !xmlStrcmp(key,"burst-rate")) done = 1; if (!done && !xmlStrcmp(key,"max-rate")) @@ -645,6 +648,7 @@ long int maxRate, long int burstRate, unsigned long int nfmark, + unsigned char prioClassifier, float parent_th, int reportTimeout) { @@ -676,6 +680,9 @@ flow->burstRate = burstRate; flow->nfmark = nfmark; + // Set the priority classifier + flow->prioClassifier = prioClassifier; + flow->parent_th = parent_th; flow->counterTimeout = reportTimeout; @@ -720,6 +727,7 @@ gettimeofday(&flow->lastThroughputUpdate,NULL); flow->curThroughputAge = 0; flow->curThroughput = 0; + flow->avgQueueSize = 0; // Set last time we calculated credit and the rest... flow->accumMs = 0; gettimeofday(&flow->lastCreditCalc,NULL); @@ -746,22 +754,18 @@ if (flow->maxQueueLen == -1) { if (flow->maxRate != 0) - flow->maxQueueLen = 5; // Seems an OK value for normal use? + flow->maxQueueLen = ((flow->burstRate + flow->maxRate) / 2 / 750) * 2; // Seems an OK value for normal use? else flow->maxQueueLen = 0; } if (flow->maxQueueSize == -1) { if (flow->maxRate != 0) - flow->maxQueueSize = 4096; // Let us queue at least 2 big packets and some small ones + flow->maxQueueSize = (flow->burstRate + flow->maxRate); // Normal use, this should be ok? else flow->maxQueueSize = 0; } - // Calculate our thresholds - //flow->min_th = (flow->maxRate / 750); - //flow->max_th = (flow->maxRate / 750) * 4; - // Blank all queues for (i = 0; i < NUM_PRIO_BANDS; i++) { @@ -928,6 +932,7 @@ char *p; long int statsLen, maxQueueSize, maxQueueLen, maxRate, burstRate, reportTimeout; unsigned long int nfmark; + unsigned char prioClassifier = AUTOCLASS_PORT; float parent_th; @@ -968,9 +973,24 @@ reportTimeout = 30; } + // Work out automatic classifier to use + if ((p = g_hash_table_lookup(tagProperties,"prio-classifier")) != NULL) + { + if (strcasecmp(p,"tos") == 0) + prioClassifier = AUTOCLASS_TOS; + else if (strcasecmp(p,"port") == 0) + prioClassifier = AUTOCLASS_PORT; + else if (strcasecmp(p,"none") == 0) + prioClassifier = AUTOCLASS_NONE; + else + fprintf(stderr,"ERROR: %s - Tag value for \"prio-classifier\" is invalid, please read manual\n",flowName); + } + else + prioClassifier = AUTOCLASS_NONE; + // Create our flow newFlow = createFlow(flowName,parentFlow,statsLen,maxQueueSize,maxQueueLen,maxRate,burstRate,nfmark, - parent_th,reportTimeout); + prioClassifier,parent_th,reportTimeout); flows = g_list_append(flows,newFlow); } |
From: SVN C. <sv...@li...> - 2005-01-21 06:45:50
|
Author: nkukard Date: 2005-01-21 08:45:35 +0200 (Fri, 21 Jan 2005) New Revision: 54 Modified: trunk/doc/bwmtools.texi Log: * Minor documentation updates Modified: trunk/doc/bwmtools.texi =================================================================== --- trunk/doc/bwmtools.texi 2005-01-21 06:42:26 UTC (rev 53) +++ trunk/doc/bwmtools.texi 2005-01-21 06:45:35 UTC (rev 54) @@ -78,12 +78,48 @@ As long as your iptables supports the @option{-j QUEUE} target, traffic shaping will work. +@menu +* Features::BWM Tools Features +@end menu +@node Features +@section BWM Tools Features +@cindex features +This section lists a few features which make BWM Tools a good solution +for small to large enterprises@dots{} +@* +@itemize +@item Traffic Shaping +@itemize +@item Hierarchical flows +Allows you to embed flows within flows to form complex traffic shaping rules. +@item Parent burst thresholds +Parent burst thresholds allow child flows to burst until their parent flow +has reached a specific utilization threshold. +@end itemize +@item Graphing +@itemize +@item RRD Tool file support +Generation of rrdtool files which can be used to create custom graphs. +@item Builtin RRD Tool graphing support +BWM Tools can generate pretty looking graphs all by itself. Parameters for +graphing are discussed in the Graphing section. +@end itemize +@item Logging +@itemize +@item Logging of traffic +BWM Tools logs can log traffic stats to file at pre-defined intervals +for use in reporting or graphing. +@end itemize +@end itemize + + + @node Installation @chapter Installing BWM Tools |
From: SVN C. <sv...@li...> - 2005-01-21 06:42:45
|
Author: nkukard Date: 2005-01-21 08:42:26 +0200 (Fri, 21 Jan 2005) New Revision: 53 Modified: branch/bwmd-tosclassify/aclocal.m4 branch/bwmd-tosclassify/bwm_firewall/bwm_firewall.c branch/bwmd-tosclassify/bwmd/autoclass.c branch/bwmd-tosclassify/bwmd/bwmd.c branch/bwmd-tosclassify/bwmd/flow.c branch/bwmd-tosclassify/bwmd/ipq.c branch/bwmd-tosclassify/configure branch/bwmd-tosclassify/configure.ac branch/bwmd-tosclassify/doc/bwmtools.texi branch/bwmd-tosclassify/include/autoclass.h branch/bwmd-tosclassify/include/flow.h branch/bwmd-tosclassify/lib/Makefile.am branch/bwmd-tosclassify/lib/Makefile.in branch/bwmd-tosclassify/lib/xmlConf.c Log: * current work on TOS and optimization Modified: branch/bwmd-tosclassify/aclocal.m4 =================================================================== --- branch/bwmd-tosclassify/aclocal.m4 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/aclocal.m4 2005-01-21 06:42:26 UTC (rev 53) @@ -32,6 +32,9 @@ gmodule) pkg_config_args="$pkg_config_args gmodule-2.0" ;; + gmodule-no-export) + pkg_config_args="$pkg_config_args gmodule-no-export-2.0" + ;; gobject) pkg_config_args="$pkg_config_args gobject-2.0" ;; Modified: branch/bwmd-tosclassify/bwm_firewall/bwm_firewall.c =================================================================== --- branch/bwmd-tosclassify/bwm_firewall/bwm_firewall.c 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/bwm_firewall/bwm_firewall.c 2005-01-21 06:42:26 UTC (rev 53) @@ -237,7 +237,7 @@ // Check if we piping to iptables aswell if (piptables_restore) { - fprintf(piptables_restore, "%s", data); + fprintf(piptables_restore, "%s", (char *) data); // Check for IO error if (ferror(piptables_restore)) { Modified: branch/bwmd-tosclassify/bwmd/autoclass.c =================================================================== --- branch/bwmd-tosclassify/bwmd/autoclass.c 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/bwmd/autoclass.c 2005-01-21 06:42:26 UTC (rev 53) @@ -22,86 +22,204 @@ */ #include "autoclass.h" +#include "flow.h" -// Band calculation functions, tcp -long int tcpPortToBand(long int bandNum, u_int16_t port) + +// Auto classify by port +static unsigned char autoClassify_port(struct ip_packet_t *ip_packet, unsigned char prioClassifier) { - long int ret = bandNum; + unsigned char prio = 0; + + + // Priority calculation functions, tcp + static unsigned char tcpPortToPrio(u_int16_t port) + { + unsigned char ret = 0; + + + // Decide band to pump packet into + switch (port) + { + // AUTH + case 113: + ret = 20; + break; + // SSH + case 22: + // TELNET + case 23: + ret = 25; + break; + // HTTP + case 80: + // PROXY? + case 8080: + case 3128: + case 3130: + // HTTPS + case 443: + ret = 65; + break; + // CVS + case 2401: + ret = 70; + break; + // POP3 + case 110: + // IMAP + case 143: + ret = 75; + break; + // FTP + case 20: + case 21: + ret = 80; + break; + }; + + return ret; + } + + + // Priority calculation functions, udp + static unsigned char udpPortToPrio(u_int16_t port) + { + unsigned char ret = 0; - // Decide band to pump packet into - switch (port) + // Decide band to pump packet into + switch (port) + { + // DNS + case 53: + ret = 10; + break; + // NTP + case 123: + ret = 15; + break; + // RADIUS + case 1645: + case 1646: + case 1812: + case 1813: + ret = 30; + break; + default: + // Traceroute + if (port >= 33434 && port <= 33465) + ret = 5; + break; + }; + + return ret; + } + + + // Process a TCP packet + if (ip_packet->protocol == IPPROTO_TCP) { - // AUTH - case 113: - ret = 20; - break; - // SSH - case 22: - // TELNET - case 23: - ret = 25; - break; - // HTTP - case 80: - // PROXY? - case 8080: - case 3128: - case 3130: - // HTTPS - case 443: - ret = 65; - break; - // CVS - case 2401: - ret = 70; - break; - // POP3 - case 110: - // IMAP - case 143: - ret = 75; - break; - // FTP - case 20: - case 21: - ret = 80; - break; - }; + struct tcphdr *tcph = (struct tcphdr *) (ip_packet + (ip_packet->ihl * 4)); +/* + fprintf(stderr," tcp -> sport = %i, dport = %i, prec = 0x%x\n", ntohs(tcph->source), + ntohs(tcph->dest), IPTOS_PREC(ip_packet->tos)); +*/ + if (!(prio = tcpPortToPrio(ntohs(tcph->dest)))) + prio = tcpPortToPrio(ntohs(tcph->source)); + } - return ret; + // Process a ICMP packet + else if (ip_packet->protocol == IPPROTO_ICMP) + { +// struct icmphdr *icmph = (struct icmphdr *) (ip_packet + (ip_packet->ihl * 4)); + +/* + fprintf(stderr,"something: icmp = %i, type = %i\n", icmph->code, icmph->type); +*/ + prio = 5; + } + + // Process a UDP packet + else if (ip_packet->protocol == IPPROTO_UDP) + { + struct udphdr *udph = (struct udphdr *) (ip_packet + (ip_packet->ihl * 4)); +/* + fprintf(stderr," udp -> sport = %i, dport = %i\n", ntohs(udph->source), + ntohs(udph->dest)); +*/ + if (!(prio = udpPortToPrio(ntohs(udph->dest)))) + prio = udpPortToPrio(ntohs(udph->source)); + } + + return prio; } + -// Band calculation functions, udp -long int udpPortToBand(long int bandNum, u_int16_t port) +// Auto classify by ip header TOS value +static unsigned char autoClassify_tos(struct ip_packet_t *ip_packet, unsigned char prioClassifier) { - long int ret = bandNum; - - - // Decide band to pump packet into - switch (port) + unsigned char prio = 0; + // Get type of service + unsigned char tos = IPTOS_TOS(ip_packet->tos); + + + // Decide what we doing... + if (tos == IPTOS_LOWDELAY) { - // DNS - case 53: - ret = 10; - break; - // NTP - case 123: - ret = 15; - break; - // RADIUS - case 1645: - case 1646: - case 1812: - case 1813: - ret = 30; - break; - }; - - if (port >= 33434 && port <= 33465) - ret = 5; - - return ret; +/* + * 1. LOW DELAY + * - PRIO 10 + * - high drop probability + */ + } + else if (tos == IPTOS_THROUGHPUT) + { +/* + * 2. THROUGHPUT + * - long queue? + * - low drop probability + */ + } + else if (tos == IPTOS_RELIABILITY) + { +/* + * 3. RELIABILITY + * - low drop probability + */ + } + else if (tos == IPTOS_MINCOST) + { +/* + * 4. MIN COST + * - PRIO 90 + * - high drop probability + */ + } + + return prio; } + +// Auto classify packet and return priority (1 - best, 100 - worst) +unsigned char autoClassify(struct ip_packet_t *ip_packet, unsigned char prioClassifier) +{ + unsigned char prio; + + + // Classify by port + if (prioClassifier == AUTOCLASS_PORT) + prio = autoClassify_port(ip_packet,prioClassifier); + // Classify by TOS + else if (prioClassifier == AUTOCLASS_TOS) + prio = autoClassify_tos(ip_packet,prioClassifier); + // Default - this will basically match if we have AUTOCLASS_NONE + else + prio = 50; + + return prio; +} + + + + Modified: branch/bwmd-tosclassify/bwmd/bwmd.c =================================================================== --- branch/bwmd-tosclassify/bwmd/bwmd.c 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/bwmd/bwmd.c 2005-01-21 06:42:26 UTC (rev 53) @@ -36,7 +36,11 @@ #include "flowControl.h" #include "xmlConf.h" +// Initialize syslog - This single function header doesn't call for a headerfile +extern void initSyslog(const char *ident, int prioMask); + +// Load a module.. void modprobe(gpointer key, gpointer value, gpointer user_data) { char buffer[4096]; Modified: branch/bwmd-tosclassify/bwmd/flow.c =================================================================== --- branch/bwmd-tosclassify/bwmd/flow.c 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/bwmd/flow.c 2005-01-21 06:42:26 UTC (rev 53) @@ -186,8 +186,8 @@ // Differences in queue when we done int acceptLen = 0, queuedLen = 0; int acceptSize = 0, queuedSize = 0; + - // Lock, hijack packets, unlock g_mutex_lock(pktQueue->lock); packets = pktQueue->packets; @@ -286,7 +286,9 @@ } } - // If packet is still ok to pass through, do our stuff + /* If packet is still ok to pass through + * Update our parent threshold stuff so we can calculate parent_th above + */ if (ok) { struct timeval curTime; @@ -319,8 +321,26 @@ // 2 seconds if (flow->curThroughputAge >= 2000000) { - flow->curThroughputAge -= 2000000; - flow->curThroughput = flow->curThroughputAge / 1000000.0 * flow->curThroughput; + float delta; + + // flow->curThroughputAge -= 2000000; + + // Get the fraction of time passed since last update + delta = flow->curThroughputAge / 1000000.0; + + // Calculate throughput + flow->curThroughput /= delta; + + // Calculate average queue size + flow->avgQueueSize = (flow->avgQueueSize + flow->curQueueSize) / delta; + /* + fprintf(stderr,"%s: curThroughput: %f, avgQueueSize: %li, delta: %f\n", + flow->flowName, + flow->curThroughput, + flow->avgQueueSize, + delta); + */ + flow->curThroughputAge = 0; } // Set this as the last time we updated our throughput @@ -381,7 +401,7 @@ // Lock everything g_mutex_lock(nextPktQueue->lock); g_mutex_lock(flow->lock); - // Add packet to parent queue & remove from child + // Append to parent nextPktQueue->packets = g_list_append(nextPktQueue->packets,packet); // Update next queue stats nextPktQueue->curLen++; @@ -417,7 +437,9 @@ g_mutex_lock(pktQueue->lock); if (packets) { + // Merge the rest in pktQueue->packets = g_list_concat(packets,pktQueue->packets); + // Signal that we just added to the queue g_mutex_lock(runnerData->bandSignalLock); // Check if we havn't already gotten the queue listed @@ -427,12 +449,13 @@ g_cond_signal(runnerData->bandSignalCond); g_mutex_unlock(runnerData->bandSignalLock); } + pktQueue->curLen -= (acceptLen + queuedLen); pktQueue->curSize -= (acceptSize + queuedLen); g_mutex_unlock(pktQueue->lock); - return(acceptLen); + return acceptLen; } @@ -441,9 +464,6 @@ void *flowRunner(void *data) { struct runnerData_t *runnerData = (struct runnerData_t*) data; - GList *queueChangeList[NUM_PRIO_BANDS]; - int i, pktsProcessed = 0; - GTimeVal mytime; // Our processing function @@ -454,19 +474,21 @@ // Check if we found a flow with a queue - pktsProcessed += processPktQueue(aRunnerData,pktQueue); + // NOTE: The function below returns the number of packets processed + processPktQueue(aRunnerData,pktQueue); } - // Allocate queue change list - for (i = 0; i < NUM_PRIO_BANDS; i++) - queueChangeList[i] = NULL; - logMessage(LOG_DEBUG, "Flow runner started...\n"); // Loop when we get a signal while (1) { + GTimeVal mytime; + unsigned char i; + GList *queueChangeList = NULL; + + g_mutex_lock(runnerData->bandSignalLock); // If the queue has changed proceed @@ -481,15 +503,14 @@ // Hijack the queue change list items for (i = 0; i < NUM_PRIO_BANDS; i++) { - // Copy list item over - queueChangeList[i] = runnerData->queueChangeList[i]; // Zero runner data if it is non-NULL if (runnerData->queueChangeList[i]) { - runnerData->queueChangeList[i] = NULL; + // Copy list item over + queueChangeList = g_list_concat(queueChangeList,runnerData->queueChangeList[i]); + // Blank used list... copy uses directly + runnerData->queueChangeList[i] = NULL; } - else - queueChangeList[i] = NULL; } runnerData->queueChanged = 0; @@ -497,15 +518,11 @@ g_mutex_unlock(runnerData->bandSignalLock); - // Process all list - for (i = 0; i < NUM_PRIO_BANDS; i++) + // Process list if it is non-NULL + if (queueChangeList) { - // Process list if it is non-NULL - if (queueChangeList[i]) - { - g_list_foreach(queueChangeList[i],processQueue,runnerData); - g_list_free(queueChangeList[i]); - } + g_list_foreach(queueChangeList,processQueue,runnerData); + g_list_free(queueChangeList); } } Modified: branch/bwmd-tosclassify/bwmd/ipq.c =================================================================== --- branch/bwmd-tosclassify/bwmd/ipq.c 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/bwmd/ipq.c 2005-01-21 06:42:26 UTC (rev 53) @@ -22,6 +22,7 @@ */ +#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -31,7 +32,10 @@ #include "libipq.h" +#define QUEUE_HEAD 1 +#define QUEUE_TAIL 2 + // Destroy the ipq handle static void destroyIPQHandle(struct ipq_handle *h) { @@ -91,6 +95,8 @@ int status; int result; int drop = 0; + // Default to inserting at queue tail + unsigned char queuePos = QUEUE_TAIL; // Our find functions @@ -137,94 +143,171 @@ if (!foundQueue) { struct ip_packet_t *ip_packet = (struct ip_packet_t *) packet->payload->payload; - long int bandNum = -1; - + unsigned char prio = 0; + /* fprintf(stderr,"auto packet queue -> protocol = %i, src = %i.%i.%i.%i, dest = %i.%i.%i.%i, tos = 0x%x\n", ip_packet->protocol, ip_packet->u_saddr.addr.a, ip_packet->u_saddr.addr.b, ip_packet->u_saddr.addr.c, ip_packet->u_saddr.addr.d, ip_packet->u_daddr.addr.a, ip_packet->u_daddr.addr.b, ip_packet->u_daddr.addr.c, ip_packet->u_daddr.addr.d, IPTOS_PREC(ip_packet->tos)); -*/ - // Process a TCP packet - if (ip_packet->protocol == IPPROTO_TCP) - { - struct tcphdr *tcph = (struct tcphdr *) (packet->payload->payload + (ip_packet->ihl * 4)); -/* - fprintf(stderr," tcp -> sport = %i, dport = %i, prec = 0x%x\n", ntohs(tcph->source), - ntohs(tcph->dest), IPTOS_PREC(ip_packet->tos)); */ - bandNum = tcpPortToBand(bandNum,ntohs(tcph->dest)); - if (bandNum == -1) - bandNum = tcpPortToBand(bandNum,ntohs(tcph->source)); + + prio = autoClassify(ip_packet,foundFlow->prioClassifier); + + // If we didn't get anything set band number to 50, 50/50 + if (prio == 0) + prio = 50; + foundQueue = foundFlow->pktQueues[prio]; + } + + + // Lock flow before we fuck with it + g_mutex_lock(foundQueue->lock); + g_mutex_lock(P_FLOW(foundQueue,lock)); + + +/* This is my current work on implementing RED - nk...@lb... */ +#if 0 + { + /* Saved variables */ + unsigned int avg; // Average queue size + unsigned long int q_time; // Last time a packet was received + unsigned int count; // Packets since last one marked + /* Fixed params */ + Wq; // Weight of queue + min_th; // Min threshold of queue + max_th; // Max threshold of queue + max_p; // Max value for Pb + /* Other */ + float Pa; // Current packet marking probability + q; // Current queue size + time; // Current time + float Pb; + + + avg = 0; + count = -1; + + + LOOP WITH PACKETS + + calculate new average + + if queue is non empty + { + // Exponential weighted moving average (EWMA) + avg = (1 - Wq) * avg + Wq * q; } + else + { + } - // Process a ICMP packet - if (ip_packet->protocol == IPPROTO_ICMP) + if (min_th <= avg && avg < max_th) { -/* - struct icmphdr *icmph = (struct icmphdr *) (packet->payload->payload + (ip_packet->ihl * 4)); + count++; - fprintf(stderr,"something: icmp = %i, type = %i\n", icmph->code, icmph->type); -*/ - bandNum = 5; + Pb = max_p * (avg - min_p) / (max_th - min_th); + // Favour small packets + Pb = Pb * (packet_size / max_packet_size); + + Pa = Pb / (1 - count & Pb); + + // FIXME - mark packet with Pa + mark packet + count = 0; } - - // Process a UDP packet - if (ip_packet->protocol == IPPROTO_UDP) + else if (max_th <= avg) { - struct udphdr *udph = (struct udphdr *) (packet->payload->payload + (ip_packet->ihl * 4)); -/* - fprintf(stderr," udp -> sport = %i, dport = %i\n", ntohs(udph->source), - ntohs(udph->dest)); -*/ - bandNum = udpPortToBand(bandNum,ntohs(udph->dest)); - if (bandNum == -1) - bandNum = udpPortToBand(bandNum,ntohs(udph->source)); + // FIXME - mark packet; + count = 0; } - - // If we didn't get anything set band number to 50, 50/50 - if (bandNum == -1) - bandNum = 50; + else + count = -1; - foundQueue = foundFlow->pktQueues[bandNum]; + if queue is empty + q_time = time(); + + CONTINUE LOOP + + + } +#endif + + + + + + - - // Lock flow before we fuck with it - g_mutex_lock(foundQueue->lock); - g_mutex_lock(P_FLOW(foundQueue,lock)); - // Check first of all if we fucked over our one of our queue limits if (will_exceed_pkt_queue(foundQueue,PKT_SIZE(packet)) || will_exceed_flow_queue(foundQueue->parentFlow,PKT_SIZE(packet))) drop = 1; + // Or checkif we fell over our soft curve, slow start algo + else + { + long int maxQueueSize, curQueueSize, avgQueueSize; + /* Check if we must use our queue's size or parent flow queue size */ #if 0 - // Check second of all if we fucked our min threshold over - else if (TH_EXCEEDED(foundQueue,min_th)) - { - int j = 1 + (int) (10.0 * rand() / (RAND_MAX + 1.0)); - - if (TH_EXCEEDED(foundQueue,max_th)) + if (foundQueue->maxSize) { - if (j > 5) - drop = 1; + maxQueueSize = foundQueue->maxSize; + curQueueSize = foundQueue->curSize; } else { - if (j < 3) - drop = 1; +#endif + maxQueueSize = P_FLOW(foundQueue,maxQueueSize); + curQueueSize = P_FLOW(foundQueue,curQueueSize); + avgQueueSize = P_FLOW(foundQueue,avgQueueSize); +#if 0 } - } #endif + + // Check if we have limits to exceed + if (maxQueueSize && curQueueSize > 0 && avgQueueSize > 0) + { + float avgProb = 0, curProb = 0, prob = 0; + int min_th = 10; + double drand = drand48(); + + // nice soft curve flow based on average queue size, starts slow, increases fast will hit 100% probability at 75% + // FIXME - this is based on the flow's queue size, it should be configurable to the queue's queue size + //avgProb = powf((P_FLOW(foundQueue,avgQueueSize) / maxQueueSize * 1.25),3); + avgProb = powf((((float) avgQueueSize / (float) maxQueueSize) * 1.25),3); + // current queue size & threshold curve... sort of flatish, but starting slowish + curProb = powf(((float) curQueueSize / (float) maxQueueSize) + powf(((float) min_th / (float) 150),3),2) / 2; + prob = avgProb + curProb; + // Check if we should drop packet + drop = drand < prob; +/* + logMessage(LOG_DEBUG, "%s: Packet Drop Probability: %f (%li:%li) %f (%li:%li)\t%f\t%i\n", + P_FLOW(foundQueue,flowName), + avgProb,avgQueueSize,maxQueueSize, + curProb,curQueueSize,maxQueueSize, + avgProb + curProb, + drop); +*/ + } + + } + // Check if we must pass the packet if (!drop) { // Lock, queue... adjust stats - foundQueue->packets = g_list_append(foundQueue->packets,packet); + if (queuePos == QUEUE_TAIL) + foundQueue->packets = g_list_append(foundQueue->packets,packet); + else if (queuePos == QUEUE_HEAD) + { + // FIXME - APPEND TO LAST QUEUE + } + foundQueue->curSize += PKT_SIZE(packet); P_FLOW(foundQueue,curQueueSize) += PKT_SIZE(packet); foundQueue->curLen++; @@ -326,7 +409,6 @@ break; case IPQM_PACKET: - // Get packet details... g_mutex_lock(runnerData->IPQLock); m = ipq_get_packet(buf); Modified: branch/bwmd-tosclassify/configure =================================================================== --- branch/bwmd-tosclassify/configure 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/configure 2005-01-21 06:42:26 UTC (rev 53) @@ -22753,7 +22753,7 @@ done -# Check for glib 2.4.0 +# Check for glib 2.2.0 # Check whether --enable-glibtest or --disable-glibtest was given. if test "${enable_glibtest+set}" = set; then enableval="$enable_glibtest" @@ -22769,6 +22769,9 @@ gmodule) pkg_config_args="$pkg_config_args gmodule-2.0" ;; + gmodule-no-export) + pkg_config_args="$pkg_config_args gmodule-no-export-2.0" + ;; gobject) pkg_config_args="$pkg_config_args gobject-2.0" ;; @@ -22833,7 +22836,7 @@ no_glib=yes fi - min_glib_version=2.4.0 + min_glib_version=2.2.0 echo "$as_me:$LINENO: checking for GLIB - version >= $min_glib_version" >&5 echo $ECHO_N "checking for GLIB - version >= $min_glib_version... $ECHO_C" >&6 @@ -23077,11 +23080,11 @@ then echo echo "* - ERROR -" - echo "* glib >= 2.4.0 required, this includes the development libraries and headers" + echo "* glib >= 2.2.0 required, this includes the development libraries and headers" exit 1 fi -# Check for libxml 2.6.0 +# Check for libxml 2.5.0 # Check whether --with-xml-prefix or --without-xml-prefix was given. @@ -23160,7 +23163,7 @@ echo "${ECHO_T}no" >&6 fi - min_xml_version=2.6.0 + min_xml_version=2.5.0 echo "$as_me:$LINENO: checking for libxml - version >= $min_xml_version" >&5 echo $ECHO_N "checking for libxml - version >= $min_xml_version... $ECHO_C" >&6 no_xml="" @@ -23390,11 +23393,14 @@ then echo echo "* - ERROR -" - echo "* libxml >= 2.6.0 required, this includes the development libraries and headers" + echo "* libxml >= 2.5.0 required, this includes the development libraries and headers" exit 1 fi -XML_CFLAGS=$XML_CPPFLAGS +if test x"$XML_CFLAGS" = x +then + XML_CFLAGS=$XML_CPPFLAGS +fi Modified: branch/bwmd-tosclassify/configure.ac =================================================================== --- branch/bwmd-tosclassify/configure.ac 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/configure.ac 2005-01-21 06:42:26 UTC (rev 53) @@ -26,7 +26,7 @@ AC_GNU_SOURCE -AM_INIT_AUTOMAKE(1.8) +AM_INIT_AUTOMAKE(1.7) # Checks for programs. @@ -95,27 +95,30 @@ AC_FUNC_VPRINTF AC_CHECK_FUNCS([gettimeofday inet_ntoa memset select socket strcasecmp strchr strdup strerror strncasecmp strndup]) -# Check for glib 2.4.0 -AM_PATH_GLIB_2_0(2.4.0,have_glib=yes,have_glib=no,gthread) +# Check for glib 2.2.0 +AM_PATH_GLIB_2_0(2.2.0,have_glib=yes,have_glib=no,gthread) if test x"$have_glib" = x"no" then echo echo "* - ERROR -" - echo "* glib >= 2.4.0 required, this includes the development libraries and headers" + echo "* glib >= 2.2.0 required, this includes the development libraries and headers" exit 1 fi -# Check for libxml 2.6.0 -AM_PATH_XML2(2.6.0,have_xml=yes,have_xml=no) +# Check for libxml 2.5.0 +AM_PATH_XML2(2.5.0,have_xml=yes,have_xml=no) if test x"$have_xml" = x"no" then echo echo "* - ERROR -" - echo "* libxml >= 2.6.0 required, this includes the development libraries and headers" + echo "* libxml >= 2.5.0 required, this includes the development libraries and headers" exit 1 fi -XML_CFLAGS=$XML_CPPFLAGS +if test x"$XML_CFLAGS" = x +then + XML_CFLAGS=$XML_CPPFLAGS +fi AC_SUBST(XML_CFLAGS) Modified: branch/bwmd-tosclassify/doc/bwmtools.texi =================================================================== --- branch/bwmd-tosclassify/doc/bwmtools.texi 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/doc/bwmtools.texi 2005-01-21 06:42:26 UTC (rev 53) @@ -78,12 +78,48 @@ As long as your iptables supports the @option{-j QUEUE} target, traffic shaping will work. +@menu +* Features::BWM Tools Features +@end menu +@node Features +@section BWM Tools Features +@cindex features +This section lists a few features which make BWM Tools a good solution +for small to large enterprises@dots{} +@* +@itemize +@item Traffic Shaping +@itemize +@item Hierarchical flows +Allows you to embed flows within flows to form complex traffic shaping rules. +@item Parent burst thresholds +Parent burst thresholds allow child flows to burst until their parent flow +has reached a specific utilization threshold. +@end itemize +@item Graphing +@itemize +@item RRD Tool file support +Generation of rrdtool files which can be used to create custom graphs. +@item Builtin RRD Tool graphing support +BWM Tools can generate pretty looking graphs all by itself. Parameters for +graphing are discussed in the Graphing section. +@end itemize +@item Logging +@itemize +@item Logging of traffic +BWM Tools logs can log traffic stats to file at pre-defined intervals +for use in reporting or graphing. +@end itemize +@end itemize + + + @node Installation @chapter Installing BWM Tools Modified: branch/bwmd-tosclassify/include/autoclass.h =================================================================== --- branch/bwmd-tosclassify/include/autoclass.h 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/include/autoclass.h 2005-01-21 06:42:26 UTC (rev 53) @@ -26,12 +26,17 @@ #include <stdlib.h> +#include "flow.h" -// Band calculation functions, tcp -long int tcpPortToBand(long int bandNum, u_int16_t port); -// Band calculation functions, udp -long int udpPortToBand(long int bandNum, u_int16_t port); +// Classificaiton types... +#define AUTOCLASS_NONE 0 +#define AUTOCLASS_PORT 1 +#define AUTOCLASS_TOS 2 +// Auto classify packet and return priority (1 - best, 100 - worst) +unsigned char autoClassify(struct ip_packet_t *ip_packet, unsigned char prioClassifier); + + #endif Modified: branch/bwmd-tosclassify/include/flow.h =================================================================== --- branch/bwmd-tosclassify/include/flow.h 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/include/flow.h 2005-01-21 06:42:26 UTC (rev 53) @@ -59,7 +59,7 @@ { GMutex *lock; - long int prio; + unsigned char prio; struct flow_t *parentFlow; // void* because we cannot ref below? @@ -69,7 +69,7 @@ long int curLen; long int maxSize; long int maxLen; - + GList *packets; }; @@ -90,7 +90,7 @@ // Shaping struct flow_t *parent; // STATIC, not specified, determined - pointer to parent - int prio; // STATIC - Flow priority + unsigned char prioClassifier; // STATIC - Flow priority auto classifier long int nfmark; // STATIC - nfmark value i must match auto to queues long int maxQueueSize; // STATIC - max length in bytes of queue long int maxQueueLen; // STATIC - and/or length in items @@ -118,6 +118,7 @@ float curThroughput; // Current throughput unsigned int curThroughputAge; // How many microseconds since last throughput update + unsigned int avgQueueSize; // Average queue size struct timeval lastThroughputUpdate; // Last time the throughput was updated unsigned int accumMs; // Accumulated number of microseconds Modified: branch/bwmd-tosclassify/lib/Makefile.am =================================================================== --- branch/bwmd-tosclassify/lib/Makefile.am 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/lib/Makefile.am 2005-01-21 06:42:26 UTC (rev 53) @@ -26,6 +26,6 @@ lib_LTLIBRARIES = libbwm.la libbwm_la_SOURCES = xmlConf.c misc.c -libbwm_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS) $(XML_CFLAGS) $(GMIME_CFLAGS) $(AM_CFLAGS) -libbwm_la_LDFLAGS = $(GLIB_LIBS) $(XML_LIBS) $(GMIME_LIBS) -version-info 1:0:0 +libbwm_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS) $(XML_CFLAGS) $(AM_CFLAGS) +libbwm_la_LDFLAGS = $(GLIB_LIBS) $(XML_LIBS) -version-info 1:0:0 Modified: branch/bwmd-tosclassify/lib/Makefile.in =================================================================== --- branch/bwmd-tosclassify/lib/Makefile.in 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/lib/Makefile.in 2005-01-21 06:42:26 UTC (rev 53) @@ -204,8 +204,8 @@ target_alias = @target_alias@ lib_LTLIBRARIES = libbwm.la libbwm_la_SOURCES = xmlConf.c misc.c -libbwm_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS) $(XML_CFLAGS) $(GMIME_CFLAGS) $(AM_CFLAGS) -libbwm_la_LDFLAGS = $(GLIB_LIBS) $(XML_LIBS) $(GMIME_LIBS) -version-info 1:0:0 +libbwm_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS) $(XML_CFLAGS) $(AM_CFLAGS) +libbwm_la_LDFLAGS = $(GLIB_LIBS) $(XML_LIBS) -version-info 1:0:0 all: all-am .SUFFIXES: Modified: branch/bwmd-tosclassify/lib/xmlConf.c =================================================================== --- branch/bwmd-tosclassify/lib/xmlConf.c 2005-01-21 06:38:35 UTC (rev 52) +++ branch/bwmd-tosclassify/lib/xmlConf.c 2005-01-21 06:42:26 UTC (rev 53) @@ -29,6 +29,7 @@ #include <time.h> #include <libxml/xmlmemory.h> #include <libxml/parser.h> +#include "autoclass.h" #include "common.h" #include "flow.h" #include "xmlConf.h" @@ -415,6 +416,8 @@ done = 1; if (!done && !xmlStrcmp(key,"report-timeout")) done = 1; + if (!done && !xmlStrcmp(key,"prio-classifier")) + done = 1; if (!done && !xmlStrcmp(key,"burst-rate")) done = 1; if (!done && !xmlStrcmp(key,"max-rate")) @@ -645,6 +648,7 @@ long int maxRate, long int burstRate, long int nfmark, + unsigned char prioClassifier, float parent_th, int reportTimeout) { @@ -676,6 +680,9 @@ flow->burstRate = burstRate; flow->nfmark = nfmark; + // Set the priority classifier + flow->prioClassifier = prioClassifier; + flow->parent_th = parent_th; flow->counterTimeout = reportTimeout; @@ -720,6 +727,7 @@ gettimeofday(&flow->lastThroughputUpdate,NULL); flow->curThroughputAge = 0; flow->curThroughput = 0; + flow->avgQueueSize = 0; // Set last time we calculated credit and the rest... flow->accumMs = 0; gettimeofday(&flow->lastCreditCalc,NULL); @@ -746,22 +754,18 @@ if (flow->maxQueueLen == -1) { if (flow->maxRate != 0) - flow->maxQueueLen = 5; // Seems an OK value for normal use? + flow->maxQueueLen = ((flow->burstRate + flow->maxRate) / 2 / 750) * 2; // Seems an OK value for normal use? else flow->maxQueueLen = 0; } if (flow->maxQueueSize == -1) { if (flow->maxRate != 0) - flow->maxQueueSize = 4096; // Let us queue at least 2 big packets and some small ones + flow->maxQueueSize = (flow->burstRate + flow->maxRate); // Normal use, this should be ok? else flow->maxQueueSize = 0; } - // Calculate our thresholds - //flow->min_th = (flow->maxRate / 750); - //flow->max_th = (flow->maxRate / 750) * 4; - // Blank all queues for (i = 0; i < NUM_PRIO_BANDS; i++) { @@ -927,6 +931,7 @@ { char *p; long int statsLen, maxQueueSize, maxQueueLen, maxRate, burstRate, reportTimeout, nfmark; + unsigned char prioClassifier = AUTOCLASS_PORT; float parent_th; @@ -967,9 +972,24 @@ reportTimeout = 30; } + // Work out automatic classifier to use + if ((p = g_hash_table_lookup(tagProperties,"prio-classifier")) != NULL) + { + if (strcasecmp(p,"tos") == 0) + prioClassifier = AUTOCLASS_TOS; + else if (strcasecmp(p,"port") == 0) + prioClassifier = AUTOCLASS_PORT; + else if (strcasecmp(p,"none") == 0) + prioClassifier = AUTOCLASS_NONE; + else + fprintf(stderr,"ERROR: %s - Tag value for \"prio-classifier\" is invalid, please read manual\n",flowName); + } + else + prioClassifier = AUTOCLASS_NONE; + // Create our flow newFlow = createFlow(flowName,parentFlow,statsLen,maxQueueSize,maxQueueLen,maxRate,burstRate,nfmark, - parent_th,reportTimeout); + prioClassifier,parent_th,reportTimeout); flows = g_list_append(flows,newFlow); } |
From: SVN C. <sv...@li...> - 2005-01-21 06:38:53
|
Author: nkukard Date: 2005-01-21 08:38:35 +0200 (Fri, 21 Jan 2005) New Revision: 52 Modified: trunk/bwmd/flow.c Log: * Improved the way avergare throughput is calculated over time * Improved packet processing efficiency Modified: trunk/bwmd/flow.c =================================================================== --- trunk/bwmd/flow.c 2005-01-19 18:26:32 UTC (rev 51) +++ trunk/bwmd/flow.c 2005-01-21 06:38:35 UTC (rev 52) @@ -321,8 +321,26 @@ // 2 seconds if (flow->curThroughputAge >= 2000000) { - flow->curThroughputAge -= 2000000; - flow->curThroughput = flow->curThroughputAge / 1000000.0 * flow->curThroughput; + float delta; + + // flow->curThroughputAge -= 2000000; + + // Get the fraction of time passed since last update + delta = flow->curThroughputAge / 1000000.0; + + // Calculate throughput + flow->curThroughput /= delta; + + // Calculate average queue size + flow->avgQueueSize = (flow->avgQueueSize + flow->curQueueSize) / delta; + /* + fprintf(stderr,"%s: curThroughput: %f, avgQueueSize: %li, delta: %f\n", + flow->flowName, + flow->curThroughput, + flow->avgQueueSize, + delta); + */ + flow->curThroughputAge = 0; } // Set this as the last time we updated our throughput @@ -446,9 +464,6 @@ void *flowRunner(void *data) { struct runnerData_t *runnerData = (struct runnerData_t*) data; - GList *queueChangeList[NUM_PRIO_BANDS]; - int i, pktsProcessed = 0; - GTimeVal mytime; // Our processing function @@ -459,19 +474,21 @@ // Check if we found a flow with a queue - pktsProcessed += processPktQueue(aRunnerData,pktQueue); + // NOTE: The function below returns the number of packets processed + processPktQueue(aRunnerData,pktQueue); } - // Allocate queue change list - for (i = 0; i < NUM_PRIO_BANDS; i++) - queueChangeList[i] = NULL; - logMessage(LOG_DEBUG, "Flow runner started...\n"); // Loop when we get a signal while (1) { + GTimeVal mytime; + unsigned char i; + GList *queueChangeList = NULL; + + g_mutex_lock(runnerData->bandSignalLock); // If the queue has changed proceed @@ -486,15 +503,14 @@ // Hijack the queue change list items for (i = 0; i < NUM_PRIO_BANDS; i++) { - // Copy list item over - queueChangeList[i] = runnerData->queueChangeList[i]; // Zero runner data if it is non-NULL if (runnerData->queueChangeList[i]) { - runnerData->queueChangeList[i] = NULL; + // Copy list item over + queueChangeList = g_list_concat(queueChangeList,runnerData->queueChangeList[i]); + // Blank used list... copy uses directly + runnerData->queueChangeList[i] = NULL; } - else - queueChangeList[i] = NULL; } runnerData->queueChanged = 0; @@ -502,15 +518,11 @@ g_mutex_unlock(runnerData->bandSignalLock); - // Process all list - for (i = 0; i < NUM_PRIO_BANDS; i++) + // Process list if it is non-NULL + if (queueChangeList) { - // Process list if it is non-NULL - if (queueChangeList[i]) - { - g_list_foreach(queueChangeList[i],processQueue,runnerData); - g_list_free(queueChangeList[i]); - } + g_list_foreach(queueChangeList,processQueue,runnerData); + g_list_free(queueChangeList); } } |
From: SVN C. <sv...@li...> - 2005-01-19 18:26:43
|
Author: nkukard Date: 2005-01-19 20:26:32 +0200 (Wed, 19 Jan 2005) New Revision: 51 Modified: trunk/bwmd/flow.c Log: * Fixed some comments & small code cleanup Modified: trunk/bwmd/flow.c =================================================================== --- trunk/bwmd/flow.c 2005-01-19 18:26:08 UTC (rev 50) +++ trunk/bwmd/flow.c 2005-01-19 18:26:32 UTC (rev 51) @@ -186,8 +186,8 @@ // Differences in queue when we done int acceptLen = 0, queuedLen = 0; int acceptSize = 0, queuedSize = 0; + - // Lock, hijack packets, unlock g_mutex_lock(pktQueue->lock); packets = pktQueue->packets; @@ -286,7 +286,9 @@ } } - // If packet is still ok to pass through, do our stuff + /* If packet is still ok to pass through + * Update our parent threshold stuff so we can calculate parent_th above + */ if (ok) { struct timeval curTime; @@ -381,7 +383,7 @@ // Lock everything g_mutex_lock(nextPktQueue->lock); g_mutex_lock(flow->lock); - // Add packet to parent queue & remove from child + // Append to parent nextPktQueue->packets = g_list_append(nextPktQueue->packets,packet); // Update next queue stats nextPktQueue->curLen++; @@ -417,7 +419,9 @@ g_mutex_lock(pktQueue->lock); if (packets) { + // Merge the rest in pktQueue->packets = g_list_concat(packets,pktQueue->packets); + // Signal that we just added to the queue g_mutex_lock(runnerData->bandSignalLock); // Check if we havn't already gotten the queue listed @@ -427,12 +431,13 @@ g_cond_signal(runnerData->bandSignalCond); g_mutex_unlock(runnerData->bandSignalLock); } + pktQueue->curLen -= (acceptLen + queuedLen); pktQueue->curSize -= (acceptSize + queuedLen); g_mutex_unlock(pktQueue->lock); - return(acceptLen); + return acceptLen; } |
From: SVN C. <sv...@li...> - 2005-01-19 18:26:30
|
Author: nkukard Date: 2005-01-19 20:26:08 +0200 (Wed, 19 Jan 2005) New Revision: 50 Modified: trunk/include/flow.h Log: * Small bugfix in bounds of prio Modified: trunk/include/flow.h =================================================================== --- trunk/include/flow.h 2005-01-19 17:04:10 UTC (rev 49) +++ trunk/include/flow.h 2005-01-19 18:26:08 UTC (rev 50) @@ -59,7 +59,7 @@ { GMutex *lock; - long int prio; + unsigned char prio; struct flow_t *parentFlow; // void* because we cannot ref below? @@ -69,7 +69,7 @@ long int curLen; long int maxSize; long int maxLen; - + GList *packets; }; |
From: SVN C. <sv...@li...> - 2005-01-19 17:04:24
|
Author: nkukard Date: 2005-01-19 19:04:10 +0200 (Wed, 19 Jan 2005) New Revision: 49 Modified: trunk/configure trunk/lib/Makefile.in Log: * forgot to check these in Modified: trunk/configure =================================================================== --- trunk/configure 2005-01-19 17:02:38 UTC (rev 48) +++ trunk/configure 2005-01-19 17:04:10 UTC (rev 49) @@ -23397,7 +23397,10 @@ exit 1 fi -XML_CFLAGS=$XML_CPPFLAGS +if test x"$XML_CFLAGS" = x +then + XML_CFLAGS=$XML_CPPFLAGS +fi Modified: trunk/lib/Makefile.in =================================================================== --- trunk/lib/Makefile.in 2005-01-19 17:02:38 UTC (rev 48) +++ trunk/lib/Makefile.in 2005-01-19 17:04:10 UTC (rev 49) @@ -204,8 +204,8 @@ target_alias = @target_alias@ lib_LTLIBRARIES = libbwm.la libbwm_la_SOURCES = xmlConf.c misc.c -libbwm_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS) $(XML_CFLAGS) $(GMIME_CFLAGS) $(AM_CFLAGS) -libbwm_la_LDFLAGS = $(GLIB_LIBS) $(XML_LIBS) $(GMIME_LIBS) -version-info 1:0:0 +libbwm_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS) $(XML_CFLAGS) $(AM_CFLAGS) +libbwm_la_LDFLAGS = $(GLIB_LIBS) $(XML_LIBS) -version-info 1:0:0 all: all-am .SUFFIXES: |
From: SVN C. <sv...@li...> - 2005-01-19 17:02:59
|
Author: nkukard Date: 2005-01-19 19:02:38 +0200 (Wed, 19 Jan 2005) New Revision: 48 Modified: trunk/aclocal.m4 trunk/configure trunk/configure.ac trunk/doc/stamp-vti trunk/doc/version.texi trunk/lib/Makefile.am Log: * Adjusted versioning for required libs * Automake 1.7 can be used * Fixed "bug" in xml cflags determination * Removed some crud that made its way into lib/Makefile.am Modified: trunk/aclocal.m4 =================================================================== --- trunk/aclocal.m4 2005-01-19 14:04:42 UTC (rev 47) +++ trunk/aclocal.m4 2005-01-19 17:02:38 UTC (rev 48) @@ -32,6 +32,9 @@ gmodule) pkg_config_args="$pkg_config_args gmodule-2.0" ;; + gmodule-no-export) + pkg_config_args="$pkg_config_args gmodule-no-export-2.0" + ;; gobject) pkg_config_args="$pkg_config_args gobject-2.0" ;; Modified: trunk/configure =================================================================== --- trunk/configure 2005-01-19 14:04:42 UTC (rev 47) +++ trunk/configure 2005-01-19 17:02:38 UTC (rev 48) @@ -22753,7 +22753,7 @@ done -# Check for glib 2.4.0 +# Check for glib 2.2.0 # Check whether --enable-glibtest or --disable-glibtest was given. if test "${enable_glibtest+set}" = set; then enableval="$enable_glibtest" @@ -22769,6 +22769,9 @@ gmodule) pkg_config_args="$pkg_config_args gmodule-2.0" ;; + gmodule-no-export) + pkg_config_args="$pkg_config_args gmodule-no-export-2.0" + ;; gobject) pkg_config_args="$pkg_config_args gobject-2.0" ;; @@ -22833,7 +22836,7 @@ no_glib=yes fi - min_glib_version=2.4.0 + min_glib_version=2.2.0 echo "$as_me:$LINENO: checking for GLIB - version >= $min_glib_version" >&5 echo $ECHO_N "checking for GLIB - version >= $min_glib_version... $ECHO_C" >&6 @@ -23077,11 +23080,11 @@ then echo echo "* - ERROR -" - echo "* glib >= 2.4.0 required, this includes the development libraries and headers" + echo "* glib >= 2.2.0 required, this includes the development libraries and headers" exit 1 fi -# Check for libxml 2.6.0 +# Check for libxml 2.5.0 # Check whether --with-xml-prefix or --without-xml-prefix was given. @@ -23160,7 +23163,7 @@ echo "${ECHO_T}no" >&6 fi - min_xml_version=2.6.0 + min_xml_version=2.5.0 echo "$as_me:$LINENO: checking for libxml - version >= $min_xml_version" >&5 echo $ECHO_N "checking for libxml - version >= $min_xml_version... $ECHO_C" >&6 no_xml="" @@ -23390,7 +23393,7 @@ then echo echo "* - ERROR -" - echo "* libxml >= 2.6.0 required, this includes the development libraries and headers" + echo "* libxml >= 2.5.0 required, this includes the development libraries and headers" exit 1 fi Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2005-01-19 14:04:42 UTC (rev 47) +++ trunk/configure.ac 2005-01-19 17:02:38 UTC (rev 48) @@ -26,7 +26,7 @@ AC_GNU_SOURCE -AM_INIT_AUTOMAKE(1.8) +AM_INIT_AUTOMAKE(1.7) # Checks for programs. @@ -95,27 +95,30 @@ AC_FUNC_VPRINTF AC_CHECK_FUNCS([gettimeofday inet_ntoa memset select socket strcasecmp strchr strdup strerror strncasecmp strndup]) -# Check for glib 2.4.0 -AM_PATH_GLIB_2_0(2.4.0,have_glib=yes,have_glib=no,gthread) +# Check for glib 2.2.0 +AM_PATH_GLIB_2_0(2.2.0,have_glib=yes,have_glib=no,gthread) if test x"$have_glib" = x"no" then echo echo "* - ERROR -" - echo "* glib >= 2.4.0 required, this includes the development libraries and headers" + echo "* glib >= 2.2.0 required, this includes the development libraries and headers" exit 1 fi -# Check for libxml 2.6.0 -AM_PATH_XML2(2.6.0,have_xml=yes,have_xml=no) +# Check for libxml 2.5.0 +AM_PATH_XML2(2.5.0,have_xml=yes,have_xml=no) if test x"$have_xml" = x"no" then echo echo "* - ERROR -" - echo "* libxml >= 2.6.0 required, this includes the development libraries and headers" + echo "* libxml >= 2.5.0 required, this includes the development libraries and headers" exit 1 fi -XML_CFLAGS=$XML_CPPFLAGS +if test x"$XML_CFLAGS" = x +then + XML_CFLAGS=$XML_CPPFLAGS +fi AC_SUBST(XML_CFLAGS) Modified: trunk/doc/stamp-vti =================================================================== --- trunk/doc/stamp-vti 2005-01-19 14:04:42 UTC (rev 47) +++ trunk/doc/stamp-vti 2005-01-19 17:02:38 UTC (rev 48) @@ -1,4 +1,4 @@ -@set UPDATED 10 January 2005 +@set UPDATED 19 January 2005 @set UPDATED-MONTH January 2005 @set EDITION devel @set VERSION devel Modified: trunk/doc/version.texi =================================================================== --- trunk/doc/version.texi 2005-01-19 14:04:42 UTC (rev 47) +++ trunk/doc/version.texi 2005-01-19 17:02:38 UTC (rev 48) @@ -1,4 +1,4 @@ -@set UPDATED 10 January 2005 +@set UPDATED 19 January 2005 @set UPDATED-MONTH January 2005 @set EDITION devel @set VERSION devel Modified: trunk/lib/Makefile.am =================================================================== --- trunk/lib/Makefile.am 2005-01-19 14:04:42 UTC (rev 47) +++ trunk/lib/Makefile.am 2005-01-19 17:02:38 UTC (rev 48) @@ -26,6 +26,6 @@ lib_LTLIBRARIES = libbwm.la libbwm_la_SOURCES = xmlConf.c misc.c -libbwm_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS) $(XML_CFLAGS) $(GMIME_CFLAGS) $(AM_CFLAGS) -libbwm_la_LDFLAGS = $(GLIB_LIBS) $(XML_LIBS) $(GMIME_LIBS) -version-info 1:0:0 +libbwm_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS) $(XML_CFLAGS) $(AM_CFLAGS) +libbwm_la_LDFLAGS = $(GLIB_LIBS) $(XML_LIBS) -version-info 1:0:0 |
From: SVN C. <sv...@li...> - 2005-01-19 14:04:57
|
Author: nkukard Date: 2005-01-19 16:04:42 +0200 (Wed, 19 Jan 2005) New Revision: 47 Modified: trunk/bwm_firewall/bwm_firewall.c Log: * Small code cleanup to fix warning on compile Modified: trunk/bwm_firewall/bwm_firewall.c =================================================================== --- trunk/bwm_firewall/bwm_firewall.c 2005-01-19 13:55:19 UTC (rev 46) +++ trunk/bwm_firewall/bwm_firewall.c 2005-01-19 14:04:42 UTC (rev 47) @@ -237,7 +237,7 @@ // Check if we piping to iptables aswell if (piptables_restore) { - fprintf(piptables_restore, "%s", data); + fprintf(piptables_restore, "%s", (char *) data); // Check for IO error if (ferror(piptables_restore)) { |
From: SVN C. <sv...@li...> - 2005-01-19 13:55:47
|
Author: nkukard Date: 2005-01-19 15:55:19 +0200 (Wed, 19 Jan 2005) New Revision: 46 Modified: trunk/bwmd/bwmd.c Log: * Small code cleanup to remove warning on compile Modified: trunk/bwmd/bwmd.c =================================================================== --- trunk/bwmd/bwmd.c 2005-01-19 13:44:24 UTC (rev 45) +++ trunk/bwmd/bwmd.c 2005-01-19 13:55:19 UTC (rev 46) @@ -36,7 +36,11 @@ #include "flowControl.h" #include "xmlConf.h" +// Initialize syslog - This single function header doesn't call for a headerfile +extern void initSyslog(const char *ident, int prioMask); + +// Load a module.. void modprobe(gpointer key, gpointer value, gpointer user_data) { char buffer[4096]; |
From: SVN C. <sv...@li...> - 2005-01-19 13:45:05
|
Author: nkukard Date: 2005-01-19 15:44:24 +0200 (Wed, 19 Jan 2005) New Revision: 45 Modified: trunk/doc/bwmtools.texi Log: * Small documentation update to clarify the QUEUE target in relation to the INPUT, OUTPUT and FORWARD chains * Small update to explain that bwmd must be end target of all accepted traffic in the INPUT or FORWARD chains Modified: trunk/doc/bwmtools.texi =================================================================== --- trunk/doc/bwmtools.texi 2005-01-15 19:42:31 UTC (rev 44) +++ trunk/doc/bwmtools.texi 2005-01-19 13:44:24 UTC (rev 45) @@ -866,8 +866,7 @@ @* @itemize @item -You want to use BWM Tools for both your firewall and traffic shaping, nothing -else. +You want to use BWM Tools for both your firewall and traffic shaping. @*@* This is the easiest scenario to deal with, only having 4 steps below to get your firewall, NAT and traffic shaping up and running@dots{} @@ -875,7 +874,9 @@ @enumerate @item Configure your classes, ACL's, NAT and traffic shaping rules as described in -the previous sections. +the previous sections. The end target for all accepted traffic must be +@dfn{bwmd} in the @dfn{INPUT} chain or @dfn{OUTPUT} chain if you doing single +box or a router configuration respectively. @* @item Run BWM Firewall with the below possible arguments to generate an @@ -944,13 +945,17 @@ @item @cindex queue BWM Tools uses the userpace queueing mechanism, all packets to be shaped must -be targetted at @dfn{QUEUE}. +be targetted at @dfn{QUEUE} in the @dfn{filter} table. This is done by either +adding a rule to the @dfn{INPUT} and @dfn{OUTPUT} chain in the case of a +single box which you need to shape traffic to and from respectively. While +in the case of a firewall where traffic passes through you would add a rule +to the @dfn{FORWARD} chain. @* @item Therefore in order for BWM Tools to shape traffic, packets must be MARK'ed with a number corrosponding to the number specified in the @code{nfmark="@dots{}"} parameter defined in the @code{<flow>} tag and targetted in iptables to -@dfn{QUEUE} instead of @dfn{ACCEPT}. +@dfn{QUEUE} instead of @dfn{ACCEPT} as per above. @end itemize @* Imagine you would like your linux router to rate limit all traffic from and to @@ -962,10 +967,10 @@ Configuring @command{iptables} @*@* @smallexample +@command{iptables -t filter -A FORWARD -m mark ! --mark 0x0 -j QUEUE} @command{iptables -t mangle -A FORWARD -s 192.168.1.100 -j MARK --set-mark 100} @command{iptables -t mangle -A FORWARD -d 192.168.1.100 -j MARK --set-mark 101} @end smallexample -@* @item Configuring @command{bwmd} @*@* |
From: SVN C. <sv...@li...> - 2005-01-15 19:43:12
|
Author: nkukard Date: 2005-01-15 21:42:31 +0200 (Sat, 15 Jan 2005) New Revision: 44 Modified: trunk/bwmd/ipq.c trunk/include/flow.h trunk/lib/xmlConf.c Log: * Fixed max value of nfmark from long int to unsigned long int Modified: trunk/bwmd/ipq.c =================================================================== --- trunk/bwmd/ipq.c 2005-01-13 19:52:32 UTC (rev 43) +++ trunk/bwmd/ipq.c 2005-01-15 19:42:31 UTC (rev 44) @@ -84,7 +84,7 @@ // Queue a packet -static int queuePacket(struct runnerData_t *runnerData, long int nfmark, struct packet_t *packet) +static int queuePacket(struct runnerData_t *runnerData, unsigned long int nfmark, struct packet_t *packet) { struct pktQueue_t *foundQueue = NULL; struct flow_t *foundFlow = NULL; @@ -98,11 +98,12 @@ { struct pktQueue_t *pktQueue = (struct pktQueue_t*) data; - + + // Check that we havn't found a queue if (foundQueue) return; - // Check if we found it - if (pktQueue->nfmark == nfmark) + // Sanity check and check if we found it + if (pktQueue->nfmark && pktQueue->nfmark == nfmark) foundQueue = pktQueue; } @@ -113,8 +114,8 @@ if (foundFlow) return; - // Check if we found it - if (flow->nfmark == nfmark) + // First make sure we have a value... then check if we found it + if (flow->nfmark && flow->nfmark == nfmark) foundFlow = flow; } Modified: trunk/include/flow.h =================================================================== --- trunk/include/flow.h 2005-01-13 19:52:32 UTC (rev 43) +++ trunk/include/flow.h 2005-01-15 19:42:31 UTC (rev 44) @@ -63,7 +63,7 @@ struct flow_t *parentFlow; // void* because we cannot ref below? - long int nfmark; + unsigned long int nfmark; long int curSize; long int curLen; @@ -91,7 +91,7 @@ // Shaping struct flow_t *parent; // STATIC, not specified, determined - pointer to parent int prio; // STATIC - Flow priority - long int nfmark; // STATIC - nfmark value i must match auto to queues + unsigned long int nfmark; // STATIC - nfmark value i must match auto to queues long int maxQueueSize; // STATIC - max length in bytes of queue long int maxQueueLen; // STATIC - and/or length in items long int maxRate; // STATIC - max rate in bytes per second Modified: trunk/lib/xmlConf.c =================================================================== --- trunk/lib/xmlConf.c 2005-01-13 19:52:32 UTC (rev 43) +++ trunk/lib/xmlConf.c 2005-01-15 19:42:31 UTC (rev 44) @@ -644,7 +644,7 @@ long int maxQueueLen, long int maxRate, long int burstRate, - long int nfmark, + unsigned long int nfmark, float parent_th, int reportTimeout) { @@ -770,7 +770,7 @@ pktQueue->lock = g_mutex_new(); pktQueue->prio = i; pktQueue->parentFlow = flow; - pktQueue->nfmark = -1; + pktQueue->nfmark = 0; pktQueue->curSize = 0; pktQueue->curLen = 0; pktQueue->maxSize = 0; @@ -858,7 +858,7 @@ // Create a packet queue for the flow static struct pktQueue_t *createPktQueue( long int prio, - long int nfmark, + unsigned long int nfmark, struct flow_t *parentFlow) { struct pktQueue_t *pktQueue = parentFlow->pktQueues[prio]; @@ -926,7 +926,8 @@ if (ok) { char *p; - long int statsLen, maxQueueSize, maxQueueLen, maxRate, burstRate, reportTimeout, nfmark; + long int statsLen, maxQueueSize, maxQueueLen, maxRate, burstRate, reportTimeout; + unsigned long int nfmark; float parent_th; @@ -954,7 +955,7 @@ } p = g_hash_table_lookup(tagProperties,"nfmark"); - nfmark = p ? atol(p) : -1; + nfmark = p ? atoll(p) : 0; p = g_hash_table_lookup(tagProperties,"burst-threshold"); parent_th = p ? atof(p) : -1; @@ -1042,7 +1043,7 @@ if (ok) { long int prio; - long int nfmark; + unsigned long int nfmark; struct pktQueue_t *pktQueue; @@ -1054,7 +1055,7 @@ ok = 0; } - nfmark = atol(queueNfmark); + nfmark = atoll(queueNfmark); // fprintf(stderr," Flow queue: %li\n", nfmark); |
From: SVN C. <sv...@li...> - 2005-01-13 19:52:57
|
Author: nkukard Date: 2005-01-13 21:52:32 +0200 (Thu, 13 Jan 2005) New Revision: 43 Added: branch/bwmd-tosclassify/ Log: * Forked off trunk to work on tos auto classifier Copied: branch/bwmd-tosclassify (from rev 42, trunk) |
From: SVN C. <sv...@li...> - 2005-01-12 18:45:30
|
Author: nkukard Date: 2005-01-12 20:45:17 +0200 (Wed, 12 Jan 2005) New Revision: 42 Added: branch/bwm_monitor-treeview/ Modified: branch/bwm_monitor-treeview/bwm_monitor/bwm_monitor.c branch/bwm_monitor-treeview/bwmd/flowControl.c branch/bwm_monitor-treeview/include/flowControl.h Log: * Created a branch to track work on treeview Copied: branch/bwm_monitor-treeview (from rev 39, trunk) Modified: branch/bwm_monitor-treeview/bwm_monitor/bwm_monitor.c =================================================================== --- trunk/bwm_monitor/bwm_monitor.c 2005-01-12 18:05:22 UTC (rev 39) +++ branch/bwm_monitor-treeview/bwm_monitor/bwm_monitor.c 2005-01-12 18:45:17 UTC (rev 42) @@ -43,8 +43,35 @@ #define PORT 9034 +#define NODE_STYLE 0x01 +#define NODE_EXPAND 0x02 +typedef struct node_t { + char *name; + char flags; + // relation fields + struct node_t *prio; + struct node_t *next; + struct node_t *parent; + struct node_t *childs; +} node_t; +#define NODE struct node_t +typedef struct tree_t { + WINDOW *window; + NODE *nodes; + NODE *topnode; + NODE *selnode; + short x,y,c,l; +} tree_t; +#define TREE struct tree_t +TREE *new_tree(int l, int c, int y, int x); +NODE *new_node(TREE *tree, char *name, char *parent, char flag); +void draw_tree(TREE *tree, NODE *start); +NODE *last_node(NODE *node); +//void dump_tree(NODE *start, char level); + + static void finish(int sig); @@ -86,7 +113,7 @@ read_fds = master_fds; - result = select(fdmax + 1, &read_fds, NULL, NULL, &timeout); + result = select(fdmax + 1, &read_fds, NULL, NULL, &timeout); // Check select() result if (result > 0) @@ -211,7 +238,9 @@ MENU *m_main; WINDOW *w_menu = NULL; ITEM **menu_items; - int mrows, mcols; + TREE *flowTree; + NODE *flowNode; + int mrows, mcols, line=1; int c; char *menuItem; int done = 0; @@ -219,7 +248,7 @@ int mySock; struct sockaddr_in serverAddr; // Server address struct ipc_packet_t myPacket; - int nbytes; + int nbytes,x,y; signal(SIGINT, finish); @@ -312,11 +341,9 @@ // Set our main screen wbkgdset(w_main, COLOR_PAIR(2) | ' '); fill_window(w_main); - windowTitle(w_main,3,2,0,2,"BWM Monitor v"PACKAGE_VERSION" - Copyright (c) 2003-2005 Linux Based Systems Design"); + windowTitle(w_main,3,2,0,2,"BWM Monitor v"PACKAGE_VERSION" - Copyright (c) 2003-2004 Linux Based Systems Design"); refresh(); - - - + // Send a LIST packet away to get a flow list myPacket.pktType = IPC_PACKET_LIST_FLOWS; @@ -325,10 +352,15 @@ fprintf(stderr,"bwm_monitor: Failed to write to socket: %s\n",strerror(errno)); exit(1); } - - c = 0; + + getmaxyx(w_main, y, x); + flowTree = new_tree(y-2, x/2, 1, x/4); +// if (flowTree && flowTree->window) +// keypad(flowTree->window,TRUE); + +// c = 0; // Allocate memory for menu items - menu_items = (ITEM **) malloc((numFlows + 1) * sizeof(ITEM *)); +// menu_items = (ITEM **) malloc((numFlows + 1) * sizeof(ITEM *)); do { // Grab pavket @@ -338,13 +370,78 @@ if (myPacket.pktType == IPC_PACKET_LIST_ITEM) { // And add memory item - menu_items[c] = new_item(strdup(myPacket.u.statusData.flowName),""); - c++; +// menu_items[c] = new_item(strdup(myPacket.u.statusData.flowName),""); +// c++; + flowNode = new_node(flowTree, myPacket.u.statusData.flowName, + myPacket.u.statusData.parentName, NODE_EXPAND); + if (flowNode != NULL) + flowTree->selnode = flowNode; } } } while (myPacket.pktType == IPC_PACKET_LIST_ITEM); + flowTree->selnode = flowTree->nodes; + draw_tree(flowTree, flowTree->selnode); +// wrefresh(flowTree->window); +// dump_tree(flowTree->nodes, 0); + while (!done) + { +// if (flowTree->window) +// keypad(flowTree->window,TRUE); + switch (getch()) + { + case 'q': + done = 1; + break; + case KEY_UP: + if (flowTree->selnode->prio) + { + flowTree->selnode = flowTree->selnode->prio; + while (flowTree->selnode->flags&NODE_EXPAND && + flowTree->selnode->childs) + flowTree->selnode = last_node(flowTree->selnode->childs); + } + else if (flowTree->selnode->parent) + { + flowTree->selnode = flowTree->selnode->parent; + } + draw_tree(flowTree, flowTree->selnode); + /* we dont need colorful, do we? */ + /* + wmove(flowTree->window, 0, 1); + waddch(flowTree->window, '('); + waddch(flowTree->window, ACS_UARROW); + waddch(flowTree->window, ')'); + wrefresh(flowTree->window); + */ + break; + case KEY_DOWN: + if (flowTree->selnode->flags&NODE_EXPAND && + flowTree->selnode->childs) + flowTree->selnode = flowTree->selnode->childs; + else if (flowTree->selnode->next) + flowTree->selnode = flowTree->selnode->next; + else if (flowTree->selnode->parent) + { + NODE *p = flowTree->selnode->parent; + while (p && !p->next) + p = p->parent; + if (p) flowTree->selnode = p->next; + } + draw_tree(flowTree, flowTree->selnode); + /* + wmove(flowTree->window, 0, 1); + waddch(flowTree->window, '('); + waddch(flowTree->window, ACS_DARROW); + waddch(flowTree->window, ')'); + wrefresh(flowTree->window); + */ + break; + } + refresh(); + } +/* // Don't forget our quit item menu_items[numFlows] = new_item(strdup("Quit"),""); @@ -397,7 +494,7 @@ free_item(menu_items[c]); // free(menu_items); free_menu(m_main); - +*/ shutdown(mySock,SHUT_RDWR); close(mySock); @@ -414,3 +511,184 @@ exit(0); } + +/******************************************************************************/ +// create new tree +TREE *new_tree(int l, int c, int y, int x) +{ + TREE *tree = (TREE *) malloc (sizeof(TREE)); + if (tree != NULL) + { + tree->nodes = NULL; + tree->x = x; + tree->y = y; + tree->c = c; + tree->l = l; + if (has_colors()) + wbkgdset(tree->window, COLOR_PAIR(5) | ' '); + else + wbkgdset(tree->window, A_BOLD | ' '); + tree->window = newwin(tree->l, tree->c, tree->y, tree->x); + } + return tree; +} + +NODE *search_node(NODE *node, const char *name) +{ + if (node == NULL) + return NULL; + while (node && strcasecmp(node->name, name)!=0) + { + NODE *pnode = search_node(node->childs, name); + if ( pnode != NULL ) + return pnode; + node = node->next; + } + if (node && strcasecmp(node->name, name)==0) + return node; + return NULL; +} + +NODE *last_node(NODE *node) +{ + if (node == NULL) + return NULL; + while (node->next != NULL) + node = node->next; + return node; +} + +// create new tree node +NODE *new_node(TREE *tree, char *name, char *parent, char flag) +{ + NODE *node, *lnode=NULL, *pnode = NULL; + + if (!name || !strlen(name)) + return NULL; + + node = (NODE *) malloc(sizeof(NODE)); + if ( node != NULL ) + { + node->name = strdup(name); + if (!node->name) + { + free(node); + node = NULL; + } + else + { + if (parent && strlen(parent)) + { + NODE *p = tree->selnode ? tree->selnode : NULL; + while (p && strcasecmp(p->name, parent)!=0) + p = p->parent; + pnode = p ? p : search_node(tree->nodes, parent); + } + if (pnode!=NULL) + if (!pnode->childs) + pnode->childs = node; + else + lnode = last_node(pnode->childs); + else + lnode = last_node(tree->nodes); + node->next = NULL; + node->prio = lnode; + node->parent = pnode; + node->childs = NULL; + node->flags = flag; + if (lnode) + lnode->next = node; + if (!tree->nodes) + tree->nodes = node; + tree->selnode = node; + } + } + return node; +} + +void draw_tree(TREE *tree, NODE *start) +{ + int y, x, l, i, level=0; + NODE *p = start->parent; + + if (!tree->window) return; + setTextAttr(tree->window,WA_BOLD); + //wbkgdset(tree->window, COLOR_PAIR(5) | ' '); + fill_window(tree->window); + box(tree->window, 0, 0); + + // get start node level + while (p) { level++; p = p->parent; } + + getmaxyx(tree->window, y, x); + for (i=1; i<y-1 && start; i++) + { + wmove(tree->window, i, level*3 + 1); + if (start->parent) + { + NODE *p = start->parent; + l = level; + while (p && l>0) + { + if (p->next) + { + wmove(tree->window, i, (l-1)*3 + 1); + waddch(tree->window, ACS_VLINE); + } + p = p->parent; l--; + } + wmove(tree->window, i, level*3 + 1); + + if (!start->next) + waddch(tree->window, ACS_LLCORNER); + else + waddch(tree->window, ACS_LTEE); + } + else if (!start->next) + waddch(tree->window, ACS_LLCORNER); + else if (!start->prio) + waddch(tree->window, ACS_ULCORNER); + else + waddch(tree->window, ACS_LTEE); + waddch(tree->window, ACS_HLINE); + mvwprintw(tree->window, i, level*3 + 4, "%s", start->name); + if (start->flags&NODE_EXPAND && start->childs) + { + start = start->childs; level++; + } + else if (start->next) + start = start->next; + else if (start->parent) + { + while (start && !start->next) + { + start = start->parent; level--; + } + if (start && start->next) + start = start->next; + } + else start = NULL; + } + wrefresh(tree->window); +} + +#if 0 +void dump_tree(NODE *start, char level) +{ + while (start) + { + char i = 0; + FILE *debug = fopen("debug.txt", "a+"); + if (debug) + { + for (i = 0; i<level; i++) + fprintf(debug, "\t"); + fprintf(debug, "%s\n", start->name); + fclose(debug); + } + dump_tree(start->childs, level+1); + start = start->next; + } +} +#endif + Modified: branch/bwm_monitor-treeview/bwmd/flowControl.c =================================================================== --- trunk/bwmd/flowControl.c 2005-01-12 18:05:22 UTC (rev 39) +++ branch/bwm_monitor-treeview/bwmd/flowControl.c 2005-01-12 18:45:17 UTC (rev 42) @@ -207,6 +207,13 @@ // Construct the status packet and send it away strncpy(statusPacket.flowName,tmpFlow->flowName,MAX_REFLEN); + // If we have a parent, get its name + if (tmpFlow->parent) + strncpy(statusPacket.parentName, + tmpFlow->parent->flowName,MAX_REFLEN); + else // If not, strlen == 0 + memset(statusPacket.parentName,'\0',MAX_REFLEN); + // Setup all our counters statusPacket.maxQueueSize = tmpFlow->maxQueueSize; statusPacket.maxQueueLen = tmpFlow->maxQueueLen; statusPacket.maxRate = tmpFlow->maxRate; @@ -250,6 +257,8 @@ // Construct the status packet and send it away strncpy(statusPacket.flowName,tmpGroup->groupName,MAX_REFLEN); + // Groups don't have parents + memset(statusPacket.parentName,'\0',MAX_REFLEN); statusPacket.maxQueueSize = -1; statusPacket.maxQueueLen = -1; statusPacket.maxRate = -1; @@ -425,6 +434,12 @@ myPacket.pktType = IPC_PACKET_LIST_ITEM; strcpy(myPacket.u.statusData.flowName,tmpFlow->flowName); + // If we have a parent, get its name + if (tmpFlow->parent) + strncpy(myPacket.u.statusData.parentName, + tmpFlow->parent->flowName,MAX_REFLEN); + else // If not, strlen == 0 + memset(myPacket.u.statusData.parentName,'\0',MAX_REFLEN); sendall(tmpClient->fd, &myPacket, sizeof(struct ipc_packet_t)); flowItem = g_list_next(flowItem); } @@ -437,6 +452,8 @@ myPacket.pktType = IPC_PACKET_LIST_ITEM; strcpy(myPacket.u.statusData.flowName,tmpGroup->groupName); + // Groups don't have parents + memset(myPacket.u.statusData.parentName,'\0',MAX_REFLEN); sendall(tmpClient->fd, &myPacket, sizeof(struct ipc_packet_t)); groupItem = g_list_next(groupItem); } Modified: branch/bwm_monitor-treeview/include/flowControl.h =================================================================== --- trunk/include/flowControl.h 2005-01-12 18:05:22 UTC (rev 39) +++ branch/bwm_monitor-treeview/include/flowControl.h 2005-01-12 18:45:17 UTC (rev 42) @@ -71,6 +71,7 @@ struct status_packet_t { char flowName[MAX_REFLEN]; + char parentName[MAX_REFLEN]; long int maxQueueSize; long int maxQueueLen; long int maxRate; |
From: SVN C. <sv...@li...> - 2005-01-12 18:44:08
|
Author: nkukard Date: 2005-01-12 20:43:50 +0200 (Wed, 12 Jan 2005) New Revision: 41 Removed: branch/bwm_monitor-treeview/ Log: * GRRRRR... make distclean first |