Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add config.SkipErrorENOBUFS option #36

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions nflog.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ func Open(config *Config) (*Nflog, error) {
if err != nil {
return nil, err
}
if config.SkipErrorENOBUFS {
if err := con.SetOption(netlink.NoENOBUFS, true); err != nil {
con.Close()
return nil, err
}
}
nflog.Con = con

if config.Logger == nil {
Expand Down
6 changes: 6 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ type Config struct {
// Optional settings to enable/disable features
Settings uint16

// If SkipErrorENOBUFS is set to "true", it will skip the "ENOBUFS" error,
// normally, the "ENOBUFS" error would close the netlink socket if there are a lot of messages,
// however, enabling this option allows the socket to continue working
// (at the cost of potentially losing some messages)
SkipErrorENOBUFS bool

// Time till a read action times out - only available for Go >= 1.12
//
// Deprecated: Cancel the context passed to RegisterWithErrorFunc() or Register()
Expand Down