Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751464AbbEAT2H (ORCPT ); Fri, 1 May 2015 15:28:07 -0400 Received: from mail-la0-f43.google.com ([209.85.215.43]:35700 "EHLO mail-la0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751007AbbEAT2E (ORCPT ); Fri, 1 May 2015 15:28:04 -0400 MIME-Version: 1.0 In-Reply-To: <1430502237-5619-1-git-send-email-emunson@akamai.com> References: <1430502237-5619-1-git-send-email-emunson@akamai.com> From: Andy Lutomirski Date: Fri, 1 May 2015 12:27:42 -0700 Message-ID: Subject: Re: [PATCH] Allow TCP connections to cache SYN packet for userspace inspection To: Eric B Munson Cc: "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , Network Development , Linux API , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1483 Lines: 29 On Fri, May 1, 2015 at 10:43 AM, Eric B Munson wrote: > In order to enable policy decisions in userspace, the data contained in > the SYN packet would be useful for tracking or identifying connections. > Only parts of this data are available to userspace after the hand shake > is completed. This patch exposes a new setsockopt() option that will, > when used with a listening socket, ask the kernel to cache the skb > holding the SYN packet for retrieval later. The SYN skbs will not be > saved while the kernel is in syn cookie mode. > > The same option will ask the kernel for the packet headers when used > with getsockopt() with the socket returned from accept(). The cached > packet will only be available for the first getsockopt() call, the skb > is consumed after the requested data is copied to userspace. Subsequent > calls will return -ENOENT. Because of this behavior, getsockopt() will > return -E2BIG if the caller supplied a buffer that is too small to hold > the skb header. What's the purpose and what headers are you returning? There was a bit of a mixup with tx timestamps where the set of headers returned was possibly excessive and incompletely thought out the first time around. --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/