Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab92306

Browse files
fix(vpn): handle sending nil router config (#16267)
Previously, a `nil` Router config would cause a panic in the dylib.Normally, a nil Router config would indicate a shutdown of the service,and that settings should be reset. However, for Coder Desktop macOS thenetwork configuration will be reset by the disconnecting of the systemVPN, so we'll instead do nothing.
1 parent76adde9 commitab92306

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

‎vpn/router.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ func (*vpnRouter) Up() error {
2222
}
2323

2424
func (v*vpnRouter)Set(cfg*router.Config)error {
25-
req:=convertRouterConfig(cfg)
25+
ifcfg==nil {
26+
returnnil
27+
}
28+
req:=convertRouterConfig(*cfg)
2629
returnv.tunnel.ApplyNetworkSettings(v.tunnel.ctx,req)
2730
}
2831

@@ -31,7 +34,7 @@ func (*vpnRouter) Close() error {
3134
returnnil
3235
}
3336

34-
funcconvertRouterConfig(cfg*router.Config)*NetworkSettingsRequest {
37+
funcconvertRouterConfig(cfg router.Config)*NetworkSettingsRequest {
3538
v4LocalAddrs:=make([]string,0)
3639
v6LocalAddrs:=make([]string,0)
3740
for_,addrs:=rangecfg.LocalAddrs {

‎vpn/router_internal_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ func TestConvertRouterConfig(t *testing.T) {
1313

1414
tests:= []struct {
1515
namestring
16-
cfg*router.Config
16+
cfg router.Config
1717
expected*NetworkSettingsRequest
1818
}{
1919
{
2020
name:"IPv4 and IPv6 configuration",
21-
cfg:&router.Config{
21+
cfg: router.Config{
2222
LocalAddrs: []netip.Prefix{netip.MustParsePrefix("100.64.0.1/32"),netip.MustParsePrefix("fd7a:115c:a1e0::1/128")},
2323
Routes: []netip.Prefix{netip.MustParsePrefix("192.168.0.0/24"),netip.MustParsePrefix("fd00::/64")},
2424
LocalRoutes: []netip.Prefix{netip.MustParsePrefix("10.0.0.0/8"),netip.MustParsePrefix("2001:db8::/32")},
@@ -48,7 +48,7 @@ func TestConvertRouterConfig(t *testing.T) {
4848
},
4949
{
5050
name:"Empty",
51-
cfg:&router.Config{},
51+
cfg: router.Config{},
5252
expected:&NetworkSettingsRequest{
5353
Ipv4Settings:&NetworkSettingsRequest_IPv4Settings{
5454
Addrs: []string{},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp