Merge pull request #89 from openziti/issue-82-fix-mtu

Issue 82 fix mtu
This commit is contained in:
dovholuknf
2020-08-03 08:10:56 -04:00
committed by GitHub
12 changed files with 154 additions and 73 deletions
+33
View File
@@ -51,5 +51,38 @@
</Grid>
</StackPanel>
</Grid>
<Grid x:Name="ConfirmView" Visibility="Collapsed" Width="350">
<Rectangle RadiusX="10" RadiusY="10">
<Rectangle.Fill>
<SolidColorBrush Color="Black" Opacity="0.9"/>
</Rectangle.Fill>
</Rectangle>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="80"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Label Name="ErrorTitle" Foreground="White" Content="Confirm Forget" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="24" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"/>
<TextBlock TextWrapping="WrapWithOverflow" Foreground="LightGray" Padding="10" Text="If you delete this identity you will no longer have access to the resources that it grants you." Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" FontSize="14" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"/>
<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="160"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Name="CancelConfirmButton" Grid.Column="0" Foreground="#CCCCCC" FontWeight="SemiBold" Content="Close" Cursor="Hand" MouseUp="CancelConfirm" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" HorizontalAlignment="Center"></Label>
<Label Name="ConfirmButton" Grid.Column="1" Foreground="#F4044D" FontWeight="SemiBold" Content="Confirm" Cursor="Hand" MouseUp="ConfirmForget" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" HorizontalAlignment="Center"></Label>
</Grid>
</Grid>
</Grid>
</Grid>
</UserControl>
+26 -24
View File
@@ -99,35 +99,37 @@ namespace ZitiDesktopEdge {
MainDetailScroll.Height = height;
}
private void ForgetIdentity(object sender, MouseButtonEventArgs e) {
// Jeremy - this works now as long as you pass a fingerprint that's valid!
UIModel.HideOnLostFocus = false;
MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure you want to forget this identity?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo);
UIModel.HideOnLostFocus = true;
if (messageBoxResult == MessageBoxResult.Yes) {
this.Visibility = Visibility.Collapsed;
ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
try {
client.RemoveIdentity(_identity.Fingerprint);
private void CancelConfirm(object sender, MouseButtonEventArgs e) {
ConfirmView.Visibility = Visibility.Collapsed;
}
ZitiIdentity forgotten = new ZitiIdentity();
foreach (var id in identities) {
if (id.Fingerprint == _identity.Fingerprint) {
forgotten = id;
identities.Remove(id);
break;
}
}
private void ConfirmForget(object sender, MouseButtonEventArgs e) {
this.Visibility = Visibility.Collapsed;
ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
try {
client.RemoveIdentity(_identity.Fingerprint);
if (OnForgot != null) {
OnForgot(forgotten);
ZitiIdentity forgotten = new ZitiIdentity();
foreach (var id in identities) {
if (id.Fingerprint == _identity.Fingerprint) {
forgotten = id;
identities.Remove(id);
break;
}
} catch (ServiceClient.ServiceException se) {
OnError(se.Message);
} catch (Exception ex) {
OnError(ex.Message);
}
if (OnForgot != null) {
OnForgot(forgotten);
}
} catch (ServiceClient.ServiceException se) {
OnError(se.Message);
} catch (Exception ex) {
OnError(ex.Message);
}
}
private void ForgetIdentity(object sender, MouseButtonEventArgs e) {
ConfirmView.Visibility = Visibility.Visible;
}
}
}
+4 -3
View File
@@ -140,12 +140,13 @@ namespace ZitiDesktopEdge
mailMessage.IsBodyHtml = true;
mailMessage.Body = "";
string serviceLogTempFile = Path.Combine(Path.GetTempPath(), "Ziti-Service.log");
string timestamp = DateTime.Now.ToFileTime().ToString();
string serviceLogTempFile = Path.Combine(Path.GetTempPath(), timestamp+"-Ziti-Service.log");
using (StreamWriter sw = new StreamWriter(serviceLogTempFile)) {
sw.WriteLine(client.GetLogs());
}
string uiLogTempFile = Path.Combine(Path.GetTempPath(), "Ziti-Application.log");
string uiLogTempFile = Path.Combine(Path.GetTempPath(), timestamp+"-Ziti-Application.log");
using (StreamWriter sw = new StreamWriter(uiLogTempFile)) {
sw.WriteLine(UILog.GetLogs());
}
@@ -153,7 +154,7 @@ namespace ZitiDesktopEdge
mailMessage.Attachments.Add(new Attachment(serviceLogTempFile));
mailMessage.Attachments.Add(new Attachment(uiLogTempFile));
string emlFile = Path.Combine(Path.GetTempPath(), "ziti.eml");
string emlFile = Path.Combine(Path.GetTempPath(), timestamp+"-ziti.eml");
using (var filestream = File.Open(emlFile, FileMode.Create)) {
var binaryWriter = new BinaryWriter(filestream);
@@ -14,8 +14,8 @@
<ColumnDefinition Width="150"/>
<ColumnDefinition x:Name="WarningColumn" Width="0"/>
</Grid.ColumnDefinitions>
<TextBox Name="MainLabel" BorderThickness="0" Background="White" ClipToBounds="True" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
<TextBox Name="MainEdit" BorderThickness="0" Background="White" ClipToBounds="True" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
<TextBox Name="MainLabel" BorderThickness="0" MinWidth="100" MaxWidth="140" Background="White" ClipToBounds="True" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
<TextBox Name="MainEdit" TextAlignment="Right" BorderThickness="0" MinWidth="100" MaxWidth="140" Background="White" ClipToBounds="True" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
<Image x:Name="WarnIcon" Visibility="Collapsed" Source="/Assets/Images/Warning.png" Grid.Column="2" Width="20" Height="20"/>
</Grid>
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
+22 -6
View File
@@ -8,14 +8,18 @@ cd /d %ZITI_TUNNEL_WIN_ROOT%
IF "%BUILD_VERSION%"=="" GOTO BUILD_VERSION_ERROR
IF "%1"=="clean" GOTO CLEAN
IF "%1"=="quick" GOTO QUICK
IF "%1"=="quick" (
echo doing 'quick' build - no tunneler sdk/c sdk build
GOTO QUICK
)
echo fetching ziti-ci
call %SVC_ROOT_DIR%/../get-ziti-ci.bat
echo ziti-ci has been retrieved. running: ziti-ci version
ziti-ci version
echo generating version info - this will pushed from publish.bat in CI
ziti-ci generate-build-info --noAddNoCommit --useVersion=false %SVC_ROOT_DIR%/ziti-tunnel/version.go main --verbose
echo generating version info - this will get pushed from publish.bat in CI _if_ publish.bat started build.bat
ziti-ci generate-build-info --noAddNoCommit --useVersion=false %SVC_ROOT_DIR%/ziti-tunnel/version.go main --verbose 2>&1
echo version info generated
goto QUICK
@@ -24,13 +28,14 @@ rmdir /s /q deps
del /q %SVC_ROOT_DIR%ziti.dll
:QUICK
echo changing to service folder: %SVC_ROOT_DIR%
cd %SVC_ROOT_DIR%
SET REPO_URL=https://github.com/openziti/ziti-tunneler-sdk-c.git
SET ZITI_TUNNEL_REPO_BRANCH=master
SET TUNNELER_SDK_DIR=%SVC_ROOT_DIR%deps\ziti-tunneler-sdk-c\
set CGO_CFLAGS=-DNOGDI -I %TUNNELER_SDK_DIR%install\include
set CGO_LDFLAGS=-L %TUNNELER_SDK_DIR%install\lib
SET CGO_CFLAGS=-DNOGDI -I %TUNNELER_SDK_DIR%install\include
SET CGO_LDFLAGS=-L %TUNNELER_SDK_DIR%install\lib
if exist %SVC_ROOT_DIR%ziti.dll (
echo ------------------------------------------------------------------------------
@@ -46,6 +51,8 @@ echo ---------------------------------------------------------------------------
set BEFORE_GIT=%cd%
if exist %TUNNELER_SDK_DIR% (
echo %TUNNELER_SDK_DIR% exists
cd %TUNNELER_SDK_DIR%
echo ------------------------------------------------------------------------------
echo issuing git pull to pick up any changes
echo ------------------------------------------------------------------------------
@@ -55,7 +62,8 @@ if exist %TUNNELER_SDK_DIR% (
echo ------------------------------------------------------------------------------
) else (
echo ------------------------------------------------------------------------------
echo cloning %REPO_URL%
echo %TUNNELER_SDK_DIR% not found
echo - cloning %REPO_URL%
echo ------------------------------------------------------------------------------
echo issuing mkdir %TUNNELER_SDK_DIR%
mkdir %TUNNELER_SDK_DIR%
@@ -64,6 +72,10 @@ if exist %TUNNELER_SDK_DIR% (
cd %TUNNELER_SDK_DIR%
echo current directory is %CD% - should be %TUNNELER_SDK_DIR%
echo.
echo git clone %REPO_URL% %TUNNELER_SDK_DIR% --recurse-submodules
echo.
git clone %REPO_URL% %TUNNELER_SDK_DIR% --recurse-submodules
SET ACTUAL_ERR=%ERRORLEVEL%
)
@@ -75,6 +87,8 @@ IF %ACTUAL_ERR% NEQ 0 (
)
echo checking out branch: %ZITI_TUNNEL_REPO_BRANCH%
echo in %cd% - checking out branch: %ZITI_TUNNEL_REPO_BRANCH%
git checkout %ZITI_TUNNEL_REPO_BRANCH%
IF %ERRORLEVEL% NEQ 0 (
SET ACTUAL_ERR=%ERRORLEVEL%
@@ -84,6 +98,8 @@ IF %ERRORLEVEL% NEQ 0 (
goto FAIL
)
echo "clone or checkout complete."
echo ------------------------------------------------------------------------------
type %TUNNELER_SDK_DIR%.gitmodules
echo.
+2 -2
View File
@@ -150,13 +150,13 @@ func netifSetup(h C.netif_handle, l *C.uv_loop_t, packetCb C.packet_cb, ctx unsa
t.read = (*C.uv_async_t)(C.calloc(1, C.sizeof_uv_async_t))
C.uv_async_init(l, t.read, C.uv_async_cb(C.readAsync))
t.read.data = unsafe.Pointer(h)
log.Debugf("in netifSetup netif[%s] handle[%p]", C.GoString(h.id), h)
log.Debugf("in netifSetup netif[%s] handle[%p] before", C.GoString(h.id), h)
t.idleR = (*C.uv_prepare_t)(C.calloc(1, C.sizeof_uv_prepare_t))
C.uv_prepare_init(l, t.idleR)
t.idleR.data = unsafe.Pointer(h)
C.uv_prepare_start(t.idleR, C.uv_prepare_cb(C.readIdle))
log.Debugf("in netifSetup netif[%s] handle[%p]", C.GoString(h.id), h)
log.Debugf("in netifSetup netif[%s] handle[%p] after", C.GoString(h.id), h)
t.onPacket = packetCb
t.onPacketCtx = ctx
+20 -6
View File
@@ -20,7 +20,10 @@ package cziti
import (
"fmt"
"github.com/miekg/dns"
"io"
"net"
"os"
"strings"
"time"
"github.com/openziti/desktop-edge-win/service/cziti/windns"
)
@@ -155,16 +158,16 @@ func proxyDNS(req *dns.Msg, peer *net.UDPAddr, serv *net.UDPConn) {
}
}
func dnsPanicRecover(dnsServers []string) {
//just rerun the dns proxy function
go runDNSproxy(dnsServers)
func dnsPanicRecover() {
// get dns again and reconfigure
go runDNSproxy(windns.GetUpstreamDNS())
}
func runDNSproxy(dnsServers []string) {
defer func() {
if r := recover(); r != nil {
log.Errorf("Recovered in f. %v", r)
dnsPanicRecover(dnsServers)
dnsPanicRecover()
}
}()
@@ -172,7 +175,13 @@ func runDNSproxy(dnsServers []string) {
for _, s := range dnsServers {
sAddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("%s:53", s))
if err != nil {
log.Debugf("skipping upstream: %s, %v", s, err.Error())
// fec0:0:0:ffff:: is 'legacy' from windows apparently...
// see: https://en.wikipedia.org/wiki/IPv6_address#Deprecated_and_obsolete_addresses_2
if ! strings.HasPrefix(s, "fec0:0:0:ffff::") {
log.Debugf("skipping upstream: %s, %v", s, err.Error())
} else {
// just ignore for now - don't even log it...
}
} else {
log.Debugf("adding upstream dns server: %s", s)
conn, err := net.DialUDP("udp", nil, sAddr)
@@ -193,7 +202,12 @@ func runDNSproxy(dnsServers []string) {
for {
n, err := proxy.Read(resp)
if err != nil {
log.Debug("error receiving from ", proxy.RemoteAddr(), err)
// something is wrong with the DNS connection panic and let DNS recovery kick in
if err == io.EOF || err == os.ErrClosed || err.Error() == "use of closed network connection" {
log.Panicf("error receiving from ", proxy.RemoteAddr(), err)
} else {
log.Panicf("UNEXPECTED error receiving from ", proxy.RemoteAddr(), err)
}
} else {
respChan <- resp[:n]
}
+2
View File
@@ -200,6 +200,8 @@ func serviceCB(_ C.ziti_context, service *C.ziti_service, status C.int, data uns
Service: &added,
ZitiContext: ctx,
}
} else {
log.Debugf("service named %s is not enabled for 'tunneling'", name)
}
}
}
+39 -27
View File
@@ -8,24 +8,24 @@ IF "%BUILD_VERSION%"=="" GOTO BUILD_VERSION_ERROR
call %SVC_ROOT_DIR%\build.bat
SET ACTUAL_ERR=%ERRORLEVEL%
if %ACTUAL_ERR% NEQ 0 (
echo.
echo call to build.bat failed with %ACTUAL_ERR%
echo.
@echo.
@echo call to build.bat failed with %ACTUAL_ERR%
@echo.
exit /b 1
) else (
echo.
echo result of ninja build: %ACTUAL_ERR%
@echo.
@echo result of ninja build: %ACTUAL_ERR%
)
IF "%GIT_BRANCH%"=="master" GOTO RELEASE
@echo Publishing to snapshot repo
ziti-ci publish artifactory --groupId=ziti-tunnel-win.amd64.windows --artifactId=ziti-tunnel-win --version=%BUILD_VERSION%-SNAPSHOT --target=service/ziti-tunnel-win.zip
REM ziti-ci publish artifactory --groupId=ziti-tunnel-win.amd64.windows --artifactId=ziti-tunnel-win --version=%BUILD_VERSION%-SNAPSHOT --target=service/ziti-tunnel-win.zip --classifier=%GIT_BRANCH%
ziti-ci publish artifactory --groupId=ziti-tunnel-win.amd64.windows --artifactId=ziti-tunnel-win --version=%BUILD_VERSION%-SNAPSHOT --target=service/ziti-tunnel-win.zip 2>&1
REM ziti-ci publish artifactory --groupId=ziti-tunnel-win.amd64.windows --artifactId=ziti-tunnel-win --version=%BUILD_VERSION%-SNAPSHOT --target=service/ziti-tunnel-win.zip --classifier=%GIT_BRANCH% 2>&1
GOTO END
:RELEASE
@echo Publishing release
ziti-ci publish artifactory --groupId=ziti-tunnel-win.amd64.windows --artifactId=ziti-tunnel-win --version=%BUILD_VERSION% --target=service/ziti-tunnel-win.zip
ziti-ci publish artifactory --groupId=ziti-tunnel-win.amd64.windows --artifactId=ziti-tunnel-win --version=%BUILD_VERSION% --target=service/ziti-tunnel-win.zip 2>&1
GOTO END
:BUILD_VERSION_ERROR
@@ -34,45 +34,57 @@ exit /b 1
:FAIL
IF %~1 NEQ 0 (
echo ================================================================
echo.
echo FAILURE:
echo %~2
echo.
echo ================================================================
@echo ================================================================
@echo.
@echo FAILURE:
@echo %~2
@echo.
@echo ================================================================
exit /b %~1
)
exit /b 0
:END
echo configuring git - relies on build.bat successfully grabbing ziti-ci and build.bat updating service/ziti-tunnel/version.go
ziti-ci configure-git 2>&1
@echo publishing complete - committing version.go as ci
@echo changing back to: %CURDIR%
cd %CURDIR%
@echo current dir: %CD%
@echo configuring git - relies on build.bat successfully grabbing ziti-ci and build.bat updating service/ziti-tunnel/version.go
ziti-ci configure-git 2>&1
@echo converting shallow clone so travis can co: %GIT_BRANCH%
git remote set-branches origin %GIT_BRANCH% 2>&1
git fetch --depth 1 origin %GIT_BRANCH% 2>&1
git checkout %GIT_BRANCH% 2>&1
CALL :FAIL %ERRORLEVEL% "checkout failed"
@echo git checkout %GIT_BRANCH% complete: %ERRORLEVEL%
@echo issuing status
@echo ========================================================
git status 2>&1
git add service/ziti-tunnel/version.go 2>&1
CALL :FAIL %ERRORLEVEL% "git add failed"
@echo git add service/ziti-tunnel/version.go complete: %ERRORLEVEL%
@echo issuing status, diff, commit
@echo ========================================================
git status 2>&1
git diff 2>&1
@echo issuing ssh -vT -i github_deploy_key git@github.com
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
ssh -vT -i github_deploy_key git@github.com 2>&1
@echo issuing commit
git commit -m "[ci skip] committing updated version information" 2>&1
CALL :FAIL %ERRORLEVEL% "git commit failed"
@echo git commit -m "[ci skip] committing updated version information" complete: %ERRORLEVEL%
@echo issuing git status and push now
@echo ========================================================
git status 2>&1
git push 2>&1
@echo issuing git push
@echo ========================================================
@echo setting git config remote.url git@github.com:openziti/desktop-edge-win.git
git config remote.url git@github.com:openziti/desktop-edge-win.git 2>&1
git config --list 2>&1
dir github_deploy_key
git push --verbose 2>&1
CALL :FAIL %ERRORLEVEL% "git push failed"
@echo git push complete: %ERRORLEVEL%
cd %CURDIR%
@echo publish script has completed
+2 -2
View File
@@ -259,12 +259,12 @@ func setTunInfo(s *dto.TunnelStatus, ipv4 string, ipv4mask int) {
log.Errorf("error reading MTU - using 0 for MTU: (%v)", err)
mtu = 0
}
umtu := uint16(mtu)
//set the tun info into the state
s.IpInfo = &dto.TunIpInfo{
Ip: ipv4,
DNS: Ipv4dns,
MTU: uint16(mtu),
MTU: umtu,
Subnet: ipv4MaskString(ipnet.Mask),
}
}
+1 -1
View File
@@ -120,7 +120,7 @@ func (t *RuntimeState) CreateTun(ipv4 string, ipv4mask int) error {
}
log.Infof("creating TUN device: %s", TunName)
tunDevice, err := tun.CreateTUN(TunName, 64*1024)
tunDevice, err := tun.CreateTUN(TunName, 64*1024 - 1)
if err == nil {
t.tun = &tunDevice
tunName, err2 := tunDevice.Name()
+1
View File
@@ -0,0 +1 @@
hi