summaryrefslogtreecommitdiff
path: root/sys-cluster/ipvsadm/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-cluster/ipvsadm/files
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-cluster/ipvsadm/files')
-rw-r--r--sys-cluster/ipvsadm/files/ipvsadm-1.26-buildsystem.patch113
-rw-r--r--sys-cluster/ipvsadm/files/ipvsadm-1.26-stack_smashing.patch32
-rw-r--r--sys-cluster/ipvsadm/files/ipvsadm-1.27-buildsystem.patch117
-rw-r--r--sys-cluster/ipvsadm/files/ipvsadm-1.27-fix-daemon-state.patch56
-rw-r--r--sys-cluster/ipvsadm/files/ipvsadm-init36
5 files changed, 354 insertions, 0 deletions
diff --git a/sys-cluster/ipvsadm/files/ipvsadm-1.26-buildsystem.patch b/sys-cluster/ipvsadm/files/ipvsadm-1.26-buildsystem.patch
new file mode 100644
index 000000000000..ba8e9450eb35
--- /dev/null
+++ b/sys-cluster/ipvsadm/files/ipvsadm-1.26-buildsystem.patch
@@ -0,0 +1,113 @@
+--- a/Makefile
++++ b/Makefile
+@@ -43,14 +43,13 @@
+ INIT = $(BUILD_ROOT)/etc/rc.d/init.d
+ MKDIR = mkdir
+ INSTALL = install
+-STATIC_LIBS = libipvs/libipvs.a
+
+ ifeq "${ARCH}" "sparc64"
+- CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow
++ CFLAGS := -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow
+ else
+- CFLAGS = -Wall -Wunused -Wstrict-prototypes -g
++ CFLAGS := -g
+ endif
+-
++OPTFLAGS += -Wall -Wunused -Wstrict-prototypes
+
+ #####################################
+ # No servicable parts below this line
+@@ -94,10 +93,12 @@
+ all: libs ipvsadm
+
+ libs:
+- make -C libipvs
++ $(MAKE) -C libipvs
++
++$(OBJS): libs
+
+-ipvsadm: $(OBJS) $(STATIC_LIBS)
+- $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
++ipvsadm: $(OBJS)
++ $(CC) $(LDFLAGS) $(OPTFLAGS) $(CFLAGS) -o $@ $^ -Llibipvs -lipvs $(LIBS)
+
+-install: all
++install:
+ if [ ! -d $(SBIN) ]; then $(MKDIR) -p $(SBIN); fi
+@@ -108,15 +109,13 @@
+ $(INSTALL) -m 0644 ipvsadm.8 $(MAN)
+ $(INSTALL) -m 0644 ipvsadm-save.8 $(MAN)
+ $(INSTALL) -m 0644 ipvsadm-restore.8 $(MAN)
+- [ -d $(INIT) ] || $(MKDIR) -p $(INIT)
+- $(INSTALL) -m 0755 ipvsadm.sh $(INIT)/ipvsadm
+
+ clean:
+ rm -f ipvsadm $(NAME).spec $(NAME)-$(VERSION).tar.gz
+ 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
+
+@@ -149,4 +148,4 @@
+ dpkg-buildpackage
+
+ %.o: %.c
+- $(CC) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $<
++ $(CC) $(OPTFLAGS) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $<
+--- a/libipvs/Makefile
++++ b/libipvs/Makefile
+@@ -1,32 +1,39 @@
+ # Makefile for libipvs
+
+ CC = gcc
+-CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -fPIC
++OPTFLAGS = -Wall -Wunused -Wstrict-prototypes
+ ifneq (0,$(HAVE_NL))
+-CFLAGS += -DLIBIPVS_USE_NL
++DEFINES += -DLIBIPVS_USE_NL
+ endif
+
+ INCLUDE += $(shell if [ -f ../../ip_vs.h ]; then \
+ echo "-I../../."; fi;)
+-DEFINES = $(shell if [ ! -f ../../ip_vs.h ]; then \
++DEFINES += $(shell if [ ! -f ../../ip_vs.h ]; then \
+ echo "-DHAVE_NET_IP_VS_H"; fi;)
+
+ .PHONY = all clean install dist distclean rpm rpms
+-STATIC_LIB = libipvs.a
+-SHARED_LIB = libipvs.so
+
+-all: $(STATIC_LIB) $(SHARED_LIB)
++TARGETS = libipvs.so
+
+-$(STATIC_LIB): libipvs.o ip_vs_nl_policy.o
++ifeq (1,$(STATIC_LIB))
++TARGETS += libipvs.a
++endif
++
++all: $(TARGETS)
++
++libipvs.a: libipvs.o ip_vs_nl_policy.o
+ ar rv $@ $^
+
+-$(SHARED_LIB): libipvs.o ip_vs_nl_policy.o
+- $(CC) -shared -Wl,-soname,$@ -o $@ $^
++libipvs.so: libipvs.lo ip_vs_nl_policy.lo
++ $(CC) $(LDFLAGS) -shared -Wl,-soname,$@ -o $@ $^
++
++%.lo: %.c
++ $(CC) -fPIC $(OPTFLAGS) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $<
+
+ %.o: %.c
+- $(CC) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $<
++ $(CC) $(OPTFLAGS) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $<
+
+ clean:
+- rm -f *.[ao] *~ *.orig *.rej core *.so
++ rm -f *.[ao] *~ *.orig *.rej core *.so *.lo
+
+ distclean: clean
diff --git a/sys-cluster/ipvsadm/files/ipvsadm-1.26-stack_smashing.patch b/sys-cluster/ipvsadm/files/ipvsadm-1.26-stack_smashing.patch
new file mode 100644
index 000000000000..d36b0bf8abe4
--- /dev/null
+++ b/sys-cluster/ipvsadm/files/ipvsadm-1.26-stack_smashing.patch
@@ -0,0 +1,32 @@
+From 81529af388c0f0f4e4b169b7bcb285ef5e798f41 Mon Sep 17 00:00:00 2001
+From: Christian Ruppert <idl0r@gentoo.org>
+Date: Sat, 8 Oct 2011 02:05:37 +0200
+Subject: [PATCH] Fix stack smashing because of a typo
+
+IPVS_CMD_ATTR_MAX was the size of __IPVS_SVC_ATTR_MAX before, which has a
+different size and thus it caused trouble. The right enum to use is
+__IPVS_CMD_ATTR_MAX.
+
+Reported-by: Deniss Gaplevsky <slim@inbox.lv>
+X-Gentoo-Bug: 371903
+X-Gentoo-Bug-URL: https://bugs.gentoo.org/371903
+---
+ libipvs/ip_vs.h | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/libipvs/ip_vs.h b/libipvs/ip_vs.h
+index 9726a17..5e1d544 100644
+--- a/libipvs/ip_vs.h
++++ b/libipvs/ip_vs.h
+@@ -413,7 +413,7 @@ enum {
+ __IPVS_CMD_ATTR_MAX,
+ };
+
+-#define IPVS_CMD_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1)
++#define IPVS_CMD_ATTR_MAX (__IPVS_CMD_ATTR_MAX - 1)
+
+ /*
+ * Attributes used to describe a service
+--
+1.7.3.4
+
diff --git a/sys-cluster/ipvsadm/files/ipvsadm-1.27-buildsystem.patch b/sys-cluster/ipvsadm/files/ipvsadm-1.27-buildsystem.patch
new file mode 100644
index 000000000000..54d2e55c1519
--- /dev/null
+++ b/sys-cluster/ipvsadm/files/ipvsadm-1.27-buildsystem.patch
@@ -0,0 +1,117 @@
+diff -Nuar -Nuar --exclude '*.orig' --exclude '*.rej' ipvsadm-1.27.orig/libipvs/Makefile ipvsadm-1.27/libipvs/Makefile
+--- ipvsadm-1.27.orig/libipvs/Makefile 2013-09-06 01:37:27.000000000 -0700
++++ ipvsadm-1.27/libipvs/Makefile 2013-11-01 23:45:21.633636401 -0700
+@@ -1,9 +1,9 @@
+ # Makefile for libipvs
+
+ CC = gcc
+-CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -fPIC
++#OPTFLAGS = -Wall -Wunused -Wstrict-prototypes
+ ifneq (0,$(HAVE_NL))
+-CFLAGS += -DLIBIPVS_USE_NL
++DEFINES += -DLIBIPVS_USE_NL
+ CFLAGS += $(shell \
+ if which pkg-config > /dev/null 2>&1; then \
+ if pkg-config --cflags libnl-3.0 2> /dev/null; then :; \
+@@ -15,7 +15,7 @@
+
+ INCLUDE += $(shell if [ -f ../../ip_vs.h ]; then \
+ echo "-I../../."; fi;)
+-DEFINES = $(shell if [ ! -f ../../ip_vs.h ]; then \
++DEFINES += $(shell if [ ! -f ../../ip_vs.h ]; then \
+ echo "-DHAVE_NET_IP_VS_H"; fi;)
+ DEFINES += $(shell if which pkg-config > /dev/null 2>&1; then \
+ if pkg-config --exists libnl-3.0; then :; \
+@@ -24,21 +24,31 @@
+ then echo "-DFALLBACK_LIBNL1"; fi; fi)
+
+ .PHONY = all clean install dist distclean rpm rpms
++
+ STATIC_LIB = libipvs.a
+ SHARED_LIB = libipvs.so
+
+-all: $(STATIC_LIB) $(SHARED_LIB)
++TARGETS = $(SHARED_LIB)
++ifeq (1,$(STATIC))
++TARGETS += $(STATIC_LIB)
++endif
++all: $(TARGETS)
++
++SOURCES = libipvs.c ip_vs_nl_policy.c
+
+-$(STATIC_LIB): libipvs.o ip_vs_nl_policy.o
++$(STATIC_LIB): $(SOURCES:%.c=%.o)
+ ar rv $@ $^
+
+-$(SHARED_LIB): libipvs.o ip_vs_nl_policy.o
+- $(CC) -shared -Wl,-soname,$@ -o $@ $^
++$(SHARED_LIB): $(SOURCES:%.c=%.lo)
++ $(CC) $(LDFLAGS) -shared -Wl,-soname,$@ -o $@ $^
++
++%.lo: %.c
++ $(CC) -fPIC $(OPTFLAGS) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $<
+
+ %.o: %.c
+- $(CC) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $<
++ $(CC) $(OPTFLAGS) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $<
+
+ clean:
+- rm -f *.[ao] *~ *.orig *.rej core *.so
++ rm -f *.[ao] *~ *.orig *.rej core *.so *.lo
+
+ distclean: clean
+diff -Nuar -Nuar --exclude '*.orig' --exclude '*.rej' ipvsadm-1.27.orig/Makefile ipvsadm-1.27/Makefile
+--- ipvsadm-1.27.orig/Makefile 2013-11-01 23:49:36.523225124 -0700
++++ ipvsadm-1.27/Makefile 2013-11-01 23:49:09.478738760 -0700
+@@ -43,14 +43,13 @@
+ INIT = $(BUILD_ROOT)/etc/rc.d/init.d
+ MKDIR = mkdir
+ INSTALL = install
+-STATIC_LIBS = libipvs/libipvs.a
+
+ ifeq "${ARCH}" "sparc64"
+- CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow
++ CFLAGS := -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow
+ else
+- CFLAGS = -Wall -Wunused -Wstrict-prototypes -g
++ CFLAGS := -g
+ endif
+-
++OPTFLAGS += -Wall -Wunused -Wstrict-prototypes
+
+ #####################################
+ # No servicable parts below this line
+@@ -84,12 +83,14 @@
+ all: libs ipvsadm
+
+ libs:
+- make -C libipvs
++ $(MAKE) -C libipvs CFLAGS="$(CFLAGS)" STATIC="$(STATIC)" OPTFLAGS="$(OPTFLAGS)"
++
++$(OBJS): libs
+
+-ipvsadm: $(OBJS) $(STATIC_LIBS)
+- $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
++ipvsadm: $(OBJS)
++ $(CC) $(LDFLAGS) $(OPTFLAGS) $(CFLAGS) -o $@ $^ -Llibipvs -lipvs $(LIBS)
+
+-install: all
++install: all
+ if [ ! -d $(SBIN) ]; then $(MKDIR) -p $(SBIN); fi
+ $(INSTALL) -m 0755 ipvsadm $(SBIN)
+ $(INSTALL) -m 0755 ipvsadm-save $(SBIN)
+@@ -106,7 +107,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
+
+@@ -139,4 +140,4 @@
+ dpkg-buildpackage
+
+ %.o: %.c
+- $(CC) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $<
++ $(CC) $(OPTFLAGS) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $<
diff --git a/sys-cluster/ipvsadm/files/ipvsadm-1.27-fix-daemon-state.patch b/sys-cluster/ipvsadm/files/ipvsadm-1.27-fix-daemon-state.patch
new file mode 100644
index 000000000000..e3e5ebec72c6
--- /dev/null
+++ b/sys-cluster/ipvsadm/files/ipvsadm-1.27-fix-daemon-state.patch
@@ -0,0 +1,56 @@
+From 8c34d5a0d4c763db9b8f1e54be0c6c3ded6c54e0 Mon Sep 17 00:00:00 2001
+From: Alexander Holler <alexander.holler@1und1.de>
+Date: Mon, 9 Jan 2012 13:16:55 +0100
+Subject: [PATCH] libipvs: Fix reporting of the state of the backup-daemon.
+
+ipvsadm -l --daemon didn't report a running ipvs-backup-daemon
+(if no master-daemon was run).
+
+It seems there was some misunderstanding of
+how the daemons got reported (without using netlink). The state of
+the backup-daemon is always reported (by the kernel) in the second
+element of type ip_vs_daemon_user which is returned by the kernel
+through IP_VS_SO_GET_DAEMON or IPVS_CMD_GET_DAEMON.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+---
+ libipvs/libipvs.c | 11 ++++++-----
+ 1 files changed, 6 insertions(+), 5 deletions(-)
+
+Note: patch adjusted slightly to apply against ipvsadm (was spun for keepalived) - robbat2
+
+diff --git a/libipvs/libipvs.c b/libipvs/libipvs.c
+index ea5e851..6bee837 100644
+--- a/libipvs/libipvs.c
++++ b/libipvs/libipvs.c
+@@ -1003,12 +1003,9 @@ static int ipvs_daemon_parse_cb(struct nl_msg *msg, void *arg)
+ struct nlattr *attrs[IPVS_CMD_ATTR_MAX + 1];
+ struct nlattr *daemon_attrs[IPVS_DAEMON_ATTR_MAX + 1];
+ ipvs_daemon_t *u = (ipvs_daemon_t *)arg;
++ __u32 state;
+ int i = 0;
+
+- /* We may get two daemons. If we've already got one, this is the second */
+- if (u[0].state)
+- i = 1;
+-
+ if (genlmsg_parse(nlh, 0, attrs, IPVS_CMD_ATTR_MAX, ipvs_cmd_policy) != 0)
+ return -1;
+
+@@ -1021,7 +1018,11 @@ static int ipvs_daemon_parse_cb(struct nl_msg *msg, void *arg)
+ daemon_attrs[IPVS_DAEMON_ATTR_SYNC_ID]))
+ return -1;
+
+- u[i].state = nla_get_u32(daemon_attrs[IPVS_DAEMON_ATTR_STATE]);
++ state = nla_get_u32(daemon_attrs[IPVS_DAEMON_ATTR_STATE]);
++ /* The second element is used for the state of the backup daemon. */
++ if (state == IP_VS_STATE_BACKUP)
++ i = 1;
++ u[i].state = state;
+ strncpy(u[i].mcast_ifn,
+ nla_get_string(daemon_attrs[IPVS_DAEMON_ATTR_MCAST_IFN]),
+ IP_VS_IFNAME_MAXLEN);
+--
+1.7.6.5
+
diff --git a/sys-cluster/ipvsadm/files/ipvsadm-init b/sys-cluster/ipvsadm/files/ipvsadm-init
new file mode 100644
index 000000000000..c4f58ee567fc
--- /dev/null
+++ b/sys-cluster/ipvsadm/files/ipvsadm-init
@@ -0,0 +1,36 @@
+#!/sbin/openrc-run
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="save"
+
+depend() {
+ need net
+}
+
+checkconfig() {
+ if [ ! -f /var/lib/ipvsadm/rules-save ] ; then
+ eerror "Not starting ipvsadm. First create some rules then run"
+ eerror "/etc/init.d/ipvsadm save"
+ return 1
+ fi
+}
+
+start() {
+ ebegin "Starting ipvsadm"
+ einfo "Clearing previous rules"
+ ipvsadm -C
+ ipvsadm-restore < /var/lib/ipvsadm/rules-save
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ipvsadm"
+ eend $?
+}
+
+save() {
+ ebegin "Saving ipvsadm state"
+ ipvsadm-save > /var/lib/ipvsadm/rules-save
+ eend $?
+}