diff mbox

[v4,4/6] linux-generic: odp-ipfw: Initial changes to compile uipfw in odp

Message ID 1458582581-21827-1-git-send-email-venkatesh.vivekanandan@linaro.org
State New
Headers show

Commit Message

Venkatesh Vivekanandan March 21, 2016, 5:49 p.m. UTC
From: Venkatesh Vivekanandan <venkatesh.vivekanandan@linaro.org>

- created example/ipfw/Makefile.am
- changes done in example/m4/configure.m4
- uipfw is the same as netmap-ipfw's kipfw
- odp_uipfw runs in userspace to receive/send packets from network
  interface. This is mostly like a forwarding application, that forwards
  traffic from one port to other port after running through a set of rules.

Signed-off-by: Venkatesh Vivekanandan <venkatesh.vivekanandan@linaro.org>
---
 example/Makefile.am      |   2 +-
 example/ipfw/Makefile.am | 113 +++++++++++++++++++++++++++++++++++++++++++++++
 example/m4/configure.m4  |   3 +-
 3 files changed, 116 insertions(+), 2 deletions(-)
 create mode 100644 example/ipfw/Makefile.am
diff mbox

Patch

diff --git a/example/Makefile.am b/example/Makefile.am
index 33556da..2dea019 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -1,2 +1,2 @@ 
 SUBDIRS = classifier generator ipsec packet time timer traffic_mgmt \
