Skip to content

Commit 77b596c

Browse files
committed
oops
1 parent 3f9b28a commit 77b596c

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

coord/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,14 @@ func (s *Server) patchReifySpec(w http.ResponseWriter, r *http.Request) {
209209
newSpec.Networks[nI].Devices[sndI].PersistentKeepalive = req.PersistentKeepalive
210210
}
211211
if req.AccessibleSet {
212-
// TODO: check req.ForwardsFor validity
213212
for _, name := range req.Accessible {
214213
if _, ok := newSpec.Networks[nI].GetDevice(name); !ok {
215214
http.Error(w, fmt.Sprintf("ForwardsFor contains nonexistent device name: %s/%s", network, name), 400)
216215
return
217216
}
218217
}
219-
newSpec.Networks[nI].Devices[sndI].ForwardsFor = req.Accessible
218+
zap.S().Debugf("setting Accessible to %v", req.Accessible)
219+
newSpec.Networks[nI].Devices[sndI].Accessible = req.Accessible
220220
}
221221
s.latestLock.Lock()
222222
defer s.latestLock.Unlock()

spec/compile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func (sc SpecCensored) CompileMachine(name string, ignoreIncomplete bool) (goal.
1616
continue
1717
}
1818
snd := sn.Devices[sndI]
19-
for _, name := range snd.ForwardsFor {
19+
for _, name := range snd.Accessible {
2020
forwardee, ok := sn.GetDevice(name)
2121
if !ok {
2222
panic("malformed spec")

spec/spec.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (nc NetworkCensored) GetDeviceIndex(name string) (i int, ok bool) {
113113
func (nc NetworkCensored) GetForwardersFor(name string) []string {
114114
forwarders := make([]string, 0)
115115
for _, ndc := range nc.Devices {
116-
if slices.Contains(ndc.ForwardsFor, name) && ndc.ForwarderAndEndpointChosen {
116+
if slices.Contains(ndc.Accessible, name) && ndc.ForwarderAndEndpointChosen {
117117
forwarders = append(forwarders, ndc.Name)
118118
}
119119
}
@@ -196,10 +196,10 @@ type NetworkDeviceCensored struct {
196196
// Set to 0 to disable persistent keepalive.
197197
// This can be set by this peer.
198198
PersistentKeepalive goal.Duration
199-
// ForwardsFor is the list of devices (in the same network) that this peer has access to, and can fowrard packets to.
199+
// Accessible is the list of devices (in the same network) that this peer has access to, and can fowrard packets to.
200200
// Note that IPv6 forwarding is not supported yet.
201201
// This can be set by this peer.
202-
ForwardsFor []string
202+
Accessible []string
203203
}
204204

205205
type networkDeviceCensoredJSON struct {
@@ -245,7 +245,7 @@ func ipNetEqual(a, b goal.IPNet) bool {
245245
}
246246

247247
func (a NetworkDeviceCensored) Equal(b NetworkDeviceCensored) bool {
248-
return a.Name == b.Name && slices.Equal(a.Endpoints, b.Endpoints) && slices.EqualFunc(a.Addresses, b.Addresses, ipNetEqual) && a.ListenPort == b.ListenPort && a.PublicKey == b.PublicKey && (a.PresharedKey != nil && b.PresharedKey != nil && *a.PresharedKey == *b.PresharedKey || a.PresharedKey == nil && b.PresharedKey == nil) && a.PersistentKeepalive == b.PersistentKeepalive && slices.Equal(a.ForwardsFor, b.ForwardsFor)
248+
return a.Name == b.Name && slices.Equal(a.Endpoints, b.Endpoints) && slices.EqualFunc(a.Addresses, b.Addresses, ipNetEqual) && a.ListenPort == b.ListenPort && a.PublicKey == b.PublicKey && (a.PresharedKey != nil && b.PresharedKey != nil && *a.PresharedKey == *b.PresharedKey || a.PresharedKey == nil && b.PresharedKey == nil) && a.PersistentKeepalive == b.PersistentKeepalive && slices.Equal(a.Accessible, b.Accessible)
249249
}
250250

251251
func (ndc NetworkDeviceCensored) Clone() NetworkDeviceCensored {

0 commit comments

Comments
 (0)