summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-09-08 08:25:06 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-09-08 08:25:06 -0700
commitb8729de9daa925f45705e72861b4986b328e65e9 (patch)
treeb3131d810a8d0fb6b47ed9ca273446101c6a56b6 /node
parent4e9280fc7a41aac6171165487412d2a9abd432a4 (diff)
downloadinfinitytier-b8729de9daa925f45705e72861b4986b328e65e9.tar.gz
infinitytier-b8729de9daa925f45705e72861b4986b328e65e9.zip
Temporarily DISABLE multicast authentication (doing in branch, will reenable in dev)
Diffstat (limited to 'node')
-rw-r--r--node/Network.hpp8
-rw-r--r--node/PacketDecoder.cpp14
-rw-r--r--node/Switch.cpp10
3 files changed, 25 insertions, 7 deletions
diff --git a/node/Network.hpp b/node/Network.hpp
index cab41411..4fde934b 100644
--- a/node/Network.hpp
+++ b/node/Network.hpp
@@ -358,6 +358,14 @@ public:
}
/**
+ * @return True if multicasts must be authenticated on this network
+ */
+ inline bool authenticateMulticasts() const
+ {
+ return false;
+ }
+
+ /**
* Shortcut for config()->permitsBridging(), returns false if no config
*
* @param peer Peer address to check
diff --git a/node/PacketDecoder.cpp b/node/PacketDecoder.cpp
index 369eda7b..9fa9d93c 100644
--- a/node/PacketDecoder.cpp
+++ b/node/PacketDecoder.cpp
@@ -612,10 +612,16 @@ bool PacketDecoder::_doMULTICAST_FRAME(const RuntimeEnvironment *_r,const Shared
// Check the multicast frame's signature to verify that its original sender is
// who it claims to be.
- const unsigned int signedPartLen = (ZT_PROTO_VERB_MULTICAST_FRAME_IDX_FRAME - ZT_PROTO_VERB_MULTICAST_FRAME_IDX__START_OF_SIGNED_PORTION) + frameLen;
- if (!originPeer->identity().verify(field(ZT_PROTO_VERB_MULTICAST_FRAME_IDX__START_OF_SIGNED_PORTION,signedPartLen),signedPartLen,signature,signatureLen)) {
- LOG("dropped MULTICAST_FRAME from %s(%s): failed signature verification, claims to be from %s",source().toString().c_str(),_remoteAddress.toString().c_str(),origin.toString().c_str());
- return true;
+ if ((!network)||(network->authenticateMulticasts())) {
+ // Note that right now we authenticate multicasts if we aren't a member of a
+ // network... have to think about whether this is mandatory. It mostly only
+ // matters for supernodes though, since ordinary peers are unlikely ever to
+ // see multicasts for networks they don't belong to.
+ const unsigned int signedPartLen = (ZT_PROTO_VERB_MULTICAST_FRAME_IDX_FRAME - ZT_PROTO_VERB_MULTICAST_FRAME_IDX__START_OF_SIGNED_PORTION) + frameLen;
+ if (!originPeer->identity().verify(field(ZT_PROTO_VERB_MULTICAST_FRAME_IDX__START_OF_SIGNED_PORTION,signedPartLen),signedPartLen,signature,signatureLen)) {
+ LOG("dropped MULTICAST_FRAME from %s(%s): failed signature verification, claims to be from %s",source().toString().c_str(),_remoteAddress.toString().c_str(),origin.toString().c_str());
+ return true;
+ }
}
// Security check to prohibit multicasts that are really Ethernet unicasts...
diff --git a/node/Switch.cpp b/node/Switch.cpp
index dd4aec21..c00c9ef3 100644
--- a/node/Switch.cpp
+++ b/node/Switch.cpp
@@ -213,9 +213,13 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
outp.append((uint16_t)data.size());
outp.append(data);
- C25519::Signature sig(_r->identity.sign(outp.field(ZT_PROTO_VERB_MULTICAST_FRAME_IDX__START_OF_SIGNED_PORTION,signedPartLen),signedPartLen));
- outp.append((uint16_t)sig.size());
- outp.append(sig.data,(unsigned int)sig.size());
+ if (network->authenticateMulticasts()) {
+ C25519::Signature sig(_r->identity.sign(outp.field(ZT_PROTO_VERB_MULTICAST_FRAME_IDX__START_OF_SIGNED_PORTION,signedPartLen),signedPartLen));
+ outp.append((uint16_t)sig.size());
+ outp.append(sig.data,(unsigned int)sig.size());
+ } else {
+ outp.append((uint16_t)0);
+ }
// FIXME: now we send the netconf cert with every single multicast,
// which pretty much ensures everyone has it ahead of time but adds