Compare commits

..
25 Commits
Author SHA1 Message Date
Adam Ierymenko 03ea06fa84 VERSION 0.6.11: Windows wrap-up work, NAT-t fixes
This version fixes a minor NAT traversal issue. In the past, NAT-t links had a timeout
but otherwise were preserved. This version makes them more ephemeral and invalidates
them on sleep/wake or changes in network configuration or environment.

This is because many NAT setups are very fragile with regard to hole punches, so the
past stickiness of links caused dead links to persist too long and break connectivity
between peers.

This is about 75% of what needs to be done to greatly improve robustness. The other 25%
involves detecting failed links or failed relays.

This version is also almost done for the Windows platform, moving us even closer to
binary release.
2014-01-30 15:49:08 -08:00
Adam Ierymenko 525ab3faa9 Take TRACE back out of Mac makefile, fix a few decode little things. 2014-01-30 15:26:12 -08:00
Adam Ierymenko 490e86dde3 Bunch of fixes to startup, pinging, and choice of route. Also some TRACE updates. 2014-01-30 14:23:52 -08:00
Adam Ierymenko 6e076e77d8 More work on connection reset stuff... 2014-01-29 22:04:23 -08:00
Adam Ierymenko d75f2f7051 SIGHUP now causes resync with peers. 2014-01-29 17:24:55 -08:00
Adam Ierymenko aa1be9fcad Some TRACE cleanup. 2014-01-29 20:09:55 -05:00
Adam Ierymenko 17796aaed4 TRACE NOP receipt. 2014-01-29 17:08:03 -08:00
Adam Ierymenko 2355fa973e Tiny compiler warning fix. 2014-01-29 18:27:02 -05:00
Adam Ierymenko 694e9f2bdc Some cleanup and rationalization of main loop. 2014-01-29 14:09:12 -08:00
Adam Ierymenko 372566295e Alternate order of packet emission in unite(). 2014-01-29 12:11:01 -08:00
Adam Ierymenko 4e85213473 Yank RuntimeEnvironment from SysEnv. 2014-01-29 09:58:17 -08:00
Adam Ierymenko d6a346ca6e Fix for GitHub issue #35 and also possibly partial fix for #29 issues. 2014-01-28 16:12:24 -08:00
Adam Ierymenko 8b65b3e6d7 Yank PROBE stuff since it's not used and was a premature addition to the protocol. 2014-01-28 10:41:43 -08:00
Adam Ierymenko ffffc0179f Fix a couple compile items. 2014-01-27 23:16:15 -08:00
Adam Ierymenko f80ec871f6 Make EthernetTap creation occur in a background thread in Network since it's a time consuming operation on Windows. This fixes one of the last remaining Windows problems. 2014-01-27 23:13:36 -08:00
Adam Ierymenko e0cb5caef2 UI appearance tweaks. 2014-01-27 14:55:56 -08:00
Adam Ierymenko afbbf61588 Delete persistent tap device on Windows when we leave a network. 2014-01-26 22:47:08 -08:00
Adam Ierymenko 28665079a0 Windows UI appearance fixes (font issue, etc.) and fix to WinSock init on GUI client. 2014-01-26 22:24:29 -08:00
Adam Ierymenko 80997f652b Few small cleanup things... 2014-01-26 10:59:33 -08:00
Adam Ierymenko 9d67a02b5f Lock down individual files in networks.d instead of directory since directory ACLs are more complex on Windows. 2014-01-26 10:32:12 -08:00
Adam Ierymenko 22efa1ab53 Windows Installer work, fix 100% CPU bug in EthernetTap on Windows, Windows lockDownFile() implementation that uses 'cacls' utility. 2014-01-26 10:21:43 -08:00
Adam Ierymenko f19d1e253a Merge branch 'adamierymenko-dev' of ssh://shub-niggurath.zerotier.com/git/ZeroTierOne into adamierymenko-dev 2014-01-24 23:15:38 -08:00
Adam Ierymenko b65f7f7895 Qt GUI now builds and runs on Windows. On Windows it can (via its manifest) automatically request admin rights on launch, which plugs it nicely into Windows' admin rights system without requiring file copies and such. 2014-01-24 23:15:14 -08:00
Adam Ierymenko fb49d2ced9 Small mac installer script fix. 2014-01-24 17:30:46 -08:00
Adam Ierymenko 434ce96f2c Officially signed 32-bit build of Windows tap driver. 2014-01-24 17:29:46 -08:00
43 changed files with 1084 additions and 546 deletions

No files matched your search

