mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 20:13:44 +02:00
Include COM with EXT_FRAME in bridged case.
This commit is contained in:
parent
35b5dcf89d
commit
6bfbc43e3c
1 changed files with 10 additions and 7 deletions
|
@ -167,7 +167,6 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
|
||||||
|
|
||||||
Address toZT(to.toAddress(network->id()));
|
Address toZT(to.toAddress(network->id()));
|
||||||
if (network->isAllowed(toZT)) {
|
if (network->isAllowed(toZT)) {
|
||||||
const bool includeCom = network->peerNeedsOurMembershipCertificate(toZT,RR->node->now());
|
|
||||||
/*
|
/*
|
||||||
if (network->peerNeedsOurMembershipCertificate(toZT,RR->node->now())) {
|
if (network->peerNeedsOurMembershipCertificate(toZT,RR->node->now())) {
|
||||||
// TODO: once there are no more <1.0.0 nodes around, we can
|
// TODO: once there are no more <1.0.0 nodes around, we can
|
||||||
|
@ -178,6 +177,7 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const bool includeCom = network->peerNeedsOurMembershipCertificate(toZT,RR->node->now());
|
||||||
if ((fromBridged)||(includeCom)) {
|
if ((fromBridged)||(includeCom)) {
|
||||||
Packet outp(toZT,RR->identity.address(),Packet::VERB_EXT_FRAME);
|
Packet outp(toZT,RR->identity.address(),Packet::VERB_EXT_FRAME);
|
||||||
outp.append(network->id());
|
outp.append(network->id());
|
||||||
|
@ -216,16 +216,14 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
|
||||||
Address bridges[ZT_MAX_BRIDGE_SPAM];
|
Address bridges[ZT_MAX_BRIDGE_SPAM];
|
||||||
unsigned int numBridges = 0;
|
unsigned int numBridges = 0;
|
||||||
|
|
||||||
|
/* Create an array of up to ZT_MAX_BRIDGE_SPAM recipients for this bridged frame. */
|
||||||
bridges[0] = network->findBridgeTo(to);
|
bridges[0] = network->findBridgeTo(to);
|
||||||
if ((bridges[0])&&(bridges[0] != RR->identity.address())&&(network->isAllowed(bridges[0]))&&(network->permitsBridging(bridges[0]))) {
|
if ((bridges[0])&&(bridges[0] != RR->identity.address())&&(network->isAllowed(bridges[0]))&&(network->permitsBridging(bridges[0]))) {
|
||||||
// We have a known bridge route for this MAC.
|
/* We have a known bridge route for this MAC, send it there. */
|
||||||
++numBridges;
|
++numBridges;
|
||||||
} else if (!nconf->activeBridges().empty()) {
|
} else if (!nconf->activeBridges().empty()) {
|
||||||
/* If there is no known route, spam to up to ZT_MAX_BRIDGE_SPAM active
|
/* If there is no known route, spam to up to ZT_MAX_BRIDGE_SPAM active
|
||||||
* bridges. This is similar to what many switches do -- if they do not
|
* bridges. If someone responds, we'll learn the route. */
|
||||||
* know which port corresponds to a MAC, they send it to all ports. If
|
|
||||||
* there aren't any active bridges, numBridges will stay 0 and packet
|
|
||||||
* is dropped. */
|
|
||||||
std::vector<Address>::const_iterator ab(nconf->activeBridges().begin());
|
std::vector<Address>::const_iterator ab(nconf->activeBridges().begin());
|
||||||
if (nconf->activeBridges().size() <= ZT_MAX_BRIDGE_SPAM) {
|
if (nconf->activeBridges().size() <= ZT_MAX_BRIDGE_SPAM) {
|
||||||
// If there are <= ZT_MAX_BRIDGE_SPAM active bridges, spam them all
|
// If there are <= ZT_MAX_BRIDGE_SPAM active bridges, spam them all
|
||||||
|
@ -251,7 +249,12 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
|
||||||
for(unsigned int b=0;b<numBridges;++b) {
|
for(unsigned int b=0;b<numBridges;++b) {
|
||||||
Packet outp(bridges[b],RR->identity.address(),Packet::VERB_EXT_FRAME);
|
Packet outp(bridges[b],RR->identity.address(),Packet::VERB_EXT_FRAME);
|
||||||
outp.append(network->id());
|
outp.append(network->id());
|
||||||
outp.append((unsigned char)0);
|
if (network->peerNeedsOurMembershipCertificate(bridges[b],RR->node->now())) {
|
||||||
|
outp.append((unsigned char)0x01); // 0x01 -- COM included
|
||||||
|
nconf->com().serialize(outp);
|
||||||
|
} else {
|
||||||
|
outp.append((unsigned char)0);
|
||||||
|
}
|
||||||
to.appendTo(outp);
|
to.appendTo(outp);
|
||||||
from.appendTo(outp);
|
from.appendTo(outp);
|
||||||
outp.append((uint16_t)etherType);
|
outp.append((uint16_t)etherType);
|
||||||
|
|
Loading…
Add table
Reference in a new issue