Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1037585rdg; Wed, 11 Oct 2023 12:24:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXjAkmHchio/rEzV8nOEpdKHeQXPGhaUTnoZpg4/QLOwbl6XbJ8TGt3SIP6siTyWrjGY5h X-Received: by 2002:a17:902:d88b:b0:1c9:b207:d40b with SMTP id b11-20020a170902d88b00b001c9b207d40bmr5845808plz.38.1697052244540; Wed, 11 Oct 2023 12:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697052244; cv=none; d=google.com; s=arc-20160816; b=0NNA/QcjYwGBDzV+Mt1iPkzJRnNFmvB5OJtCpFjkOX10pang85lcQMQuALXQKVdaZR cjUc5L3EDXgD41uDJ4sEuVAvQHOuHaMpulGd3fEKZDHq/MDhdtP9NvoY6kp1Guf8rQvO gPRxK3bKnjQsadkL8O/c5eKvjWL9VYWJgjw26KVyNrRPB2AJJ4yyc237sr1BP4EILDat SOoSjTmPHzaQAFUIi6Z2vaMYGZYelEmNHL0mYdwHmwgXS5oKizhCzVq/Qf31atoHLsJG P9em652+wV64hSPj05jwpg8cqKbmYqZywBuDN9ZfFFqIy+HSIwa4AM0a5Tymg8CDX6ye MYAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=VVY4n+sUUal8Mo6ekLH5OHpKIcKhQ7qGm4MhPBpzpRk=; fh=ccTyxxnYwp2Ns6leTxeUuSYAnoaMlmJvtOyUczxVArA=; b=QyaXYLEFq6VD14K3HBPEHCJsDA8CqimhodHlEwFCNFAgVikEKueM1J2tktO80chWKR 6c0nuezJqLNPRWD7QXE3SWPNxXNrZz7GZfu9rWyH25178voqf4Cdqqnd7uuDtjG+MufY /IwpK35TMaUaGWmHHrhq/yCEF9pgEHE9oI5gFrzOuZSHiJ8srbmYxulMA6594eySIkhJ DQv6oYhWilJlnqLRbo6uZCSNjpVEKmVMJgHFf9jdw4BZnF3FcHF/jnVsLgJGoo06TOFq QlzTMjW/F1sn1q5dXctpPnie1Vmm/iheG9XBK69C9X0uUnb7nKEBdPuP32AMtQdvvwZK yiCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=google header.b=PsbFF0Ak; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id y7-20020a17090322c700b001bbad1883d5si389480plg.293.2023.10.11.12.24.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 12:24:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@arista.com header.s=google header.b=PsbFF0Ak; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=arista.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id E062F814971E; Wed, 11 Oct 2023 12:24:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346743AbjJKTXp (ORCPT + 99 others); Wed, 11 Oct 2023 15:23:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233342AbjJKTXo (ORCPT ); Wed, 11 Oct 2023 15:23:44 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 619B190 for ; Wed, 11 Oct 2023 12:23:42 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4064867903cso2994465e9.2 for ; Wed, 11 Oct 2023 12:23:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=google; t=1697052221; x=1697657021; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=VVY4n+sUUal8Mo6ekLH5OHpKIcKhQ7qGm4MhPBpzpRk=; b=PsbFF0AkTiENlOdBSGZZXtkuS4mXS53gmYKDCEFtu5mOZq6e23DQSdesi4y9kNicXv WEdKx4hChnE1iaPYx8zqsR+1hSfgVLOgpXxMfFxnJG5q4vPNATNwc6C2lntoExEZfi+p OLDaRAtep2naqsjhLxF0FJh+QpMbC/v8ARfPsUT2KaAoZA/AhqgtjU3RupttIo+yaNvJ ao9oxsjWSgOg8VASH+L0b04s6N0/GO0dLWQcMF8VClebhtX2UVH+BcLvT+rGiHRVA/w1 RcYIk/K5o4y6X4FCbxsmwuifav6HiRPc5z+QxfEAKgDlCHCfe+4ryFinz7jLdSq9NEEf AqUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697052221; x=1697657021; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VVY4n+sUUal8Mo6ekLH5OHpKIcKhQ7qGm4MhPBpzpRk=; b=HL4SkvmFB8E5Z77DyeWnBXMZxxi18R11e/NqeVyBu6fFietwiXofijsdtvFhaDIqLt jk9UZwDc/YIee8YkMh4YatIIVs8e4O6kEdCqwS/QrhqiOgncKv8hQxfIO+J08sd0zJqd T4T6pjNZA9W23wBSv2GZViblibrRjMnAU47g4xkNPslD+2zeXtuAhu9mKGAwcXBgSUPW wHYHfebg4ETpCTGQFETlvvRmWVQQ8Hw7j43eTDvis+6Cx8q5+DndDb+PMp9kOlNScKZF o3YWqGs2DUNN5v8UpZnioYfqbrLaTqG9BDrLvKNu22JpckcBZd9EtVYAw1rn+ORk/w5f /Lxg== X-Gm-Message-State: AOJu0Yzg/Ou+9lSlfzRBIVruOyXUaclo1zU9y1Xt48N+WVZJ2ucq5rAp aKorx1KZJveej7ghmGGNBfXu6Q== X-Received: by 2002:a5d:65c4:0:b0:321:4c58:7722 with SMTP id e4-20020a5d65c4000000b003214c587722mr18708893wrw.69.1697052220829; Wed, 11 Oct 2023 12:23:40 -0700 (PDT) Received: from [10.83.37.178] ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id e28-20020adfa45c000000b0032d892e70b4sm1970391wra.37.2023.10.11.12.23.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Oct 2023 12:23:40 -0700 (PDT) Message-ID: Date: Wed, 11 Oct 2023 20:23:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v14 net-next 08/23] net/tcp: Add AO sign to RST packets Content-Language: en-US To: Eric Dumazet Cc: David Ahern , Paolo Abeni , Jakub Kicinski , "David S. Miller" , linux-kernel@vger.kernel.org, Andy Lutomirski , Ard Biesheuvel , Bob Gilligan , Dan Carpenter , David Laight , Dmitry Safonov <0x7f454c46@gmail.com>, Donald Cassidy , Eric Biggers , "Eric W. Biederman" , Francesco Ruggeri , "Gaillardetz, Dominik" , Herbert Xu , Hideaki YOSHIFUJI , Ivan Delalande , Leonard Crestez , "Nassiri, Mohammad" , Salam Noureddine , Simon Horman , "Tetreault, Francois" , netdev@vger.kernel.org References: <20231009230722.76268-1-dima@arista.com> <20231009230722.76268-9-dima@arista.com> From: Dmitry Safonov In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 11 Oct 2023 12:24:01 -0700 (PDT) X-Spam-Level: ** On 10/11/23 19:04, Eric Dumazet wrote: > On Tue, Oct 10, 2023 at 1:07 AM Dmitry Safonov wrote: [..] >> struct tcp_key { >> union { >> - struct tcp_ao_key *ao_key; >> + struct { >> + struct tcp_ao_key *ao_key; >> + u32 sne; >> + char *traffic_key; > > Move sne after traffic_key to avoid a hole on 64bit arches. Sure, thanks! [..] >> @@ -435,6 +495,46 @@ struct tcp_ao_key *tcp_v4_ao_lookup(const struct sock *sk, struct sock *addr_sk, >> return tcp_ao_do_lookup(sk, addr, AF_INET, sndid, rcvid); >> } >> >> +int tcp_ao_prepare_reset(const struct sock *sk, struct sk_buff *skb, >> + const struct tcp_ao_hdr *aoh, int l3index, >> + struct tcp_ao_key **key, char **traffic_key, >> + bool *allocated_traffic_key, u8 *keyid, u32 *sne) >> +{ >> + struct tcp_ao_info *ao_info; >> + >> + *allocated_traffic_key = false; >> + /* If there's no socket - than initial sisn/disn are unknown. >> + * Drop the segment. RFC5925 (7.7) advises to require graceful >> + * restart [RFC4724]. Alternatively, the RFC5925 advises to >> + * save/restore traffic keys before/after reboot. >> + * Linux TCP-AO support provides TCP_AO_ADD_KEY and TCP_AO_REPAIR >> + * options to restore a socket post-reboot. >> + */ >> + if (!sk) >> + return -ENOTCONN; >> + >> + if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV)) { >> + return -1; >> + } else { >> + struct tcp_ao_key *rnext_key; >> + >> + if (sk->sk_state == TCP_TIME_WAIT) > > Why not adding TCPF_TIME_WAIT in the prior test ? Well, twsk is wired up here in the next patch "net/tcp: Add TCP-AO sign to twsk", while the condition for request sockets is the patch after that. I probably can move it to the same condition just to polish the code in the middle of patch set, I guess it felt not critical when I split it by patches. > >> + return -1; [..] Thanks, Dmitry