How to Compile mod_cband module for Apache 2.4.3 on Centos 6.3/ Redhat/ Fedora/ Ubuntu 12.04
mod_cband is an Apache 2 module that solves the problem of limiting the bandwidth usage of users, virtual hosts, and destinations.
INSTALLATION
============
Prerequisites
Apache 2.0.54 or above Apache 2.4.3- http://www.apache.org/
Other versions may work but have not been tested
I Have tested on Apache 2.4.3
Building
If you have got the apxs/apxs2 (Apache eXtenSion tool) tool installed, write the following commands to build module:
$ wget http://pkgs.fedoraproject.org/repo/pkgs/mod_cband/mod-cband-0.9.7.4.tgz/ff635d7b55bf7ca648d319247dfb45e3/mod-cband-0.9.7.4.tgz
$ tar xzvf mod-cband-0.9.7.4.tgz
$ cd mod-cband-0.9.7.4
$ ./configure
$ make
$ make install
Note : Above Source code having error for Apache 2.4.x version
Error : if You got the error Like this while executing make.
apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -c src/mod_cband.c
/usr/local/apr/build-1/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/local/apache/include -I/usr/local/apr/include/apr-1 -I/usr/local/apr/include/apr-1 -Wall -DDST_CLASS=3 -c -o src/mod_cband.lo src/mod_cband.c && touch src/mod_cband.slo
src/mod_cband.c: In function 'mod_cband_create_traffic_size':
src/mod_cband.c:1046: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1046: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1050: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1050: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c: In function 'mod_cband_get_dst':
src/mod_cband.c:1325: error: 'conn_rec' has no member named 'remote_ip'
src/mod_cband.c: In function 'mod_cband_get_remote_host':
src/mod_cband.c:1354: error: 'struct conn_rec' has no member named 'remote_ip'
src/mod_cband.c:1355: error: 'struct conn_rec' has no member named 'remote_ip'
src/mod_cband.c:1357: error: 'struct conn_rec' has no member named 'remote_addr'
apxs:Error: Command failed with rc=65536
.
make: *** [src/.libs/mod_cband.so] Error 1
On Source Directory
[root@netwrkspider mod-cband-0.9.7.4]# ls
AUTHORS conf config.status doc libpatricia.copyright Makefile src
Changes config.log configure INSTALL LICENSE Makefile.in
open c program file under src folder .
[root@netwrkspider src]# vim mod_cband.c
On c code
1 ) change variable name remote_ip" to "client_ip"
2 ) Search & change the given below line.
else
addr = c->remote_addr->sa.sin.sin_addr.s_addr;
to
else
addr = c->client_addr->sa.sin.sin_addr.s_addr;
Save & exit .
Now try to compile program from mod_cband root directory.
make
make install
Enjoy
Note : API Changes in Apache HTTP Server 2.4 since 2.2
http://httpd.apache.org/docs/2.4/developer/new_api_2_4.html
Code Changes Details :
mod_cband is an Apache 2 module that solves the problem of limiting the bandwidth usage of users, virtual hosts, and destinations.
INSTALLATION
============
Prerequisites
Apache 2.0.54 or above Apache 2.4.3- http://www.apache.org/
Other versions may work but have not been tested
I Have tested on Apache 2.4.3
Building
If you have got the apxs/apxs2 (Apache eXtenSion tool) tool installed, write the following commands to build module:
$ wget http://pkgs.fedoraproject.org/repo/pkgs/mod_cband/mod-cband-0.9.7.4.tgz/ff635d7b55bf7ca648d319247dfb45e3/mod-cband-0.9.7.4.tgz
$ tar xzvf mod-cband-0.9.7.4.tgz
$ cd mod-cband-0.9.7.4
$ ./configure
$ make
$ make install
Note : Above Source code having error for Apache 2.4.x version
Error : if You got the error Like this while executing make.
apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -c src/mod_cband.c
/usr/local/apr/build-1/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/local/apache/include -I/usr/local/apr/include/apr-1 -I/usr/local/apr/include/apr-1 -Wall -DDST_CLASS=3 -c -o src/mod_cband.lo src/mod_cband.c && touch src/mod_cband.slo
src/mod_cband.c: In function 'mod_cband_create_traffic_size':
src/mod_cband.c:1046: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1046: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1050: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1050: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c: In function 'mod_cband_get_dst':
src/mod_cband.c:1325: error: 'conn_rec' has no member named 'remote_ip'
src/mod_cband.c: In function 'mod_cband_get_remote_host':
src/mod_cband.c:1354: error: 'struct conn_rec' has no member named 'remote_ip'
src/mod_cband.c:1355: error: 'struct conn_rec' has no member named 'remote_ip'
src/mod_cband.c:1357: error: 'struct conn_rec' has no member named 'remote_addr'
apxs:Error: Command failed with rc=65536
.
make: *** [src/.libs/mod_cband.so] Error 1
On Source Directory
[root@netwrkspider mod-cband-0.9.7.4]# ls
AUTHORS conf config.status doc libpatricia.copyright Makefile src
Changes config.log configure INSTALL LICENSE Makefile.in
open c program file under src folder .
[root@netwrkspider src]# vim mod_cband.c
On c code
1 ) change variable name remote_ip" to "client_ip"
2 ) Search & change the given below line.
else
addr = c->remote_addr->sa.sin.sin_addr.s_addr;
to
else
addr = c->client_addr->sa.sin.sin_addr.s_addr;
Save & exit .
Now try to compile program from mod_cband root directory.
make
make install
Enjoy
Note : API Changes in Apache HTTP Server 2.4 since 2.2
http://httpd.apache.org/docs/2.4/developer/new_api_2_4.html
Code Changes Details :
2 comments:
Thanks! This was a really helpful guide. It also works on Ubuntu 14.04 LTS.
Could do without the page music, though. It's 2016...
Thanks you so much! like crazeeeyez sayed this is very very usefull and this is work for ubuntu 16.04 too
Post a Comment