Skip to contentSkip to conversation

IPVS: precedence bug in ip_vs_sync_switch_mode()

PATCH In review Dan Carpenter 2 participants 2 messages Feb 7, 2011

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IPVS: precedence bug in ip_vs_sync_switch_mode()

'!' has higher precedence than '&'. IP_VS_STATE_MASTER is 0x1 so the original code is equivelent to if (!ipvs->sync_state) ...

net/netfilter/ipvs/ip_vs_sync.c +1 -1
index 2a2a836..d1b7298 100644
@@ -392,7 +392,7 @@ void ip_vs_sync_switch_mode(struct net *net, int mode)
 {
 	struct netns_ipvs *ipvs = net_ipvs(net);
 
-	if (!ipvs->sync_state & IP_VS_STATE_MASTER)
+	if (!(ipvs->sync_state & IP_VS_STATE_MASTER))
 		return;
 	if (mode = ipvs->sysctl_sync_ver || !ipvs->sync_buff)
 		return;
maintainer
#1 lore raw
Quoted 2 lines · Dan Carpenter

'!' has higher precedence than '&'. IP_VS_STATE_MASTER is 0x1 so the original code is equivelent to if (!ipvs->sync_state) ...

Thanks Dan, I'll push this to Patrick ASAP.

For the record, this seems to have been added as part of the new synchronisation code and as such is only present in development trees at this time. i.e. its not in .37 nor scheduled for .38.

Quoted 20 lines
net/netfilter/ipvs/ip_vs_sync.c +1 -2
index 2a2a836..d1b7298 100644
@@ -392,7 +392,7 @@ void ip_vs_sync_switch_mode(struct net *net, int mode)
 {
 	struct netns_ipvs *ipvs = net_ipvs(net);
 
-	if (!ipvs->sync_state & IP_VS_STATE_MASTER)
+	if (!(ipvs->sync_state & IP_VS_STATE_MASTER))
 		return;
 	if (mode = ipvs->sysctl_sync_ver || !ipvs->sync_buff)
 		return;
--

To unsubscribe from this list: send the line "unsubscribe lvs-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html