+88 -86
View File
@@ -3,105 +3,107 @@ TARGET = "ZeroTier One"
TEMPLATE = app
win32:RC_FILE = ZeroTierUI.rc
win32:LIBS += winhttp.lib Iphlpapi.lib ws2_32.lib advapi32.lib Shell32.lib Rpcrt4.lib
win32:QMAKE_LFLAGS += /MANIFESTUAC:\"level=\'requireAdministrator\' uiAccess=\'false\'\"
mac:ICON = zt1icon.icns
mac:QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
mac:QMAKE_INFO_PLIST = Info.plist
mac:LIBS += -framework Cocoa
SOURCES += main.cpp\
mainwindow.cpp \
aboutwindow.cpp \
../node/C25519.cpp \
../node/CertificateOfMembership.cpp \
../node/Defaults.cpp \
../node/Demarc.cpp \
../node/EthernetTap.cpp \
../node/HttpClient.cpp \
../node/Identity.cpp \
../node/InetAddress.cpp \
../node/Logger.cpp \
../node/Multicaster.cpp \
../node/Network.cpp \
../node/NetworkConfig.cpp \
../node/Node.cpp \
../node/NodeConfig.cpp \
../node/Packet.cpp \
../node/PacketDecoder.cpp \
../node/Peer.cpp \
../node/Poly1305.cpp \
../node/Salsa20.cpp \
../node/Service.cpp \
../node/SHA512.cpp \
../node/SoftwareUpdater.cpp \
../node/Switch.cpp \
../node/SysEnv.cpp \
../node/Topology.cpp \
../node/UdpSocket.cpp \
../node/Utils.cpp \
../ext/lz4/lz4.c \
../ext/lz4/lz4hc.c \
networkwidget.cpp \
installdialog.cpp \
SOURCES += main.cpp \
mainwindow.cpp \
aboutwindow.cpp \
../node/C25519.cpp \
../node/CertificateOfMembership.cpp \
../node/Defaults.cpp \
../node/Demarc.cpp \
../node/EthernetTap.cpp \
../node/HttpClient.cpp \
../node/Identity.cpp \
../node/InetAddress.cpp \
../node/Logger.cpp \
../node/Multicaster.cpp \
../node/Network.cpp \
../node/NetworkConfig.cpp \
../node/Node.cpp \
../node/NodeConfig.cpp \
../node/Packet.cpp \
../node/PacketDecoder.cpp \
../node/Peer.cpp \
../node/Poly1305.cpp \
../node/Salsa20.cpp \
../node/Service.cpp \
../node/SHA512.cpp \
../node/SoftwareUpdater.cpp \
../node/Switch.cpp \
../node/SysEnv.cpp \
../node/Topology.cpp \
../node/UdpSocket.cpp \
../node/Utils.cpp \
../ext/lz4/lz4.c \
../ext/lz4/lz4hc.c \
networkwidget.cpp \
installdialog.cpp \
licensedialog.cpp
HEADERS += mainwindow.h \
aboutwindow.h \
../node/Node.hpp \
../node/Utils.hpp \
../node/Defaults.hpp \
../node/Address.hpp \
../node/Array.hpp \
../node/AtomicCounter.hpp \
../node/BandwidthAccount.hpp \
../node/Buffer.hpp \
../node/C25519.hpp \
../node/CertificateOfMembership.hpp \
../node/CMWC4096.hpp \
../node/Condition.hpp \
../node/Constants.hpp \
../node/Demarc.hpp \
../node/Dictionary.hpp \
../node/EthernetTap.hpp \
../node/HttpClient.hpp \
../node/Identity.hpp \
../node/InetAddress.hpp \
../node/Logger.hpp \
../node/MAC.hpp \
../node/Multicaster.hpp \
../node/MulticastGroup.hpp \
../node/Mutex.hpp \
../node/Network.hpp \
../node/NetworkConfig.hpp \
../node/NodeConfig.hpp \
../node/NonCopyable.hpp \
../node/Packet.hpp \
../node/PacketDecoder.hpp \
../node/Peer.hpp \
../node/Poly1305.hpp \
../node/RuntimeEnvironment.hpp \
../node/Salsa20.hpp \
../node/Service.hpp \
../node/SHA512.hpp \
../node/SharedPtr.hpp \
../node/SoftwareUpdater.hpp \
../node/Switch.hpp \
../node/SysEnv.hpp \
../node/Thread.hpp \
../node/Topology.hpp \
../node/UdpSocket.hpp \
../ext/lz4/lz4.h \
../ext/lz4/lz4hc.h \
networkwidget.h \
installdialog.h \
mac_doprivileged.h \
aboutwindow.h \
../node/Node.hpp \
../node/Utils.hpp \
../node/Defaults.hpp \
../node/Address.hpp \
../node/Array.hpp \
../node/AtomicCounter.hpp \
../node/BandwidthAccount.hpp \
../node/Buffer.hpp \
../node/C25519.hpp \
../node/CertificateOfMembership.hpp \
../node/CMWC4096.hpp \
../node/Condition.hpp \
../node/Constants.hpp \
../node/Demarc.hpp \
../node/Dictionary.hpp \
../node/EthernetTap.hpp \
../node/HttpClient.hpp \
../node/Identity.hpp \
../node/InetAddress.hpp \
../node/Logger.hpp \
../node/MAC.hpp \
../node/Multicaster.hpp \
../node/MulticastGroup.hpp \
../node/Mutex.hpp \
../node/Network.hpp \
../node/NetworkConfig.hpp \
../node/NodeConfig.hpp \
../node/NonCopyable.hpp \
../node/Packet.hpp \
../node/PacketDecoder.hpp \
../node/Peer.hpp \
../node/Poly1305.hpp \
../node/RuntimeEnvironment.hpp \
../node/Salsa20.hpp \
../node/Service.hpp \
../node/SHA512.hpp \
../node/SharedPtr.hpp \
../node/SoftwareUpdater.hpp \
../node/Switch.hpp \
../node/SysEnv.hpp \
../node/Thread.hpp \
../node/Topology.hpp \
../node/UdpSocket.hpp \
../ext/lz4/lz4.h \
../ext/lz4/lz4hc.h \
networkwidget.h \
installdialog.h \
mac_doprivileged.h \
licensedialog.h \
main.h
FORMS += mainwindow.ui \
aboutwindow.ui \
networkwidget.ui \
installdialog.ui \
aboutwindow.ui \
networkwidget.ui \
installdialog.ui \
licensedialog.ui
RESOURCES += \
+2 -1
View File
@@ -29,7 +29,9 @@
#include "ui_aboutwindow.h"
#include <QMessageBox>
#include <QFont>
#include "../node/Constants.hpp"
#include "../node/Node.hpp"
AboutWindow::AboutWindow(QWidget *parent) :
@@ -37,7 +39,6 @@ AboutWindow::AboutWindow(QWidget *parent) :
ui(new Ui::AboutWindow)
{
ui->setupUi(this);
ui->aboutTextLabel->setText(QString("ZeroTier One\nVersion ")+ZeroTier::Node::versionString()+"\nQt Graphical User Interface\n\n(c)2011-2014 ZeroTier Networks LLC\n\nReleased under the terms of the GNU\nGeneral Public License v3.0, see: http://gplv3.fsf.org for terms.\n\nAuthor(s): Adam Ierymenko");
}
+1 -1
View File
@@ -134,7 +134,7 @@
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<enum>QFrame::Sunken</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
+11
View File
@@ -5,11 +5,22 @@
#include "licensedialog.h"
#include "ui_licensedialog.h"
#include "../node/Constants.hpp"
LicenseDialog::LicenseDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::LicenseDialog)
{
ui->setupUi(this);
#ifdef __WINDOWS__
QWidgetList widgets = this->findChildren<QWidget*>();
foreach(QWidget *widget, widgets) {
QFont font(widget->font());
font.setPointSizeF(font.pointSizeF() * 0.75);
widget->setFont(font);
}
#endif
}
LicenseDialog::~LicenseDialog()
+15
View File
@@ -32,6 +32,12 @@
#include <QApplication>
#include <QDir>
#include <QString>
#include <QFont>
#ifdef __WINDOWS__
#include <WinSock2.h>
#include <windows.h>
#endif
QSettings *settings = (QSettings *)0;
@@ -39,6 +45,13 @@ int main(int argc, char *argv[])
{
QApplication a(argc, argv);
#ifdef __WINDOWS__
{
WSADATA wsaData;
WSAStartup(MAKEWORD(2,2),&wsaData);
}
#endif
{
QFile qss(":css/stylesheet.css");
qss.open(QFile::ReadOnly);
@@ -59,6 +72,8 @@ int main(int argc, char *argv[])
#ifdef __APPLE__
{
// Put QSettings here because this is one of the writable directories allowed
// in Apple's app store sandbox specs. We might end up in app store someday.
QString zt1AppSupport(QDir::homePath() + "/Library/Application Support/ZeroTier/One");
QDir::root().mkpath(zt1AppSupport);
settings = new QSettings(zt1AppSupport + "/ui.ini",QSettings::IniFormat);
+48 -24
View File
@@ -44,6 +44,7 @@
#include <QVBoxLayout>
#include <QScrollBar>
#include <QEventLoop>
#include <QFont>
#include "main.h"
#include "mainwindow.h"
@@ -99,13 +100,29 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this);
if (ui->networkListWidget->verticalScrollBar())
ui->networkListWidget->verticalScrollBar()->setSingleStep(8);
#ifdef __APPLE__
QWidgetList widgets = this->findChildren<QWidget*>();
foreach(QWidget *widget, widgets)
widget->setAttribute(Qt::WA_MacShowFocusRect,false);
ui->noNetworksLabel->setText("Connecting to Service..."); // changed when result is received
#endif
this->pollServiceTimerId = this->startTimer(1000);
this->setEnabled(false); // gets enabled when updates are received
#ifdef __WINDOWS__
QWidgetList widgets = this->findChildren<QWidget*>();
foreach(QWidget *widget, widgets) {
QFont font(widget->font());
font.setPointSizeF(font.pointSizeF() * 0.75);
widget->setFont(font);
}
#endif
ui->noNetworksLabel->setVisible(true);
ui->noNetworksLabel->setText("Connecting to Service...");
ui->bottomContainerWidget->setVisible(false);
ui->networkListWidget->setVisible(false);
this->firstTimerTick = true;
this->pollServiceTimerId = this->startTimer(200);
this->cyclesSinceResponseFromService = 0;
}
@@ -117,15 +134,19 @@ MainWindow::~MainWindow()
mainWindow = (MainWindow *)0;
}
void MainWindow::timerEvent(QTimerEvent *event)
void MainWindow::timerEvent(QTimerEvent *event) // event can be null since code also calls this directly
{
event->accept();
if (this->isHidden())
return;
if (pollServiceTimerId < 0)
if (this->pollServiceTimerId < 0)
return;
if (this->firstTimerTick) {
this->firstTimerTick = false;
this->killTimer(this->pollServiceTimerId);
this->pollServiceTimerId = this->startTimer(1500);
}
if (!zeroTierClient) {
std::string authToken;
if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultUserPath().c_str(),authToken)) {
@@ -173,19 +194,25 @@ void MainWindow::timerEvent(QTimerEvent *event)
#endif
if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultUserPath().c_str(),authToken)) {
QMessageBox::critical(this,"Cannot Authorize","Unable to authorize this user to administrate ZeroTier One. (Did you enter your password correctly?)",QMessageBox::Ok,QMessageBox::NoButton);
QApplication::exit(1);
return;
if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultSystemPath().c_str(),authToken)) {
QMessageBox::critical(this,"Cannot Authorize","Unable to authorize this user to administrate ZeroTier One. (Did you enter your password correctly?)",QMessageBox::Ok,QMessageBox::NoButton);
QApplication::exit(1);
return;
}
}
}
zeroTierClient = new ZeroTier::Node::LocalClient(authToken.c_str(),0,&handleZTMessage,this);
}
// TODO: do something more user-friendly here... or maybe try to restart
// the service?
if (++this->cyclesSinceResponseFromService == 4)
QMessageBox::critical(this,"No Response from Service","The ZeroTier One service does not appear to be running.",QMessageBox::Ok,QMessageBox::NoButton);
if (++this->cyclesSinceResponseFromService >= 3) {
if (this->cyclesSinceResponseFromService == 3)
QMessageBox::warning(this,"Service Not Running","Can't connect to the ZeroTier One service. Is it running?",QMessageBox::Ok);
ui->noNetworksLabel->setVisible(true);
ui->noNetworksLabel->setText("Connecting to Service...");
ui->bottomContainerWidget->setVisible(false);
ui->networkListWidget->setVisible(false);
}
zeroTierClient->send("info");
zeroTierClient->send("listnetworks");
@@ -198,14 +225,14 @@ void MainWindow::customEvent(QEvent *event)
if (m->ztMessage.size() == 0)
return;
this->cyclesSinceResponseFromService = 0;
std::vector<std::string> hdr(ZeroTier::Node::LocalClient::splitLine(m->ztMessage[0]));
if (hdr.size() < 2)
return;
if (hdr[0] != "200")
return;
this->cyclesSinceResponseFromService = 0;
if (hdr[1] == "info") {
if (hdr.size() >= 3)
this->myAddress = hdr[2].c_str();
@@ -281,6 +308,11 @@ void MainWindow::customEvent(QEvent *event)
ui->noNetworksLabel->setVisible(true);
} else ui->noNetworksLabel->setVisible(false);
if (!ui->bottomContainerWidget->isVisible())
ui->bottomContainerWidget->setVisible(true);
if (!ui->networkListWidget->isVisible())
ui->networkListWidget->setVisible(true);
if (this->myAddress.size())
ui->addressButton->setText(this->myAddress);
else ui->addressButton->setText(" ");
@@ -292,14 +324,6 @@ void MainWindow::customEvent(QEvent *event)
st += QString::number(this->numPeers);
st += " direct links to peers";
ui->statusLabel->setText(st);
if (this->myStatus == "ONLINE") {
if (!this->isEnabled())
this->setEnabled(true);
} else {
if (this->isEnabled())
this->setEnabled(false);
}
}
void MainWindow::on_joinNetworkButton_clicked()
+2
View File
@@ -39,6 +39,7 @@
#include <vector>
#include <string>
#include "../node/Constants.hpp"
#include "../node/Node.hpp"
#include "../node/Utils.hpp"
@@ -85,6 +86,7 @@ private:
QString myAddress;
QString myStatus;
QString myVersion;
bool firstTimerTick;
int pollServiceTimerId;
unsigned int numPeers;
unsigned int cyclesSinceResponseFromService;
+18 -40
View File
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>668</width>
<width>720</width>
<height>300</height>
</rect>
</property>
@@ -36,43 +36,6 @@
</property>
<item>
<widget class="QLabel" name="noNetworksLabel">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="64">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="64">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>127</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
@@ -266,10 +229,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>668</width>
<width>720</width>
<height>22</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
@@ -292,7 +260,7 @@
<widget class="QStatusBar" name="statusBar">
<property name="font">
<font>
<pointsize>12</pointsize>
<pointsize>10</pointsize>
</font>
</property>
</widget>
@@ -300,11 +268,21 @@
<property name="text">
<string>About</string>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</action>
<action name="actionExit">
<property name="text">
<string>Exit</string>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
+22 -2
View File
@@ -36,6 +36,9 @@
#include <QProcess>
#include <QList>
#include <QMessageBox>
#include <QFont>
#include "../node/Constants.hpp"
NetworkWidget::NetworkWidget(QWidget *parent,const std::string &nwid) :
QWidget(parent),
@@ -50,9 +53,20 @@ NetworkWidget::NetworkWidget(QWidget *parent,const std::string &nwid) :
ui->ipListWidget->setMinimumHeight(lineHeight * 4);
ui->ipListWidget->setMaximumHeight(lineHeight * 4);
#ifdef __APPLE__
QWidgetList widgets = this->findChildren<QWidget*>();
foreach(QWidget* widget, widgets)
widget->setAttribute(Qt::WA_MacShowFocusRect,false);
#endif
#ifdef __WINDOWS__
QWidgetList widgets = this->findChildren<QWidget*>();
foreach(QWidget *widget, widgets) {
QFont font(widget->font());
font.setPointSizeF(font.pointSizeF() * 0.75);
widget->setFont(font);
}
#endif
}
NetworkWidget::~NetworkWidget()
@@ -145,6 +159,12 @@ void NetworkWidget::on_networkIdButton_clicked()
void NetworkWidget::on_ipListWidget_itemActivated(QListWidgetItem *item)
{
if (item)
QApplication::clipboard()->setText(item->text());
if (item)
QApplication::clipboard()->setText(item->text());
}
void NetworkWidget::on_ipListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
{
if (current)
QApplication::clipboard()->setText(current->text());
}
+1
View File
@@ -57,6 +57,7 @@ private slots:
void on_leaveNetworkButton_clicked();
void on_networkIdButton_clicked();
void on_ipListWidget_itemActivated(QListWidgetItem *item);
void on_ipListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
private:
Ui::NetworkWidget *ui;
+52 -2
View File
@@ -95,6 +95,24 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>[</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nameLabel">
<property name="font">
@@ -114,7 +132,7 @@
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
@@ -124,6 +142,37 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>]</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
@@ -384,6 +433,7 @@
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<underline>false</underline>
</font>
</property>
@@ -419,7 +469,7 @@
</font>
</property>
<property name="statusTip">
<string>Double-click an IP to copy it to the clipboard.</string>
<string>IP addresses assigned to this interface; click to copy to clipboard.</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
+18 -2
View File
@@ -11,6 +11,7 @@ QToolButton:focus {
}
QToolButton:hover {
background: palette(highlight);
color: palette(highlight-text);
}
QToolButton:pressed {
border: 1px solid #000000;
@@ -63,16 +64,26 @@ QListWidget.ipAddressList::item {
}
QListWidget.ipAddressList::item:selected {
background: transparent;
border-top: 0;
border-left: 0;
border-right: 0;
border-bottom: 1px solid transparent;
}
QListWidget.ipAddressList::item:hover {
border-bottom: 1px solid palette(link);
}
QStatusBar {
background: palette(button);
}
QLabel.networkName {
padding: 0 0.8em 0.1em 0;
padding: 0;
margin: 0;
text-align: right;
}
#networkIdButton {
padding: 0.2em 0 0 0;
}
#joinNetworkButton {
@@ -80,6 +91,11 @@ QLabel.networkName {
padding: 0;
}
#noNetworksLabel {
background: transparent;
color: #ffffff;
}
#networkListWidget {
background: palette(dark);
margin: 0 0 2px 0;
Binary file not shown.
Binary file not shown.
+76
View File
@@ -0,0 +1,76 @@
[Version]
Signature="$WINDOWS NT$"
Class=Net
ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318}
Provider=%Provider%
CatalogFile=zttap200.cat
DriverVer=01/24/2014,17.25.51.226
[Strings]
DeviceDescription = "ZeroTier One Virtual Network Port"
Provider = "ZeroTier Networks LLC"
; To build for x86, take NTamd64 off this and off the named section manually, build, then put it back!
[Manufacturer]
%Provider%=zttap200
[zttap200]
%DeviceDescription%=zttap200.ndi,zttap200
[zttap200.ndi]
CopyFiles = zttap200.driver,zttap200.files
AddReg = zttap200.reg
AddReg = zttap200.params.reg
Characteristics = 0x81
[zttap200.ndi.Services]
AddService = zttap200, 2, zttap200.service
[zttap200.reg]
HKR, Ndi, Service, 0, "zttap200"
HKR, Ndi\Interfaces, UpperRange, 0, "ndis5"
HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"
HKR, , Manufacturer, 0, "%Provider%"
HKR, , ProductName, 0, "%DeviceDescription%"
[zttap200.params.reg]
HKR, Ndi\params\MTU, ParamDesc, 0, "MTU"
HKR, Ndi\params\MTU, Type, 0, "int"
HKR, Ndi\params\MTU, Default, 0, "2800"
HKR, Ndi\params\MTU, Optional, 0, "0"
HKR, Ndi\params\MTU, Min, 0, "100"
HKR, Ndi\params\MTU, Max, 0, "2800"
HKR, Ndi\params\MTU, Step, 0, "1"
HKR, Ndi\params\MediaStatus, ParamDesc, 0, "Media Status"
HKR, Ndi\params\MediaStatus, Type, 0, "enum"
HKR, Ndi\params\MediaStatus, Default, 0, "0"
HKR, Ndi\params\MediaStatus, Optional, 0, "0"
HKR, Ndi\params\MediaStatus\enum, "0", 0, "Application Controlled"
HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always Connected"
HKR, Ndi\params\MAC, ParamDesc, 0, "MAC Address"
HKR, Ndi\params\MAC, Type, 0, "edit"
HKR, Ndi\params\MAC, Optional, 0, "1"
[zttap200.service]
DisplayName = %DeviceDescription%
ServiceType = 1
StartType = 3
ErrorControl = 1
LoadOrderGroup = NDIS
ServiceBinary = %12%\zttap200.sys
[SourceDisksNames]
1 = %DeviceDescription%, zttap200.sys
[SourceDisksFiles]
zttap200.sys = 1
[DestinationDirs]
zttap200.files = 11
zttap200.driver = 12
[zttap200.files]
;
[zttap200.driver]
zttap200.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
Binary file not shown.
+1 -6
View File
@@ -127,14 +127,9 @@ fi
echo 'Installing and (re-)starting zerotier-one service via launchctl...'
mv -f './Library/LaunchDaemons/com.zerotier.one.plist' '/Library/LaunchDaemons/'
if [ ! -z "`launchctl list | grep -F com.zerotier.one`" ]; then
launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist
sleep 1
fi
launchctl load /Library/LaunchDaemons/com.zerotier.one.plist
sleep 1
/usr/bin/zerotier-cli info
# launchctl will restart us after exit if this is an online auto-update
cd /tmp
rm -rf _zt1tmp
+7 -1
View File
@@ -357,6 +357,12 @@ static int main(int argc,char **argv)
} // namespace ZeroTierIdTool ------------------------------------------------
#ifdef __UNIX_LIKE__
static void sighandlerHup(int sig)
{
Node *n = node;
if (n)
n->resync();
}
static void sighandlerQuit(int sig)
{
Node *n = node;
@@ -569,7 +575,7 @@ int main(int argc,char **argv)
#endif
{
#ifdef __UNIX_LIKE__
signal(SIGHUP,SIG_IGN);
signal(SIGHUP,&sighandlerHup);
signal(SIGPIPE,SIG_IGN);
signal(SIGUSR1,SIG_IGN);
signal(SIGUSR2,SIG_IGN);
+100 -38
View File
@@ -336,8 +336,6 @@ EthernetTap::EthernetTap(
}
}
whack(); // turns on IPv6 on OSX
::pipe(_shutdownSignalPipe);
_thread = Thread::start(this);
@@ -378,7 +376,7 @@ EthernetTap::~EthernetTap()
#endif // __APPLE__
}
#ifdef __APPLE__
/*
void EthernetTap::whack()
{
const char *ipconfig = UNIX_COMMANDS[ZT_MAC_IPCONFIG_COMMAND];
@@ -393,9 +391,7 @@ void EthernetTap::whack()
}
}
}
#else
void EthernetTap::whack() {}
#endif // __APPLE__ / !__APPLE__
*/
void EthernetTap::setDisplayName(const char *dn)
{
@@ -570,6 +566,11 @@ std::string EthernetTap::deviceName() const
return std::string(_dev);
}
std::string EthernetTap::persistentId() const
{
return std::string();
}
#ifdef __LINUX__
bool EthernetTap::updateMulticastGroups(std::set<MulticastGroup> &groups)
{
@@ -901,6 +902,11 @@ void EthernetTap::threadMain()
}
}
bool EthernetTap::deletePersistentTapDevice(const RuntimeEnvironment *_r,const char *pid)
{
return false;
}
} // namespace ZeroTier
#endif // __UNIX_LIKE__ //////////////////////////////////////////////////////
@@ -969,7 +975,8 @@ EthernetTap::EthernetTap(
_arg(arg),
_tap(INVALID_HANDLE_VALUE),
_injectSemaphore(INVALID_HANDLE_VALUE),
_run(true)
_run(true),
_initialized(false)
{
char subkeyName[4096];
char subkeyClass[4096];
@@ -1193,11 +1200,15 @@ EthernetTap::EthernetTap(
// Start background thread that actually performs I/O
_injectSemaphore = CreateSemaphore(NULL,0,1,NULL);
_thread = Thread::start(this);
// Certain functions can now work (e.g. ips())
_initialized = true;
}
EthernetTap::~EthernetTap()
{
_run = false;
ReleaseSemaphore(_injectSemaphore,1,NULL);
Thread::join(_thread);
CloseHandle(_tap);
@@ -1227,12 +1238,10 @@ EthernetTap::~EthernetTap()
}
}
void EthernetTap::whack()
{
}
void EthernetTap::setDisplayName(const char *dn)
{
if (!_initialized)
return;
HKEY ifp;
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,(std::string("SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\") + _myDeviceInstanceId).c_str(),0,KEY_READ|KEY_WRITE,&ifp) == ERROR_SUCCESS) {
RegSetKeyValueA(ifp,"Connection","Name",REG_SZ,(LPCVOID)dn,(DWORD)(strlen(dn)+1));
@@ -1242,6 +1251,8 @@ void EthernetTap::setDisplayName(const char *dn)
bool EthernetTap::addIP(const InetAddress &ip)
{
if (!_initialized)
return false;
if (!ip.netmaskBits()) // sanity check... netmask of 0.0.0.0 is WUT?
return false;
@@ -1278,31 +1289,9 @@ bool EthernetTap::addIP(const InetAddress &ip)
}
}
// Update registry to contain all non-link-local IPs for this interface
std::string regMultiIps,regMultiNetmasks;
for(std::set<InetAddress>::const_iterator i(haveIps.begin());i!=haveIps.end();++i) {
if (!i->isLinkLocal()) {
regMultiIps.append(i->toIpString());
regMultiIps.push_back((char)0);
regMultiNetmasks.append(i->netmask().toIpString());
regMultiNetmasks.push_back((char)0);
}
}
HKEY tcpIpInterfaces;
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\services\\Tcpip\\Parameters\\Interfaces",0,KEY_READ|KEY_WRITE,&tcpIpInterfaces) == ERROR_SUCCESS) {
if (regMultiIps.length()) {
regMultiIps.push_back((char)0);
regMultiNetmasks.push_back((char)0);
RegSetKeyValueA(tcpIpInterfaces,_myDeviceInstanceId.c_str(),"IPAddress",REG_MULTI_SZ,regMultiIps.data(),(DWORD)regMultiIps.length());
RegSetKeyValueA(tcpIpInterfaces,_myDeviceInstanceId.c_str(),"SubnetMask",REG_MULTI_SZ,regMultiNetmasks.data(),(DWORD)regMultiNetmasks.length());
} else {
RegDeleteKeyValueA(tcpIpInterfaces,_myDeviceInstanceId.c_str(),"IPAddress");
RegDeleteKeyValueA(tcpIpInterfaces,_myDeviceInstanceId.c_str(),"SubnetMask");
}
}
RegCloseKey(tcpIpInterfaces);
_syncIpsWithRegistry(haveIps);
} catch (std::exception &exc) {
LOG("unexpected exception adding IP address to %s: %s",ip.toString().c_str(),deviceName().c_str(),exc.what());
LOG("unexpected exception adding IP address %s to %s: %s",ip.toString().c_str(),deviceName().c_str(),exc.what());
} catch ( ... ) {
LOG("unexpected exception adding IP address %s to %s: unknown exception",ip.toString().c_str(),deviceName().c_str());
}
@@ -1311,6 +1300,8 @@ bool EthernetTap::addIP(const InetAddress &ip)
bool EthernetTap::removeIP(const InetAddress &ip)
{
if (!_initialized)
return false;
try {
MIB_UNICASTIPADDRESS_TABLE *ipt = (MIB_UNICASTIPADDRESS_TABLE *)0;
std::pair<NET_LUID,NET_IFINDEX> ifidx = _findAdapterByGuid(_deviceGuid);
@@ -1331,13 +1322,18 @@ bool EthernetTap::removeIP(const InetAddress &ip)
if (addr == ip) {
DeleteUnicastIpAddressEntry(&(ipt->Table[i]));
FreeMibTable(ipt);
_syncIpsWithRegistry(ips());
return true;
}
}
}
FreeMibTable((PVOID)ipt);
}
} catch ( ... ) {}
} catch (std::exception &exc) {
LOG("unexpected exception removing IP address %s from %s: %s",ip.toString().c_str(),deviceName().c_str(),exc.what());
} catch ( ... ) {
LOG("unexpected exception removing IP address %s from %s: unknown exception",ip.toString().c_str(),deviceName().c_str());
}
return false;
}
@@ -1346,6 +1342,9 @@ std::set<InetAddress> EthernetTap::ips() const
static const InetAddress linkLocalLoopback("fe80::1",64); // what is this and why does Windows assign it?
std::set<InetAddress> addrs;
if (!_initialized)
return addrs;
try {
MIB_UNICASTIPADDRESS_TABLE *ipt = (MIB_UNICASTIPADDRESS_TABLE *)0;
std::pair<NET_LUID,NET_IFINDEX> ifidx = _findAdapterByGuid(_deviceGuid);
@@ -1376,6 +1375,8 @@ std::set<InetAddress> EthernetTap::ips() const
void EthernetTap::put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len)
{
if (!_initialized)
return;
if (len > (ZT_IF_MTU))
return;
@@ -1398,8 +1399,16 @@ std::string EthernetTap::deviceName() const
return _myDeviceInstanceId;
}
std::string EthernetTap::persistentId() const
{
return _myDeviceInstanceIdPath;
}
bool EthernetTap::updateMulticastGroups(std::set<MulticastGroup> &groups)
{
if (!_initialized)
return false;
std::set<MulticastGroup> newGroups;
// Ensure that groups are added for each IP... this handles the MAC:ADI
@@ -1458,14 +1467,14 @@ void EthernetTap::threadMain()
HANDLE wait4[3];
wait4[0] = _injectSemaphore;
wait4[1] = _tapOvlRead.hEvent;
wait4[2] = _tapOvlWrite.hEvent;
wait4[2] = _tapOvlWrite.hEvent; // only included if writeInProgress is true
ReadFile(_tap,_tapReadBuf,sizeof(_tapReadBuf),NULL,&_tapOvlRead);
bool writeInProgress = false;
for(;;) {
if (!_run) break;
WaitForMultipleObjectsEx(3,wait4,FALSE,INFINITE,TRUE);
DWORD r = WaitForMultipleObjectsEx(writeInProgress ? 3 : 2,wait4,FALSE,INFINITE,TRUE);
if (!_run) break;
if (HasOverlappedIoCompleted(&_tapOvlRead)) {
@@ -1501,6 +1510,59 @@ void EthernetTap::threadMain()
CancelIo(_tap);
}
bool EthernetTap::deletePersistentTapDevice(const RuntimeEnvironment *_r,const char *pid)
{
#ifdef _WIN64
BOOL is64Bit = TRUE;
const char *devcon = "\\devcon_x64.exe";
#else
BOOL is64Bit = FALSE;
IsWow64Process(GetCurrentProcess(),&is64Bit);
const char *devcon = ((is64Bit == TRUE) ? "\\devcon_x64.exe" : "\\devcon_x86.exe");
#endif
STARTUPINFOA startupInfo;
startupInfo.cb = sizeof(startupInfo);
PROCESS_INFORMATION processInfo;
memset(&startupInfo,0,sizeof(STARTUPINFOA));
memset(&processInfo,0,sizeof(PROCESS_INFORMATION));
if (CreateProcessA(NULL,(LPSTR)(std::string("\"") + _r->homePath + devcon + "\" remove @" + pid).c_str(),NULL,NULL,FALSE,0,NULL,NULL,&startupInfo,&processInfo)) {
WaitForSingleObject(processInfo.hProcess,INFINITE);
CloseHandle(processInfo.hProcess);
CloseHandle(processInfo.hThread);
return true;
}
return false;
}
void EthernetTap::_syncIpsWithRegistry(const std::set<InetAddress> &haveIps)
{
// Update registry to contain all non-link-local IPs for this interface
std::string regMultiIps,regMultiNetmasks;
for(std::set<InetAddress>::const_iterator i(haveIps.begin());i!=haveIps.end();++i) {
if (!i->isLinkLocal()) {
regMultiIps.append(i->toIpString());
regMultiIps.push_back((char)0);
regMultiNetmasks.append(i->netmask().toIpString());
regMultiNetmasks.push_back((char)0);
}
}
HKEY tcpIpInterfaces;
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\services\\Tcpip\\Parameters\\Interfaces",0,KEY_READ|KEY_WRITE,&tcpIpInterfaces) == ERROR_SUCCESS) {
if (regMultiIps.length()) {
regMultiIps.push_back((char)0);
regMultiNetmasks.push_back((char)0);
RegSetKeyValueA(tcpIpInterfaces,_myDeviceInstanceId.c_str(),"IPAddress",REG_MULTI_SZ,regMultiIps.data(),(DWORD)regMultiIps.length());
RegSetKeyValueA(tcpIpInterfaces,_myDeviceInstanceId.c_str(),"SubnetMask",REG_MULTI_SZ,regMultiNetmasks.data(),(DWORD)regMultiNetmasks.length());
} else {
RegDeleteKeyValueA(tcpIpInterfaces,_myDeviceInstanceId.c_str(),"IPAddress");
RegDeleteKeyValueA(tcpIpInterfaces,_myDeviceInstanceId.c_str(),"SubnetMask");
}
}
RegCloseKey(tcpIpInterfaces);
}
} // namespace ZeroTier
#endif // __WINDOWS__ ////////////////////////////////////////////////////////
+21 -5
View File
@@ -94,11 +94,6 @@ public:
*/
~EthernetTap();
/**
* Perform OS dependent actions on network configuration change detection
*/
void whack();
/**
* Set the user display name for this connection
*
@@ -175,6 +170,11 @@ public:
*/
std::string deviceName() const;
/**
* @return OS-internal persistent device ID or empty string if not applicable to this platform or not persistent
*/
std::string persistentId() const;
/**
* Fill or modify a set to contain multicast groups for this device
*
@@ -195,6 +195,19 @@ public:
void threadMain()
throw();
/**
* Remove persistent tap device by device name
*
* This has no effect on platforms that do not have persistent taps.
* On platforms like Windows with persistent devices the device is
* uninstalled.
*
* @param _r Runtime environment
* @param pdev Device name as returned by persistentId() while tap is running
* @return True if a device was deleted
*/
static bool deletePersistentTapDevice(const RuntimeEnvironment *_r,const char *pid);
private:
const MAC _mac;
const unsigned int _mtu;
@@ -215,6 +228,8 @@ private:
#endif
#ifdef __WINDOWS__
void _syncIpsWithRegistry(const std::set<InetAddress> &haveIps);
HANDLE _tap;
OVERLAPPED _tapOvlRead,_tapOvlWrite;
char _tapReadBuf[ZT_IF_MTU + 32];
@@ -225,6 +240,7 @@ private:
std::queue< std::pair< Array<char,ZT_IF_MTU + 32>,unsigned int > > _injectPending;
Mutex _injectPending_m;
volatile bool _run;
volatile bool _initialized;
#endif
};
Loaded 20 of 43 files, more files were not shown because too many files have changed in this diff. Show more