Skip to content

Commit

Permalink
add ebtablesu scheme, along with general cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart De Schuymer committed Jan 19, 2005
1 parent 00bbac8 commit 6622a01
Show file tree
Hide file tree
Showing 14 changed files with 1,429 additions and 1,044 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
20051701
Since last entry:
* added ulog watcher
* made the ebtables code modular (make library functions).
* added the ebtablesd/ebtablesu scheme to allow faster
addition of rules (and to test the modular code).
* some small fixes
20031102
Since last entry:
* <grzes_at_gnu.univ.gda.pl> added arpreply and among modules
Expand Down
10 changes: 7 additions & 3 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ WHAT GETS INSTALLED?
The Makefile will append /man8/ebtables.8.
- ethertypes is by default placed in /etc/, if you
want to change this, include ETHERTYPESPATH=<<path>>.
- the userspace program ebtables is compiled and the executable is copied
by default to /usr/sbin/ebtables. If you want to put the executable
somewhere else, include BINPATH=<<path>>.
- The pipe used for communication by ebtablesd and ebtablesu is by
default the file /etc/ebtables-v$(PROGVERSION)/ebtablesd_pipe. To
change the directory, include PIPE_DIR=<<dir>>. There is no option
to change the name of the pipe.
- the userspace programs ebtables ebtablesu and ebtablesd are compiled and
the executables are copied by default to /usr/sbin/ebtables. If you want
to put the executables somewhere else, include BINPATH=<<path>>.

That's all

Expand Down
50 changes: 42 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,30 @@ KERNEL_INCLUDES?=include/
ETHERTYPESPATH?=$(ETCDIR)
ETHERTYPESFILE:=$(ETHERTYPESPATH)/ethertypes

BINFILE:=$(BINDIR)/ebtables
PIPE_DIR?=.
PIPE=$(PIPE_DIR)/ebtablesd_pipe
EBTD_CMDLINE_MAXLN?=2048
EBTD_ARGC_MAX?=50

BINFILE_EBT:=$(BINDIR)/$(PROGNAME)
BINFILE_EBTD:=$(BINDIR)/$(PROGNAME)d
BINFILE_EBTU:=$(BINDIR)/$(PROGNAME)u

PROGSPECS:=-DPROGVERSION=\"$(PROGVERSION)\" \
-DPROGNAME=\"$(PROGNAME)\" \
-DPROGDATE=\"$(PROGDATE)\" \
-D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\"

PROGSPECSD:=-DPROGVERSION=\"$(PROGVERSION)\" \
-DPROGNAME=\"$(PROGNAME)\" \
-DPROGDATE=\"$(PROGDATE)\" \
-D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\" \
-DEBTD_CMDLINE_MAXLN=$(EBTD_CMDLINE_MAXLN) \
-DEBTD_ARGC_MAX=$(EBTD_ARGC_MAX) \
-DEBTD_PIPE=\"$(PIPE)\" \
-DEBTD_PIPE_DIR=\"$(PIPE_DIR)\"

all: ebtables
all: ebtables daemon

communication.o: communication.c include/ebtables_u.h
$(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
Expand All @@ -63,11 +78,28 @@ getethertype.o: getethertype.c include/ethernetdb.h
ebtables.o: ebtables.c include/ebtables_u.h
$(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)

ebtables: $(OBJECTS)
ebtables-standalone.o: ebtables-standalone.c ebtables.c include/ebtables_u.h
$(CC) $(CFLAGS) $(PROGSPECS) -c $< ebtables.c -o $@ -I$(KERNEL_INCLUDES)

ebtables: $(OBJECTS) ebtables-standalone.o
$(LD) -shared -soname libebtc.so -o libebtc.so -lc $(OBJECTS2)
$(CC) $(CFLAGS) -o $@ ebtables.o -I$(KERNEL_INCLUDES) -L/root/ \
$(CC) $(CFLAGS) -o $@ ebtables-standalone.o -I$(KERNEL_INCLUDES) -L/root/ \
-L. -Lextensions/ -lebtc $(EXT_LIBSI)


ebtablesu: ebtablesu.c
$(CC) $(CFLAGS) $(PROGSPECSD) $< -o $@

ebtablesd.o: ebtablesd.c ebtables.c include/ebtables_u.h
$(CC) $(CFLAGS) $(PROGSPECSD) -c $< ebtables.c -o $@ -I$(KERNEL_INCLUDES)

ebtablesd: $(OBJECTS) ebtablesd.o
$(LD) -shared -soname libebtc.so -o libebtc.so -lc $(OBJECTS2)
$(CC) $(CFLAGS) -o $@ ebtablesd.o -I$(KERNEL_INCLUDES) -L/root/ \
-L. -Lextensions/ -lebtc $(EXT_LIBSI)

.PHONY: daemon
daemon: ebtablesd ebtablesu

$(MANDIR)/man8/ebtables.8: ebtables.8
mkdir -p $(@D)
install -m 0644 -o root -g root $< $@
Expand All @@ -77,9 +109,11 @@ $(ETHERTYPESFILE): ethertypes
install -m 0644 -o root -g root $< $@

.PHONY: exec
exec: ebtables
exec: ebtables daemon
mkdir -p $(BINDIR)
install -m 0755 -o root -g root $< $(BINFILE)
install -m 0755 -o root -g root $(PROGNAME) $(BINFILE_EBT)
install -m 0755 -o root -g root $(PROGNAME)d $(BINFILE_EBTD)
install -m 0755 -o root -g root $(PROGNAME)u $(BINFILE_EBTU)

.PHONY: install
install: $(MANDIR)/man8/ebtables.8 $(ETHERTYPESFILE) exec
Expand All @@ -89,7 +123,7 @@ install: $(MANDIR)/man8/ebtables.8 $(ETHERTYPESFILE) exec

.PHONY: clean
clean:
rm -f ebtables
rm -f ebtables ebtablesd ebtablesu
rm -f *.o *.c~ *.so
rm -f extensions/*.o extensions/*.c~ extensions/*.so

Expand Down
Loading

0 comments on commit 6622a01

Please sign in to comment.