summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-06-24 05:21:25 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-06-24 05:21:25 -0700
commit20d155e630aba9fdfb757765e889c13ea8d9a9d9 (patch)
tree70a69d29a128723c1548ec87d7b5b5fb1eb62f68 /node
parentbe5996daca9fab8125ba765ad1c1cba560369a30 (diff)
downloadinfinitytier-20d155e630aba9fdfb757765e889c13ea8d9a9d9.tar.gz
infinitytier-20d155e630aba9fdfb757765e889c13ea8d9a9d9.zip
.
Diffstat (limited to 'node')
-rw-r--r--node/Switch.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/node/Switch.cpp b/node/Switch.cpp
index d2f482d6..b134cc69 100644
--- a/node/Switch.cpp
+++ b/node/Switch.cpp
@@ -357,9 +357,9 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
const uint8_t *const pkt6 = reinterpret_cast<const uint8_t *>(data) + 40 + 8;
const uint8_t *my6 = (const uint8_t *)0;
- // ZT-rfc4193 address: fdNN:NNNN:NNNN:NNNN:NN99:93DD:DDDD:DDDD / 88 (one /128 per actual host)
+ // ZT-RFC4193 address: fdNN:NNNN:NNNN:NNNN:NN99:93DD:DDDD:DDDD / 88 (one /128 per actual host)
- // ZT-6plane address: fcXX:XXXX:XXDD:DDDD:DDDD:####:####:#### / 40 (one /80 per actual host)
+ // ZT-6PLANE address: fcXX:XXXX:XXDD:DDDD:DDDD:####:####:#### / 40 (one /80 per actual host)
// (XX - lower 32 bits of network ID XORed with higher 32 bits)
// For these to work, we must have a ZT-managed address assigned in one of the
@@ -369,31 +369,27 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
if (sip->ss_family == AF_INET6) {
my6 = reinterpret_cast<const uint8_t *>(reinterpret_cast<const struct sockaddr_in6 *>(&(*sip))->sin6_addr.s6_addr);
const unsigned int sipNetmaskBits = Utils::ntoh((uint16_t)reinterpret_cast<const struct sockaddr_in6 *>(&(*sip))->sin6_port);
- if ((sipNetmaskBits == 88)&&(my6[0] == 0xfd)&&(my6[9] == 0x99)&&(my6[10] == 0x93)) {
+ if ((sipNetmaskBits == 88)&&(my6[0] == 0xfd)&&(my6[9] == 0x99)&&(my6[10] == 0x93)) { // ZT-RFC4193 /88 ???
unsigned int ptr = 0;
while (ptr != 11) {
if (pkt6[ptr] != my6[ptr])
break;
++ptr;
}
- if (ptr == 11) {
+ if (ptr == 11) { // prefix match!
v6EmbeddedAddress.setTo(pkt6 + ptr,5);
break;
}
- } else if (sipNetmaskBits == 40) {
+ } else if (sipNetmaskBits == 40) { // ZT-6PLANE /40 ???
const uint32_t nwid32 = (uint32_t)((network->id() ^ (network->id() >> 32)) & 0xffffffff);
- if ((my6[0] == 0xfc) &&
- (my6[1] == (uint8_t)((nwid32 >> 24) & 0xff)) &&
- (my6[2] == (uint8_t)((nwid32 >> 16) & 0xff)) &&
- (my6[3] == (uint8_t)((nwid32 >> 8) & 0xff)) &&
- (my6[4] == (uint8_t)(nwid32 & 0xff))) {
+ if ( (my6[0] == 0xfc) && (my6[1] == (uint8_t)((nwid32 >> 24) & 0xff)) && (my6[2] == (uint8_t)((nwid32 >> 16) & 0xff)) && (my6[3] == (uint8_t)((nwid32 >> 8) & 0xff)) && (my6[4] == (uint8_t)(nwid32 & 0xff))) {
unsigned int ptr = 0;
while (ptr != 5) {
if (pkt6[ptr] != my6[ptr])
break;
++ptr;
}
- if (ptr == 5) {
+ if (ptr == 5) { // prefix match!
v6EmbeddedAddress.setTo(pkt6 + ptr,5);
break;
}