'\" t .\" Title: sk_filter_trim_cap .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: June 2017 .\" Manual: Linux Networking .\" Source: Kernel Hackers Manual 4.11.3 .\" Language: English .\" .TH "SK_FILTER_TRIM_CAP" "9" "June 2017" "Kernel Hackers Manual 4\&.11\&" "Linux Networking" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" sk_filter_trim_cap \- run a packet through a socket filter .SH "SYNOPSIS" .HP \w'int\ sk_filter_trim_cap('u .BI "int sk_filter_trim_cap(struct\ sock\ *\ " "sk" ", struct\ sk_buff\ *\ " "skb" ", unsigned\ int\ " "cap" ");" .SH "ARGUMENTS" .PP \fIstruct sock * sk\fR .RS 4 sock associated with &sk_buff .RE .PP \fIstruct sk_buff * skb\fR .RS 4 buffer to filter .RE .PP \fIunsigned int cap\fR .RS 4 limit on how short the eBPF program may trim the packet .RE .SH "DESCRIPTION" .PP Run the eBPF program and then cut skb\->data to correct size returned by the program\&. If pkt_len is 0 we toss packet\&. If skb\->len is smaller than pkt_len we keep whole skb\->data\&. This is the socket level wrapper to BPF_PROG_RUN\&. It returns 0 if the packet should be accepted or \-EPERM if the packet should be tossed\&. .SH "COPYRIGHT" .br