Browse Source

Tactics packet manipulator reload fixes

- Manipulator.SetSpecs ignored input and
  always used config specs

- Don't reload packet manipulation specs
  when not running packet manipulator
Rod Hynes 5 years ago
parent
commit
25858e23ef
2 changed files with 11 additions and 11 deletions
  1. 1 1
      psiphon/common/packetman/packetman_linux.go
  2. 10 10
      psiphon/server/services.go

+ 1 - 1
psiphon/common/packetman/packetman_linux.go

@@ -279,7 +279,7 @@ func (m *Manipulator) Stop() {
 func (m *Manipulator) SetSpecs(specs []*Spec) error {
 
 	compiledSpecs := make(map[string]*compiledSpec)
-	for _, spec := range m.config.Specs {
+	for _, spec := range specs {
 		if spec.Name == "" {
 			return errors.TraceNew("invalid spec name")
 		}

+ 10 - 10
psiphon/server/services.go

@@ -510,22 +510,22 @@ func (support *SupportServices) Reload() {
 	// reload; new tactics will be obtained on the next client handshake or
 	// tactics request.
 
-	reloadSpecs := func() {
-		err := reloadPacketManipulationSpecs(support)
-		if err != nil {
-			log.WithTraceFields(
-				LogFields{"error": errors.Trace(err)}).Warning(
-				"failed to reload packet manipulation specs")
-		}
-	}
-
 	// Take these actions only after the corresponding Reloader has reloaded.
 	// In both the traffic rules and OSL cases, there is some impact from state
 	// reset, so the reset should be avoided where possible.
 	reloadPostActions := map[common.Reloader]func(){
 		support.TrafficRulesSet: func() { support.TunnelServer.ResetAllClientTrafficRules() },
 		support.OSLConfig:       func() { support.TunnelServer.ResetAllClientOSLConfigs() },
-		support.TacticsServer:   reloadSpecs,
+	}
+	if support.Config.RunPacketManipulator {
+		reloadPostActions[support.TacticsServer] = func() {
+			err := reloadPacketManipulationSpecs(support)
+			if err != nil {
+				log.WithTraceFields(
+					LogFields{"error": errors.Trace(err)}).Warning(
+					"failed to reload packet manipulation specs")
+			}
+		}
 	}
 
 	for _, reloader := range reloaders {