From owner-freebsd-net@freebsd.org Tue Dec 29 22:26:11 2015 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13760A53010 for ; Tue, 29 Dec 2015 22:26:11 +0000 (UTC) (envelope-from mybsdmailing@gmail.com) Received: from mail-ob0-x242.google.com (mail-ob0-x242.google.com [IPv6:2607:f8b0:4003:c01::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D06D41E52 for ; Tue, 29 Dec 2015 22:26:10 +0000 (UTC) (envelope-from mybsdmailing@gmail.com) Received: by mail-ob0-x242.google.com with SMTP id or18so13435901obb.3 for ; Tue, 29 Dec 2015 14:26:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=cKLs8tC5QSrJd7/usomjafwpKirEx3++9hU4VfM8JdY=; b=jOZ+e5wwHaNozuEkb4O9BFJwijQwtPqG5iPr8nM8jgwhagjgLOQEhoKbu1521l41EI uu3qz15U5SuVbErTJM5NUz9DB/Xfn3zvKlzrIsX8+xALz3EqQRxoEJWYPOmOsnHqg9Vy qjDDeBiGdc6wn5J49KvKU9q7pWipGG0DAU82squV9AEisRDmt9CgB6AjjWhqwcdWbFog xghxRhIUIp/w7p4rEeAJ4C5ALNTXapu98VBFbrrXgrWWBGb63C/6NiIMQE/ZvSRWyXYL 0haTfDLgGiWKWwYoJ2KHFQhbwjt8Fn4BCljrOIZXs3epVKi3ePWEY2Z5zoXxY5RKBaI6 e99Q== MIME-Version: 1.0 X-Received: by 10.60.159.72 with SMTP id xa8mr37883539oeb.25.1451427970094; Tue, 29 Dec 2015 14:26:10 -0800 (PST) Received: by 10.202.177.69 with HTTP; Tue, 29 Dec 2015 14:26:10 -0800 (PST) Date: Tue, 29 Dec 2015 16:26:10 -0600 Message-ID: Subject: BPF Berkeley Packet Filter From: Juan Herrera To: freebsd-net@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2015 22:26:11 -0000 Hello, I have a question regarding Berkeley Packet filter, which is Can I read an incoming packet length with BPF, I am working on a project that requires to filter the receiving packets in the kernel before they get to userspace, but I need to be able to read the packet length when applying BPF because I (previously) encapsulated the packet with my own metadata before sending it to the machine with BPF so I want to read packet length to decapsulate as I know the value for the metadata at the end of the packet? Thank you in advance!