From owner-freebsd-net@freebsd.org Wed Oct 16 17:14:46 2019 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8749314B948 for ; Wed, 16 Oct 2019 17:14:46 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46tf6s4tHYz432p for ; Wed, 16 Oct 2019 17:14:45 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x835.google.com with SMTP id n17so17844307qtr.4 for ; Wed, 16 Oct 2019 10:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=EC2sSG6pBEWCBU+ek8xt5aS3b7UvPM1z+iEyFi1W9o4=; b=Da5o3R0aoO8Y7jNHRH66rUmtrHxJsKfCiXkjMRNPY9oYnAQjK1naQ6DbFNCkHjX4UN hQGQlZiR2qP28Osy/JnASSnLwTz+b9o4RYqNrqCaeknM9dWfyIZ60cIFgf456/ISKDl1 Y0tfoefyRgUMsCWNa+SXCDpX8qSAU0n397OmZOU4/3BVxgTZvMD6L2vJLhZd8TypkabU i2Kb74799OrULJVjRo5soUOnyeKD38WsAvKy5XqRqzcUMTw1jVxEzSrvgh5FAhPcM3f1 GZ9WlPI9bC2+vaW+k/1t+F8j2Kj90lzi3M8QUf8TqhGdVZIcy4HPb5hwVNSWFDMmL4Dy LGcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=EC2sSG6pBEWCBU+ek8xt5aS3b7UvPM1z+iEyFi1W9o4=; b=pqjEywbrnlwZfxwrYu0wPmoTG43bCSvjWAcIjhyeqgQIut1I3zwU0J5M+olbdbX99Y gRTigjfJFGSeqJwU8GRWHs+X+cTWwlmCJN2AFPGOdzhATM+OhM+EzIwGV72lA5/I1XDm WxKNG0Iaqg8g0DDjPQsR/Mwb1+aQQ/zUMOhfVLGa3ZGNxcpTgFFBlGTlyt08vHbnmg3j 50SWd0luu6ti6PH+1nUJiI7ZW/jLzaYv8ZIGLa1n28KAbYmhJBHsuajCLkouF6KGEUdy nvqyNHtm78CwRA3/ePjeotol+7IWCtQpdtypnxdU+WVphbSkkZfn238zKcDJgIc4r3Pc eA/w== X-Gm-Message-State: APjAAAVF/ZVTBSG5hCffDoHaaqA4RFjH+qO4O3mPq3fNvIiZD7dWqFzk nLoaQvF4pLcXmwEOMNtdeIo= X-Google-Smtp-Source: APXvYqyauN2s64RXaTPcLzHJx3kiRlifUZemE3Tepc3nA9qU4M15sTOwLkxZ08fUm/9XgT0YLIX9MA== X-Received: by 2002:a0c:f9c1:: with SMTP id j1mr20635254qvo.244.1571246083473; Wed, 16 Oct 2019 10:14:43 -0700 (PDT) Received: from raichu (toroon0560w-lp130-05-69-158-183-252.dsl.bell.ca. [69.158.183.252]) by smtp.gmail.com with ESMTPSA id c26sm16194696qtk.93.2019.10.16.10.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 10:14:42 -0700 (PDT) Sender: Mark Johnston Date: Wed, 16 Oct 2019 13:14:40 -0400 From: Mark Johnston To: Dheeraj Kandula Cc: freebsd-net@freebsd.org Subject: Re: sol_upcall in FreeBSD 12 Message-ID: <20191016171440.GE82455@raichu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46tf6s4tHYz432p X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Da5o3R0a; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::835 as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-4.50 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCVD_COUNT_THREE(0.00)[3]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[5.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.80)[ip: (-9.38), ipnet: 2607:f8b0::/32(-2.47), asn: 15169(-2.10), country: US(-0.05)]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 17:14:46 -0000 On Thu, Aug 01, 2019 at 04:06:34PM -0400, Dheeraj Kandula wrote: > When going through the code of FreeBSD12, I see that the socket code has > undergone significant change. > > The socket is now either a regular socket or a listen socket. > The listen socket has two new fields besides others: > > sol_upcall and sol_upcallarg > > My understanding is that this callback will be used to notify the accept > socket's consumers when the 3 way handshake is completed and the socket is > ready to be accepted. Right, it is called from solisten_wakeup() when a new connection is established. > However in soisconnected function, when the accept filter is set, the code > still sets the receive socket buffer's upcall. Right. The accept filter is supposed to process incoming data on that socket until it accepts or rejects the connection. To do this, we must set the socket buffer upcall. When the accept filter returns SU_ISCONNECTED, the receive socket transitions to the connected state, and the listen socket upcall, if any, is invoked. > Shouldn't we set the > sol_upcall in line 3773 below instead. If not, when should the sol_upcall > be set. An example will help clarify the usage. I don't really follow: line 3773 is setting an upcall for the new socket, not the listening socket. If the listening socket has set sol_upcall, and an accept filter is configured, sol_upcall will be invoked once the accept filter has accepted the connection.