This package contains:
- ipvsadm utility to configure IP VS tables, virtual and real servers

Dependencies:
- ipvs kernel modules configuration

Signed-off-by: Mauro Mozzarelli <ma...@ezplanet.net>

diff --git a/package/network/utils/ipvsadm/Makefile 
b/package/network/utils/ipvsadm/Makefile
new file mode 100644
index 0000000..1eeca83
--- /dev/null
+++ b/package/network/utils/ipvsadm/Makefile
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2016 OpenWrt, Mauro Mozzarelli
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# AUTHOR: Mauro Mozzarelli <ma...@ezplanet.net>
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ipvsadm
+PKG_VERSION:=1.28
+PKG_MAINTAINER:=Mauro Mozzarelli <ma...@ezplanet.net>
+PKG_LICENSE:=GPL-1.0
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://www.kernel.org/pub/linux/utils/kernel/ipvsadm/
+PKG_MD5SUM:=b2c8fa302d5a9e9ebd4f60dd34aecd83
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/$(PKG_NAME)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=IP Virtual Server Configuration Manager
+  URL:=http://www.linuxvirtualserver.org
+  DEPENDS:= +kmod-nf-ipvs +libnl-tiny +libpopt
+endef
+
+define Package/$(PKG_NAME)/description
+  IPVS (IP Virtual Server) implements transport-layer load balancing inside 
the Linux kernel, so called
Layer-4 switching.
+  ipvsadm is used to set up, maintain or inspect the virtual server table in 
the Linux kernel.
+  The Linux Virtual Server can be used to build scalable network services 
based on a cluster of two or more
nodes.
+endef
+
+TARGET_CFLAGS += \
+       -I$(STAGING_DIR)/usr/include/libnl-tiny
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS)" \
+       LIBS="-lnl-tiny -lpopt" \
+       CROSS_COMPILE=wrt
+
+define Package/$(PKG_NAME)/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ipvsadm $(1)/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ipvsadm-save $(1)/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ipvsadm-restore $(1)/sbin/
+endef
+
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/package/network/utils/ipvsadm/patches/001-Makefile.patch
b/package/network/utils/ipvsadm/patches/001-Makefile.patch
new file mode 100644
index 0000000..cd146e7
--- /dev/null
+++ b/package/network/utils/ipvsadm/patches/001-Makefile.patch
@@ -0,0 +1,75 @@
+diff -Naur ipvsadm-1.28/libipvs/Makefile ipvsadm-1.28.owrt/libipvs/Makefile
+--- ipvsadm-1.28/libipvs/Makefile      2015-02-09 05:26:39.000000000 +0000
++++ ipvsadm-1.28.owrt/libipvs/Makefile 2016-03-06 13:37:43.689116242 +0000
+@@ -1,4 +1,7 @@
+ # Makefile for libipvs
++#
++#      ChangeLog
++#      M. Mozzarelli  :   Added CROSS_COMPILE parameter (supports wrt)
+
+ CC            = gcc
+ CFLAGS                = -Wall -Wunused -Wstrict-prototypes -g -fPIC
+@@ -23,6 +26,10 @@
+                        elif pkg-config --exists libnl-1; \
+                        then echo "-DFALLBACK_LIBNL1"; fi; fi)
+
++ifeq "${CROSS_COMPILE}" "wrt"
++      DEFINES += -fPIC -DLIBIPVS_USE_NL -D_GNU_SOURCE
++endif
++
+ .PHONY                = all clean install dist distclean rpm rpms
+ STATIC_LIB    = libipvs.a
+ SHARED_LIB    = libipvs.so
+diff -Naur ipvsadm-1.28/Makefile ipvsadm-1.28.owrt/Makefile
+--- ipvsadm-1.28/Makefile      2015-02-09 05:26:39.000000000 +0000
++++ ipvsadm-1.28.owrt/Makefile 2016-03-06 13:37:33.649230267 +0000
+@@ -10,7 +10,10 @@
+ #      This file:
+ #
+ #      ChangeLog
+-#
++#
++#      M. Mozzarelli  :   Added support for DESTDIR for automated build
++#                     :   Added CROSS_COMPILE parameter (supports wrt)
++#                     :   Amended to use $(MAKE) for compatibility
+ #      Wensong        :   Modified the Makefile and the spec files so
+ #                     :   that rpms can be created with ipvsadm alone
+ #      P.Copeland     :   Modified the Makefile and the spec files so
+@@ -37,6 +40,9 @@
+
+ CC            = gcc
+ INCLUDE               =
++ifneq (0,$(DESTDIR))
++BUILD_ROOT  = $(DESTDIR)
++endif
+ SBIN          = $(BUILD_ROOT)/sbin
+ MANDIR                = usr/man
+ MAN           = $(BUILD_ROOT)/$(MANDIR)/man8
+@@ -77,14 +83,16 @@
+                 -DPE_LIST=\"$(PE_LIST)\" $(POPT_DEFINE)
+ DEFINES               += $(shell if [ ! -f ../ip_vs.h ]; then \
+                    echo "-DHAVE_NET_IP_VS_H"; fi;)
+-
++ifeq "${CROSS_COMPILE}" "wrt"
++      DEFINES += -fPIC -D_GNU_SOURCE
++endif
+
+ .PHONY        = all clean install dist distclean rpm rpms
+
+ all:            libs ipvsadm
+
+ libs:
+-              make -C libipvs
++              $(MAKE) -C libipvs
+
+ ipvsadm:      $(OBJS) $(STATIC_LIBS)
+               $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
+@@ -106,7 +114,7 @@
+               rm -rf debian/tmp
+               find . -name '*.[ao]' -o -name "*~" -o -name "*.orig" \
+                 -o -name "*.rej" -o -name core | xargs rm -f
+-              make -C libipvs clean
++              $(MAKE) -C libipvs clean
+
+ distclean:    clean
+
diff --git a/package/network/utils/ipvsadm/patches/002-save-restore.patch
b/package/network/utils/ipvsadm/patches/002-save-restore.patch
new file mode 100644
index 0000000..96fb4cf
--- /dev/null
+++ b/package/network/utils/ipvsadm/patches/002-save-restore.patch
@@ -0,0 +1,36 @@
+diff -Naur ipvsadm-1.28/ipvsadm-restore ipvsadm-1.28.owrt/ipvsadm-restore
+--- ipvsadm-1.28/ipvsadm-restore       2015-02-09 05:26:39.000000000 +0000
++++ ipvsadm-1.28.owrt/ipvsadm-restore  2016-03-06 11:38:29.400884795 +0000
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ #      ipvsadm-restore - Restore IPVS rules
+ #
+ #      A very simple wrapper to restore IPVS rules
+@@ -11,6 +11,8 @@
+ #      This file:
+ #
+ #      ChangeLog
++#      M. Mozzarelli       :        Amended to use /bin/sh for compatibility
++#                          :        with embedded systems using busybox
+ #      Horms               :        Clear IPVS rules before adding from STDIN
+ #      Horms               :        Filter out "^#"
+ #
+diff -Naur ipvsadm-1.28/ipvsadm-save ipvsadm-1.28.owrt/ipvsadm-save
+--- ipvsadm-1.28/ipvsadm-save  2015-02-09 05:26:39.000000000 +0000
++++ ipvsadm-1.28.owrt/ipvsadm-save     2016-03-06 11:39:07.369444537 +0000
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ #      ipvsadm-save - Save IPVS rules
+ #
+ #      A very simple wrapper to save IPVS rules
+@@ -12,6 +12,8 @@
+ #
+ #      ChangeLog
+ #
++#    M. Mozzarelli          :  Amended to use /bin/sh for compatibility
++#                           :  with embedded systems using busybox
+ #      Wensong Zhang          :  Added the "-n" option and the help()
+ #
+
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to