Gentoo Archives: gentoo-commits

From: "Robin H. Johnson (robbat2)" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-cluster/ipvsadm/files: ipvsadm-1.27-fix-daemon-state.patch
Date: Sat, 02 Nov 2013 19:49:53
Message-Id: 20131102194947.B491120005@flycatcher.gentoo.org
1 robbat2 13/11/02 19:49:47
2
3 Added: ipvsadm-1.27-fix-daemon-state.patch
4 Log:
5 Bug #403133: this keepalived patch was needed for ipvsadm as well, and got lost along the way.
6
7 (Portage version: 2.2.7/cvs/Linux x86_64, unsigned Manifest commit)
8
9 Revision Changes Path
10 1.1 sys-cluster/ipvsadm/files/ipvsadm-1.27-fix-daemon-state.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-cluster/ipvsadm/files/ipvsadm-1.27-fix-daemon-state.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-cluster/ipvsadm/files/ipvsadm-1.27-fix-daemon-state.patch?rev=1.1&content-type=text/plain
14
15 Index: ipvsadm-1.27-fix-daemon-state.patch
16 ===================================================================
17 From 8c34d5a0d4c763db9b8f1e54be0c6c3ded6c54e0 Mon Sep 17 00:00:00 2001
18 From: Alexander Holler <alexander.holler@×××××.de>
19 Date: Mon, 9 Jan 2012 13:16:55 +0100
20 Subject: [PATCH] libipvs: Fix reporting of the state of the backup-daemon.
21
22 ipvsadm -l --daemon didn't report a running ipvs-backup-daemon
23 (if no master-daemon was run).
24
25 It seems there was some misunderstanding of
26 how the daemons got reported (without using netlink). The state of
27 the backup-daemon is always reported (by the kernel) in the second
28 element of type ip_vs_daemon_user which is returned by the kernel
29 through IP_VS_SO_GET_DAEMON or IPVS_CMD_GET_DAEMON.
30
31 Signed-off-by: Robin H. Johnson <robbat2@g.o>
32
33 ---
34 libipvs/libipvs.c | 11 ++++++-----
35 1 files changed, 6 insertions(+), 5 deletions(-)
36
37 Note: patch adjusted slightly to apply against ipvsadm (was spun for keepalived) - robbat2
38
39 diff --git a/libipvs/libipvs.c b/libipvs/libipvs.c
40 index ea5e851..6bee837 100644
41 --- a/libipvs/libipvs.c
42 +++ b/libipvs/libipvs.c
43 @@ -1003,12 +1003,9 @@ static int ipvs_daemon_parse_cb(struct nl_msg *msg, void *arg)
44 struct nlattr *attrs[IPVS_CMD_ATTR_MAX + 1];
45 struct nlattr *daemon_attrs[IPVS_DAEMON_ATTR_MAX + 1];
46 ipvs_daemon_t *u = (ipvs_daemon_t *)arg;
47 + __u32 state;
48 int i = 0;
49
50 - /* We may get two daemons. If we've already got one, this is the second */
51 - if (u[0].state)
52 - i = 1;
53 -
54 if (genlmsg_parse(nlh, 0, attrs, IPVS_CMD_ATTR_MAX, ipvs_cmd_policy) != 0)
55 return -1;
56
57 @@ -1021,7 +1018,11 @@ static int ipvs_daemon_parse_cb(struct nl_msg *msg, void *arg)
58 daemon_attrs[IPVS_DAEMON_ATTR_SYNC_ID]))
59 return -1;
60
61 - u[i].state = nla_get_u32(daemon_attrs[IPVS_DAEMON_ATTR_STATE]);
62 + state = nla_get_u32(daemon_attrs[IPVS_DAEMON_ATTR_STATE]);
63 + /* The second element is used for the state of the backup daemon. */
64 + if (state == IP_VS_STATE_BACKUP)
65 + i = 1;
66 + u[i].state = state;
67 strncpy(u[i].mcast_ifn,
68 nla_get_string(daemon_attrs[IPVS_DAEMON_ATTR_MCAST_IFN]),
69 IP_VS_IFNAME_MAXLEN);
70 --
71 1.7.6.5