
jesler at sourcefire
Aug 22, 2012, 10:15 AM
Post #3 of 3
(713 views)
Permalink
|
|
Re: Patch: add jitter to freshclam's update period
[In reply to]
|
|
Thanks Nick, We've opened a bug on our side to track this. -- Joel Esler Senior Research Engineer, VRT OpenSource Community Manager Sourcefire On Aug 22, 2012, at 12:08 PM, Nick Johnson <npjohnso [at] cs> wrote: > Hello, > > If you are managing a large number of machines, jitter helps spread > freshclam's network traffic over time so the machines don't all hit > the network simultaneously. > > Here is a patch to add jitter to freshclam's update period. It adds a > random number of seconds in [0, jitter) to the bigsleep. It adds a > configuration option "Jitter" (-j, --jitter) to freshclam. The > default value is zero seconds, which will cause no change to most > users. > > Thank you, > N > > > $ diff -w clamav-0.97.5-original/freshclam/freshclam.c > clamav-0.97.5/freshclam/freshclam.c > 156a157 >> mprintf(" --jitter=#n -j #n random jitter on check period, in seconds\n"); > 244a246,248 >> /* Seed random number generator (for Jitter) */ >> srand(time(0)); >> > 429a434 >> int jitter; > 455a461,467 >> jitter = optget(opts, "Jitter")->numarg; >> if( jitter < 0 ) { >> logg("^Jitter must be a non-negative integer number of seconds."); >> optfree(opts); >> return 41; >> } >> > 501a514,516 >> if( jitter > 0 ) >> sleep(bigsleep + (rand() % jitter) ); >> else > 505a521,522 >> if( jitter > 0 ) >> wakeup += rand() % jitter; > > $ diff -w clamav-0.97.5-original/shared/ clamav-0.97.5/shared/ > diff -w clamav-0.97.5-original/shared/optparser.c > clamav-0.97.5/shared/optparser.c > 365a366 >> { "Jitter", "jitter", 'j', TYPE_NUMBER, MATCH_NUMBER, 12, NULL, 0, OPT_FRESHCLAM, "This option adds random jitter to freshclam's update period.", "0" }, > > > -- > Nick Johnson > _______________________________________________ > http://lurker.clamav.net/list/clamav-devel.html > Please submit your patches to our Bugzilla: http://bugs.clamav.net _______________________________________________ http://lurker.clamav.net/list/clamav-devel.html Please submit your patches to our Bugzilla: http://bugs.clamav.net
|