Skip to content

Commit

Permalink
Merge pull request #277 from vaibhav92/ipt_coova
Browse files Browse the repository at this point in the history
Fix build failures with ipt_coova kernel module and coova-chilli source
  • Loading branch information
wlanmac authored Sep 6, 2016
2 parents c78d007 + c651bc8 commit a343157
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/chilli.c
Original file line number Diff line number Diff line change
Expand Up @@ -4347,7 +4347,10 @@ static int chilliauth_cb(struct radius_t *radius,
while (!differ && r1 > 0 && r2 > 0);
}

if (oldfd) safe_close(oldfd); oldfd=0;
if (oldfd) {
safe_close(oldfd);
oldfd=0;
}

if (differ) {
if (_options.debug)
Expand Down
14 changes: 10 additions & 4 deletions src/linux/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
KERNEL_DIR ?= /usr/src/linux-headers-$(shell uname -r)
#check if this makefile is being processed from kbuild
ifeq ($(KERNELRELEASE),)

obj-m += xt_coova.o
KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build

all: libxt_coova.so
make -C ${KERNEL_DIR} M=$$PWD;
Expand All @@ -21,12 +22,17 @@ lib%.so: lib%.o
$(CC) $(CFLAGS) -shared -o $@ $^;

lib%.o: lib%.c
$(CC) $(CFLAGS) -fPIC -O2 -Wall -I${KERNEL_DIR}/include -D_INIT=lib$*_init -c -o $@ $<;
$(CC) $(CFLAGS) -fPIC -O2 -Wall -D_INIT=lib$*_init -c -o $@ $<;

install: modules_install libxt_coova.so
mkdir -p $(DESTDIR)/lib/xtables/
cp libxt_coova.so $(DESTDIR)/lib/xtables/

distdir:

distclean: clean
distclean: clean

else
#kbuild variables for xtables coova module
obj-m += xt_coova.o
endif
6 changes: 4 additions & 2 deletions src/redir.c
Original file line number Diff line number Diff line change
Expand Up @@ -3277,9 +3277,11 @@ pid_t redir_fork(int in, int out) {
}

#if defined(F_DUPFD)
if (fcntl(in,F_GETFL,0) == -1) return -1; safe_close(0);
if (fcntl(in,F_GETFL,0) == -1) return -1;
safe_close(0);
if (fcntl(in,F_DUPFD,0) == -1) return -1;
if (fcntl(out,F_GETFL,1) == -1) return -1; safe_close(1);
if (fcntl(out,F_GETFL,1) == -1) return -1;
safe_close(1);
if (fcntl(out,F_DUPFD,1) == -1) return -1;
#else
if (dup2(in,0) == -1) return -1;
Expand Down

0 comments on commit a343157

Please sign in to comment.