Quellcode durchsuchen

Go ahead and loop back packets whose destination is self. Some OSes require this since they aactually follow the full network path even for local IPs.

Adam Ierymenko vor 9 Jahren
Ursprung
Commit
d5f4d381d0
1 geänderte Dateien mit 5 neuen und 7 gelöschten Zeilen
  1. 5 7
      node/Switch.cpp

+ 5 - 7
node/Switch.cpp

@@ -334,18 +334,13 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
 	if (!network->hasConfig())
 	if (!network->hasConfig())
 		return;
 		return;
 
 
-	// Sanity check -- bridge loop? OS problem?
-	if (to == network->mac())
-		return;
-
 	// Check if this packet is from someone other than the tap -- i.e. bridged in
 	// Check if this packet is from someone other than the tap -- i.e. bridged in
-	bool fromBridged = false;
-	if (from != network->mac()) {
+	bool fromBridged;
+	if ((fromBridged = (from != network->mac()))) {
 		if (!network->config().permitsBridging(RR->identity.address())) {
 		if (!network->config().permitsBridging(RR->identity.address())) {
 			TRACE("%.16llx: %s -> %s %s not forwarded, bridging disabled or this peer not a bridge",network->id(),from.toString().c_str(),to.toString().c_str(),etherTypeName(etherType));
 			TRACE("%.16llx: %s -> %s %s not forwarded, bridging disabled or this peer not a bridge",network->id(),from.toString().c_str(),to.toString().c_str(),etherTypeName(etherType));
 			return;
 			return;
 		}
 		}
-		fromBridged = true;
 	}
 	}
 
 
 	if (to.isMulticast()) {
 	if (to.isMulticast()) {
@@ -484,6 +479,9 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
 			etherType,
 			etherType,
 			data,
 			data,
 			len);
 			len);
+	} else if (to == network->mac()) {
+		// Destination is this node, so just reinject it
+		RR->node->putFrame(network->id(),network->userPtr(),from,to,etherType,vlanId,data,len);
 	} else if (to[0] == MAC::firstOctetForNetwork(network->id())) {
 	} else if (to[0] == MAC::firstOctetForNetwork(network->id())) {
 		// Destination is another ZeroTier peer on the same network
 		// Destination is another ZeroTier peer on the same network