new: queue handle is not passed to the packet proxy plugins in order to be able to drop/accept packets from within the callback (fixes #1202)

This commit is contained in:
evilsocket 2025-07-12 11:59:55 +02:00
commit 414d18a6da

View file

@ -16,13 +16,15 @@ import (
"github.com/evilsocket/islazy/fs"
)
type hookFunc func(q *nfqueue.Nfqueue, a nfqueue.Attribute) int
type PacketProxy struct {
session.SessionModule
chainName string
rule string
queue *nfqueue.Nfqueue
queueNum int
queueCb nfqueue.HookFunc
queueCb hookFunc
pluginPath string
plugin *plugin.Plugin
}
@ -149,7 +151,7 @@ func (mod *PacketProxy) Configure() (err error) {
return
} else if sym, err = mod.plugin.Lookup("OnPacket"); err != nil {
return
} else if mod.queueCb, ok = sym.(func(nfqueue.Attribute) int); !ok {
} else if mod.queueCb, ok = sym.(hookFunc); !ok {
return fmt.Errorf("Symbol OnPacket is not a valid callback function.")
}
@ -198,7 +200,7 @@ func (mod *PacketProxy) Configure() (err error) {
// CGO callback ... ¯\_(ツ)_/¯
func dummyCallback(attribute nfqueue.Attribute) int {
if mod.queueCb != nil {
return mod.queueCb(attribute)
return mod.queueCb(mod.queue, attribute)
} else {
id := *attribute.PacketID