Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1423493

[PATCH v3 3/4] ipvs: Don't check result < 0 after setting result = 0

From Quentin Armitage <quentin@armitage.org.uk>
Newsgroups linux.kernel
Subject [PATCH v3 3/4] ipvs: Don't check result < 0 after setting result = 0
Date 2016-06-15 23:50 +0200
Message-ID <rKqRc-7Wk-49@gated-at.bofh.it> (permalink)
References <rJXvP-5Yz-5@gated-at.bofh.it> <rKqRb-7Wk-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Move the block testing result < 0 to avoid the test immediately
after setting result = 0

Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
---
 net/netfilter/ipvs/ip_vs_sync.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index fbc5ba4..2be99b2 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -1496,13 +1496,14 @@ static struct socket *make_send_sock(struct netns_ipvs *ipvs, int id,
 	if (result > 0)
 		set_sock_size(sock->sk, 1, result);
 
-	if (AF_INET == ipvs->mcfg.mcast_af)
+	if (ipvs->mcfg.mcast_af == AF_INET) {
 		result = bind_mcastif_addr(sock, dev);
-	else
+		if (result < 0) {
+			pr_err("Error binding address of mcast interface\n");
+			goto error;
+		}
+	} else {
 		result = 0;
-	if (result < 0) {
-		pr_err("Error binding address of the mcast interface\n");
-		goto error;
 	}
 
 	get_mcast_sockaddr(&mcast_addr, &salen, &ipvs->mcfg, id);
-- 
1.7.7.6

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/5] ipvs: fix backup sync daemon with IPv6, and minor updates Quentin Armitage <quentin@armitage.org.uk> - 2016-06-14 16:30 +0200
  [PATCH v2 2/5] ipvs: Stop calling __dev_get_by_name() repeatedly when starting sync daemon Quentin Armitage <quentin@armitage.org.uk> - 2016-06-14 16:30 +0200
  [PATCH v2 1/5] ipvs: Enable setting IPv6 multicast address for ipvs sync daemon backup Quentin Armitage <quentin@armitage.org.uk> - 2016-06-14 16:30 +0200
  Re: [PATCH v2 0/5] ipvs: fix backup sync daemon with IPv6, and minor  updates Julian Anastasov <ja@ssi.bg> - 2016-06-15 07:30 +0200
    Re: [PATCH v2 0/5] ipvs: fix backup sync daemon with IPv6, and minor  updates Julian Anastasov <ja@ssi.bg> - 2016-06-15 22:00 +0200
  [PATCH v3 4/4] ipvs: log additional sync daemon parameters Quentin Armitage <quentin@armitage.org.uk> - 2016-06-15 23:50 +0200
  [PATCH v3 0/4] ipvs: fix backup sync daemon with IPv6, and minor updates Quentin Armitage <quentin@armitage.org.uk> - 2016-06-15 23:50 +0200
    [PATCH v3 1/4] ipvs: Enable setting IPv6 multicast address for ipvs Quentin Armitage <quentin@armitage.org.uk> - 2016-06-15 23:50 +0200
    [PATCH v3 3/4] ipvs: Don't check result < 0 after setting result = 0 Quentin Armitage <quentin@armitage.org.uk> - 2016-06-15 23:50 +0200
    [PATCH v3 2/4] ipvs: Stop calling __dev_get_by_name() repeatedly when starting sync daemon Quentin Armitage <quentin@armitage.org.uk> - 2016-06-15 23:50 +0200
    Re: [PATCH v3 0/4] ipvs: fix backup sync daemon with IPv6, and minor  updates Julian Anastasov <ja@ssi.bg> - 2016-06-16 08:20 +0200
      [PATCH v4 net] ipvs: fix bind to link-local mcast IPv6 address in backup Quentin Armitage <quentin@armitage.org.uk> - 2016-06-16 09:10 +0200
        Re: [PATCH v4 net] ipvs: fix bind to link-local mcast IPv6 address  in backup Julian Anastasov <ja@ssi.bg> - 2016-06-17 08:50 +0200
          Re: [PATCH v4 net] ipvs: fix bind to link-local mcast IPv6 address  in backup Simon Horman <horms@verge.net.au> - 2016-06-23 03:30 +0200
      [PATCH net-next v4 1/3] ipvs: Stop calling __dev_get_by_name() repeatedly when starting sync daemon Quentin Armitage <quentin@armitage.org.uk> - 2016-06-16 09:10 +0200
        [PATCH net-next v4 3/3] ipvs: log additional sync daemon parameters Quentin Armitage <quentin@armitage.org.uk> - 2016-06-16 09:10 +0200
        [PATCH net-next v4 2/3] ipvs: Don't check result < 0 after setting result = 0 Quentin Armitage <quentin@armitage.org.uk> - 2016-06-16 09:10 +0200

csiph-web