Browse Source

lib/model: Introducer can remove stuff it introduced (fixes #1015)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3522
Audrius Butkevicius 9 years ago
parent
commit
0b88cf1d03

+ 8 - 6
lib/config/deviceconfiguration.go

@@ -9,12 +9,14 @@ package config
 import "github.com/syncthing/syncthing/lib/protocol"
 
 type DeviceConfiguration struct {
-	DeviceID    protocol.DeviceID    `xml:"id,attr" json:"deviceID"`
-	Name        string               `xml:"name,attr,omitempty" json:"name"`
-	Addresses   []string             `xml:"address,omitempty" json:"addresses"`
-	Compression protocol.Compression `xml:"compression,attr" json:"compression"`
-	CertName    string               `xml:"certName,attr,omitempty" json:"certName"`
-	Introducer  bool                 `xml:"introducer,attr" json:"introducer"`
+	DeviceID                 protocol.DeviceID    `xml:"id,attr" json:"deviceID"`
+	Name                     string               `xml:"name,attr,omitempty" json:"name"`
+	Addresses                []string             `xml:"address,omitempty" json:"addresses"`
+	Compression              protocol.Compression `xml:"compression,attr" json:"compression"`
+	CertName                 string               `xml:"certName,attr,omitempty" json:"certName"`
+	Introducer               bool                 `xml:"introducer,attr" json:"introducer"`
+	SkipIntroductionRemovals bool                 `xml:"skipIntroductionRemovals,attr" json:"skipIntroductionRemovals"`
+	IntroducedBy             protocol.DeviceID    `xml:"introducedBy,attr" json:"introducedBy"`
 }
 
 func NewDeviceConfiguration(id protocol.DeviceID, name string) DeviceConfiguration {

+ 2 - 1
lib/config/folderconfiguration.go

@@ -45,7 +45,8 @@ type FolderConfiguration struct {
 }
 
 type FolderDeviceConfiguration struct {
-	DeviceID protocol.DeviceID `xml:"id,attr" json:"deviceID"`
+	DeviceID     protocol.DeviceID `xml:"id,attr" json:"deviceID"`
+	IntroducedBy protocol.DeviceID `xml:"introducedBy,attr" json:"introducedBy"`
 }
 
 func NewFolderConfiguration(id, path string) FolderConfiguration {

+ 188 - 64
lib/model/model.go

@@ -83,7 +83,7 @@ type Model struct {
 
 	folderCfgs         map[string]config.FolderConfiguration                  // folder -> cfg
 	folderFiles        map[string]*db.FileSet                                 // folder -> files
-	folderDevices      map[string][]protocol.DeviceID                         // folder -> deviceIDs
+	folderDevices      folderDeviceSet                                        // folder -> deviceIDs
 	deviceFolders      map[protocol.DeviceID][]string                         // deviceID -> folders
 	deviceStatRefs     map[protocol.DeviceID]*stats.DeviceStatisticsReference // deviceID -> statsRef
 	folderIgnores      map[string]*ignore.Matcher                             // folder -> matcher object
@@ -144,7 +144,7 @@ func NewModel(cfg *config.Wrapper, id protocol.DeviceID, deviceName, clientName,
 		clientVersion:      clientVersion,
 		folderCfgs:         make(map[string]config.FolderConfiguration),
 		folderFiles:        make(map[string]*db.FileSet),
-		folderDevices:      make(map[string][]protocol.DeviceID),
+		folderDevices:      make(folderDeviceSet),
 		deviceFolders:      make(map[protocol.DeviceID][]string),
 		deviceStatRefs:     make(map[protocol.DeviceID]*stats.DeviceStatisticsReference),
 		folderIgnores:      make(map[string]*ignore.Matcher),
@@ -303,9 +303,8 @@ func (m *Model) addFolderLocked(cfg config.FolderConfiguration) {
 	m.folderCfgs[cfg.ID] = cfg
 	m.folderFiles[cfg.ID] = db.NewFileSet(cfg.ID, m.db)
 
-	m.folderDevices[cfg.ID] = make([]protocol.DeviceID, len(cfg.Devices))
-	for i, device := range cfg.Devices {
-		m.folderDevices[cfg.ID][i] = device.DeviceID
+	for _, device := range cfg.Devices {
+		m.folderDevices.set(device.DeviceID, cfg.ID)
 		m.deviceFolders[device.DeviceID] = append(m.deviceFolders[device.DeviceID], cfg.ID)
 	}
 
@@ -335,7 +334,7 @@ func (m *Model) tearDownFolderLocked(folder string) {
 	}
 
 	// Close connections to affected devices
-	for _, dev := range m.folderDevices[folder] {
+	for dev := range m.folderDevices[folder] {
 		if conn, ok := m.conn[dev]; ok {
 			closeRawConn(conn)
 		}
@@ -872,78 +871,175 @@ func (m *Model) ClusterConfig(deviceID protocol.DeviceID, cm protocol.ClusterCon
 		}
 	}
 
-	var changed bool
+	var changed = false
+	if deviceCfg := m.cfg.Devices()[deviceID]; deviceCfg.Introducer {
+		foldersDevices, introduced := m.handleIntroductions(deviceCfg, cm)
+		if introduced {
+			changed = true
+		}
+		// If permitted, check if the introducer has unshare devices/folders with
+		// some of the devices/folders that we know were introduced to us by him.
+		if !deviceCfg.SkipIntroductionRemovals && m.handleDeintroductions(deviceCfg, cm, foldersDevices) {
+			changed = true
+		}
+	}
 
-	if m.cfg.Devices()[deviceID].Introducer {
-		// This device is an introducer. Go through the announced lists of folders
-		// and devices and add what we are missing.
+	if changed {
+		if err := m.cfg.Save(); err != nil {
+			l.Warnln("Failed to save config", err)
+		}
+	}
+}
 
-		for _, folder := range cm.Folders {
-			if _, ok := m.folderDevices[folder.ID]; !ok {
-				continue
-			}
+// handleIntroductions handles adding devices/shares that are shared by an introducer device
+func (m *Model) handleIntroductions(introducerCfg config.DeviceConfiguration, cm protocol.ClusterConfig) (folderDeviceSet, bool) {
+	// This device is an introducer. Go through the announced lists of folders
+	// and devices and add what we are missing, remove what we have extra that
+	// has been introducer by the introducer.
+	changed := false
 
-		nextDevice:
-			for _, device := range folder.Devices {
-				if _, ok := m.cfg.Devices()[device.ID]; !ok {
-					// The device is currently unknown. Add it to the config.
+	foldersDevices := make(folderDeviceSet)
 
-					addresses := []string{"dynamic"}
-					for _, addr := range device.Addresses {
-						if addr != "dynamic" {
-							addresses = append(addresses, addr)
-						}
-					}
+	for _, folder := range cm.Folders {
+		// We don't have this folder, skip.
+		if _, ok := m.folderDevices[folder.ID]; !ok {
+			continue
+		}
 
-					l.Infof("Adding device %v to config (vouched for by introducer %v)", device.ID, deviceID)
-					newDeviceCfg := config.DeviceConfiguration{
-						DeviceID:    device.ID,
-						Name:        device.Name,
-						Compression: m.cfg.Devices()[deviceID].Compression,
-						Addresses:   addresses,
-						CertName:    device.CertName,
-					}
+		// Adds devices which we do not have, but the introducer has
+		// for the folders that we have in common. Also, shares folders
+		// with devices that we have in common, yet are currently not sharing
+		// the folder.
+	nextDevice:
+		for _, device := range folder.Devices {
+			foldersDevices.set(device.ID, folder.ID)
 
-					// The introducers' introducers are also our introducers.
-					if device.Introducer {
-						l.Infof("Device %v is now also an introducer", device.ID)
-						newDeviceCfg.Introducer = true
-					}
+			if _, ok := m.cfg.Devices()[device.ID]; !ok {
+				// The device is currently unknown. Add it to the config.
+				m.introduceDevice(device, introducerCfg)
+				changed = true
+			}
 
-					m.cfg.SetDevice(newDeviceCfg)
-					changed = true
+			for _, er := range m.deviceFolders[device.ID] {
+				if er == folder.ID {
+					// We already share the folder with this device, so
+					// nothing to do.
+					continue nextDevice
 				}
+			}
 
-				for _, er := range m.deviceFolders[device.ID] {
-					if er == folder.ID {
-						// We already share the folder with this device, so
-						// nothing to do.
-						continue nextDevice
-					}
-				}
+			// We don't yet share this folder with this device. Add the device
+			// to sharing list of the folder.
+			m.introduceDeviceToFolder(device, folder, introducerCfg)
+			changed = true
+		}
+	}
 
-				// We don't yet share this folder with this device. Add the device
-				// to sharing list of the folder.
+	return foldersDevices, changed
+}
 
-				l.Infof("Adding device %v to share %q (vouched for by introducer %v)", device.ID, folder.ID, deviceID)
+// handleIntroductions handles removals of devices/shares that are removed by an introducer device
+func (m *Model) handleDeintroductions(introducerCfg config.DeviceConfiguration, cm protocol.ClusterConfig, foldersDevices folderDeviceSet) bool {
+	changed := false
+	foldersIntroducedByOthers := make(folderDeviceSet)
 
-				m.deviceFolders[device.ID] = append(m.deviceFolders[device.ID], folder.ID)
-				m.folderDevices[folder.ID] = append(m.folderDevices[folder.ID], device.ID)
+	// Check if we should unshare some folders, if the introducer has unshared them.
+	for _, folderCfg := range m.cfg.Folders() {
+		folderChanged := false
+		for i := 0; i < len(folderCfg.Devices); i++ {
+			if folderCfg.Devices[i].IntroducedBy == introducerCfg.DeviceID {
+				if !foldersDevices.has(folderCfg.Devices[i].DeviceID, folderCfg.ID) {
+					// We could not find that folder shared on the introducer with the device that was introduced to us.
+					// We should follow and unshare aswell.
+					l.Infof("Unsharing folder %q with %v as introducer %v no longer shares the folder with that device", folderCfg.ID, folderCfg.Devices[i].DeviceID, folderCfg.Devices[i].IntroducedBy)
+					folderCfg.Devices = append(folderCfg.Devices[:i], folderCfg.Devices[i+1:]...)
+					i--
+					folderChanged = true
+				}
+			} else {
+				foldersIntroducedByOthers.set(folderCfg.Devices[i].DeviceID, folderCfg.ID)
+			}
+		}
 
-				folderCfg := m.cfg.Folders()[folder.ID]
-				folderCfg.Devices = append(folderCfg.Devices, config.FolderDeviceConfiguration{
-					DeviceID: device.ID,
-				})
-				m.cfg.SetFolder(folderCfg)
+		// We've modified the folder, hence update it.
+		if folderChanged {
+			m.cfg.SetFolder(folderCfg)
+			changed = true
+		}
+	}
 
-				changed = true
+	// Check if we should remove some devices, if the introducer no longer shares any folder with them.
+	// Yet do not remove if we share other folders that haven't been introduced by the introducer.
+	raw := m.cfg.Raw()
+	deviceChanged := false
+	for i := 0; i < len(raw.Devices); i++ {
+		if raw.Devices[i].IntroducedBy == introducerCfg.DeviceID {
+			if !foldersDevices.hasDevice(raw.Devices[i].DeviceID) {
+				if foldersIntroducedByOthers.hasDevice(raw.Devices[i].DeviceID) {
+					l.Infof("Would have removed %v as %v no longer shares any folders, yet there are other folders that are shared with this device that haven't been introduced by this introducer.", raw.Devices[i].DeviceID, raw.Devices[i].IntroducedBy)
+					continue
+				}
+				// The introducer no longer shares any folder with the device, remove the device.
+				l.Infof("Removing device %v as introducer %v no longer shares any folders with that device", raw.Devices[i].DeviceID, raw.Devices[i].IntroducedBy)
+				raw.Devices = append(raw.Devices[:i], raw.Devices[i+1:]...)
+				i--
+				deviceChanged = true
 			}
 		}
 	}
 
-	if changed {
-		m.cfg.Save()
+	// We've removed a device, replace the config.
+	if deviceChanged {
+		if err := m.cfg.Replace(raw); err != nil {
+			l.Warnln("Failed to save config", err)
+		}
+		changed = true
+	}
+
+	return changed
+
+}
+
+func (m *Model) introduceDevice(device protocol.Device, introducerCfg config.DeviceConfiguration) {
+	addresses := []string{"dynamic"}
+	for _, addr := range device.Addresses {
+		if addr != "dynamic" {
+			addresses = append(addresses, addr)
+		}
+	}
+
+	l.Infof("Adding device %v to config (vouched for by introducer %v)", device.ID, introducerCfg.DeviceID)
+	newDeviceCfg := config.DeviceConfiguration{
+		DeviceID:     device.ID,
+		Name:         device.Name,
+		Compression:  introducerCfg.Compression,
+		Addresses:    addresses,
+		CertName:     device.CertName,
+		IntroducedBy: introducerCfg.DeviceID,
+	}
+
+	// The introducers' introducers are also our introducers.
+	if device.Introducer {
+		l.Infof("Device %v is now also an introducer", device.ID)
+		newDeviceCfg.Introducer = true
+		newDeviceCfg.SkipIntroductionRemovals = device.SkipIntroductionRemovals
 	}
+
+	m.cfg.SetDevice(newDeviceCfg)
+}
+
+func (m *Model) introduceDeviceToFolder(device protocol.Device, folder protocol.Folder, introducerCfg config.DeviceConfiguration) {
+	l.Infof("Sharing folder %q with %v (vouched for by introducer %v)", folder.ID, device.ID, introducerCfg.DeviceID)
+
+	m.deviceFolders[device.ID] = append(m.deviceFolders[device.ID], folder.ID)
+	m.folderDevices.set(device.ID, folder.ID)
+
+	folderCfg := m.cfg.Folders()[folder.ID]
+	folderCfg.Devices = append(folderCfg.Devices, config.FolderDeviceConfiguration{
+		DeviceID:     device.ID,
+		IntroducedBy: introducerCfg.DeviceID,
+	})
+	m.cfg.SetFolder(folderCfg)
 }
 
 // Closed is called when a connection has been closed
@@ -1469,7 +1565,6 @@ func (m *Model) updateLocalsFromScanning(folder string, fs []protocol.FileInfo)
 	m.fmut.RLock()
 	folderCfg := m.folderCfgs[folder]
 	m.fmut.RUnlock()
-
 	// Fire the LocalChangeDetected event to notify listeners about local updates.
 	m.localChangeDetected(folderCfg, fs)
 }
@@ -1876,7 +1971,7 @@ func (m *Model) generateClusterConfig(device protocol.DeviceID) protocol.Cluster
 			DisableTempIndexes: folderCfg.DisableTempIndexes,
 		}
 
-		for _, device := range m.folderDevices[folder] {
+		for device := range m.folderDevices[folder] {
 			// DeviceID is a value type, but with an underlying array. Copy it
 			// so we don't grab aliases to the same array later on in device[:]
 			device := device
@@ -1999,8 +2094,8 @@ func (m *Model) RemoteSequence(folder string) (int64, bool) {
 	}
 
 	var ver int64
-	for _, n := range m.folderDevices[folder] {
-		ver += fs.Sequence(n)
+	for device := range m.folderDevices[folder] {
+		ver += fs.Sequence(device)
 	}
 
 	return ver, true
@@ -2094,7 +2189,7 @@ func (m *Model) Availability(folder, file string, version protocol.Vector, block
 		}
 	}
 
-	for _, device := range devices {
+	for device := range devices {
 		if m.deviceDownloads[device].Has(folder, file, version, int32(block.Offset/protocol.BlockSize)) {
 			availabilities = append(availabilities, Availability{ID: device, FromTemporary: true})
 		}
@@ -2480,3 +2575,32 @@ func shouldIgnore(file db.FileIntf, matcher *ignore.Matcher, ignoreDelete bool)
 
 	return false
 }
+
+// folderDeviceSet is a set of (folder, deviceID) pairs
+type folderDeviceSet map[string]map[protocol.DeviceID]struct{}
+
+// set adds the (dev, folder) pair to the set
+func (s folderDeviceSet) set(dev protocol.DeviceID, folder string) {
+	devs, ok := s[folder]
+	if !ok {
+		devs = make(map[protocol.DeviceID]struct{})
+		s[folder] = devs
+	}
+	devs[dev] = struct{}{}
+}
+
+// has returns true if the (dev, folder) pair is in the set
+func (s folderDeviceSet) has(dev protocol.DeviceID, folder string) bool {
+	_, ok := s[folder][dev]
+	return ok
+}
+
+// hasDevice returns true if the device is set on any folder
+func (s folderDeviceSet) hasDevice(dev protocol.DeviceID) bool {
+	for _, devices := range s {
+		if _, ok := devices[dev]; ok {
+			return true
+		}
+	}
+	return false
+}

+ 371 - 1
lib/model/model_test.go

@@ -478,6 +478,376 @@ func TestClusterConfig(t *testing.T) {
 	}
 }
 
+func TestIntroducer(t *testing.T) {
+	var introducedByAnyone protocol.DeviceID
+
+	// LocalDeviceID is a magic value meaning don't check introducer
+	contains := func(cfg config.FolderConfiguration, id, introducedBy protocol.DeviceID) bool {
+		for _, dev := range cfg.Devices {
+			if dev.DeviceID.Equals(id) {
+				if introducedBy.Equals(introducedByAnyone) {
+					return true
+				}
+				return introducedBy.Equals(introducedBy)
+			}
+		}
+		return false
+	}
+
+	newState := func(cfg config.Configuration) (*config.Wrapper, *Model) {
+		db := db.OpenMemory()
+
+		wcfg := config.Wrap("/tmp/test", cfg)
+
+		m := NewModel(wcfg, protocol.LocalDeviceID, "device", "syncthing", "dev", db, nil)
+		for _, folder := range cfg.Folders {
+			m.AddFolder(folder)
+		}
+		m.ServeBackground()
+		m.AddConnection(connections.Connection{
+			IntermediateConnection: connections.IntermediateConnection{
+				Conn: tls.Client(&fakeConn{}, nil),
+			},
+			Connection: &FakeConnection{
+				id: device1,
+			},
+		}, protocol.HelloResult{})
+		return wcfg, m
+	}
+
+	wcfg, m := newState(config.Configuration{
+		Devices: []config.DeviceConfiguration{
+			{
+				DeviceID:   device1,
+				Introducer: true,
+			},
+		},
+		Folders: []config.FolderConfiguration{
+			{
+				ID: "folder1",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+				},
+			},
+			{
+				ID: "folder2",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+				},
+			},
+		},
+	})
+	m.ClusterConfig(device1, protocol.ClusterConfig{
+		Folders: []protocol.Folder{
+			{
+				ID: "folder1",
+				Devices: []protocol.Device{
+					{
+						ID:                       device2,
+						Introducer:               true,
+						SkipIntroductionRemovals: true,
+					},
+				},
+			},
+		},
+	})
+
+	if newDev, ok := wcfg.Device(device2); !ok || !newDev.Introducer || !newDev.SkipIntroductionRemovals {
+		t.Error("devie 2 missing or wrong flags")
+	}
+
+	if !contains(wcfg.Folders()["folder1"], device2, device1) {
+		t.Error("expected folder 1 to have device2 introduced by device 1")
+	}
+
+	wcfg, m = newState(config.Configuration{
+		Devices: []config.DeviceConfiguration{
+			{
+				DeviceID:   device1,
+				Introducer: true,
+			},
+			{
+				DeviceID:     device2,
+				IntroducedBy: device1,
+			},
+		},
+		Folders: []config.FolderConfiguration{
+			{
+				ID: "folder1",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+					{DeviceID: device2, IntroducedBy: device1},
+				},
+			},
+			{
+				ID: "folder2",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+				},
+			},
+		},
+	})
+	m.ClusterConfig(device1, protocol.ClusterConfig{
+		Folders: []protocol.Folder{
+			{
+				ID: "folder2",
+				Devices: []protocol.Device{
+					{
+						ID:                       device2,
+						Introducer:               true,
+						SkipIntroductionRemovals: true,
+					},
+				},
+			},
+		},
+	})
+
+	// Should not get introducer, as it's already unset, and it's an existing device.
+	if newDev, ok := wcfg.Device(device2); !ok || newDev.Introducer || newDev.SkipIntroductionRemovals {
+		t.Error("device 2 missing or changed flags")
+	}
+
+	if contains(wcfg.Folders()["folder1"], device2, introducedByAnyone) {
+		t.Error("expected device 2 to be removed from folder 1")
+	}
+
+	if !contains(wcfg.Folders()["folder2"], device2, device1) {
+		t.Error("expected device 2 to be added to folder 2")
+	}
+
+	wcfg, m = newState(config.Configuration{
+		Devices: []config.DeviceConfiguration{
+			{
+				DeviceID:   device1,
+				Introducer: true,
+			},
+			{
+				DeviceID:     device2,
+				IntroducedBy: device1,
+			},
+		},
+		Folders: []config.FolderConfiguration{
+			{
+				ID: "folder1",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+					{DeviceID: device2, IntroducedBy: device1},
+				},
+			},
+			{
+				ID: "folder2",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+					{DeviceID: device2, IntroducedBy: device1},
+				},
+			},
+		},
+	})
+	m.ClusterConfig(device1, protocol.ClusterConfig{})
+
+	if _, ok := wcfg.Device(device2); ok {
+		t.Error("device 2 should have been removed")
+	}
+
+	if contains(wcfg.Folders()["folder1"], device2, introducedByAnyone) {
+		t.Error("expected device 2 to be removed from folder 1")
+	}
+
+	if contains(wcfg.Folders()["folder2"], device2, introducedByAnyone) {
+		t.Error("expected device 2 to be removed from folder 2")
+	}
+
+	// Two cases when removals should not happen
+	// 1. Introducer flag no longer set on device
+
+	wcfg, m = newState(config.Configuration{
+		Devices: []config.DeviceConfiguration{
+			{
+				DeviceID:   device1,
+				Introducer: false,
+			},
+			{
+				DeviceID:     device2,
+				IntroducedBy: device1,
+			},
+		},
+		Folders: []config.FolderConfiguration{
+			{
+				ID: "folder1",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+					{DeviceID: device2, IntroducedBy: device1},
+				},
+			},
+			{
+				ID: "folder2",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+					{DeviceID: device2, IntroducedBy: device1},
+				},
+			},
+		},
+	})
+	m.ClusterConfig(device1, protocol.ClusterConfig{})
+
+	if _, ok := wcfg.Device(device2); !ok {
+		t.Error("device 2 should not have been removed")
+	}
+
+	if !contains(wcfg.Folders()["folder1"], device2, device1) {
+		t.Error("expected device 2 not to be removed from folder 1")
+	}
+
+	if !contains(wcfg.Folders()["folder2"], device2, device1) {
+		t.Error("expected device 2 not to be removed from folder 2")
+	}
+
+	// 2. SkipIntroductionRemovals is set
+
+	wcfg, m = newState(config.Configuration{
+		Devices: []config.DeviceConfiguration{
+			{
+				DeviceID:                 device1,
+				Introducer:               true,
+				SkipIntroductionRemovals: true,
+			},
+			{
+				DeviceID:     device2,
+				IntroducedBy: device1,
+			},
+		},
+		Folders: []config.FolderConfiguration{
+			{
+				ID: "folder1",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+					{DeviceID: device2, IntroducedBy: device1},
+				},
+			},
+			{
+				ID: "folder2",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+				},
+			},
+		},
+	})
+	m.ClusterConfig(device1, protocol.ClusterConfig{
+		Folders: []protocol.Folder{
+			{
+				ID: "folder2",
+				Devices: []protocol.Device{
+					{
+						ID:                       device2,
+						Introducer:               true,
+						SkipIntroductionRemovals: true,
+					},
+				},
+			},
+		},
+	})
+
+	if _, ok := wcfg.Device(device2); !ok {
+		t.Error("device 2 should not have been removed")
+	}
+
+	if !contains(wcfg.Folders()["folder1"], device2, device1) {
+		t.Error("expected device 2 not to be removed from folder 1")
+	}
+
+	if !contains(wcfg.Folders()["folder2"], device2, device1) {
+		t.Error("expected device 2 not to be added to folder 2")
+	}
+
+	// Test device not being removed as it's shared without an introducer.
+
+	wcfg, m = newState(config.Configuration{
+		Devices: []config.DeviceConfiguration{
+			{
+				DeviceID:   device1,
+				Introducer: true,
+			},
+			{
+				DeviceID:     device2,
+				IntroducedBy: device1,
+			},
+		},
+		Folders: []config.FolderConfiguration{
+			{
+				ID: "folder1",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+					{DeviceID: device2, IntroducedBy: device1},
+				},
+			},
+			{
+				ID: "folder2",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+					{DeviceID: device2},
+				},
+			},
+		},
+	})
+	m.ClusterConfig(device1, protocol.ClusterConfig{})
+
+	if _, ok := wcfg.Device(device2); !ok {
+		t.Error("device 2 should not have been removed")
+	}
+
+	if contains(wcfg.Folders()["folder1"], device2, introducedByAnyone) {
+		t.Error("expected device 2 to be removed from folder 1")
+	}
+
+	if !contains(wcfg.Folders()["folder2"], device2, introducedByAnyone) {
+		t.Error("expected device 2 not to be removed from folder 2")
+	}
+
+	// Test device not being removed as it's shared by a different introducer.
+
+	wcfg, m = newState(config.Configuration{
+		Devices: []config.DeviceConfiguration{
+			{
+				DeviceID:   device1,
+				Introducer: true,
+			},
+			{
+				DeviceID:     device2,
+				IntroducedBy: device1,
+			},
+		},
+		Folders: []config.FolderConfiguration{
+			{
+				ID: "folder1",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+					{DeviceID: device2, IntroducedBy: device1},
+				},
+			},
+			{
+				ID: "folder2",
+				Devices: []config.FolderDeviceConfiguration{
+					{DeviceID: device1},
+					{DeviceID: device2, IntroducedBy: protocol.LocalDeviceID},
+				},
+			},
+		},
+	})
+	m.ClusterConfig(device1, protocol.ClusterConfig{})
+
+	if _, ok := wcfg.Device(device2); !ok {
+		t.Error("device 2 should not have been removed")
+	}
+
+	if contains(wcfg.Folders()["folder1"], device2, introducedByAnyone) {
+		t.Error("expected device 2 to be removed from folder 1")
+	}
+
+	if !contains(wcfg.Folders()["folder2"], device2, introducedByAnyone) {
+		t.Error("expected device 2 not to be removed from folder 2")
+	}
+}
+
 func TestIgnores(t *testing.T) {
 	arrEqual := func(a, b []string) bool {
 		if len(a) != len(b) {
@@ -1623,7 +1993,7 @@ func TestSharedWithClearedOnDisconnect(t *testing.T) {
 		t.Error("folder missing?")
 	}
 
-	for _, id := range fdevs {
+	for id := range fdevs {
 		if id == device2 {
 			t.Error("still there")
 		}

+ 147 - 111
lib/protocol/bep.pb.go

@@ -255,14 +255,15 @@ func (*Folder) ProtoMessage()               {}
 func (*Folder) Descriptor() ([]byte, []int) { return fileDescriptorBep, []int{3} }
 
 type Device struct {
-	ID          DeviceID    `protobuf:"bytes,1,opt,name=id,proto3,customtype=DeviceID" json:"id"`
-	Name        string      `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
-	Addresses   []string    `protobuf:"bytes,3,rep,name=addresses" json:"addresses,omitempty"`
-	Compression Compression `protobuf:"varint,4,opt,name=compression,proto3,enum=protocol.Compression" json:"compression,omitempty"`
-	CertName    string      `protobuf:"bytes,5,opt,name=cert_name,json=certName,proto3" json:"cert_name,omitempty"`
-	MaxSequence int64       `protobuf:"varint,6,opt,name=max_sequence,json=maxSequence,proto3" json:"max_sequence,omitempty"`
-	Introducer  bool        `protobuf:"varint,7,opt,name=introducer,proto3" json:"introducer,omitempty"`
-	IndexID     IndexID     `protobuf:"varint,8,opt,name=index_id,json=indexId,proto3,customtype=IndexID" json:"index_id"`
+	ID                       DeviceID    `protobuf:"bytes,1,opt,name=id,proto3,customtype=DeviceID" json:"id"`
+	Name                     string      `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
+	Addresses                []string    `protobuf:"bytes,3,rep,name=addresses" json:"addresses,omitempty"`
+	Compression              Compression `protobuf:"varint,4,opt,name=compression,proto3,enum=protocol.Compression" json:"compression,omitempty"`
+	CertName                 string      `protobuf:"bytes,5,opt,name=cert_name,json=certName,proto3" json:"cert_name,omitempty"`
+	MaxSequence              int64       `protobuf:"varint,6,opt,name=max_sequence,json=maxSequence,proto3" json:"max_sequence,omitempty"`
+	Introducer               bool        `protobuf:"varint,7,opt,name=introducer,proto3" json:"introducer,omitempty"`
+	IndexID                  IndexID     `protobuf:"varint,8,opt,name=index_id,json=indexId,proto3,customtype=IndexID" json:"index_id"`
+	SkipIntroductionRemovals bool        `protobuf:"varint,9,opt,name=skip_introduction_removals,json=skipIntroductionRemovals,proto3" json:"skip_introduction_removals,omitempty"`
 }
 
 func (m *Device) Reset()                    { *m = Device{} }
@@ -681,6 +682,16 @@ func (m *Device) MarshalTo(data []byte) (int, error) {
 		i++
 		i = encodeVarintBep(data, i, uint64(m.IndexID))
 	}
+	if m.SkipIntroductionRemovals {
+		data[i] = 0x48
+		i++
+		if m.SkipIntroductionRemovals {
+			data[i] = 1
+		} else {
+			data[i] = 0
+		}
+		i++
+	}
 	return i, nil
 }
 
@@ -1303,6 +1314,9 @@ func (m *Device) ProtoSize() (n int) {
 	if m.IndexID != 0 {
 		n += 1 + sovBep(uint64(m.IndexID))
 	}
+	if m.SkipIntroductionRemovals {
+		n += 2
+	}
 	return n
 }
 
@@ -2282,6 +2296,26 @@ func (m *Device) Unmarshal(data []byte) error {
 					break
 				}
 			}
+		case 9:
+			if wireType != 0 {
+				return fmt.Errorf("proto: wrong wireType = %d for field SkipIntroductionRemovals", wireType)
+			}
+			var v int
+			for shift := uint(0); ; shift += 7 {
+				if shift >= 64 {
+					return ErrIntOverflowBep
+				}
+				if iNdEx >= l {
+					return io.ErrUnexpectedEOF
+				}
+				b := data[iNdEx]
+				iNdEx++
+				v |= (int(b) & 0x7F) << shift
+				if b < 0x80 {
+					break
+				}
+			}
+			m.SkipIntroductionRemovals = bool(v != 0)
 		default:
 			iNdEx = preIndex
 			skippy, err := skipBep(data[iNdEx:])
@@ -3953,108 +3987,110 @@ var (
 )
 
 var fileDescriptorBep = []byte{
-	// 1635 bytes of a gzipped FileDescriptorProto
+	// 1665 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x73, 0xdb, 0xc6,
-	0x15, 0x17, 0x48, 0x10, 0x24, 0x1f, 0x29, 0x05, 0x5a, 0xcb, 0x0a, 0x0b, 0x2b, 0x14, 0x02, 0xc7,
-	0xad, 0xa2, 0x69, 0x14, 0x37, 0x4e, 0x9b, 0x99, 0xce, 0xb4, 0x33, 0x14, 0x09, 0xc9, 0x9c, 0xd0,
-	0x20, 0xb3, 0xa4, 0xec, 0x3a, 0x87, 0x62, 0x40, 0x62, 0x49, 0x61, 0x0c, 0x62, 0x59, 0x00, 0x94,
-	0xad, 0x7e, 0x04, 0xf6, 0x0b, 0xf4, 0xc2, 0x99, 0x4c, 0x6f, 0xbd, 0x76, 0xfa, 0x21, 0x7c, 0xcc,
-	0xe4, 0xd8, 0x83, 0xa7, 0x51, 0x2f, 0xfd, 0x02, 0xbd, 0x77, 0xb0, 0x0b, 0x80, 0xa0, 0xfe, 0x74,
-	0x7c, 0xe8, 0x89, 0xbb, 0xef, 0xfd, 0xf6, 0xed, 0xbe, 0xdf, 0xfb, 0xbd, 0x07, 0x42, 0x79, 0x48,
-	0x66, 0x47, 0x33, 0x9f, 0x86, 0x14, 0x95, 0xd8, 0xcf, 0x88, 0xba, 0xca, 0x67, 0x13, 0x27, 0x3c,
-	0x9f, 0x0f, 0x8f, 0x46, 0x74, 0xfa, 0xf9, 0x84, 0x4e, 0xe8, 0xe7, 0xcc, 0x33, 0x9c, 0x8f, 0xd9,
-	0x8e, 0x6d, 0xd8, 0x8a, 0x1f, 0xd4, 0x66, 0x50, 0x78, 0x4a, 0x5c, 0x97, 0xa2, 0x7d, 0xa8, 0xd8,
-	0xe4, 0xc2, 0x19, 0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09, 0x09, 0x8f,
+	0xf7, 0xde, 0x7e, 0x5f, 0xdf, 0xf8, 0xf6, 0xfb, 0xfa, 0xc6, 0xdb, 0xab, 0xba, 0xf0, 0xed, 0x55,
+	0x5d, 0xf8, 0xe7, 0x55, 0x7d, 0xe3, 0xdf, 0x57, 0x75, 0xe1, 0x9b, 0x7f, 0xd5, 0x85, 0x61, 0x91,
+	0xcd, 0xae, 0x27, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x64, 0x17, 0x1e, 0x19, 0xf4, 0x0d, 0x00,
+	0x00,
 }

+ 9 - 8
lib/protocol/bep.proto

@@ -63,14 +63,15 @@ message Folder {
 }
 
 message Device {
-    bytes           id           = 1 [(gogoproto.customname) = "ID", (gogoproto.customtype) = "DeviceID", (gogoproto.nullable) = false];
-    string          name         = 2;
-    repeated string addresses    = 3;
-    Compression     compression  = 4;
-    string          cert_name    = 5;
-    int64           max_sequence = 6;
-    bool            introducer   = 7;
-    uint64          index_id     = 8 [(gogoproto.customname) = "IndexID", (gogoproto.customtype) = "IndexID", (gogoproto.nullable) = false];
+    bytes           id                         = 1 [(gogoproto.customname) = "ID", (gogoproto.customtype) = "DeviceID", (gogoproto.nullable) = false];
+    string          name                       = 2;
+    repeated string addresses                  = 3;
+    Compression     compression                = 4;
+    string          cert_name                  = 5;
+    int64           max_sequence               = 6;
+    bool            introducer                 = 7;
+    uint64          index_id                   = 8 [(gogoproto.customname) = "IndexID", (gogoproto.customtype) = "IndexID", (gogoproto.nullable) = false];
+    bool            skip_introduction_removals = 9;
 }
 
 enum Compression {