mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
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:
parent
da2292fbb7
commit
414d18a6da
1 changed files with 5 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue