Make sure all vpnAddrs are hoisted to primary, resolve a few more TODOs (#1319)

This commit is contained in:
Nate Brown
2025-01-30 13:33:19 -06:00
committed by GitHub
parent 1ad0f57c1e
commit e4daed3563
15 changed files with 61 additions and 112 deletions

View File

@@ -294,7 +294,7 @@ func (t *tun) activate6(network netip.Prefix) error {
Vltime: 0xffffffff,
Pltime: 0xffffffff,
},
//TODO: should we disable DAD (duplicate address detection) and mark this as a secured address?
//TODO: CERT-V2 should we disable DAD (duplicate address detection) and mark this as a secured address?
Flags: _IN6_IFF_NODAD,
}

View File

@@ -290,7 +290,7 @@ func (t *tun) addIPs(link netlink.Link) error {
//add all new addresses
for i := range newAddrs {
//todo do we want to stack errors and try as many ops as possible?
//TODO: CERT-V2 do we want to stack errors and try as many ops as possible?
//AddrReplace still adds new IPs, but if their properties change it will change them as well
if err := netlink.AddrReplace(link, newAddrs[i]); err != nil {
return err

View File

@@ -223,7 +223,7 @@ func (t *tun) removeRoutes(routes []Route) error {
continue
}
//todo is this right?
//TODO: CERT-V2 is this right?
cmd := exec.Command("/sbin/route", "-n", "delete", "-net", r.Cidr.String(), t.vpnNetworks[0].Addr().String())
t.l.Debug("command: ", cmd.String())
if err := cmd.Run(); err != nil {

View File

@@ -170,7 +170,7 @@ func (t *tun) addRoutes(logErrors bool) error {
// We don't allow route MTUs so only install routes with a via
continue
}
//todo is this right?
//TODO: CERT-V2 is this right?
cmd := exec.Command("/sbin/route", "-n", "add", "-inet", r.Cidr.String(), t.vpnNetworks[0].Addr().String())
t.l.Debug("command: ", cmd.String())
if err := cmd.Run(); err != nil {
@@ -191,7 +191,7 @@ func (t *tun) removeRoutes(routes []Route) error {
if !r.Install {
continue
}
//todo is this right?
//TODO: CERT-V2 is this right?
cmd := exec.Command("/sbin/route", "-n", "delete", "-inet", r.Cidr.String(), t.vpnNetworks[0].Addr().String())
t.l.Debug("command: ", cmd.String())
if err := cmd.Run(); err != nil {