Skip to content

Commit

Permalink
Add SetOption to example
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Lehner <[email protected]>
  • Loading branch information
florianl committed Mar 30, 2024
1 parent 83070d7 commit 4ba8c2a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ func main() {

nf, err := nflog.Open(&config)
if err != nil {
fmt.Println("could not open nflog socket:", err)
fmt.Fprintln(os.Stderr, "could not open nflog socket:", err)
return
}
defer nf.Close()

// NoENOBUFS - avoid fatal error if netlink buffer overflows.
if err := rtnl.SetOption(netlink.NoENOBUFS, true); err != nil {
fmt.Fprintf(os.Stderr, "failed to set netlink option %v: %v",
netlink.NoENOBUFS, err)
return
}

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

Expand Down

0 comments on commit 4ba8c2a

Please sign in to comment.