mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Merge pull request #201 from safing/fix/linux-performance
Fix nfqueue performance
This commit is contained in:
commit
67b4b315f9
4 changed files with 17 additions and 9 deletions
12
Gopkg.lock
generated
12
Gopkg.lock
generated
|
@ -140,15 +140,15 @@
|
||||||
revision = "2bc1f35cddc0cc527b4bc3dce8578fc2a6c11384"
|
revision = "2bc1f35cddc0cc527b4bc3dce8578fc2a6c11384"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:4f0792bf942a61626dfdc06d228aa79783e51f214faacba73992a73f9485c0a8"
|
branch = "master"
|
||||||
|
digest = "1:1f6a000c4fe2eaf76f506ecc23e859e1a5b81c0ec3039c5fca21bfbb80c43979"
|
||||||
name = "github.com/mdlayher/netlink"
|
name = "github.com/mdlayher/netlink"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
"nlenc",
|
"nlenc",
|
||||||
]
|
]
|
||||||
pruneopts = ""
|
pruneopts = ""
|
||||||
revision = "ad88bf8eff5c1fd8d6a29299addeeb23d05f1ec1"
|
revision = "ded538f7f4be5ec9a64b7a16c7fdb0bc66bfb85b"
|
||||||
version = "v1.1.0"
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:508f444b8e00a569a40899aaf5740348b44c305d36f36d4f002b277677deef95"
|
digest = "1:508f444b8e00a569a40899aaf5740348b44c305d36f36d4f002b277677deef95"
|
||||||
|
@ -276,7 +276,10 @@
|
||||||
branch = "master"
|
branch = "master"
|
||||||
digest = "1:ae1578a64c2b241c13ab243739d05936d83825d2b6e9ff043ea3c7105666493d"
|
digest = "1:ae1578a64c2b241c13ab243739d05936d83825d2b6e9ff043ea3c7105666493d"
|
||||||
name = "golang.org/x/sync"
|
name = "golang.org/x/sync"
|
||||||
packages = ["errgroup"]
|
packages = [
|
||||||
|
"errgroup",
|
||||||
|
"singleflight",
|
||||||
|
]
|
||||||
pruneopts = ""
|
pruneopts = ""
|
||||||
revision = "6e8e738ad208923de99951fe0b48239bfd864f28"
|
revision = "6e8e738ad208923de99951fe0b48239bfd864f28"
|
||||||
|
|
||||||
|
@ -390,6 +393,7 @@
|
||||||
"golang.org/x/net/ipv4",
|
"golang.org/x/net/ipv4",
|
||||||
"golang.org/x/net/publicsuffix",
|
"golang.org/x/net/publicsuffix",
|
||||||
"golang.org/x/sync/errgroup",
|
"golang.org/x/sync/errgroup",
|
||||||
|
"golang.org/x/sync/singleflight",
|
||||||
"golang.org/x/sys/unix",
|
"golang.org/x/sys/unix",
|
||||||
"golang.org/x/sys/windows",
|
"golang.org/x/sys/windows",
|
||||||
"golang.org/x/sys/windows/svc",
|
"golang.org/x/sys/windows/svc",
|
||||||
|
|
|
@ -29,3 +29,7 @@ ignored = ["github.com/safing/portbase/*", "github.com/safing/spn/*"]
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/florianl/go-nfqueue"
|
name = "github.com/florianl/go-nfqueue"
|
||||||
branch = "master" # switch back once we migrate to go.mod
|
branch = "master" # switch back once we migrate to go.mod
|
||||||
|
|
||||||
|
[[override]]
|
||||||
|
name = "github.com/mdlayher/netlink"
|
||||||
|
branch = "master" # remove when https://github.com/mdlayher/netlink/pull/171 is released and in github.com/florianl/go-nfqueue
|
||||||
|
|
|
@ -39,8 +39,8 @@ func New(qid uint16, v6 bool) (*Queue, error) { //nolint:gocognit
|
||||||
MaxQueueLen: 0xffff,
|
MaxQueueLen: 0xffff,
|
||||||
AfFamily: uint8(afFamily),
|
AfFamily: uint8(afFamily),
|
||||||
Copymode: nfqueue.NfQnlCopyPacket,
|
Copymode: nfqueue.NfQnlCopyPacket,
|
||||||
ReadTimeout: 5 * time.Millisecond,
|
ReadTimeout: 1000 * time.Millisecond,
|
||||||
WriteTimeout: 100 * time.Millisecond,
|
WriteTimeout: 1000 * time.Millisecond,
|
||||||
}
|
}
|
||||||
|
|
||||||
nf, err := nfqueue.Open(cfg)
|
nf, err := nfqueue.Open(cfg)
|
||||||
|
|
|
@ -92,12 +92,12 @@ func (p *Process) Delete() {
|
||||||
// CleanProcessStorage cleans the storage from old processes.
|
// CleanProcessStorage cleans the storage from old processes.
|
||||||
func CleanProcessStorage(activePIDs map[int]struct{}) {
|
func CleanProcessStorage(activePIDs map[int]struct{}) {
|
||||||
// add system table of processes
|
// add system table of processes
|
||||||
procs, err := processInfo.Processes()
|
pids, err := processInfo.Pids()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warningf("process: failed to get list of active PIDs: %s", err)
|
log.Warningf("process: failed to get list of active PIDs: %s", err)
|
||||||
} else {
|
} else {
|
||||||
for _, p := range procs {
|
for _, pid := range pids {
|
||||||
activePIDs[int(p.Pid)] = struct{}{}
|
activePIDs[int(pid)] = struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue