Apache 2.4.x 서버에서 mod_cband  (트래픽 사용량 제어 모듈) 설치시 다음과 같은 오류 메세지가 출력됩니다.

[ SUN(11.123) , /usr/local/src/mod-cband-0.9.7.5 ] > make

/usr/local/apache/bin/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 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/local/apache/include -I/usr/local/apr/include/apr-1 -I/usr/local/apr-util/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:1054: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1054: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1058: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1058: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c: In function ‘mod_cband_get_dst’:
src/mod_cband.c:1333: error: ‘conn_rec’ has no member named ‘remote_ip’
src/mod_cband.c: In function ‘mod_cband_get_remote_host’:
src/mod_cband.c:1362: error: ‘struct conn_rec’ has no member named ‘remote_ip’
src/mod_cband.c:1363: error: ‘struct conn_rec’ has no member named ‘remote_ip’
src/mod_cband.c:1365: error: ‘struct conn_rec’ has no member named ‘remote_addr’
apxs:Error: Command failed with rc=65536
.
make: *** [src/.libs/mod_cband.so] 오류 1

mod_cband.c 파일을 편집합니다.

vi /usr/local/src/mod-cband-0.9.7.5/src/mod_cband.c

이때, src/.libs/mod_cband.c 라는 파일이 존재 않은 상태에서 작업해야 합니다.

빨간색은 수정 이전 라인, 파란색은 수정 이후 라인입니다.

1333번 라인
p.add.sin.s_addr = inet_addr(r->connection->remote_ip);
p.add.sin.s_addr = inet_addr(r->connection->client_ip);

1342번 라인
   fprintf(stderr,”%s leaf %s\n”,r->connection->remote_ip,leaf);
   fprintf(stderr,”%s leaf %s\n”,r->connection->client_ip,leaf);

1362~1365번 라인
if (c->remote_ip != NULL)
addr = inet_addr(c->client_ip);
else
addr = c->remote_addr->sa.sin.sin_addr.s_addr;

if (c->client_ip != NULL)
addr = inet_addr(c->client_ip);
else
addr = c->client_addr->sa.sin.sin_addr.s_addr;

위와 같이 수정한 다음 make 명령을 내리면 정상적으로 컴파일이 진행됩니다.

/usr/local/apache/bin/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 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/local/apache/include -I/usr/local/apr/include/apr-1 -I/usr/local/apr-util/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:1054: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1054: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1058: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1058: warning: comparison with string literal results in unspecified behavior
/usr/local/apr/build-1/libtool –silent –mode=link gcc -std=gnu99 -o src/mod_cband.la -rpath /usr/local/apache/modules -module -avoid-version src/mod_cband.lo

write “make install” to install module

 

make install

/usr/local/apache/bin/apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -i -a -n cband src/mod_cband.la
/usr/local/apache/build/instdso.sh SH_LIBTOOL=’/usr/local/apr/build-1/libtool’ src/mod_cband.la /usr/local/apache/modules
/usr/local/apr/build-1/libtool –mode=install install src/mod_cband.la /usr/local/apache/modules/
libtool: install: install src/.libs/mod_cband.so /usr/local/apache/modules/mod_cband.so
libtool: install: install src/.libs/mod_cband.lai /usr/local/apache/modules/mod_cband.la
libtool: install: install src/.libs/mod_cband.a /usr/local/apache/modules/mod_cband.a
libtool: install: chmod 644 /usr/local/apache/modules/mod_cband.a
libtool: install: ranlib /usr/local/apache/modules/mod_cband.a
libtool: finish: PATH=”/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/java/bin:/root/bin:/sbin” ldconfig -n /usr/local/apache/modules
———————————————————————-
Libraries have been installed in:
/usr/local/apache/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR’
flag during linking and do at least one of the following:
– add LIBDIR to the `LD_LIBRARY_PATH’ environment variable
during execution
– add LIBDIR to the `LD_RUN_PATH’ environment variable
during linking
– use the `-Wl,-rpath -Wl,LIBDIR’ linker flag
– have your system administrator add LIBDIR to `/etc/ld.so.conf’

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
———————————————————————-
chmod 755 /usr/local/apache/modules/mod_cband.so
[activating module `cband’ in /usr/local/apache/conf/httpd.conf]

출처 : http://idchowto.com/tip-apache-2-4-x-%EC%84%9C%EB%B2%84%EC%97%90%EC%84%9C-mod_cband-%EC%84%A4%EC%B9%98%EC%8B%9C-%EC%98%A4%EB%A5%98-%EB%A9%94%EC%84%B8%EC%A7%80-%EC%B2%98%EB%A6%AC%EB%B0%A9%EB%B2%95/