From patchwork Thu Sep 21 07:12:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darrell Ball X-Patchwork-Id: 816708 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Xqf5D6zd"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xySVx1NJCz9s7h for ; Thu, 21 Sep 2017 17:12:57 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0FC98970; Thu, 21 Sep 2017 07:12:23 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 4E8A8904 for ; Thu, 21 Sep 2017 07:12:21 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f67.google.com (mail-pg0-f67.google.com [74.125.83.67]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 00FB81A6 for ; Thu, 21 Sep 2017 07:12:20 +0000 (UTC) Received: by mail-pg0-f67.google.com with SMTP id i130so2989165pgc.0 for ; Thu, 21 Sep 2017 00:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=c0DmAgqM1K01YU4zR9lzqaIyRX/pxNQtOLAH+P4+Wh4=; b=Xqf5D6zd1Q5C9lYx5I9WYsbatB/PptERP7D1+vLKE4XsJuNWBympaYrjLQenURNX/4 WKDKSbGfXbDvUgMkSAuNLgckMxcQHnZOvJJLk/TwluE1WJaWRqFZkV3S3AYSd9phHtfP SCLrV/jmJwc42EGxm4nhrEO7BkyMTQWtnSTQGaQz+wxvzA5fSvgmCw82VdzpLfrMl/4v kHPf6/Q3TxLwKYmVsZ/cI/OS1G+PS+JKVSX+fsxgVQ0UH0XdKViu0ClYdnTiTUL1PYwE KJjbqpFUIPpoXVSmYjMXqibSUYEsgycBLO1PBFWrhMKuP+TJArsZNxIYe08I9yKSbuDC tlDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=c0DmAgqM1K01YU4zR9lzqaIyRX/pxNQtOLAH+P4+Wh4=; b=sR9PJQforBXpETutzA8u6X38b4rO3eh71lAjirVmM+taFUO2eVW/xFp7rjfToqh3QZ 4MmwZkQSeUP3Npcpa9+R0VswpulaapQu+Fx7ocQrwkxli6dvFRpbWe6uSRCrOc4wF7jy I4YrlnVEFMFBzrsm8K+iPok+yBdWb+9pCKE0lL5kVVpEqwLkPBfpjvHGoPmeANzbzke7 0Q+A7HgPrJ5J/wgzLLq1D+C4pbxgkS11Um9HxLbdbRtueo/78cJpQIVnmhMa+juhe4aH BduhxWeHIvSGenU6fyKGjiuK4e35EdX2zTBspWBpRkMJ4A+fKCVO98fwRjJNTkJJxd0n kZ0A== X-Gm-Message-State: AHPjjUhWj6gAjv1Hkek+hviRAZVxiuKEMZDnXwMPky1PJmp1x1xHW2iO 1D6nR37OVPJtD6/E93/7riE+/Q== X-Google-Smtp-Source: AOwi7QBFAt0sweI0qVuCItY2QSkn9NGJnchsjIcDqeV5T6mMGQ95TkYI9Pvy0Yqj2G7kdOgVjluRdQ== X-Received: by 10.84.137.106 with SMTP id 97mr4533440plm.411.1505977940545; Thu, 21 Sep 2017 00:12:20 -0700 (PDT) Received: from localhost.localdomain (c-73-162-236-45.hsd1.ca.comcast.net. [73.162.236.45]) by smtp.gmail.com with ESMTPSA id j83sm1475734pfe.133.2017.09.21.00.12.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Sep 2017 00:12:19 -0700 (PDT) From: Darrell Ball To: dlu998@gmail.com, dev@openvswitch.org Date: Thu, 21 Sep 2017 00:12:05 -0700 Message-Id: <1505977929-13284-1-git-send-email-dlu998@gmail.com> X-Mailer: git-send-email 1.9.1 X-Spam-Status: No, score=0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [patch v2 1/5] conntrack: Fix clang static analysis reports. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org These dead assignment warnings do not affect functionality. In one case, a local variable could be removed and in another case, the working pointer should be used rather than the start pointer. Fixes: bd5e81a0e596 ("Userspace Datapath: Add ALG infra and FTP.") Reported-by: Bhanuprakash Bodireddy Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-September/338515.html Signed-off-by: Darrell Ball Acked-by: Bhanuprakash Bodireddy --- lib/conntrack.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index 419cb1d..59d3c4e 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -2617,7 +2617,7 @@ process_ftp_ctl_v4(struct conntrack *ct, char *ftp = ftp_msg; enum ct_alg_mode mode; - if (!strncasecmp(ftp_msg, FTP_PORT_CMD, strlen(FTP_PORT_CMD))) { + if (!strncasecmp(ftp, FTP_PORT_CMD, strlen(FTP_PORT_CMD))) { ftp = ftp_msg + strlen(FTP_PORT_CMD); mode = CT_FTP_MODE_ACTIVE; } else { @@ -2763,7 +2763,7 @@ process_ftp_ctl_v6(struct conntrack *ct, char *ftp = ftp_msg; struct in6_addr ip6_addr; - if (!strncasecmp(ftp_msg, FTP_EPRT_CMD, strlen(FTP_EPRT_CMD))) { + if (!strncasecmp(ftp, FTP_EPRT_CMD, strlen(FTP_EPRT_CMD))) { ftp = ftp_msg + strlen(FTP_EPRT_CMD); ftp = skip_non_digits(ftp); if (*ftp != FTP_AF_V6 || isdigit(ftp[1])) { @@ -2906,10 +2906,8 @@ handle_ftp_ctl(struct conntrack *ct, const struct conn_lookup_ctx *ctx, struct ovs_16aligned_ip6_hdr *nh6 = dp_packet_l3(pkt); int64_t seq_skew = 0; - bool seq_skew_dir; if (ftp_ctl == CT_FTP_CTL_OTHER) { seq_skew = conn_for_expectation->seq_skew; - seq_skew_dir = conn_for_expectation->seq_skew_dir; } else if (ftp_ctl == CT_FTP_CTL_INTEREST) { enum ftp_ctl_pkt rc; if (ctx->key.dl_type == htons(ETH_TYPE_IPV6)) { @@ -2933,18 +2931,16 @@ handle_ftp_ctl(struct conntrack *ct, const struct conn_lookup_ctx *ctx, seq_skew = repl_ftp_v6_addr(pkt, v6_addr_rep, ftp_data_start, addr_offset_from_ftp_data_start, addr_size, mode); - seq_skew_dir = ctx->reply; if (seq_skew) { ip_len = ntohs(nh6->ip6_ctlun.ip6_un1.ip6_un1_plen); ip_len += seq_skew; nh6->ip6_ctlun.ip6_un1.ip6_un1_plen = htons(ip_len); conn_seq_skew_set(ct, &conn_for_expectation->key, now, - seq_skew, seq_skew_dir); + seq_skew, ctx->reply); } } else { seq_skew = repl_ftp_v4_addr(pkt, v4_addr_rep, ftp_data_start, addr_offset_from_ftp_data_start); - seq_skew_dir = ctx->reply; ip_len = ntohs(l3_hdr->ip_tot_len); if (seq_skew) { ip_len += seq_skew; @@ -2952,7 +2948,7 @@ handle_ftp_ctl(struct conntrack *ct, const struct conn_lookup_ctx *ctx, l3_hdr->ip_tot_len, htons(ip_len)); l3_hdr->ip_tot_len = htons(ip_len); conn_seq_skew_set(ct, &conn_for_expectation->key, now, - seq_skew, seq_skew_dir); + seq_skew, ctx->reply); } } } else { From patchwork Thu Sep 21 07:12:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darrell Ball X-Patchwork-Id: 816709 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Sab2e+yX"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xySWj31G8z9s76 for ; Thu, 21 Sep 2017 17:13:37 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id EF0C29E8; Thu, 21 Sep 2017 07:12:24 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 7541B95D for ; Thu, 21 Sep 2017 07:12:22 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 3112C1A6 for ; Thu, 21 Sep 2017 07:12:22 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id h4so2166627pfk.0 for ; Thu, 21 Sep 2017 00:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=3KYTSW12NohC2LjYj94DtYu+qm5Gu/6mDmhEiFPQ/IE=; b=Sab2e+yX5lxDGksJPdzbfHJKxL7xHD5EHthqgjMoB3ES3uxiUJ3tzYU0dS7tKq0BC9 X8z8kjRhKQLcwxLdXgTe41dX1+/GRFrDvvLxtFU2wKRbbyIW+I2Iw98ZK4verI6UEBBs d4nqost2xN//pi5U9WdfWXhY48FZ6DWqRFtI53by0Z0hqE03G/aFaJsYBLz7Ewhvl3CF yRWQnr/Lf6P/MMDioeWOewmXurD7fKoZVU7U4BkyM55IEk+HSgj/bPEzrT54qPgqTvUF QIDY56VYwSQ2N/EPmWJtFe57MNuJndnzMVTtUHIY4OtRhGJsGFbMdX61jCB6job7oxSI 209w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=3KYTSW12NohC2LjYj94DtYu+qm5Gu/6mDmhEiFPQ/IE=; b=CNtsoRaoNM+dhhEISRa0Lfqoa2kIXDU5pYnNmfwJaIzM7dxxq67XyTMm1mz2SjUAma MODjaEsvBY2p9IWOt/w/uSPYJSA+qm7gGzRHMAQjLIt/MN5KwecP3OqETq/UTtT/Pzna /h7B0pfTRgPznQhk07eDsgDpHT2UIIAJ4or2jdm8f8pE1rhOjMcIU9vywTOIPeuBqrO5 QkZ+j7k3qAM/F9LGFMTRZjZvDKf5eKlq2An5QhtXT8WnPxNLzWQTck+vCVDu0z28iWxC tU3a4zjwfWsPcl2KUPT/jt16Wf/B+jVW9s+RG3g12YvRGr2p2MInNgU6qxPWWVN6brI6 jhFw== X-Gm-Message-State: AHPjjUgz0F27GXyMw7ARkJNjWQWA/b400av2HGlRUpX1Y3dL9nPgxGuS rC6zNl03eSen854QU/YX9w/hZQ== X-Google-Smtp-Source: AOwi7QCKrGsE8pQ+79NT24BtbWiQjStL7D/fk1V5wQ8AMdbPphvl6emt7dxNd+zy0igu0AhanOJHwg== X-Received: by 10.84.224.136 with SMTP id s8mr4647488plj.324.1505977941754; Thu, 21 Sep 2017 00:12:21 -0700 (PDT) Received: from localhost.localdomain (c-73-162-236-45.hsd1.ca.comcast.net. [73.162.236.45]) by smtp.gmail.com with ESMTPSA id j83sm1475734pfe.133.2017.09.21.00.12.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Sep 2017 00:12:21 -0700 (PDT) From: Darrell Ball To: dlu998@gmail.com, dev@openvswitch.org Date: Thu, 21 Sep 2017 00:12:06 -0700 Message-Id: <1505977929-13284-2-git-send-email-dlu998@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505977929-13284-1-git-send-email-dlu998@gmail.com> References: <1505977929-13284-1-git-send-email-dlu998@gmail.com> X-Spam-Status: No, score=0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [patch v2 2/5] conntrack: Minor performance enhancement. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Add an OVS_UNLIKELY and reorder a few variable condition checks. Signed-off-by: Darrell Ball Acked-by: Bhanuprakash Bodireddy --- lib/conntrack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index 59d3c4e..c94bc27 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -1104,7 +1104,7 @@ process_one(struct conntrack *ct, struct dp_packet *pkt, bool tftp_ctl = is_tftp_ctl(pkt); struct conn conn_for_expectation; - if (conn && (ftp_ctl || tftp_ctl)) { + if (OVS_UNLIKELY((ftp_ctl || tftp_ctl) && conn)) { conn_for_expectation = *conn; } @@ -1115,10 +1115,10 @@ process_one(struct conntrack *ct, struct dp_packet *pkt, } /* FTP control packet handling with expectation creation. */ - if (OVS_UNLIKELY(conn && ftp_ctl)) { + if (OVS_UNLIKELY(ftp_ctl && conn)) { handle_ftp_ctl(ct, ctx, pkt, &conn_for_expectation, now, CT_FTP_CTL_INTEREST, !!nat_action_info); - } else if (OVS_UNLIKELY(conn && tftp_ctl)) { + } else if (OVS_UNLIKELY(tftp_ctl && conn)) { handle_tftp_ctl(ct, &conn_for_expectation, now); } } From patchwork Thu Sep 21 07:12:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darrell Ball X-Patchwork-Id: 816710 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fmgmVIAI"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xySXV1y5Hz9s7v for ; Thu, 21 Sep 2017 17:14:18 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 1F347A59; Thu, 21 Sep 2017 07:12:26 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 4135F95D for ; Thu, 21 Sep 2017 07:12:23 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id DBAE914B for ; Thu, 21 Sep 2017 07:12:22 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id g65so2164022pfe.1 for ; Thu, 21 Sep 2017 00:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=7umNDCYznxt0LibNet0Ten8OSPRl1wrQ5QIS5s7Chkk=; b=fmgmVIAIaUwA9tkmJls/p7mB2MI9kJLD0hkXN2q5dbjM7uCczrptbifGysI6TPmi1O bot2exJF/AuMjkMjcbU9G6ZKjpHouEIUEkHmtLDlqCyNneLZWh7+6/debpeJxOjruzgU pru2drBPdQoXePxKVEyc6/m6i1frV4dlmzJ1WByFnIaIVjsb7P0cThUgI9qCLLlAY2H9 LGfNAkC4g+0pxClaRmmQt18c4V2B/tHpeKcNcuF/AY1+1nHRoMU2WsZYUQENcl/iHjuH CkvKr9JeQoXKYHM58Chkf9DUE80VRuHYc7asLz8diJke9AQ1+lUyFq7Ln8nP2NwiOVWB VETA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=7umNDCYznxt0LibNet0Ten8OSPRl1wrQ5QIS5s7Chkk=; b=Ro1LtUCyhtO2Ufzyl7y80wHOC/5Aqor0hbLZeIJIdkNdgCTF/TgUxlVkEdqXLWuedX ePzG60zQNNafZCfNEiBRjG9hdAYgPA3HhG/4bsQJydOdqR8ETXhbLZd8HMankpbC0LGo UqnKP0G6dMMAS350jvlxfKAPA7iazwUE2YPYPRfgYxr3PtYgUPPv1hu1cUo7YOYmLt2p EnSjZaRKl4bQBEkpNXyTOArIxzhCe2KJ0Scy8IbvY94UpQ/i6Rrj/MdKn3u+T/Movuz/ J4q3q1QetdKk73huI0BIfc/0y+rh3tVGDChGDUA3EEr8Jgtkzw55F0NnDVGh8dRfre3q kzJA== X-Gm-Message-State: AHPjjUh8jPNcR2JWgVT7EOCe5tF/c0v/716wFrnmCmAY6H5eQ3o6OnxJ ZEfdtYpIFMhM6Z8swBDfzT0= X-Google-Smtp-Source: AOwi7QC/CWzPP7HHnrSKzqEFtZbl96EOCSY8XCV5ejblic8Wf7ksthF22eu+b+oINxH5pQdqU9+Aww== X-Received: by 10.84.233.69 with SMTP id k5mr4681687plt.260.1505977942562; Thu, 21 Sep 2017 00:12:22 -0700 (PDT) Received: from localhost.localdomain (c-73-162-236-45.hsd1.ca.comcast.net. [73.162.236.45]) by smtp.gmail.com with ESMTPSA id j83sm1475734pfe.133.2017.09.21.00.12.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Sep 2017 00:12:22 -0700 (PDT) From: Darrell Ball To: dlu998@gmail.com, dev@openvswitch.org Date: Thu, 21 Sep 2017 00:12:07 -0700 Message-Id: <1505977929-13284-3-git-send-email-dlu998@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505977929-13284-1-git-send-email-dlu998@gmail.com> References: <1505977929-13284-1-git-send-email-dlu998@gmail.com> X-Spam-Status: No, score=0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [patch v2 3/5] conntrack: Create nat_conn_keys_insert(). X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Create a separate function from existing code, so the code can be reused in a subsequent patch; no change in functionality. Signed-off-by: Darrell Ball Acked-by: Bhanuprakash Bodireddy --- lib/conntrack.c | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index c94bc27..2eca38d 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -96,6 +96,11 @@ nat_conn_keys_lookup(struct hmap *nat_conn_keys, const struct conn_key *key, uint32_t basis); +static bool +nat_conn_keys_insert(struct hmap *nat_conn_keys, + const struct conn *nat_conn, + uint32_t hash_basis); + static void nat_conn_keys_remove(struct hmap *nat_conn_keys, const struct conn_key *key, @@ -2065,19 +2070,10 @@ nat_select_range_tuple(struct conntrack *ct, const struct conn *conn, nat_conn->rev_key.src.port = htons(port); } - struct nat_conn_key_node *nat_conn_key_node = - nat_conn_keys_lookup(&ct->nat_conn_keys, &nat_conn->rev_key, - ct->hash_basis); - - if (!nat_conn_key_node) { - struct nat_conn_key_node *nat_conn_key = - xzalloc(sizeof *nat_conn_key); - nat_conn_key->key = nat_conn->rev_key; - nat_conn_key->value = nat_conn->key; - uint32_t nat_conn_key_hash = conn_key_hash(&nat_conn_key->key, - ct->hash_basis); - hmap_insert(&ct->nat_conn_keys, &nat_conn_key->node, - nat_conn_key_hash); + bool new_insert = nat_conn_keys_insert(&ct->nat_conn_keys, nat_conn, + ct->hash_basis); + + if (new_insert) { return true; } else if (!all_ports_tried) { if (min_port == max_port) { @@ -2137,6 +2133,26 @@ nat_conn_keys_lookup(struct hmap *nat_conn_keys, return NULL; } +/* This function must be called with the ct->resources lock taken. */ +static bool +nat_conn_keys_insert(struct hmap *nat_conn_keys, const struct conn *nat_conn, + uint32_t hash_basis) +{ + struct nat_conn_key_node *nat_conn_key_node = + nat_conn_keys_lookup(nat_conn_keys, &nat_conn->rev_key, hash_basis); + + if (!nat_conn_key_node) { + struct nat_conn_key_node *nat_conn_key = xzalloc(sizeof *nat_conn_key); + nat_conn_key->key = nat_conn->rev_key; + nat_conn_key->value = nat_conn->key; + uint32_t nat_conn_key_hash = conn_key_hash(&nat_conn_key->key, + hash_basis); + hmap_insert(nat_conn_keys, &nat_conn_key->node, nat_conn_key_hash); + return true; + } + return false; +} + /* This function must be called with the ct->resources write lock taken. */ static void nat_conn_keys_remove(struct hmap *nat_conn_keys, From patchwork Thu Sep 21 07:12:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darrell Ball X-Patchwork-Id: 816711 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="pk3FzPDW"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xySYH3gxCz9s7v for ; Thu, 21 Sep 2017 17:14:59 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 273AA9AF; Thu, 21 Sep 2017 07:12:27 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 0337396F for ; Thu, 21 Sep 2017 07:12:24 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B284E14B for ; Thu, 21 Sep 2017 07:12:23 +0000 (UTC) Received: by mail-pf0-f196.google.com with SMTP id g65so2164034pfe.1 for ; Thu, 21 Sep 2017 00:12:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=sxhwZi3dG1uIBI8KD+z53z4fK/kj00ezGT7SjkhXRd4=; b=pk3FzPDWMaajp+8HDLYSNr6EdA9Glh+t5oXKb8UHPGgP5+xK9Zc5192UH6yeZaJ4Yl Y4LJkCJbKx+2tmV8JWSGa+fyMuYjiqEuYUBNKBy4xoVkPfGIJYMMK08mVe38ivfv2Riq orHxrGbOBHL3zXB0mTObZMUB75xcrPiKHmT/DoEARGk6wxyCCCfWOtzDJCnTwycuX14O n25KguXZyRfR+59bGXDRLUA9QJ0Ux9u2mqS82WC+7x0C9PYl8QzRHZWEamoe/gDF3OMc 64/cAhpJMllDXeFia2skEy8TbV7y/9KnoKPGEkxRk1o1wL/Drz/kB3FTSCcBcd1t5W0G CrBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=sxhwZi3dG1uIBI8KD+z53z4fK/kj00ezGT7SjkhXRd4=; b=sBUrJCBmXy6PM9AYm4EanDqrKwhgA1yVtZPzXPHCNyiFatIFFSbigmODgCE6BOGxmN cvAxKHzzCgRVQ+mcUEN/Id18Jo3QeMvDRAHZ4iPIkJx/GFnCg12tfSvQccQ9jfy17jer H43VRv4cF51XzR+XJLwDYbmAtt4CXfCqyGQT+yOW1tWL66Y9WEClC2wJJwQ8r9eBaETd FQK4FDYyg3NN2MoUue496MrXA3V6qXvgafb+ELijA36RgrZ9vm+5c+pECAYvcZWcNZPw dCPTHT4/iBf4a+OBQMTQOycuo2qG3rD5q6UTy7DIWHaf0xYPtGrPDt2JiBSr+5rw37ZR zbkg== X-Gm-Message-State: AHPjjUhzX3RXDh12TkNrYXuWofq5bI40eQQtDu8/MFIRXZJCqZFOpFxC xn4I9IevZBRI97asUPNLAjY= X-Google-Smtp-Source: AOwi7QCZtNW7NFKXzC2BozzuBKOsxflKmG4pSKoWnLZ8m1nzDfP7vtsWmxLrduaN36mC07oIClwPLQ== X-Received: by 10.84.224.13 with SMTP id r13mr4631948plj.137.1505977943379; Thu, 21 Sep 2017 00:12:23 -0700 (PDT) Received: from localhost.localdomain (c-73-162-236-45.hsd1.ca.comcast.net. [73.162.236.45]) by smtp.gmail.com with ESMTPSA id j83sm1475734pfe.133.2017.09.21.00.12.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Sep 2017 00:12:22 -0700 (PDT) From: Darrell Ball To: dlu998@gmail.com, dev@openvswitch.org Date: Thu, 21 Sep 2017 00:12:08 -0700 Message-Id: <1505977929-13284-4-git-send-email-dlu998@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505977929-13284-1-git-send-email-dlu998@gmail.com> References: <1505977929-13284-1-git-send-email-dlu998@gmail.com> X-Spam-Status: No, score=0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [patch v2 4/5] conntrack: Add function print_conn_info(). X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org A new debug function is added and used in a subsequent patch. Signed-off-by: Darrell Ball Acked-by: Antonio Fischetti --- lib/conntrack.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/lib/conntrack.c b/lib/conntrack.c index 2eca38d..8deeec9 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -67,6 +67,8 @@ enum ct_alg_mode { CT_TFTP_MODE, }; +void print_conn_info(struct conn *c, char *log_msg); + static bool conn_key_extract(struct conntrack *, struct dp_packet *, ovs_be16 dl_type, struct conn_lookup_ctx *, uint16_t zone); @@ -223,6 +225,57 @@ conn_key_cmp(const struct conn_key *key1, const struct conn_key *key2) return 1; } +void +print_conn_info(struct conn *c, char *log_msg) +{ + VLOG_INFO("%s", log_msg); + if (c->key.dl_type == htons(ETH_TYPE_IP)) { + VLOG_INFO("src addr "IP_FMT " dst addr "IP_FMT + " rev src addr "IP_FMT " rev dst addr "IP_FMT, + IP_ARGS(c->key.src.addr.ipv4_aligned), + IP_ARGS(c->key.dst.addr.ipv4_aligned), + IP_ARGS(c->rev_key.src.addr.ipv4_aligned), + IP_ARGS(c->rev_key.dst.addr.ipv4_aligned)); + } else { + ovs_be32 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13; + ovs_be32 a14, a15; + memcpy(&a0, &c->key.src.addr.ipv6_aligned.s6_addr[0], sizeof a0); + memcpy(&a1, &c->key.src.addr.ipv6_aligned.s6_addr[4], sizeof a1); + memcpy(&a2, &c->key.src.addr.ipv6_aligned.s6_addr[8], sizeof a2); + memcpy(&a3, &c->key.src.addr.ipv6_aligned.s6_addr[12], sizeof a3); + memcpy(&a4, &c->key.dst.addr.ipv6_aligned.s6_addr[0], sizeof a4); + memcpy(&a5, &c->key.dst.addr.ipv6_aligned.s6_addr[4], sizeof a5); + memcpy(&a6, &c->key.dst.addr.ipv6_aligned.s6_addr[8], sizeof a6); + memcpy(&a7, &c->key.dst.addr.ipv6_aligned.s6_addr[12], sizeof a7); + memcpy(&a8, &c->rev_key.src.addr.ipv6_aligned.s6_addr[0], + sizeof a8); + memcpy(&a9, &c->rev_key.src.addr.ipv6_aligned.s6_addr[4], + sizeof a9); + memcpy(&a10, &c->rev_key.src.addr.ipv6_aligned.s6_addr[8], + sizeof a10); + memcpy(&a11, &c->rev_key.src.addr.ipv6_aligned.s6_addr[12], + sizeof a11); + memcpy(&a12, &c->rev_key.dst.addr.ipv6_aligned.s6_addr[0], + sizeof a12); + memcpy(&a13, &c->rev_key.dst.addr.ipv6_aligned.s6_addr[4], + sizeof a13); + memcpy(&a14, &c->rev_key.dst.addr.ipv6_aligned.s6_addr[8], + sizeof a14); + memcpy(&a15, &c->rev_key.dst.addr.ipv6_aligned.s6_addr[12], + sizeof a15); + + VLOG_INFO("src addr 0x%08x:%08x:%08x:%08x; " + "dst addr 0x%08x:%08x:%08x:%08x; " + "rev src addr 0x%08x:%08x:%08x:%08x; " + "rev dst addr 0x%08x:%08x:%08x:%08x", ntohl(a0), ntohl(a1), + ntohl(a2), ntohl(a3), ntohl(a4), ntohl(a5), ntohl(a6), + ntohl(a7), ntohl(a8), ntohl(a9), ntohl(a10), ntohl(a11), + ntohl(a12), ntohl(a13), ntohl(a14), ntohl(a15)); + } + VLOG_INFO("src/dst ports %d/%d rev src/dst ports %d/%d", c->key.src.port, + c->key.dst.port, c->rev_key.src.port, c->rev_key.dst.port); +} + /* Initializes the connection tracker 'ct'. The caller is responsible for * calling 'conntrack_destroy()', when the instance is not needed anymore */ void From patchwork Thu Sep 21 07:12:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darrell Ball X-Patchwork-Id: 816712 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="qdcXAPck"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xySZ30BR2z9s7v for ; Thu, 21 Sep 2017 17:15:39 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 287959FA; Thu, 21 Sep 2017 07:12:29 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 2DC849AF for ; Thu, 21 Sep 2017 07:12:25 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id D015D41D for ; Thu, 21 Sep 2017 07:12:24 +0000 (UTC) Received: by mail-pg0-f65.google.com with SMTP id i130so2989217pgc.0 for ; Thu, 21 Sep 2017 00:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=Xe6mm7KucalY7WMg7Q31r4bkgm7hLXTeBSgBjbgzoPs=; b=qdcXAPck7lIFNxdQH8bT+WTdOi2/lr34Qpk77ncG4ZBlklBHmvWXkRLWdpcu+0XTuE 6JeR3SNQyg/FaQFg0sS0jpYaA3KxmmsrycKYsF5K3QtXPjbE643OXjowJiool0GipVGr 8zZxtXfl0oQBsLQZB2QOwDCXgXqeyCkb9bUNZZIuSwr1jM9lm1y54sVG4uJFuax+hamg jd2FS7aUce7P4qFpoW4kcGmJoigSzQzlQitgEecoHdVwKANWhzt32O9wvWHcoUSSuuJh SXDKNGa8mt71N9ohUfYi9/PQNiKpwIhsnnJfVl9mvOwOwSmyHtM6rFK+b48N8qhAuP2g azIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Xe6mm7KucalY7WMg7Q31r4bkgm7hLXTeBSgBjbgzoPs=; b=i6smqSBHxEPw74YwS6ZGW+7JbPKLgIFkgMLnlWd0jh4q7tjSnVYGAoM2F3H3c1AxCR KN+/KTjhaIvwQwH+Lj74F2GNia9c3PioS/v+qmKf1raem4VuB947+XvbPEkteMIsBIPZ rqaenHXXjzMwJdzcrkKb7fyuL0v9jKcuFas3UPn2uq4i81XQvHbQm/Xikp4n838Kx9KP FfkbX9rPT/kYOBHahHQs8b+Z0L7kVl71nXoKxI7A/WBDLPspbyi2J3iCi68HecwawH+h TAMiFGDb01ywwT9NqMgj8dZCa7xNsa9vMMAx7lh41pdwfCcBk8hoNhJvy6M5r+ugeSeJ DBcg== X-Gm-Message-State: AHPjjUgbGrtRPC6MMX8DwwWDhZiZchN88KPX3n1c7a7rfssRjVs8Fs89 M0ZT404k47CeWigjw1LisHp2Hw== X-Google-Smtp-Source: AOwi7QBM4ROsVos+oEGE8BuYr2rBSPxXp8g/ou2b3wYIDlSneLVOG/qaYr+wp7ZsHQ/6AZp9/T4PmA== X-Received: by 10.84.240.196 with SMTP id l4mr4590547plt.445.1505977944513; Thu, 21 Sep 2017 00:12:24 -0700 (PDT) Received: from localhost.localdomain (c-73-162-236-45.hsd1.ca.comcast.net. [73.162.236.45]) by smtp.gmail.com with ESMTPSA id j83sm1475734pfe.133.2017.09.21.00.12.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Sep 2017 00:12:23 -0700 (PDT) From: Darrell Ball To: dlu998@gmail.com, dev@openvswitch.org Date: Thu, 21 Sep 2017 00:12:09 -0700 Message-Id: <1505977929-13284-5-git-send-email-dlu998@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505977929-13284-1-git-send-email-dlu998@gmail.com> References: <1505977929-13284-1-git-send-email-dlu998@gmail.com> X-Spam-Status: No, score=0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [patch v2 5/5] conntrack: Tighten handling of alg reverse conns. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Close a theoretical race delete/create corner case for alg reverse conns and add debugging around this that may point to an intentional exploit, unintentional problem or just a rare condition. Fixes: bd5e81a0e596 ("Userspace Datapath: Add ALG infra and FTP.") Signed-off-by: Darrell Ball --- lib/conntrack.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index 8deeec9..302a85c 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -67,8 +67,6 @@ enum ct_alg_mode { CT_TFTP_MODE, }; -void print_conn_info(struct conn *c, char *log_msg); - static bool conn_key_extract(struct conntrack *, struct dp_packet *, ovs_be16 dl_type, struct conn_lookup_ctx *, uint16_t zone); @@ -225,7 +223,7 @@ conn_key_cmp(const struct conn_key *key1, const struct conn_key *key2) return 1; } -void +static void print_conn_info(struct conn *c, char *log_msg) { VLOG_INFO("%s", log_msg); @@ -830,6 +828,17 @@ conn_not_found(struct conntrack *ct, struct dp_packet *pkt, nc->nat_info->nat_action = NAT_ACTION_DST; } *conn_for_un_nat_copy = *nc; + ct_rwlock_wrlock(&ct->resources_lock); + bool new_insert = nat_conn_keys_insert(&ct->nat_conn_keys, + conn_for_un_nat_copy, + ct->hash_basis); + ct_rwlock_unlock(&ct->resources_lock); + if (!new_insert) { + char *log_msg = xasprintf("Pre-existing alg " + "nat_conn_key"); + print_conn_info(conn_for_un_nat_copy, log_msg); + free(log_msg); + } } else { *conn_for_un_nat_copy = *nc; ct_rwlock_wrlock(&ct->resources_lock); @@ -931,8 +940,16 @@ create_un_nat_conn(struct conntrack *ct, struct conn *conn_for_un_nat_copy, struct conn *rev_conn = conn_lookup(ct, &nc->key, now); if (alg_un_nat) { - hmap_insert(&ct->buckets[un_nat_conn_bucket].connections, - &nc->node, un_nat_hash); + if (!rev_conn) { + hmap_insert(&ct->buckets[un_nat_conn_bucket].connections, + &nc->node, un_nat_hash); + } else { + char *log_msg = xasprintf("Unusual condition for un_nat conn " + "create for alg: rev_conn %p", rev_conn); + print_conn_info(nc, log_msg); + free(log_msg); + free(nc); + } } else { ct_rwlock_rdlock(&ct->resources_lock); @@ -944,6 +961,11 @@ create_un_nat_conn(struct conntrack *ct, struct conn *conn_for_un_nat_copy, hmap_insert(&ct->buckets[un_nat_conn_bucket].connections, &nc->node, un_nat_hash); } else { + char *log_msg = xasprintf("Unusual condition for un_nat conn " + "create: nat_conn_key_node/rev_conn " + "%p/%p", nat_conn_key_node, rev_conn); + print_conn_info(nc, log_msg); + free(log_msg); free(nc); } ct_rwlock_unlock(&ct->resources_lock);