---
name: "sk_filter_trim_cap"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/sk_filter_trim_cap"
---

# sk\_filter\_trim\_cap(9)

run a packet through a socket filter

## NAME

sk\_filter\_trim\_cap - run a packet through a socket filter

## SYNOPSIS

**int sk\_filter\_trim\_cap(struct sock \*** *sk***, struct sk\_buff \*** *skb***, unsigned int** *cap***);**

## ARGUMENTS

*sk*

sock associated with sk\_buff

*skb*

buffer to filter

*cap*

limit on how short the eBPF program may trim the packet

## DESCRIPTION

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.

## COPYRIGHT