-	l2fwd_simple ipfw/ipfw
+	l2fwd_simple ipfw/ipfw ipfw
diff --git a/example/ipfw/Makefile.am b/example/ipfw/Makefile.am
new file mode 100644
index 0000000..a37d00b
--- /dev/null
+++ b/example/ipfw/Makefile.am
@@ -0,0 +1,113 @@ 
+OBJDIR=objs
+# ipfw and uipfw are built in subdirs
+INCDIRS  = -I ./$(OBJDIR)/include_e -DEMULATE_SYSCTL
+INCDIRS += -I ./sys -I ./extra/sys -I ./extra/sys/contrib/pf -I../../include
+# ODP specific start
+INCDIRS += -I$(top_srcdir)/test \
+           -I$(top_srcdir)/platform/@with_platform@/include \
+           -I$(top_srcdir)/include \
+           -I$(top_srcdir)/helper/include
+# ODP specific end
+
+
+OBJPATH = ./$(OBJDIR)
+
+# EFILES* are the dummy files created to avoid compilation errors.
+# Please refer Makefile.kipfw available at
+# https://github.com/luigirizzo/netmap-ipfw.git
+
+#EFILES_.         = libutil.h
+#EFILES_sys       = condvar.h priv.h _lock.h cpuset.h
+#EFILES_sys      += lock.h ucred.h # taskqueue.h
+#EFILES_sys      += sockio.h
+#EFILES_sys      += cpuset.h
+#EFILES_machine   = in_cksum.h
+#EFILES_netinet   = in_pcb.h ip_carp.h pim.h sctp.h tcp_var.h
+#EFILES_net       = if_types.h bpf.h netisr.h vnet.h
+#EFILES_linux     = module.h
+
+E_CFLAGS = $(INCDIRS)
+E_CFLAGS += -include ./extra/glue.h	# headers
+E_CFLAGS += -include ./extra/missing.h	# headers
+E_CFLAGS += -O2 -Wall -Werror
+E_CFLAGS += -fno-strict-aliasing
+E_CFLAGS += -Wno-variadic-macros
+E_CFLAGS += -Wno-pointer-arith
+E_CFLAGS += -g
+E_CFLAGS += -DKERNEL_SIDE	# build the kernel side of the firewall
+E_CFLAGS += -DUSERSPACE		# communicate through userspace
+E_CFLAGS += -DINET
+E_CFLAGS += -DIPFIREWALL_DEFAULT_TO_ACCEPT
+E_CFLAGS += -D_BSD_SOURCE
+E_CFLAGS += -D_DEFAULT_SOURCE # on glibc 2.20 and above
+# many of the kernel headers need _KERNEL
+E_CFLAGS += -D_KERNEL
+E_CFLAGS += -D__BSD_VISIBLE
+E_CFLAGS += -D_GNU_SOURCE # ffsl
+E_CFLAGS += -DNEED_SIN_LEN
+E_CFLAGS += -include ./extra/linux_defs.h
+E_CFLAGS += -Wno-unused-but-set-variable
+E_CFLAGS += -Wno-unused
+E_CFLAGS += -Dradix -DNEED_ROUNDUP2
+
+#ipfw + dummynet section, other parts are not compiled in
+SRCS_NET         = sys/net/radix.c
+SRCS_NETINET     = sys/netinet/in_cksum.c
+SRCS_IPFW        = sys/netpfil/ipfw/dn_heap.c
+SRCS_IPFW       += sys/netpfil/ipfw/dn_sched_fifo.c
+SRCS_IPFW       += sys/netpfil/ipfw/dn_sched_prio.c
+SRCS_IPFW       += sys/netpfil/ipfw/dn_sched_qfq.c
+SRCS_IPFW       += sys/netpfil/ipfw/dn_sched_rr.c
+SRCS_IPFW       += sys/netpfil/ipfw/dn_sched_wf2q.c
+SRCS_IPFW       += sys/netpfil/ipfw/ip_dn_glue.c
+SRCS_IPFW       += sys/netpfil/ipfw/ip_dn_io.c
+SRCS_IPFW       += sys/netpfil/ipfw/ip_dummynet.c
+SRCS_IPFW       += sys/netpfil/ipfw/ip_fw2.c
+SRCS_IPFW       += sys/netpfil/ipfw/ip_fw_dynamic.c
+SRCS_IPFW       += sys/netpfil/ipfw/ip_fw_iface.c
+SRCS_IPFW       += sys/netpfil/ipfw/ip_fw_log.c
+SRCS_IPFW       += sys/netpfil/ipfw/ip_fw_pfil.c
+SRCS_IPFW       += sys/netpfil/ipfw/ip_fw_sockopt.c
+SRCS_IPFW       += sys/netpfil/ipfw/ip_fw_table.c
+SRCS_IPFW       += sys/netpfil/ipfw/ip_fw_table_algo.c
+SRCS_IPFW       += sys/netpfil/ipfw/ip_fw_table_value.c
+# Module glue and functions missing in linux
+IPFW_SRCS       = $(SRCS_NET) $(SRCS_NETINET) $(SRCS_IPFW)
+IPFW_SRCS += extra/ipfw2_mod.c # bsd_compat.c
+
+IPFW_SRCS += extra/missing.c extra/session.c
+
+# entries to create empty files
+#EFILES_.        += opt_inet.h opt_ipsec.h opt_ipdivert.h
+#EFILES_.        += opt_inet6.h opt_ipfw.h opt_mpath.h
+#EFILES_.        += opt_mbuf_stress_test.h opt_param.h
+#EFILES_.        += timeconv.h
+
+#EFILES_altq     += if_altq.h
+
+#EFILES_net      += if_var.h route.h if_clone.h
+#EFILES_netpfil/pf       += pf_mtag.h
+#EFILES_netinet  += in_var.h ip_var.h udp_var.h
+#EFILES_netinet6 += ip6_var.h
+#EFILES_sys      += proc.h sockopt.h sysctl.h
+# new
+#EFILES_sys      += mutex.h _mutex.h _rwlock.h rwlock.h
+#EFILES_sys      += eventhandler.h
+#EFILES_sys      += jail.h ktr.h rmlock.h
+#EFILES_sys      += counter.h
+
+#EFILES_vm       += vm.h vm_extern.h
+
+AM_CFLAGS  = $(E_CFLAGS)
+AM_CFLAGS += -I$(top_srcdir)/platform/$(with_platform)/arch/$(ARCH)
+
+AM_LDFLAGS += ../../lib/.libs/libodp.a ../../lib/.libs/libodphelper.a -lpthread
+
+bin_PROGRAMS = odp_uipfw$(EXEEXT)
+odp_uipfw_LDFLAGS = $(AM_LDFLAGS) -static
+odp_uipfw_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example
+
+noinst_HEADERS = \
+		  $(top_srcdir)/example/example_debug.h
+
+dist_odp_uipfw_SOURCES = $(IPFW_SRCS)
diff --git a/example/m4/configure.m4 b/example/m4/configure.m4
index ebe38ec..4d9c893 100644
--- a/example/m4/configure.m4
+++ b/example/m4/configure.m4
@@ -7,4 +7,5 @@  AC_CONFIG_FILES([example/classifier/Makefile
 		 example/timer/Makefile
 		 example/traffic_mgmt/Makefile
 		 example/l2fwd_simple/Makefile
-		 example/ipfw/ipfw/Makefile])
+		 example/ipfw/ipfw/Makefile
+		 example/ipfw/Makefile])