Skip to contentSkip to conversation

bridge: simplify a br_multicast_query_received() function call

PATCH In review Linus Lüssing 2 participants 3 messages Apr 21, 2014 – May 2, 2014

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

PATCH 1/1 bridge: simplify a br_multicast_query_received() function call

The call from the IPv6 part can be simplified as the beginning of the calling function ensures that we end up here when having a proper IPv6 source address only.

Introduced by 6565b9eeef194afbb3beec80d6dd2447f4091f8c ("bridge: multicast: add sanity check for query source addresses")

---
 net/bridge/br_multicast.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/bridge/br_multicast.c +1 -2
index 7b757b5..d2c3aae 100644
@@ -1282,8 +1282,7 @@ static int br_ip6_multicast_query(struct net_bridge *br,
 		goto out;
 	}
 
-	br_multicast_query_received(br, port, &br->ip6_querier,
-				    !ipv6_addr_any(&ip6h->saddr),
+	br_multicast_query_received(br, port, &br->ip6_querier, 1,
 				    is_general_query, max_delay);
 
 	if (!group)
Signature · 1 line
1.7.10.4
maintainer
#1 lore raw

From: Linus Lüssing <[email protected]>
Date: Mon, 21 Apr 2014 20:59:35 +0200

Quoted 18 lines

The call from the IPv6 part can be simplified as the beginning of the calling function ensures that we end up here when having a proper IPv6 source address only.

Introduced by 6565b9eeef194afbb3beec80d6dd2447f4091f8c ("bridge: multicast: add sanity check for query source addresses")

---
 net/bridge/br_multicast.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/bridge/br_multicast.c +0 -0
index 7b757b5..d2c3aae 100644

net/bridge/br_multicast.c static int br_ip6_multicast_query(struct net_bridge *br, · line 1288

Quoted 9 lines
net/bridge/br_multicast.c +1 -2
@@ -1282,8 +1282,7 @@ static int br_ip6_multicast_query(struct net_bridge *br,
 		goto out;
 	}
 
-	br_multicast_query_received(br, port, &br->ip6_querier,
-				    !ipv6_addr_any(&ip6h->saddr),
+	br_multicast_query_received(br, port, &br->ip6_querier, 1,
 				    is_general_query, max_delay);
 
 	if (!group)

This doesn't make any sense to me, is_general_query can be false at this point.

Furthermore, even if your change would be correct, the argument is a boolean not an integer.

#2 lore raw
Quoted 11 lines · David Miller
Quoted 11 lines
net/bridge/br_multicast.c +1 -2
@@ -1282,8 +1282,7 @@ static int br_ip6_multicast_query(struct net_bridge *br,
 		goto out;
 	}
 
-	br_multicast_query_received(br, port, &br->ip6_querier,
-				    !ipv6_addr_any(&ip6h->saddr),
+	br_multicast_query_received(br, port, &br->ip6_querier, 1,
 				    is_general_query, max_delay);
 
Quoted 4 lines

net/bridge/br_multicast.c static int br_ip6_multicast_query(struct net_bridge *br, · line 1288

Quoted 1 line
net/bridge/br_multicast.c +0 -0
 	if (!group)

This doesn't make any sense to me, is_general_query can be false at this point.

This change has nothing to do with is_general_query, the fifth argument. I'm modifying the fourth, the is_saddr flag. As Hannes has pointed out here [0], now that we make sure that we have a link-local IPv6 address at the beginning of br_ip6_multicast_query() this implies that the source address is not '::'.

Quoted 3 lines

Furthermore, even if your change would be correct, the argument is a boolean not an integer.

Semantically yes. Syntactically the fourth argument is an integer at the moment (unnecessarily). Should I change 'int saddr' to 'bool saddr' while at it, within the same patch?

Cheers