This commit is contained in:
Adam Ierymenko 2016-06-24 05:21:25 -07:00
parent be5996daca
commit 20d155e630
4 changed files with 17 additions and 17 deletions

6
cli/README.md Normal file
View File

@ -0,0 +1,6 @@
ZeroTier Newer-Spiffier Command Line Interface
======
This will be the future home of our new unified CLI for ZeroTier One, controllers, and Central (my.zerotier.com etc.).
IT IS NOT DONE AND DOES NOT WORK EVEN A LITTLE BIT. GO AWAY.

View File

@ -9,12 +9,11 @@ CREATE TABLE Network (
private integer NOT NULL DEFAULT(1),
enableBroadcast integer NOT NULL DEFAULT(1),
allowPassiveBridging integer NOT NULL DEFAULT(0),
v4AssignMode varchar(8) NOT NULL DEFAULT('none'),
v6AssignMode varchar(8) NOT NULL DEFAULT('none'),
multicastLimit integer NOT NULL DEFAULT(32),
creationTime integer NOT NULL DEFAULT(0),
revision integer NOT NULL DEFAULT(1),
memberRevisionCounter integer NOT NULL DEFAULT(1)
memberRevisionCounter integer NOT NULL DEFAULT(1),
flags integer NOT NULL DEFAULT(0)
);
CREATE TABLE AuthToken (

View File

@ -10,12 +10,11 @@
" private integer NOT NULL DEFAULT(1),\n"\
" enableBroadcast integer NOT NULL DEFAULT(1),\n"\
" allowPassiveBridging integer NOT NULL DEFAULT(0),\n"\
" v4AssignMode varchar(8) NOT NULL DEFAULT('none'),\n"\
" v6AssignMode varchar(8) NOT NULL DEFAULT('none'),\n"\
" multicastLimit integer NOT NULL DEFAULT(32),\n"\
" creationTime integer NOT NULL DEFAULT(0),\n"\
" revision integer NOT NULL DEFAULT(1),\n"\
" memberRevisionCounter integer NOT NULL DEFAULT(1)\n"\
" memberRevisionCounter integer NOT NULL DEFAULT(1),\n"\
" flags integer NOT NULL DEFAULT(0)\n"\
");\n"\
"\n"\
"CREATE TABLE AuthToken (\n"\

View File

@ -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;
}