| 1 | # This file is part of the FreeWRT project. FreeWRT is copyrighted
|
|---|
| 2 | # material, please see the LICENCE file in the top-level directory
|
|---|
| 3 |
|
|---|
| 4 | include $(TOPDIR)/rules.mk
|
|---|
| 5 |
|
|---|
| 6 | PKG_NAME:= iptables
|
|---|
| 7 | PKG_VERSION:= 1.8.11
|
|---|
| 8 | PKG_RELEASE:= 1
|
|---|
| 9 | PKG_MD5SUM:= 44191ce12055da9790a92429c771ba50
|
|---|
| 10 | PKG_INIT:= 45
|
|---|
| 11 |
|
|---|
| 12 | PKG_SOURCE_URL:= http://www.netfilter.org/projects/iptables/files
|
|---|
| 13 | PKG_SOURCE:= $(PKG_NAME)-$(PKG_VERSION).tar.xz
|
|---|
| 14 |
|
|---|
| 15 | define IPKG_plugin_template
|
|---|
| 16 |
|
|---|
| 17 | $$(IPKG_$(1)):
|
|---|
| 18 | install -m0755 -d $$(IDIR_$(1))/usr/lib/xtables
|
|---|
| 19 | for m in $(2); do \
|
|---|
| 20 | $(INSTALL_DATA) $(WRKINST)/usr/lib/xtables/lib$$$${m}.so $$(IDIR_$(1))/usr/lib/xtables/ ; \
|
|---|
| 21 | done
|
|---|
| 22 | @[ -z "$(3)" ] || $(MAKE) $(3)
|
|---|
| 23 | $(RSTRIP) $$(IDIR_$(1))
|
|---|
| 24 | $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
|
|---|
| 25 |
|
|---|
| 26 | endef
|
|---|
| 27 |
|
|---|
| 28 | include $(TOPDIR)/mk/package.mk
|
|---|
| 29 | include $(LINUX_DIR)/.config
|
|---|
| 30 | include $(TOPDIR)/mk/netfilter.mk
|
|---|
| 31 |
|
|---|
| 32 | $(eval $(call PKG_template,IPTABLES,iptables,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
|
|---|
| 33 | $(eval $(call PKG_template,IPTABLES_UTILS,iptables-utils,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
|
|---|
| 34 | $(eval $(call PKG_template,IPTABLES_FIREWALL_SCRIPT,iptables-firewall-script,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
|
|---|
| 35 | $(eval $(call PKG_template,IP6TABLES,ip6tables,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
|
|---|
| 36 |
|
|---|
| 37 | $(eval $(call PKG_template,IPTABLES_MOD_CONNTRACK,iptables-mod-conntrack,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
|
|---|
| 38 | $(eval $(call PKG_template,IPTABLES_MOD_EXTRA,iptables-mod-extra,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
|
|---|
| 39 | $(eval $(call PKG_template,IPTABLES_MOD_FILTER,iptables-mod-filter,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
|
|---|
| 40 | $(eval $(call PKG_template,IPTABLES_MOD_IMQ,iptables-mod-imq,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
|
|---|
| 41 | $(eval $(call PKG_template,IPTABLES_MOD_IPOPT,iptables-mod-ipopt,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
|
|---|
| 42 | $(eval $(call PKG_template,IPTABLES_MOD_IPSEC,iptables-mod-ipsec,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
|
|---|
| 43 | $(eval $(call PKG_template,IPTABLES_MOD_NAT,iptables-mod-nat,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
|
|---|
| 44 | $(eval $(call PKG_template,IPTABLES_MOD_ULOG,iptables-mod-ulog,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
|
|---|
| 45 |
|
|---|
| 46 | $(eval $(call IPKG_plugin_template,IPTABLES_MOD_CONNTRACK,$(IPT_CONNTRACK-m)))
|
|---|
| 47 | $(eval $(call IPKG_plugin_template,IPTABLES_MOD_EXTRA,$(IPT_EXTRA-m)))
|
|---|
| 48 | $(eval $(call IPKG_plugin_template,IPTABLES_MOD_FILTER,$(IPT_FILTER-m),layer7-install))
|
|---|
| 49 | $(eval $(call IPKG_plugin_template,IPTABLES_MOD_IMQ,$(IPT_IMQ-m)))
|
|---|
| 50 | $(eval $(call IPKG_plugin_template,IPTABLES_MOD_IPOPT,$(IPT_IPOPT-m)))
|
|---|
| 51 | $(eval $(call IPKG_plugin_template,IPTABLES_MOD_IPSEC,$(IPT_IPSEC-m)))
|
|---|
| 52 | $(eval $(call IPKG_plugin_template,IPTABLES_MOD_NAT,$(IPT_NAT-m)))
|
|---|
| 53 | $(eval $(call IPKG_plugin_template,IPTABLES_MOD_ULOG,$(IPT_ULOG-m)))
|
|---|
| 54 |
|
|---|
| 55 | $(WRKBUILD)/.configured:
|
|---|
| 56 | (PATH="$(TARGET_PATH)"; cd $(WRKBUILD); ./configure \
|
|---|
| 57 | --prefix=/usr \
|
|---|
| 58 | --target=$(GNU_TARGET_NAME) \
|
|---|
| 59 | --host=$(GNU_TARGET_NAME) \
|
|---|
| 60 | --build=$(GNU_HOST_NAME) \
|
|---|
| 61 | --disable-nftables \
|
|---|
| 62 | );
|
|---|
| 63 | touch $@
|
|---|
| 64 |
|
|---|
| 65 | $(WRKBUILD)/.built:
|
|---|
| 66 | $(MAKE) -C $(WRKBUILD) \
|
|---|
| 67 | $(TARGET_CONFIGURE_OPTS) \
|
|---|
| 68 | CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \
|
|---|
| 69 | KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
|
|---|
| 70 | DESTDIR="$(WRKINST)" \
|
|---|
| 71 | all install
|
|---|
| 72 | touch $@
|
|---|
| 73 |
|
|---|
| 74 | $(IPKG_IPTABLES):
|
|---|
| 75 | $(INSTALL_DIR) $(IDIR_IPTABLES)/usr/sbin
|
|---|
| 76 | $(INSTALL_DIR) $(IDIR_IPTABLES)/usr/lib/xtables
|
|---|
| 77 | $(INSTALL_BIN) $(WRKINST)/usr/sbin/iptables $(IDIR_IPTABLES)/usr/sbin/
|
|---|
| 78 | $(CP) $(WRKINST)/usr/lib/libxtables*.so* $(IDIR_IPTABLES)/usr/lib/
|
|---|
| 79 | $(CP) $(WRKINST)/usr/lib/libip4tc.so* $(IDIR_IPTABLES)/usr/lib/
|
|---|
| 80 | $(CP) $(WRKINST)/usr/lib/libip6tc.so* $(IDIR_IPTABLES)/usr/lib/
|
|---|
| 81 | (cd $(WRKINST)/usr/lib/xtables ; \
|
|---|
| 82 | $(INSTALL_DATA) libxt_standard.so libxt_tcp.so libxt_udp.so $(IDIR_IPTABLES)/usr/lib/xtables/ \
|
|---|
| 83 | )
|
|---|
| 84 | $(RSTRIP) $(IDIR_IPTABLES)
|
|---|
| 85 | $(IPKG_BUILD) $(IDIR_IPTABLES) $(PACKAGE_DIR)
|
|---|
| 86 |
|
|---|
| 87 | $(IPKG_IPTABLES_FIREWALL_SCRIPT):
|
|---|
| 88 | $(INSTALL_DIR) $(IDIR_IPTABLES_FIREWALL_SCRIPT)/etc/init.d
|
|---|
| 89 | $(INSTALL_BIN) ./files/firewall.init $(IDIR_IPTABLES_FIREWALL_SCRIPT)/etc/init.d/S$(PKG_INIT)firewall
|
|---|
| 90 | $(INSTALL_BIN) -m0644 ./files/firewall.conf $(IDIR_IPTABLES_FIREWALL_SCRIPT)/etc/
|
|---|
| 91 | $(IPKG_BUILD) $(IDIR_IPTABLES_FIREWALL_SCRIPT) $(PACKAGE_DIR)
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 | $(IPKG_IPTABLES_UTILS):
|
|---|
| 95 | $(INSTALL_DIR) $(IDIR_IPTABLES_UTILS)/usr/sbin
|
|---|
| 96 | $(INSTALL_BIN) $(WRKINST)/usr/sbin/iptables-{save,restore} $(IDIR_IPTABLES_UTILS)/usr/sbin/
|
|---|
| 97 | $(RSTRIP) $(IDIR_IPTABLES_UTILS)
|
|---|
| 98 | $(IPKG_BUILD) $(IDIR_IPTABLES_UTILS) $(PACKAGE_DIR)
|
|---|
| 99 |
|
|---|
| 100 | $(IPKG_IP6TABLES):
|
|---|
| 101 | $(INSTALL_DIR) $(IDIR_IP6TABLES)/usr/sbin
|
|---|
| 102 | $(INSTALL_DIR) $(IDIR_IP6TABLES)/usr/lib/iptables
|
|---|
| 103 | $(INSTALL_BIN) $(WRKINST)/usr/sbin/ip6tables $(IDIR_IP6TABLES)/usr/sbin/
|
|---|
| 104 | (cd $(WRKINST)/usr/lib/xtables ; \
|
|---|
| 105 | $(INSTALL_DATA) libip6t_*.so $(IDIR_IP6TABLES)/usr/lib/xtables/ \
|
|---|
| 106 | )
|
|---|
| 107 | $(RSTRIP) $(IDIR_IP6TABLES)
|
|---|
| 108 | $(IPKG_BUILD) $(IDIR_IP6TABLES) $(PACKAGE_DIR)
|
|---|
| 109 |
|
|---|
| 110 | layer7-install:
|
|---|
| 111 | $(INSTALL_DIR) $(IDIR_IPTABLES_MOD_FILTER)/etc/l7-protocols
|
|---|
| 112 | $(INSTALL_DATA) files/l7/*.pat $(IDIR_IPTABLES_MOD_FILTER)/etc/l7-protocols/
|
|---|