Просмотр исходного кода

Fix: don't run manipulator operations when no ports

Rod Hynes 5 лет назад
Родитель
Сommit
bc342a2f8b
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      psiphon/common/packetman/packetman_linux.go

+ 8 - 0
psiphon/common/packetman/packetman_linux.go

@@ -128,6 +128,14 @@ func (m *Manipulator) Start() (retErr error) {
 		return errors.TraceNew("already running")
 	}
 
+	if len(m.config.ProtocolPorts) == 0 {
+		// There are no ports to intercept, so there is nothing to run. Skip
+		// subsequent operations which assume at least one intercept port is
+		// configured. This is a success case, and a subseqent call to Stop is a
+		// no-op.
+		return nil
+	}
+
 	err := m.configureIPTables(true)
 	if err != nil {
 		return errors.Trace(err)