- Notifications
You must be signed in to change notification settings - Fork914
fix(vpn): send subnet masks and prefix lengths from router#16317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -36,12 +36,16 @@ func (*vpnRouter) Close() error { | ||
func convertRouterConfig(cfg router.Config) *NetworkSettingsRequest { | ||
v4LocalAddrs := make([]string, 0) | ||
v4SubnetMasks := make([]string, 0) | ||
v6LocalAddrs := make([]string, 0) | ||
v6PrefixLengths := make([]uint32, 0) | ||
for _, addrs := range cfg.LocalAddrs { | ||
if addrs.Addr().Is4() { | ||
v4LocalAddrs = append(v4LocalAddrs, addrs.Addr().String()) | ||
v4SubnetMasks = append(v4SubnetMasks, prefixToSubnetMask(addrs)) | ||
} else if addrs.Addr().Is6() { | ||
v6LocalAddrs = append(v6LocalAddrs, addrs.Addr().String()) | ||
v6PrefixLengths = append(v6PrefixLengths, uint32(addrs.Bits())) | ||
} else { | ||
continue | ||
} | ||
@@ -69,18 +73,31 @@ func convertRouterConfig(cfg router.Config) *NetworkSettingsRequest { | ||
} | ||
} | ||
var v4Settings *NetworkSettingsRequest_IPv4Settings | ||
if len(v4LocalAddrs) > 0 || len(v4Routes) > 0 || len(v4ExcludedRoutes) > 0 { | ||
MemberAuthor
| ||
v4Settings = &NetworkSettingsRequest_IPv4Settings{ | ||
Addrs: v4LocalAddrs, | ||
SubnetMasks: v4SubnetMasks, | ||
IncludedRoutes: v4Routes, | ||
ExcludedRoutes: v4ExcludedRoutes, | ||
Router: "", // NA | ||
} | ||
} | ||
var v6Settings *NetworkSettingsRequest_IPv6Settings | ||
if len(v6LocalAddrs) > 0 || len(v6Routes) > 0 || len(v6ExcludedRoutes) > 0 { | ||
v6Settings = &NetworkSettingsRequest_IPv6Settings{ | ||
Addrs: v6LocalAddrs, | ||
PrefixLengths: v6PrefixLengths, | ||
IncludedRoutes: v6Routes, | ||
ExcludedRoutes: v6ExcludedRoutes, | ||
} | ||
} | ||
return &NetworkSettingsRequest{ | ||
Mtu: uint32(cfg.NewMTU), | ||
Ipv4Settings: v4Settings, | ||
Ipv6Settings: v6Settings, | ||
TunnelOverheadBytes: 0, // N/A | ||
TunnelRemoteAddress: "", // N/A | ||
} | ||
Uh oh!
There was an error while loading.Please reload this page.