Skip to contentSkip to conversation

Repair "tap server" mode brokenness caused by <stdbool.h> fallout

PATCH Applied Gert Doering 3 participants 3 messages Jun 30, 2012 – Jul 2, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Repair "tap server" mode brokenness caused by <stdbool.h> fallout

Operator/Cast precedence wrong: casting mac[0] to (bool) first - giving "1" for "any mac address that does not start with 00:" - and only then bit-anding with "1" - thus always returning "true". Which, in turn, leads to "reject all incoming packets with 'bad source address'".

OpenVPN bug #216.

---
 src/openvpn/mroute.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/openvpn/mroute.c +1 -1
index aecb702..850e336 100644
@@ -52,7 +52,7 @@ mroute_addr_init (struct mroute_addr *addr)
 static inline bool
 is_mac_mcast_addr (const uint8_t *mac)
 {
-  return (bool) mac[0] & 1;
+  return (bool) (mac[0] & 1);
 }
 
 static inline bool
Signature · 1 line
1.7.8.6
#1 lore raw

Hi everyone,

2012/6/30 Gert Doering <[email protected]...>:

Quoted 12 lines
src/openvpn/mroute.c +0 -0
index aecb702..850e336 100644
@@ -52,7 +52,7 @@ mroute_addr_init (struct mroute_addr *addr)

 static inline bool
 is_mac_mcast_addr (const uint8_t *mac)
 {
-  return (bool) mac[0] & 1;
+  return (bool) (mac[0] & 1);
 }

Quoted 1 line

 static inline bool

ACK. In the context of is_mac_mcast_addr, the check now looks obviously correct.

Cheers
Fabian

#2 lore raw
In reply to Gert Doering
Quoted 5 lines · Gert Doering

Operator/Cast precedence wrong: casting mac[0] to (bool) first - giving "1" for "any mac address that does not start with 00:" - and only then bit-anding with "1" - thus always returning "true". Which, in turn, leads to "reject all incoming packets with 'bad source address'".

Quoted 7 lines

OpenVPN bug #216.

---
 src/openvpn/mroute.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied to master.

commit 8df08de6f84d224c6a79ab6c74ba73c33a47735d

Author: Gert Doering <[email protected]...>
Date:   Sat Jun 30 22:50:43 2012 +0200
    Repair "tap server" mode brokenness caused by <stdbool.h> fallout

    Signed-off-by: Gert Doering <[email protected]...>
    Acked-by: Fabian Knittel <[email protected]...>
    Message-Id: [email protected]...
    URL: http://article.gmane.org/gmane.network.openvpn.devel/6817
    Signed-off-by: David Sommerseth <[email protected]...>

kind regards,

David Sommerseth