[ntop] update to 5.0.1, fix build, fix license issues, fix changelog dates
Tom Callaway
spot at fedoraproject.org
Tue Jan 21 20:18:37 UTC 2014
commit 2744857e024c095cf92847a2da70807957a1558a
Author: Tom Callaway <spot at fedoraproject.org>
Date: Tue Jan 21 15:18:53 2014 -0500
update to 5.0.1, fix build, fix license issues, fix changelog dates
.gitignore | 1 +
ntop-5.0.1-configure-fixes.patch | 23 +
ntop-5.0.1-countmin-prng-license-fix.patch | 1034 ++++++++++++++++++++++++++++
ntop.spec | 52 ++-
sources | 6 +-
5 files changed, 1104 insertions(+), 12 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9a28242..4bc3ac1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ ntop-3.4-pre3.tar.gz
/ntop-4.1.0.tar.gz
/ntop-5.0.tar.gz
/nDPI-svn5614.tar.gz
+/ntop-5.0.1.tar.gz
diff --git a/ntop-5.0.1-configure-fixes.patch b/ntop-5.0.1-configure-fixes.patch
new file mode 100644
index 0000000..6e80af2
--- /dev/null
+++ b/ntop-5.0.1-configure-fixes.patch
@@ -0,0 +1,23 @@
+diff -up ntop-5.0.1/autogen.sh.fix ntop-5.0.1/autogen.sh
+--- ntop-5.0.1/autogen.sh.fix 2014-01-21 14:11:46.929494780 -0500
++++ ntop-5.0.1/autogen.sh 2014-01-21 14:12:00.156483357 -0500
+@@ -334,7 +334,7 @@ echo ""
+ # 3. create local definitions for automake
+ #
+ echo "3. Create acinclude.m4, local definitions for automake ..."
+-cat acinclude.m4.in libtool.m4.in acinclude.m4.ntop > acinclude.m4
++cat libtool.m4.in acinclude.m4.in acinclude.m4.ntop > acinclude.m4
+ echo " .... done"
+ echo ""
+
+diff -up ntop-5.0.1/configure.in.fix ntop-5.0.1/configure.in
+--- ntop-5.0.1/configure.in.fix 2014-01-21 14:09:34.423611805 -0500
++++ ntop-5.0.1/configure.in 2014-01-21 14:09:34.430611799 -0500
+@@ -341,6 +341,7 @@ if test ".${ac_cv_prog_cc_stdc}" = ".no"
+ echo
+ HAS_WARNING="yes"
+ fi
++AM_PROG_CC_C_O
+
+ dnl> NTOPCONFIGDEBUG_SETTINGS([After cc stdc test])
+
diff --git a/ntop-5.0.1-countmin-prng-license-fix.patch b/ntop-5.0.1-countmin-prng-license-fix.patch
new file mode 100644
index 0000000..17791ae
--- /dev/null
+++ b/ntop-5.0.1-countmin-prng-license-fix.patch
@@ -0,0 +1,1034 @@
+diff -up ntop-5.0.1/countmin.c.licfix ntop-5.0.1/countmin.c
+--- ntop-5.0.1/countmin.c.licfix 2011-11-21 08:42:08.000000000 -0500
++++ ntop-5.0.1/countmin.c 2014-01-21 13:38:51.539186980 -0500
+@@ -1,20 +1,31 @@
+ /********************************************************************
+ Count-Min Sketches
+
+-G. Cormode 2003,2004
++G. Cormode 2003,2004, 2010, 2012
+
+-Updated: 2004-06 Added a floating point sketch and support for
++Updated: 2004-06 Added a floating point sketch and support for
+ inner product point estimation
+ Initial version: 2003-12
+
+-This work is licensed under the Creative Commons
+-Attribution-NonCommercial License. To view a copy of this license,
+-visit http://creativecommons.org/licenses/by-nc/1.0/ or send a letter
+-to Creative Commons, 559 Nathan Abbott Way, Stanford, California
+-94305, USA.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License along
++ with this program; if not, write to the Free Software Foundation, Inc.,
++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *********************************************************************/
+
+ #include <stdlib.h>
++#include "prng.h"
++#include "massdal.h"
+ #include "countmin.h"
+
+ #define min(x,y) ((x) < (y) ? (x) : (y))
+@@ -23,8 +34,6 @@ to Creative Commons, 559 Nathan Abbott W
+ double eps; /* 1+epsilon = approximation factor */
+ double delta; /* probability of failure */
+
+-//int bits=32;
+-
+ /************************************************************************/
+ /* Routines to support Count-Min sketches */
+ /************************************************************************/
+@@ -36,7 +45,7 @@ CM_type * CM_Init(int width, int depth,
+ prng_type * prng;
+
+ cm=(CM_type *) malloc(sizeof(CM_type));
+- prng=prng_Init(-abs(seed),2);
++ prng=prng_Init(-abs(seed),2);
+ // initialize the generator to pick the hash functions
+
+ if (cm && prng)
+@@ -44,7 +53,6 @@ CM_type * CM_Init(int width, int depth,
+ cm->depth=depth;
+ cm->width=width;
+ cm->count=0;
+- cm->prng = prng; /* L. Deri */
+ cm->counts=(int **)calloc(sizeof(int *),cm->depth);
+ cm->counts[0]=(int *)calloc(sizeof(int), cm->depth*cm->width);
+ cm->hasha=(unsigned int *)calloc(sizeof(unsigned int),cm->depth);
+@@ -105,7 +113,6 @@ void CM_Destroy(CM_type * cm)
+ }
+ if (cm->hasha) free(cm->hasha); cm->hasha=NULL;
+ if (cm->hashb) free(cm->hashb); cm->hashb=NULL;
+- prng_Destroy(cm->prng); /* L.Deri */
+ free(cm); cm=NULL;
+ }
+
+@@ -143,7 +150,6 @@ int CM_PointEst(CM_type * cm, unsigned i
+ return (ans);
+ }
+
+-#if 0
+ int CM_PointMed(CM_type * cm, unsigned int query)
+ {
+ // return an estimate of the count by taking the median estimate
+@@ -171,7 +177,6 @@ int CM_PointMed(CM_type * cm, unsigned i
+ return result;
+ // need to adjust for routine starting at 1
+ }
+-#endif
+
+ int CM_Compatible(CM_type * cm1, CM_type * cm2)
+ { // test whether two sketches are comparable (have same parameters)
+@@ -187,9 +192,10 @@ int CM_Compatible(CM_type * cm1, CM_type
+ return 1;
+ }
+
+-int CM_InnerProd(CM_type * cm1, CM_type * cm2)
++long long CM_InnerProd(CM_type * cm1, CM_type * cm2)
+ { // Estimate the inner product of two vectors by comparing their sketches
+- int i,j, tmp, result;
++ int i,j;
++ long long result, tmp;
+
+ result=0;
+ if (CM_Compatible(cm1,cm2))
+@@ -207,9 +213,31 @@ int CM_InnerProd(CM_type * cm1, CM_type
+ return result;
+ }
+
++long long CM_F2Est(CM_type * cm)
++{ // Estimate the second frequency moment of the stream
++ int i,j;
++ long long result, tmp, *ans;
++
++ if (!cm) return 0;
++ ans=(long long *) calloc(1+cm->depth,sizeof(long long));
++
++ for (j=0;j<cm->depth;j++)
++ {
++ result=0;
++ for (i=0;i<cm->width;i+=2)
++ {
++ tmp=(cm->counts[j][i]-cm->counts[j][i+1]);
++ result+=tmp*tmp;
++ }
++ ans[j+1]=result;
++ }
++ result=LLMedSelect((cm->depth+1)/2,cm->depth,ans);
++ return result;
++}
++
+ int CM_Residue(CM_type * cm, unsigned int * Q)
+ {
+-// CM_Residue computes the sum of everything left after the points
++// CM_Residue computes the sum of everything left after the points
+ // from Q have been removed
+ // Q is a list of points, where Q[0] gives the length of the list
+
+@@ -224,7 +252,7 @@ int CM_Residue(CM_type * cm, unsigned in
+ nextest=0;
+ for (i=0;i<cm->width;i++)
+ bitmap[i]=0;
+- for (i=1;i<Q[0];i++)
++ for (i=1;i<(int) Q[0];i++)
+ bitmap[hash31(cm->hasha[j],cm->hashb[j],Q[i]) % cm->width]=1;
+ for (i=0;i<cm->width;i++)
+ if (bitmap[i]==0) nextest+=cm->counts[j][i];
+@@ -245,7 +273,7 @@ CMF_type * CMF_Init(int width, int depth
+
+ cm=(CMF_type *) malloc(sizeof(CMF_type));
+
+- prng=prng_Init(-abs(seed),2);
++ prng=prng_Init(-abs(seed),2);
+ // initialize the generator to pick the hash functions
+
+ if (cm && prng)
+@@ -311,8 +339,6 @@ void CMF_Destroy(CMF_type * cm)
+ free(cm->counts);
+ cm->counts=NULL;
+ }
+-
+-
+ if (cm->hasha) free(cm->hasha); cm->hasha=NULL;
+ if (cm->hashb) free(cm->hashb); cm->hashb=NULL;
+ free(cm); cm=NULL;
+@@ -339,10 +365,11 @@ void CMF_Update(CMF_type * cm, unsigned
+ // this can be done more efficiently if the width is a power of two
+ }
+
+-int CMF_PointEst(CMF_type * cm, unsigned int query)
++double CMF_PointEst(CMF_type * cm, unsigned int query)
+ {
+ // return an estimate of the count of an item by taking the minimum
+- int j, ans;
++ int j;
++ double ans=0.;
+
+ if (!cm) return 0;
+ ans=cm->counts[0][hash31(cm->hasha[0],cm->hashb[0],query) % cm->width];
+@@ -380,12 +407,12 @@ double CMF_PointProd(CMF_type * cm1, CMF
+ {
+ loc=hash31(cm1->hasha[j],cm1->hashb[j],query) % cm1->width;
+ tmp=cm1->counts[j][loc]*cm2->counts[j][loc];
+- ans=min(ans,tmp);
++ ans=min(ans,tmp);
+ }
+ }
+ return (ans);
+ }
+-
++
+ double CMF_InnerProd(CMF_type * cm1, CMF_type * cm2)
+ { // Estimate the inner product of two vectors by comparing their sketches
+ int i,j;
+@@ -413,7 +440,7 @@ double CMF_InnerProd(CMF_type * cm1, CMF
+
+ CMH_type * CMH_Init(int width, int depth, int U, int gran)
+ {
+- // initialize a hierarchical set of sketches for range queries
++ // initialize a hierarchical set of sketches for range queries
+ // heavy hitters or quantiles
+
+ CMH_type * cmh;
+@@ -424,10 +451,10 @@ CMH_type * CMH_Init(int width, int depth
+ // U is the log the size of the universe in bits
+
+ if (gran>U || gran<1) return(NULL);
+- // gran is the granularity to look at the universe in
++ // gran is the granularity to look at the universe in
+ // check that the parameters make sense...
+
+- cmh=(CMH_type *) malloc(sizeof(CMH_type));
++ cmh=(CMH_type *) calloc(1,sizeof(CMH_type));
+
+ prng=prng_Init(-12784,2);
+ // initialize the generator for picking the hash functions
+@@ -441,11 +468,11 @@ CMH_type * CMH_Init(int width, int depth
+ cmh->gran=gran;
+ cmh->levels=(int) ceil(((float) U)/((float) gran));
+ for (j=0;j<cmh->levels;j++)
+- if (1<<(cmh->gran*j) <= cmh->depth*cmh->width)
++ if ((long long) 1<<(cmh->gran*j) <= cmh->depth*cmh->width)
+ cmh->freelim=j;
+ //find the level up to which it is cheaper to keep exact counts
+ cmh->freelim=cmh->levels-cmh->freelim;
+-
++
+ cmh->counts=(int **) calloc(sizeof(int *), 1+cmh->levels);
+ cmh->hasha=(unsigned int **)calloc(sizeof(unsigned int *),1+cmh->levels);
+ cmh->hashb=(unsigned int **)calloc(sizeof(unsigned int *),1+cmh->levels);
+@@ -454,12 +481,12 @@ CMH_type * CMH_Init(int width, int depth
+ {
+ if (i>=cmh->freelim)
+ { // allocate space for representing things exactly at high levels
+- cmh->counts[i]=calloc(1<<(cmh->gran*j),sizeof(int));
++ cmh->counts[i]=(int *) calloc(1<<(cmh->gran*j),sizeof(int));
+ j++;
+ cmh->hasha[i]=NULL;
+ cmh->hashb[i]=NULL;
+ }
+- else
++ else
+ { // allocate space for a sketch
+ cmh->counts[i]=(int *)calloc(sizeof(int), cmh->depth*cmh->width);
+ cmh->hasha[i]=(unsigned int *)
+@@ -480,7 +507,7 @@ CMH_type * CMH_Init(int width, int depth
+ }
+
+ void CMH_Destroy(CMH_type * cmh)
+-{ // free up the space
++{ // free up the space
+ int i;
+ if (!cmh) return;
+ for (i=0;i<cmh->levels;i++)
+@@ -489,7 +516,7 @@ void CMH_Destroy(CMH_type * cmh)
+ {
+ free(cmh->counts[i]);
+ }
+- else
++ else
+ {
+ free(cmh->hasha[i]);
+ free(cmh->hashb[i]);
+@@ -513,14 +540,14 @@ void CMH_Update(CMH_type * cmh, unsigned
+ {
+ offset=0;
+ if (i>=cmh->freelim)
+- {
++ { // level 0 = leaves, higher levels = internal nodes
+ cmh->counts[i][item]+=diff;
+- // keep exact counts at high levels in the hierarchy
++ // keep exact counts at high levels in the hierarchy
+ }
+ else
+ for (j=0;j<cmh->depth;j++)
+ {
+- cmh->counts[i][(hash31(cmh->hasha[i][j],cmh->hashb[i][j],item)
++ cmh->counts[i][(hash31(cmh->hasha[i][j],cmh->hashb[i][j],item)
+ % cmh->width) + offset]+=diff;
+ // this can be done more efficiently if the width is a power of two
+ offset+=cmh->width;
+@@ -545,7 +572,7 @@ int CMH_Size(CMH_type * cmh)
+ return(admin + hashes + counts);
+ }
+
+-int CMH_count(CMH_type * cmh, int depth, int item)
++int CMH_count(CMH_type * cmh, int depth, unsigned int item)
+ {
+ // return an estimate of item at level depth
+
+@@ -561,23 +588,23 @@ int CMH_count(CMH_type * cmh, int depth,
+ // else, use the appropriate sketch to make an estimate
+ offset=0;
+ estimate=cmh->counts[depth][(hash31(cmh->hasha[depth][0],
+- cmh->hashb[depth][0],item)
++ cmh->hashb[depth][0],item)
+ % cmh->width) + offset];
+ for (j=1;j<cmh->depth;j++)
+ {
+ offset+=cmh->width;
+ estimate=min(estimate,
+ cmh->counts[depth][(hash31(cmh->hasha[depth][j],
+- cmh->hashb[depth][j],item)
++ cmh->hashb[depth][j],item)
+ % cmh->width) + offset]);
+ }
+ return(estimate);
+ }
+
+-void CMH_recursive(CMH_type * cmh, int depth, int start,
++void CMH_recursive(CMH_type * cmh, int depth, int start,
+ int thresh, unsigned int * results)
+ {
+- // for finding heavy hitters, recursively descend looking
++ // for finding heavy hitters, recursively descend looking
+ // for ranges that exceed the threshold
+
+ int i;
+@@ -586,11 +613,11 @@ void CMH_recursive(CMH_type * cmh, int d
+ int itemshift;
+
+ estcount=CMH_count(cmh,depth,start);
+- if (estcount>=thresh)
+- {
++ if (estcount>=thresh)
++ {
+ if (depth==0)
+ {
+- if (results[0]<cmh->width)
++ if (results[0]<(unsigned int) cmh->width)
+ {
+ results[0]++;
+ results[results[0]]=start;
+@@ -607,7 +634,7 @@ void CMH_recursive(CMH_type * cmh, int d
+ }
+ }
+
+-int * CMH_FindHH(CMH_type * cmh, int thresh)
++unsigned int * CMH_FindHH(CMH_type * cmh, int thresh)
+ { // find all items whose estimated count is greater than phi n
+
+ unsigned int * results;
+@@ -618,27 +645,31 @@ int * CMH_FindHH(CMH_type * cmh, int thr
+ return(results);
+ }
+
+-int CMH_Rangesum(CMH_type * cmh, int start, int end)
++int CMH_Rangesum(CMH_type * cmh, long long start, long long end)
+ {
+- // compute a range sum:
++ // compute a range sum:
+ // start at bottom level
+ // compute any estimates needed at each level
+ // work upwards
+
+- int leftend,rightend,i,depth, result, topend;
++ int depth, result;
++ long long range, leftend, rightend;
++ long long topend, i;
+
+- topend=1<<cmh->U;
++ topend=((long long) 1)<<cmh->U;
+ end=min(topend,end);
+- if ((end>topend) && (start==0))
++ if ((end>topend) && (start==0)) {
+ return cmh->count;
++ }
+
+ end+=1; // adjust for end effects
+ result=0;
+ for (depth=0;depth<=cmh->levels;depth++)
+ {
+ if (start==end) break;
+- if ((end-start+1)<(1<<cmh->gran))
+- { // at the highest level, avoid overcounting
++ range=(end-start+1);
++ if ((unsigned int) (end-start+1)<(((unsigned int) 1)<<cmh->gran))
++ { // if only a few nodes to probe at this level, probe them all
+ for (i=start;i<end;i++)
+ result+=CMH_count(cmh,depth,i);
+ break;
+@@ -646,6 +677,7 @@ int CMH_Rangesum(CMH_type * cmh, int sta
+ else
+ { // figure out what needs to be done at each end
+ leftend=(((start>>cmh->gran)+1)<<cmh->gran) - start;
++ if (leftend>= 1<<cmh->gran) leftend=0;
+ rightend=(end)-((end>>cmh->gran)<<cmh->gran);
+ if ((leftend>0) && (start<end))
+ for (i=0;i<leftend;i++)
+@@ -665,19 +697,20 @@ int CMH_Rangesum(CMH_type * cmh, int sta
+ return result;
+ }
+
+-int CMH_FindRange(CMH_type * cmh, int sum)
++long long CMH_FindRange(CMH_type * cmh, int sum)
+ {
+- unsigned long low, high, mid=0, est;
+- int i;
++ long long low, high, mid=0;
++ int i, est=0;
+ // find a range starting from zero that adds up to sum
+
+ if (cmh->count<sum) return 1<<(cmh->U);
+ low=0;
+- high=1<<cmh->U;
++ high=((long long) 1)<<cmh->U;
++
+ for (i=0;i<cmh->U;i++)
+ {
+ mid=(low+high)/2;
+- est=CMH_Rangesum(cmh,0,mid);
++ est=CMH_Rangesum(cmh,0,(unsigned int) mid);
+ if (est>sum)
+ high=mid;
+ else
+@@ -687,18 +720,17 @@ int CMH_FindRange(CMH_type * cmh, int su
+
+ }
+
+-int CMH_AltFindRange(CMH_type * cmh, int sum)
++long long CMH_AltFindRange(CMH_type * cmh, int sum)
+ {
+- unsigned long low, high, mid=0, est, top;
+- int i;
++ long long low, high, mid=0,top;
++ int i, est=0;
+ // find a range starting from the right hand side that adds up to sum
+
+ if (cmh->count<sum) return 1<<(cmh->U);
+ low=0;
+- top=1<<cmh->U;
++ top=((long long) 1)<<cmh->U;
+ high=top;
+- for (i=0;i<cmh->U;i++)
+- {
++ for (i=0;i<cmh->U;i++) {
+ mid=(low+high)/2;
+ est=CMH_Rangesum(cmh,mid,top);
+ if (est<sum)
+@@ -710,17 +742,17 @@ int CMH_AltFindRange(CMH_type * cmh, int
+
+ }
+
+-int CMH_Quantile(CMH_type * cmh, float frac)
++long long CMH_Quantile(CMH_type * cmh, float frac)
+ {
+ // find a quantile by doing the appropriate range search
+ if (frac<0) return 0;
+- if (frac>1)
++ if (frac>1)
+ return 1<<cmh->U;
+- return ((CMH_FindRange(cmh,cmh->count*frac)+
+- CMH_AltFindRange(cmh,cmh->count*(1-frac)))/2);
++ return ((CMH_FindRange(cmh,(long long) (cmh->count*frac))+
++ CMH_AltFindRange(cmh,(long long) (cmh->count*(1-frac))))/2);
+ // each result gives a lower/upper bound on the location of the quantile
+ // with high probability, these will be close: only a small number of values
+- // will be between the estimates.
++ // will be between the estimates.
+ }
+
+ long long CMH_F2Est(CMH_type * cmh)
+diff -up ntop-5.0.1/countmin.h.licfix ntop-5.0.1/countmin.h
+--- ntop-5.0.1/countmin.h.licfix 2012-02-21 18:51:02.000000000 -0500
++++ ntop-5.0.1/countmin.h 2014-01-21 13:39:14.783174834 -0500
+@@ -2,15 +2,8 @@
+ // 1 -- The basic CM Sketch
+ // 2 -- The hierarchical CM Sketch: with log n levels, for range sums etc.
+
+-#ifndef min
+ #define min(x,y) ((x) < (y) ? (x) : (y))
+-#endif
+-
+-#ifndef max
+ #define max(x,y) ((x) > (y) ? (x) : (y))
+-#endif
+-
+-#include "prng.h"
+
+ typedef struct CM_type{
+ long long count;
+@@ -18,7 +11,6 @@ typedef struct CM_type{
+ int width;
+ int ** counts;
+ unsigned int *hasha, *hashb;
+- prng_type * prng; /* L. Deri */
+ } CM_type;
+
+ typedef struct CMF_type{ // shadow of above stucture with floats
+@@ -37,8 +29,9 @@ extern int CM_Size(CM_type *);
+ extern void CM_Update(CM_type *, unsigned int, int);
+ extern int CM_PointEst(CM_type *, unsigned int);
+ extern int CM_PointMed(CM_type *, unsigned int);
+-extern int CM_InnerProd(CM_type *, CM_type *);
++extern long long CM_InnerProd(CM_type *, CM_type *);
+ extern int CM_Residue(CM_type *, unsigned int *);
++extern long long CM_F2Est(CM_type *);
+
+ extern CMF_type * CMF_Init(int, int, int);
+ extern CMF_type * CMF_Copy(CMF_type *);
+@@ -57,7 +50,7 @@ typedef struct CMH_type{
+ int depth;
+ int width;
+ int ** counts;
+- unsigned int **hasha, * *hashb;
++ unsigned int **hasha, **hashb;
+ } CMH_type;
+
+ extern CMH_type * CMH_Init(int, int, int, int);
+@@ -66,9 +59,9 @@ extern void CMH_Destroy(CMH_type *);
+ extern int CMH_Size(CMH_type *);
+
+ extern void CMH_Update(CMH_type *, unsigned int, int);
+-extern int * CMH_FindHH(CMH_type *, int);
+-extern int CMH_Rangesum(CMH_type *, int, int);
++extern unsigned int * CMH_FindHH(CMH_type *, int);
++extern int CMH_Rangesum(CMH_type *, long long, long long);
+
+-extern int CMH_FindRange(CMH_type * cmh, int);
+-extern int CMH_Quantile(CMH_type *cmh,float);
++extern long long CMH_FindRange(CMH_type * cmh, int);
++extern long long CMH_Quantile(CMH_type *cmh,float);
+ extern long long CMH_F2Est(CMH_type *);
+diff -up ntop-5.0.1/Makefile.am.am.licfix ntop-5.0.1/Makefile.am.am
+--- ntop-5.0.1/Makefile.am.am.licfix 2014-01-21 13:40:54.839114367 -0500
++++ ntop-5.0.1/Makefile.am.am 2014-01-21 13:41:07.738105763 -0500
+@@ -129,7 +129,7 @@ libntop_la_SOURCES = address.c argv.c
+ sessions.c term.c util.c utildl.c \
+ traffic.c vendor.c version.c \
+ ntop_darwin.c \
+- prng.c countmin.c
++ prng.c countmin.c massdal.c
+
+ libntop_la_DEPENDENCIES = config.h
+ libntop_la_LIBADD = $(BASE_LIBS)
+diff -up ntop-5.0.1/Makefile.am.licfix ntop-5.0.1/Makefile.am
+--- ntop-5.0.1/Makefile.am.licfix 2014-01-21 13:41:22.129095982 -0500
++++ ntop-5.0.1/Makefile.am 2014-01-21 13:41:29.062091201 -0500
+@@ -121,7 +121,7 @@ libntop_la_SOURCES = address.c argv.c
+ sessions.c term.c util.c utildl.c \
+ traffic.c vendor.c version.c \
+ ntop_darwin.c \
+- prng.c countmin.c
++ prng.c countmin.c massdal.c
+
+ libntop_la_DEPENDENCIES = config.h
+ libntop_la_LIBADD = $(BASE_LIBS)
+diff -up ntop-5.0.1/massdal.c.licfix ntop-5.0.1/massdal.c
+--- ntop-5.0.1/massdal.c.licfix 2014-01-21 13:41:39.066084232 -0500
++++ ntop-5.0.1/massdal.c 2014-01-21 13:39:23.463170092 -0500
+@@ -0,0 +1,133 @@
++/*****************************************************************
++
++Massdal: simple timing and median routines
++
++Graham Cormode 2003-2012
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License along
++ with this program; if not, write to the Free Software Foundation, Inc.,
++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++*******************************************************************/
++
++
++#include "massdal.h"
++#include <sys/time.h>
++#include <time.h>
++#include <stdio.h>
++#include <stdlib.h>
++
++// simple timing routines for testing
++// these use global variables, so they will not interleave well
++
++long secs, usecs;
++struct timeval tt;
++
++void StartTheClock()
++{
++ gettimeofday(&tt,NULL);
++ secs=tt.tv_sec;
++ usecs=tt.tv_usec;
++}
++
++long StopTheClock()
++{
++ gettimeofday(&tt,NULL);
++ secs=tt.tv_sec-secs;
++ usecs=tt.tv_usec-usecs;
++ return (long) 1000*secs+(usecs/1000);
++}
++
++#define SWAP(a,b) temp=(a);(a)=(b);(b)=temp;
++// defined for the purposes of the median finding procedures below
++
++
++ /* Routine from Numerical Recipes --
++ find the k'th element out of n that are in arr (assumed
++ indexed from 1 to n)
++ */
++#define MEDIAN \
++\
++ int i, ir, j, mid, l;\
++\
++ l=1; \
++ ir=n; \
++ for (;;) { \
++ if (ir <= l+1) { \
++ if (ir == l+1 && arr[ir] < arr[l]) { \
++ SWAP(arr[l],arr[ir]) \
++ } \
++ return arr[k]; \
++ } \
++ else \
++ { \
++ mid=(l+ir) >> 1; \
++ SWAP(arr[mid],arr[l+1]) \
++ if (arr[l] > arr[ir]) { \
++ SWAP(arr[l],arr[ir]) \
++ } \
++ if (arr[l+1] > arr[ir]) { \
++ SWAP(arr[l+1],arr[ir]) \
++ } \
++ if (arr[l] > arr[l+1]) { \
++ SWAP(arr[l],arr[l+1]) \
++ } \
++ i=l+1; \
++ j=ir; \
++ a=arr[l+1]; \
++ for (;;) { \
++ do i++; while (arr[i] < a);\
++ do j--; while (arr[j] > a);\
++ if (j < i) break;\
++ SWAP(arr[i],arr[j])\
++ }\
++ arr[l+1]=arr[j];\
++ arr[j]=a;\
++ if (j >= k) ir=j-1;\
++ if (j <= k) l=i;\
++ }\
++ }\
++
++
++int MedSelect(int k, int n, int arr[]) {
++ int a, temp;
++
++ MEDIAN
++ }
++
++long long LLMedSelect(int k, int n, long long arr[]) {
++ long long a, temp;
++
++ MEDIAN
++ }
++
++double DMedSelect(int k, int n, double arr[]) {
++ double a, temp;
++
++ MEDIAN
++ }
++
++long LMedSelect(int k, int n, long arr[]) {
++ long a, temp;
++
++ MEDIAN
++ }
++
++
++void CheckMemory(void * ptr)
++{
++ if (!ptr)
++ {
++ fprintf(stderr,"Out of memory error\n");
++ exit(-1);
++ }
++}
+diff -up ntop-5.0.1/massdal.h.licfix ntop-5.0.1/massdal.h
+--- ntop-5.0.1/massdal.h.licfix 2014-01-21 13:41:44.661080300 -0500
++++ ntop-5.0.1/massdal.h 2014-01-21 13:39:26.461168430 -0500
+@@ -0,0 +1,9 @@
++#include <sys/time.h>
++
++extern void StartTheClock();
++extern long StopTheClock();
++extern int MedSelect(int, int, int[]);
++extern long LMedSelect(int, int, long[]);
++extern long long LLMedSelect(int, int, long long[]);
++extern double DMedSelect(int, int, double[]);
++extern void CheckMemory(void *);
+diff -up ntop-5.0.1/prng.c.licfix ntop-5.0.1/prng.c
+--- ntop-5.0.1/prng.c.licfix 2012-02-21 18:51:02.000000000 -0500
++++ ntop-5.0.1/prng.c 2014-01-21 13:39:28.988167019 -0500
+@@ -1,3 +1,24 @@
++/*********************************************************************
++
++prng: pseudo-random number generators and hashing routines
++
++G. Cormode 2003-2012
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License along
++ with this program; if not, write to the Free Software Foundation, Inc.,
++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++************************************************************************/
++
+ #include <math.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -9,7 +30,7 @@ long hash31(long long a, long long b, lo
+ {
+
+ long long result;
+- long lresult;
++ long lresult;
+
+ // return a hash of x using a and b mod (2^31 - 1)
+ // may need to do another mod afterwards, or drop high bits
+@@ -19,8 +40,8 @@ long hash31(long long a, long long b, lo
+ // result = ((long long) a)*((long long) x)+((long long) b);
+ result=(a * x) + b;
+ result = ((result >> HL) + result) & MOD;
+- lresult=(long) result;
+-
++ lresult=(long) result;
++
+ return(lresult);
+ }
+
+@@ -28,11 +49,11 @@ long fourwise(long long a, long long b,
+ {
+ long long result;
+ long lresult;
+-
++
+ // returns values that are 4-wise independent by repeated calls
+- // to the pairwise indpendent routine.
++ // to the pairwise indpendent routine.
+
+- result = hash31(hash31(hash31(x,a,b),x,c),x,d);
++ result = hash31(hash31(hash31(a,b,x),c,x),d,x);
+ lresult = (long) result;
+ return lresult;
+ }
+@@ -45,7 +66,7 @@ long fourwise(long long a, long long b,
+ // There are *THREE* alternate implementations of PRNGs here.
+ // One taken from Numerical Recipes in C, the second from www.agner.org
+ // The third is an internal C random library, srand
+-// The variable usenric controls which one is used: pick one
++// The variable usenric controls which one is used: pick one
+ // and stick with it, switching between the two will give unpredictable
+ // results. This is controlled by the randinit procedure, call it with
+ // usenric == 1 to use the Numerical Recipes gens
+@@ -66,7 +87,7 @@ extern double sqrt(double);
+ #define RNMX (1.0-EPS)
+
+ float ran1(prng_type * prng) {
+-
++
+ // A Random Number Generator that picks a uniform [0,1] random number
+ // From Numerical Recipes, page 280
+ // Should be called with a NEGATIVE value of idum to initialize
+@@ -75,7 +96,7 @@ float ran1(prng_type * prng) {
+ int j;
+ long k;
+ float temp;
+-
++
+ if (prng->floatidum <= 0 || !prng->iy) {
+ if (-(prng->floatidum) < 1) prng->floatidum=1;
+ else prng->floatidum = -(prng->floatidum);
+@@ -96,9 +117,9 @@ float ran1(prng_type * prng) {
+ if ((temp=AM*prng->iy) > RNMX) return RNMX;
+ else return temp;
+ }
+-
++
+ long ran2(prng_type * prng) {
+-
++
+ // A Random Number Generator that picks a uniform random number
+ // from the range of long integers.
+ // From Numerical Recipes, page 280
+@@ -109,7 +130,7 @@ long ran2(prng_type * prng) {
+
+ int j;
+ long k;
+-
++
+ if (prng->intidum <= 0 || !prng->iy) {
+ if (-(prng->intidum) < 1) prng->intidum=1;
+ else prng->intidum = -(prng->intidum);
+@@ -174,7 +195,7 @@ unsigned long ran3(prng_type * prng) {
+
+ /* generate next random number */
+
+- x = prng->randbuffer[prng->r_p1] = rotl(prng->randbuffer[prng->r_p2], R1)
++ x = prng->randbuffer[prng->r_p1] = rotl(prng->randbuffer[prng->r_p2], R1)
+ + rotl(prng->randbuffer[prng->r_p1], R2);
+ /* rotate list pointers */
+ if (--prng->r_p1 < 0) prng->r_p1 = KK - 1;
+@@ -225,7 +246,7 @@ long prng_int(prng_type * prng) {
+ {
+ case 1 : response=(ran2(prng)); break;
+ case 2 : response=(ran3(prng)); break;
+- // case 3 : response=(lrand48()); break;
++ case 3 : response=(lrand48()); break;
+ }
+ return response;
+ }
+@@ -233,7 +254,7 @@ long prng_int(prng_type * prng) {
+
+ float prng_float(prng_type * prng) {
+
+- // returns a pseudo-random float in the range [0.0,1.0].
++ // returns a pseudo-random float in the range [0.0,1.0].
+ // Initialise the generator before use!
+ float result=0;
+
+@@ -241,7 +262,7 @@ float prng_float(prng_type * prng) {
+ {
+ case 1 : result=(ran1(prng)); break;
+ case 2 : result=(ran4(prng)); break;
+- // case 3 : result=(drand48()); break;
++ case 3 : result=(drand48()); break;
+ }
+ return result;
+ }
+@@ -249,25 +270,25 @@ float prng_float(prng_type * prng) {
+ prng_type * prng_Init(long seed, int nric) {
+
+ // Initialise the random number generators. nric determines
+- // which algorithm to use, 1 for Numerical Recipes in C,
+- // 0 for the other one.
++ // which algorithm to use, 1 for Numerical Recipes in C,
++ // 0 for the other one.
+ prng_type * result;
+
+ result=(prng_type *) calloc(1,sizeof(prng_type));
+
+ result->iy=0;
+- result->usenric=nric;
++ result->usenric=nric;
+ result->floatidum=-1;
+ result->intidum=-1;
+ result->iset=0;
+ // set a global variable to record which algorithm to use
+ switch (nric)
+- {
+- case 2 :
++ {
++ case 2 :
+ RanrotAInit(result,seed);
+ break;
+- case 1 :
+- if (seed>0) {
++ case 1 :
++ if (seed>0) {
+ // to initialise the NRiC PRNGs, call it with a negative value
+ // so make sure it gets a negative value!
+ result->floatidum = -(seed); result->intidum = -(seed);
+@@ -275,26 +296,26 @@ prng_type * prng_Init(long seed, int nri
+ result->floatidum=seed; result->intidum=seed;
+ }
+ break;
+- case 3 :
+- srand(seed);
++ case 3 :
++ srand48(seed);
+ break;
+ }
+
+ prng_float(result);
+ prng_int(result);
+ // call the routines to actually initialise them
+- return(result);
++ return(result);
+ }
+
+ void prng_Reseed(prng_type * prng, long seed)
+ {
+ switch (prng->usenric)
+- {
+- case 2 :
++ {
++ case 2 :
+ RanrotAInit(prng,seed);
+ break;
+- case 1 :
+- if (seed>0) {
++ case 1 :
++ if (seed>0) {
+ // to initialise the NRiC PRNGs, call it with a negative value
+ // so make sure it gets a negative value!
+ prng->floatidum = -(seed); prng->intidum = -(seed);
+@@ -302,16 +323,15 @@ void prng_Reseed(prng_type * prng, long
+ prng->floatidum=seed; prng->intidum=seed;
+ }
+ break;
+- case 3 :
+- srand(seed);
++ case 3 :
++ srand48(seed);
+ break;
+ }
+-}
++}
+
+ void prng_Destroy(prng_type * prng)
+-{
++{
+ free(prng);
+- prng=NULL;
+ }
+
+ /**********************************************************************/
+@@ -333,7 +353,7 @@ double prng_normal(prng_type * prng) {
+ v2 = 2.0*prng_float(prng)-1.0;
+ rsq=v1*v1+v2*v2;
+ } while (rsq >= 1.0 || rsq == 0.0);
+-
++
+ fac = sqrt((double) -2.0*log((double)rsq)/rsq);
+ prng->gset=v1*fac;
+ prng->iset=1;
+@@ -349,7 +369,7 @@ double prng_stabledbn(prng_type * prng,
+
+ // From 'stable distributions', John Nolan, manuscript, p24
+ // we set beta = 0 by analogy with the normal and cauchy case
+- // identical to the above routine, but returns a double instead
++ // identical to the above routine, but returns a double instead
+ // of a long double (you'll see this a lot...)
+
+ double theta, W, holder, left, right;
+@@ -380,10 +400,10 @@ long double prng_cauchy(prng_type * prng
+ }
+
+
+-double prng_altstab(prng_type * prng, double p)
++double prng_altstab(prng_type * prng, double p)
+ {
+ double u,v,result;
+-
++
+ u=prng_float(prng);
+ v=prng_float(prng);
+ result=pow(u,p);
+@@ -402,7 +422,7 @@ long double levy() {
+
+ z=gasdev();
+ return (1.0/(z*z));
+- }
++ }
+
+ */
+
+@@ -416,7 +436,7 @@ double prng_stable(prng_type * prng, dou
+ // the first time since it uses the random generators
+
+
+- if (alpha==2.0)
++ if (alpha==2.0)
+ return(prng_normal(prng));
+ else if (alpha==1.0)
+ return(prng_cauchy(prng));
+@@ -425,7 +445,7 @@ double prng_stable(prng_type * prng, dou
+ else return (prng_stabledbn(prng,alpha));
+ }
+
+-double zeta(long n, double theta)
++double zeta(long n, double theta)
+ {
+
+ // the zeta function, used by the below zipf function
+@@ -434,7 +454,7 @@ double zeta(long n, double theta)
+
+ int i;
+ double ans=0.0;
+-
++
+ for (i=1; i <= n; i++)
+ ans += pow(1./(double)i, theta);
+ return(ans);
+@@ -444,9 +464,9 @@ double fastzipf(double theta, long n, do
+
+ // this draws values from the zipf distribution
+ // this is mainly useful for test generation purposes
+- // n is range, theta is skewness parameter
++ // n is range, theta is skewness parameter
+ // theta = 0 gives uniform dbn,
+- // theta > 1 gives highly skewed dbn.
++ // theta > 1 gives highly skewed dbn.
+ // original code due to Flip Korn, used with permission
+
+ double alpha;
+@@ -459,7 +479,8 @@ double fastzipf(double theta, long n, do
+ // the first time since it uses the random generators
+
+ alpha = 1. / (1. - theta);
+- eta = (1. - pow(2./n, 1. - theta)) / (1. - zeta(2.,theta)/zetan);
++ eta = (1. - pow(2./((double) n), 1. - theta))
++ / (1. - zeta(2,theta)/zetan);
+
+ u = prng_float(prng);
+ uz = u * zetan;
+@@ -475,9 +496,9 @@ long double zipf(double theta, long n) {
+
+ // this draws values from the zipf distribution
+ // this is mainly useful for test generation purposes
+- // n is range, theta is skewness parameter
++ // n is range, theta is skewness parameter
+ // theta = 0 gives uniform dbn,
+- // theta > 1 gives highly skewed dbn.
++ // theta > 1 gives highly skewed dbn.
+
+ double alpha;
+ double zetan;
+diff -up ntop-5.0.1/prng.h.licfix ntop-5.0.1/prng.h
diff --git a/ntop.spec b/ntop.spec
index ccb19c7..46207a3 100644
--- a/ntop.spec
+++ b/ntop.spec
@@ -1,11 +1,23 @@
%define _hardened_build 1
Name: ntop
-Version: 5.0
-Release: 7%{?dist}
+Version: 5.0.1
+Release: 1%{?dist}
Summary: A network traffic probe similar to the UNIX top command
Group: Applications/Internet
# Confirmed from fedora legal 488717
-License: GPLv2 and BSD with advertising
+# .dat files are CC-BY-SA 3.0
+# http://dev.maxmind.com/geoip/legacy/geolite/
+# Jquery files are marked as (MIT or GPLv2+)
+# but upstream jquery has relicensed all works to just MIT.
+# Even if they had not, if there was a compat concern, Fedora would have
+# chosen the MIT option.
+# html/jqplot/excanvas.js is ASL 2.0, but it is not a GPL compat issue
+# because it is not linked to anything.
+# nDPI is LGPLv3+ (and it is linked to ntop, which is GPLv2+)
+# This means that practically, the ntop combined work is GPLv3+
+# but since this is already confusing, I will not simplify it in the
+# license tag.
+License: GPLv2+ and LGPLv3+ and (MIT or GPLv2) and ASL 2.0 and BSD with advertising and CC-BY-SA
URL: http://www.ntop.org
Source0: http://downloads.sourceforge.net/ntop/ntop-%{version}.tar.gz
Source1: ntop.service
@@ -24,6 +36,11 @@ Patch2: ntop-dbfile-default-dir.patch
Patch3: ntop-http_c.patch
Patch4: ntop-dot-default-path.patch
Patch5: ntop-disable-svn-requirement.patch
+# From http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692732
+# Fixes license on these files to be GPLv2+
+Patch6: ntop-5.0.1-countmin-prng-license-fix.patch
+# Improve configure
+Patch7: ntop-5.0.1-configure-fixes.patch
BuildRequires: autoconf, automake, pkgconfig, libtool, groff, libpcap-devel wget
BuildRequires: gdbm-devel, gd-devel, rrdtool-devel, openssl-devel
BuildRequires: net-snmp-devel, lm_sensors-devel, pcre-devel, mysql-devel
@@ -85,13 +102,26 @@ find . \( -name \*\.gz -o -name \*\.c -o -name \*\.h -o -name \*\.pdf \
%patch3 -p1 -b .http_c
%patch4 -p0 -b .dot-default-path
%patch5 -p1 -b .svn
+%patch6 -p1 -b .licfix
+%patch7 -p1 -b .fix
+
+mv configure.in configure.ac
+mv acinclude.m4.ntop ntop.m4
%build
#run ntop own autoconf wrapper
-./autogen.sh --noconfig
+# ./autogen.sh --noconfig
+
+mkdir m4
+autoreconf -ifv -I .
+
+pushd nDPI
+%configure --with-pic
+make %{?_smp_mflags}
+popd
+
+%{configure} --enable-snmp --disable-static
-%{configure} --enable-snmp \
- --disable-static
#rpath problem
sed -i -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
@@ -239,6 +269,10 @@ fi
%{_localstatedir}/lib/ntop/rrd
%changelog
+* Tue Jan 21 2014 Tom Callaway <spot at fedoraproject.org> - 5.0.1-1
+- update to 5.0.1
+- fix licensing issues
+
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 5.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
@@ -281,7 +315,7 @@ fi
- Build with PAM.
- Drop no longer available configure options.
-* Thu Nov 23 2011 Sven Lankes <sven at lank.es> - 4.1.0-1
+* Wed Nov 23 2011 Sven Lankes <sven at lank.es> - 4.1.0-1
- update to latest upstream release (rhbz #652868)
- rebuild to not include debug info (rhbz #713613)
- fix file permissions for graphviz output to work (rhbz #696607)
@@ -426,7 +460,7 @@ fi
- Better description to initfile summary
- add LSB bits to initfile
-* Mon Mar 07 2007 Bernard Johnson <bjohnson at symetrix.com> - 3.3-0.8.20070307cvs
+* Wed Mar 07 2007 Bernard Johnson <bjohnson at symetrix.com> - 3.3-0.8.20070307cvs
- update to 20070307cvs
- move database files to %%{_localstatedir}/lib/ntop
- fix javascript files not being installed
@@ -455,7 +489,7 @@ fi
- patch .so files to just version 3.3 not 3.3rc0; otherwise rpmlint complains
- fix typo in init file
-* Wed Feb 18 2007 Bernard Johnson <bjohnson at symetrix.com> - 3.3-0.2.20060218cvs
+* Sun Feb 18 2007 Bernard Johnson <bjohnson at symetrix.com> - 3.3-0.2.20060218cvs
- update to ntop cvs 20060208
* Wed Feb 07 2007 Bernard Johnson <bjohnson at symetrix.com> - 3.3-0.1.20060207cvs
diff --git a/sources b/sources
index bdb6a7d..218b7d0 100644
--- a/sources
+++ b/sources
@@ -1,5 +1,5 @@
-248128df8e0ffb12fc8a837e3310e2af GeoIPASNum.dat.gz
-c7723d644e545936ef5ef80fb4779901 GeoLiteCity.dat.gz
96fa6c171e00f4df2d6add2c1dc8ae30 etter.finger.os.gz
e21eeebf7134161dcb9375d343f13bcc nDPI-svn5614.tar.gz
-e4115a6609fd2def2dce177772f9a789 ntop-5.0.tar.gz
+24f082fa05a2bac804b664f6a0893aba GeoIPASNum.dat.gz
+f6c103398687dda345fcd1002b7e5505 GeoLiteCity.dat.gz
+01710b6925a8a5ffe1a41b8b512ebd69 ntop-5.0.1.tar.gz
More information about the scm-commits
mailing list