--- .gitignore | 23 +++++- INSTALL | 71 ++++++----------- Makefile | 214 -------------------------------------------------- Makefile.am | 76 ++++++++++++++++++ autogen.sh | 4 + configure.ac | 23 ++++++ m4/.gitignore | 2 + 7 files changed, 149 insertions(+), 264 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 m4/.gitignore diff --git a/.gitignore b/.gitignore index d2fc36e..1fff83c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,28 @@ -*.o +*.a +*.la +*.lo *.so +*.o +.deps/ +.dirstamp +.libs/ +Makefile +Makefile.in + +/aclocal.m4 +/autom4te.cache/ +/build-aux/ +/config.* +/configure +/libtool +/stamp-h1 + /ebtables +/ebtables-config /ebtables-restore +/ebtables-save +/ebtables.8 +/ebtables.sysv /ebtablesd /ebtablesu /static diff --git a/INSTALL b/INSTALL index e90d5c1..c43d95c 100644 --- a/INSTALL +++ b/INSTALL @@ -1,63 +1,36 @@ -FOLLOW THESE SIMPLE GUIDELINES: -------------------------------- +Installation instructions for iptables +====================================== -Compiling the source code: -%make -Put the files in the right directories: -%make install +ebtables uses the well-known configure(autotools) infrastructure. -If you are using the CVS code or need your own kernel includes, do this -instead (change the include directory to the appropriate one): -%make install KERNEL_INCLUDES=/usr/src/linux/include + $ ./configure + $ make + # make install -If you want to make a static binary for ebtables, containing all the -extensions, without shared libraries, do this (this will make a -binary called 'static', which you can rename): -%make static -WHAT GETS INSTALLED AND WHAT OPTIONS ARE AVAILABLE? ---------------------------------------------------- +Prerequisites +============= -- The ebtables manual gets installed in /usr/local/man/man8 - To put the manual somewhere else, include MANDIR=<<man-path/man>> as - option on the command line. - 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 programs ebtables ebtables-save and ebtables-restore are - are copied by default to /usr/local/sbin/ebtables. If you want to put - the executables somewhere else, include BINPATH=<<path>>. -- The ebtables initialisation file (enabling use of 'service ebtables') is - copied to /etc/rc.d/init.d (change with option INITDIR) -- The ebtables configuration file (ebtables-config) is copied to /etc/sysconfig -- ebtables can use a lock file to enable concurrent execution of the ebtables - tool. The standard location of the lock file is /var/lib/ebtables/lock. - Include LOCKFILE=<<path-to-file>> if you want to use another file. + * no kernel-source required -That's all + * but obviously a compiler, glibc-devel and linux-kernel-headers + (/usr/include/linux) -You can also use a base directory different from the root directory (/), -using the DESTDIR option. See the Makefile for more details. -You might need to set LDFLAGS=-Wl,-no-as-needed to build ebtables correctly -on your system. +Configuring and compiling +========================= -ADDITIONAL PROGRAMS: ----------------------- --- examples/ulog/test_ulog.c -- +./configure [options] -Contains an example to receive and parse netlink messages containing -packets seen by the ebtables ulog watcher. +--prefix= -Compile with: -%make test_ulog KERNEL_INCLUDES=/usr/src/linux/include + The prefix to put all installed files under. It defaults to + /usr/local, so the binaries will go into /usr/local/bin, sbin, + manpages into /usr/local/share/man, etc. -Usage: -%examples/ulog/test_ulog NETLINK_GROUP -%ebtables -A chain --ulog-nlgroup NETLINK_GROUP +If you want to enable debugging, use --- examples/perf_test/perf_test -- + ./configure CFLAGS="-ggdb3 -O0" CPPFLAGS="-DEBT_DEBUG" -A test script to compare the performance for the different ways to -construct an ebtables table. This is deprecated and should probably -be ignored. +(-O0 is used to turn off instruction reordering, which makes debugging +much easier.) diff --git a/Makefile b/Makefile deleted file mode 100644 index 4d7b10f..0000000 --- a/Makefile +++ /dev/null @@ -1,214 +0,0 @@ -# ebtables Makefile - -PROGNAME:=ebtables -PROGRELEASE:=4 -PROGVERSION_:=2.0.10 -PROGVERSION:=$(PROGVERSION_)-$(PROGRELEASE) -PROGDATE:=December\ 2011 -LOCKFILE?=/var/lib/ebtables/lock -LOCKDIR:=$(shell echo $(LOCKFILE) | sed 's/\(.*\)\/.*/\1/')/ - -# default paths -LIBDIR:=/usr/lib -MANDIR:=/usr/local/man -BINDIR:=/usr/local/sbin -ETCDIR:=/etc -INITDIR:=/etc/rc.d/init.d -SYSCONFIGDIR:=/etc/sysconfig -DESTDIR:= - -CFLAGS:=-Wall -Wunused -Werror -CFLAGS_SH_LIB:=-fPIC -O3 -CC:=gcc - -ifeq ($(shell uname -m),sparc64) -CFLAGS+=-DEBT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32 -endif - -include extensions/Makefile - -OBJECTS2:=getethertype.o communication.o libebtc.o \ -useful_functions.o ebtables.o - -OBJECTS:=$(OBJECTS2) $(EXT_OBJS) $(EXT_LIBS) - -KERNEL_INCLUDES?=include/ - -ETHERTYPESPATH?=$(ETCDIR) -ETHERTYPESFILE:=$(ETHERTYPESPATH)/ethertypes - -PIPE_DIR?=/tmp/$(PROGNAME)-v$(PROGVERSION) -PIPE=$(PIPE_DIR)/ebtablesd_pipe -EBTD_CMDLINE_MAXLN?=2048 -EBTD_ARGC_MAX?=50 - -PROGSPECS:=-DPROGVERSION=\"$(PROGVERSION)\" \ - -DPROGNAME=\"$(PROGNAME)\" \ - -DPROGDATE=\"$(PROGDATE)\" \ - -D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\" \ - -DEBTD_ARGC_MAX=$(EBTD_ARGC_MAX) \ - -DEBTD_CMDLINE_MAXLN=$(EBTD_CMDLINE_MAXLN) \ - -DLOCKFILE=\"$(LOCKFILE)\" \ - -DLOCKDIR=\"$(LOCKDIR)\" - -# You can probably ignore this, ebtables{u,d} are normally not used -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)\" - -# Uncomment for debugging (slower) -#PROGSPECS+=-DEBT_DEBUG -#PROGSPECSD+=-DEBT_DEBUG -#CFLAGS+=-ggdb - -all: ebtables ebtables-restore - -communication.o: communication.c include/ebtables_u.h - $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) - -libebtc.o: libebtc.c include/ebtables_u.h - $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) - -useful_functions.o: useful_functions.c include/ebtables_u.h - $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) - -getethertype.o: getethertype.c include/ethernetdb.h - $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -Iinclude/ - -ebtables.o: ebtables.c include/ebtables_u.h - $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) - -ebtables-standalone.o: ebtables-standalone.c include/ebtables_u.h - $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c $< -o $@ -I$(KERNEL_INCLUDES) - -libebtc.so: $(OBJECTS2) - $(CC) -shared $(LDFLAGS) -Wl,-soname,libebtc.so -o libebtc.so -lc $(OBJECTS2) - -ebtables: $(OBJECTS) ebtables-standalone.o libebtc.so - $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(LDFLAGS) -o $@ ebtables-standalone.o -I$(KERNEL_INCLUDES) -L. -Lextensions -lebtc $(EXT_LIBSI) \ - -Wl,-rpath,$(LIBDIR) - -ebtablesu: ebtablesu.c - $(CC) $(CFLAGS) $(PROGSPECSD) $< -o $@ - -ebtablesd.o: ebtablesd.c include/ebtables_u.h - $(CC) $(CFLAGS) $(PROGSPECSD) -c $< -o $@ -I$(KERNEL_INCLUDES) - -ebtablesd: $(OBJECTS) ebtablesd.o libebtc.so - $(CC) $(CFLAGS) -o $@ ebtablesd.o -I$(KERNEL_INCLUDES) -L. -Lextensions -lebtc $(EXT_LIBSI) \ - -Wl,-rpath,$(LIBDIR) - -ebtables-restore.o: ebtables-restore.c include/ebtables_u.h - $(CC) $(CFLAGS) $(PROGSPECS) -c $< -o $@ -I$(KERNEL_INCLUDES) - -ebtables-restore: $(OBJECTS) ebtables-restore.o libebtc.so - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ebtables-restore.o -I$(KERNEL_INCLUDES) -L. -Lextensions -lebtc $(EXT_LIBSI) \ - -Wl,-rpath,$(LIBDIR) - -.PHONY: daemon -daemon: ebtablesd ebtablesu - -# a little scripting for a static binary, making one for ebtables-restore -# should be completely analogous -static: extensions/ebt_*.c extensions/ebtable_*.c ebtables.c communication.c ebtables-standalone.c getethertype.c libebtc.c useful_functions.c - $(CC) $(CFLAGS) $(LDFLAGS) $(PROGSPECS) -o $@ $^ -I$(KERNEL_INCLUDES) -Iinclude - -tmp1:=$(shell printf $(BINDIR) | sed 's/\//\\\//g') -tmp2:=$(shell printf $(SYSCONFIGDIR) | sed 's/\//\\\//g') -tmp3:=$(shell printf $(PIPE) | sed 's/\//\\\//g') -.PHONY: scripts -scripts: ebtables-save.in ebtables.sysv.in ebtables-config.in - sed -e 's/[@]sbindir@/$(tmp1)/g' <ebtables-save.in >ebtables-save_ - mkdir -p $(DESTDIR)$(BINDIR) - install -m 0755 ebtables-save_ $(DESTDIR)$(BINDIR)/ebtables-save - sed -e 's/[@]sbindir@/$(tmp1)/g' -e 's/[@]sysconfigdir@/$(tmp2)/g' <ebtables.sysv.in >ebtables.sysv_ - if [ "$(DESTDIR)" != "" ]; then mkdir -p $(DESTDIR)$(INITDIR); fi - if test -d $(DESTDIR)$(INITDIR); then install -m 0755 ebtables.sysv_ $(DESTDIR)$(INITDIR)/ebtables; fi - sed -e 's/[@]sysconfigdir@/$(tmp2)/g' <ebtables-config >ebtables-config_ - if [ "$(DESTDIR)" != "" ]; then mkdir -p $(DESTDIR)$(SYSCONFIGDIR); fi - if test -d $(DESTDIR)$(SYSCONFIGDIR); then install -m 0600 ebtables-config_ $(DESTDIR)$(SYSCONFIGDIR)/ebtables-config; fi - rm -f ebtables-save_ ebtables.sysv_ ebtables-config_ - -tmp4:=$(shell printf $(LOCKFILE) | sed 's/\//\\\//g') -$(MANDIR)/man8/ebtables.8: ebtables.8.in - mkdir -p $(DESTDIR)$(@D) - sed -e 's/[@]PACKAGE_VERSION@/$(PROGVERSION)/' -e 's/[@]PACKAGE_DATE@/$(PROGDATE)/' -e 's/[@]LOCKFILE@/$(tmp4)/' <$< >ebtables.8_ - install -m 0644 ebtables.8_ $(DESTDIR)$@ - rm -f ebtables.8_ - -$(DESTDIR)$(ETHERTYPESFILE): ethertypes - mkdir -p $(@D) - install -m 0644 $< $@ - -.PHONY: exec -exec: ebtables ebtables-restore - mkdir -p $(DESTDIR)$(BINDIR) - install -m 0755 $(PROGNAME) $(DESTDIR)$(BINDIR)/$(PROGNAME) - install -m 0755 ebtables-restore $(DESTDIR)$(BINDIR)/ebtables-restore - -.PHONY: install -install: $(MANDIR)/man8/ebtables.8 $(DESTDIR)$(ETHERTYPESFILE) exec scripts - mkdir -p $(DESTDIR)$(LIBDIR) - install -m 0755 extensions/*.so $(DESTDIR)$(LIBDIR) - install -m 0755 *.so $(DESTDIR)$(LIBDIR) - -.PHONY: clean -clean: - rm -f ebtables ebtables-restore ebtablesd ebtablesu static - rm -f *.o *~ *.so - rm -f extensions/*.o extensions/*.c~ extensions/*.so include/*~ - -DIR:=$(PROGNAME)-v$(PROGVERSION) -CVSDIRS:=CVS extensions/CVS examples/CVS examples/perf_test/CVS \ -examples/ulog/CVS include/CVS -# This is used to make a new userspace release, some files are altered so -# do this on a temporary version -.PHONY: release -release: - rm -f extensions/ebt_inat.c - rm -rf $(CVSDIRS) - mkdir -p include/linux/netfilter_bridge - install -m 0644 \ - $(KERNEL_INCLUDES)/linux/netfilter_bridge.h include/linux/ -# To keep possible compile error complaints about undefined ETH_P_8021Q -# off my back - install -m 0644 \ - $(KERNEL_INCLUDES)/linux/if_ether.h include/linux/ - install -m 0644 \ - $(KERNEL_INCLUDES)/linux/types.h include/linux/ - install -m 0644 \ - $(KERNEL_INCLUDES)/linux/netfilter_bridge/*.h \ - include/linux/netfilter_bridge/ - install -m 0644 \ - include/ebtables.h include/linux/netfilter_bridge/ - make clean - touch * - touch extensions/* - touch include/* - touch include/linux/* - touch include/linux/netfilter_bridge/* - sed -i -e 's/$$(VERSION)/$(PROGVERSION)/' -e 's/$$(DATE)/$(PROGDATE)/' -e 's/$$(LOCKFILE)/$(tmp4)/' <ebtables.8.in >ebtables.8 - sed -i -e 's/$$(VERSION)/$(PROGVERSION_)/' -e 's/$$(RELEASE)/$(PROGRELEASE)/' ebtables.spec - cd ..;tar -c $(DIR) | gzip >$(DIR).tar.gz; cd - - rm -rf include/linux - -# This will make the rpm and put it in /usr/src/redhat/RPMS -# (do this as root after make release) -.PHONY: rpmbuild -rpmbuild: - cp ../$(DIR).tar.gz /usr/src/redhat/SOURCES/ - rpmbuild --buildroot $(shell mktemp -td $(DIR)-XXXXX) -bb ebtables.spec - -.PHONY: test_ulog -test_ulog: examples/ulog/test_ulog.c getethertype.o - $(CC) $(CFLAGS) $< -o test_ulog -I$(KERNEL_INCLUDES) -lc \ - getethertype.o - mv test_ulog examples/ulog/ - -.PHONY: examples -examples: test_ulog diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..14938fe --- /dev/null +++ b/Makefile.am @@ -0,0 +1,76 @@ +# -*- Makefile -*- + +# For debugging, use ./configure CPPFLAGS=-DEBT_DEBUG CFLAGS="-O0 -ggdb3" + +PROGNAME = ${PACKAGE_NAME} +PROGVERSION = ${PACKAGE_VERSION} +PROGDATE = December\ 2011 +LOCKDIR = /var/lib/ebtables +LOCKFILE = ${LOCKDIR}/lock +INITDIR = /etc/rc.d/init.d +initddir = ${INITDIR} +sysconfigdir = ${sysconfdir}/sysconfig +EBTD_CMDLINE_MAXLN = 2048 +EBTD_ARGC_MAX = 50 +PIPE_DIR = /tmp/${PACKAGE_NAME}-v${PROGVERSION} +PIPE = ${PIPE_DIR}/ebtablesd_pipe + + +ACLOCAL_AMFLAGS = -I m4 +AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_srcdir}/include \ + -DPROGVERSION=\"${PACKAGE_VERSION}\" -DPROGNAME=\"${PACKAGE_NAME}\" \ + -DPROGDATE=\"${PROGDATE}\" \ + -D_PATH_ETHERTYPES=\"${sysconfdir}/ethertypes\" \ + -DLOCKFILE=\"${LOCKFILE}\" -DLOCKDIR=\"${LOCKDIR}\" \ + -DEBTD_ARGC_MAX=${EBTD_ARGC_MAX} -DEBTD_CMDLINE_MAXLN=${EBTD_CMDLINE_MAXLN} \ + -DEBTD_PIPE=\"${PIPE}\" -DEBTD_PIPE_DIR=\"${PIPE_DIR}\" +AM_CFLAGS = ${regular_CFLAGS} + +sbin_PROGRAMS = ebtables ebtablesd ebtablesu ebtables-restore +EXTRA_PROGRAMS = static examples/ulog/test_ulog +sysconf_DATA = ethertypes +sbin_SCRIPTS = ebtables-save +man8_MANS = ebtables.8 +lib_LTLIBRARIES = libebtc.la + +libebtc_la_SOURCES = \ + communication.c ebtables.c getethertype.c \ + libebtc.c useful_functions.c \ + extensions/ebt_802_3.c extensions/ebt_among.c extensions/ebt_arp.c \ + extensions/ebt_arpreply.c extensions/ebt_ip.c extensions/ebt_ip6.c \ + extensions/ebt_limit.c extensions/ebt_log.c extensions/ebt_mark.c \ + extensions/ebt_mark_m.c extensions/ebt_nat.c extensions/ebt_nflog.c \ + extensions/ebt_pkttype.c extensions/ebt_redirect.c \ + extensions/ebt_standard.c extensions/ebt_stp.c extensions/ebt_string.c \ + extensions/ebt_ulog.c extensions/ebt_vlan.c \ + extensions/ebtable_broute.c extensions/ebtable_filter.c \ + extensions/ebtable_nat.c +# Make sure ebtables.c can be built twice +libebtc_la_CPPFLAGS = ${AM_CPPFLAGS} +ebtables_SOURCES = ebtables-standalone.c +ebtables_LDADD = libebtc.la +ebtablesd_LDADD = libebtc.la +ebtables_restore_LDADD = libebtc.la +static_SOURCES = ebtables.c +static_LDFLAGS = -static +static_LDADD = libebtc.la +examples_ulog_test_ulog_SOURCES = examples/ulog/test_ulog.c getethertype.c + +daemon: ebtablesd ebtablesu +exec: ebtables ebtables-restore + +CLEANFILES = ebtables-save ebtables.sysv ebtables-config ebtables.8 + +ebtables-save: ebtables-save.in ${top_builddir}/config.status + ${AM_V_GEN}sed -e 's![@]sbindir@!${sbindir}!g' <$< >$@ + +ebtables.sysv: ebtables.sysv.in ${top_builddir}/config.status + ${AM_V_GEN}sed -e 's![@]sbindir@!${sbindir}!g' -e 's![@]sysconfigdir@!${sysconfigdir}!g' <$< >$@ + +ebtables-config: ebtables-config.in ${top_builddir}/config.status + ${AM_V_GEN}sed -e 's![@]sysconfigdir@!${sysconfigdir}!g' <$< >$@ + +ebtables.8: ebtables.8.in ${top_builddir}/config.status + ${AM_V_GEN}sed -e 's![@]PACKAGE_VERSION!${PACKAGE_VERSION}!g' \ + -e 's![@]PACKAGE_DATE@!${PROGDATE}!g' \ + -e 's![@]LOCKFILE@!${LOCKFILE}!g' <$< >$@ diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..a0c4395 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,4 @@ +#!/bin/sh -e + +autoreconf -fi; +rm -Rf autom4te*.cache; diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..a3bc3c9 --- /dev/null +++ b/configure.ac @@ -0,0 +1,23 @@ +AC_INIT([ebtables], [2.0.10.4]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) +AC_PROG_INSTALL +AM_INIT_AUTOMAKE([-Wall foreign subdir-objects tar-pax]) +AC_PROG_CC +AM_PROG_CC_C_O +AC_DISABLE_STATIC +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) +AM_PROG_LIBTOOL + +regular_CFLAGS="-Wall -Wunused" +regular_CPPFLAGS="" +case "$host" in + sparc64-*) + regular_CPPFLAGS="$regular_CPPFLAGS -DEBT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32";; +esac + +AC_SUBST([regular_CFLAGS]) +AC_SUBST([regular_CPPFLAGS]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/m4/.gitignore b/m4/.gitignore new file mode 100644 index 0000000..64d9bbc --- /dev/null +++ b/m4/.gitignore @@ -0,0 +1,2 @@ +/libtool.m4 +/lt*.m4 -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html