[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
Google
 
Web openvpn.net

Re: [Openvpn-users] Seemingly inexplicable phenomena with several bridges in a full mesh


  • Subject: Re: [Openvpn-users] Seemingly inexplicable phenomena with several bridges in a full mesh
  • From: James Yonan <jim@xxxxxxxxx>
  • Date: Sat, 10 Jul 2004 20:47:04 -0500

> I'm assuming that the bridge-like thing inside openvpn (that does
> client-to-client, for example) tries to be well-behaved and does not
> forward locally generated packets addressed to 01:80:c2:00:00:00 to its
> peers, so the TCNs never reach the root bridge. This would explain why my
> packets take the long route instead of the short one, but doesn't readily
> explain why my other box would lose its eth0 arp entries.
>
> Any ideas?

Here is a patch that treats MAC addresses with the magic 01:80:c2 prefix the 
same way that the broadcast MAC address (FF:FF:FF:FF:FF:FF) would be handled.

This should allow the TCNs to reach the root bridge.

Not tested yet, so let me know if it works.

James
--- openvpn-2.0_beta7/mroute.c	2004-06-23 20:40:42.000000000 -0500
+++ openvpn-2.0_beta7-test/mroute.c	2004-07-10 20:24:33.490041736 -0500
@@ -40,7 +40,13 @@
 
 #include "memdbg.h"
 
-static const uint8_t ethernet_bcast_addr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
+/*
+ * Special MAC addresses
+ */
+
+static const uint8_t ethernet_bcast_addr[] =  { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
+
+static const uint8_t ethernet_group_prefix[] = { 0x01, 0x80, 0xC2 };
 
 void
 mroute_addr_init (struct mroute_addr *addr)
@@ -48,6 +54,24 @@
   CLEAR (*addr);
 }
 
+static inline bool
+is_mac_group_addr (const uint8_t *mac)
+{
+  return memcmp (mac, ethernet_group_prefix, 3) == 0; 
+}
+
+static inline bool
+is_mac_bcast_addr (const uint8_t *mac)
+{
+  return memcmp (mac, ethernet_bcast_addr, 6) == 0;
+}
+
+static inline bool
+is_mac_group_maddr (const struct mroute_addr *addr)
+{
+  return (addr->type & MR_ADDR_MASK) == MR_ADDR_ETHER && is_mac_group_addr (addr->addr); 
+}
+
 /*
  * Don't learn certain addresses.
  */
@@ -66,7 +90,7 @@
       if (b != 0xFF)
 	not_all_ones = true;
     }
-  return not_all_zeros && not_all_ones;
+  return not_all_zeros && not_all_ones && !is_mac_group_maddr (addr);
 }
 
 /*
@@ -143,7 +167,7 @@
 	      memcpy (dest->addr, eth->dest, 6);
 
 	      /* broadcast packet? */
-	      if (memcmp (eth->dest, ethernet_bcast_addr, 6) == 0)
+	      if (is_mac_bcast_addr (eth->dest) || is_mac_group_addr (eth->dest))
 		ret |= MROUTE_EXTRACT_BCAST;
 	    }