-
-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flag to disable packet interception
- Loading branch information
Showing
3 changed files
with
46 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package interception | ||
|
||
import ( | ||
"flag" | ||
|
||
"github.com/safing/portbase/log" | ||
"github.com/safing/portmaster/network/packet" | ||
) | ||
|
||
var ( | ||
// Packets channel for feeding the firewall. | ||
Packets = make(chan packet.Packet, 1000) | ||
|
||
disableInterception bool | ||
) | ||
|
||
func init() { | ||
flag.BoolVar(&disableInterception, "disable-interception", false, "disable packet interception - this breaks a lot of functionality") | ||
} | ||
|
||
// Start starts the interception. | ||
func Start() error { | ||
if disableInterception { | ||
log.Warning("interception: packet interception is disabled via flag - this breaks a lot of functionality") | ||
return nil | ||
} | ||
|
||
return start() | ||
} | ||
|
||
// Stop starts the interception. | ||
func Stop() error { | ||
if disableInterception { | ||
return nil | ||
} | ||
|
||
return stop() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
package interception | ||
|
||
import "github.com/safing/portmaster/network/packet" | ||
|
||
// Packets channel for feeding the firewall. | ||
var Packets = make(chan packet.Packet, 1000) | ||
|
||
// Start starts the interception. | ||
func Start() error { | ||
// start starts the interception. | ||
func start() error { | ||
return StartNfqueueInterception() | ||
} | ||
|
||
// Stop starts the interception. | ||
func Stop() error { | ||
// stop starts the interception. | ||
func stop() error { | ||
return StopNfqueueInterception() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters