@ -135,9 +135,16 @@ type Wrapper struct {
PreFilterIn FilterFunc
PreFilterIn FilterFunc
// PostFilterIn is the inbound filter function that runs after the main filter.
// PostFilterIn is the inbound filter function that runs after the main filter.
PostFilterIn FilterFunc
PostFilterIn FilterFunc
// PreFilterOut is the outbound filter function that runs before the main filter
// PreFilterFromTunToNetstack is a filter function that runs before the main filter
// and therefore sees the packets that may be later dropped by it.
// for packets from the local system. This filter is populated by netstack to hook
PreFilterOut FilterFunc
// packets that should be handled by netstack. If set, this filter runs before
// PreFilterFromTunToEngine.
PreFilterFromTunToNetstack FilterFunc
// PreFilterFromTunToEngine is a filter function that runs before the main filter
// for packets from the local system. This filter is populated by wgengine to hook
// packets which it handles internally. If both this and PreFilterFromTunToNetstack
// filter functions are non-nil, this filter runs second.
PreFilterFromTunToEngine FilterFunc
// PostFilterOut is the outbound filter function that runs after the main filter.
// PostFilterOut is the outbound filter function that runs after the main filter.
PostFilterOut FilterFunc
PostFilterOut FilterFunc
@ -451,9 +458,16 @@ func (t *Wrapper) filterOut(p *packet.Parsed) filter.Response {
return filter . DropSilently
return filter . DropSilently
}
}
if t . PreFilterOut != nil {
if t . PreFilterFromTunToNetstack != nil {
if res := t . PreFilterOut ( p , t ) ; res . IsDrop ( ) {
if res := t . PreFilterFromTunToNetstack ( p , t ) ; res . IsDrop ( ) {
// Handled by userspaceEngine.handleLocalPackets (quad-100 DNS primarily).
// Handled by netstack.Impl.handleLocalPackets (quad-100 DNS primarily)
return res
}
}
if t . PreFilterFromTunToEngine != nil {
if res := t . PreFilterFromTunToEngine ( p , t ) ; res . IsDrop ( ) {
// Handled by userspaceEngine.handleLocalPackets (primarily handles
// quad-100 if netstack is not installed).
return res
return res
}
}
}
}