From patchwork Wed Jul 11 15:29:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 412 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net (Dovecot) with LMTP id Cz6GBomvRltvSAAAIUCqbw for ; Wed, 11 Jul 2018 21:31:53 -0400 Received: from proxy16.mail.iad3b.rsapps.net ([172.31.255.6]) by director12.mail.ord1d.rsapps.net (Dovecot) with LMTP id S/ilAImvRltQFAAAIasKDg ; Wed, 11 Jul 2018 21:31:53 -0400 Received: from smtp27.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy16.mail.iad3b.rsapps.net with LMTP id 8MJxOoivRltaEQAAPj+4aA ; Wed, 11 Jul 2018 21:31:52 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp27.gate.iad3b.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: 5a69ba62-8573-11e8-97b6-5254006b1ac1-1-1 Received: from [216.105.38.7] ([216.105.38.7:30435] helo=lists.sourceforge.net) by smtp27.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id C9/84-09833-88FA64B5; Wed, 11 Jul 2018 21:31:52 -0400 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1fdQRP-0000vx-Ma; Thu, 12 Jul 2018 01:30:43 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1fdQRO-0000vp-Fp for openvpn-devel@lists.sourceforge.net; Thu, 12 Jul 2018 01:30:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=XqMa7+QkddSxLK0gprBXk3fS+EoyNGHR9hpEQBKaZFk=; b=Bo6MLNkom4GMBAz6eNZIHPY+Wo PsJtVFtq5WjDjgxXIzFgvdViHotcHLSvOKP4g/CTFYoTBKCBL2YK2iWZmalgXtJfiD1TYf7xENao9 UK/H5nTPzKldPYHRWn7vzXSM7B69S2tsfxerFNaVbgsS5SDjBMEnCwWsolcBqj2kX6wE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To :MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=XqMa7+QkddSxLK0gprBXk3fS+EoyNGHR9hpEQBKaZFk=; b=bsvZl61b/8jeEp5DZlFw94v3C+ wdciUIsicvqctXdbETE0hUkTWj654GtKo1ifrK8zrnz5duaU+Y0P6B8iAK0PNOkEtXDuNEol+rU0r p015F1xQMXL59tXC2PL93plIyQ0slaf+X12VspCeaIymIGZ0tIoMPJ7f3yJK92nPWet0=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1fdQRM-005vi3-Hq for openvpn-devel@lists.sourceforge.net; Thu, 12 Jul 2018 01:30:42 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Thu, 12 Jul 2018 09:29:55 +0800 Message-Id: <20180712012955.24050-1-a@unstable.cc> In-Reply-To: <20180711170042.15154-1-a@unstable.cc> References: <20180711170042.15154-1-a@unstable.cc> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [5.148.176.60 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1fdQRM-005vi3-Hq Subject: [Openvpn-devel] [PATCH v3] socket: make stream_buf_* functions static X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Antonio Quartulli MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox stream_buf_init(), stream_buf_close() and stream_buf_added() are only used within socket.c, therefore there is noneed to have them declared in socket.h. Make them static and remove useless declarations. This change reuired adding function prototypes in socket.c to avoid useless code re-ordering. Signed-off-by: Antonio Quartulli Acked-by: Gert Doering --- v2: - fix commit subject v3: - move functions back to their original locations and add prototypes before the first usage of the three functions --- src/openvpn/socket.c | 22 +++++++++++++++++++--- src/openvpn/socket.h | 15 --------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 211e7441..29de56fd 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -1491,6 +1491,22 @@ done: gc_free(&gc); } +/* + * Stream buffer handling prototypes -- stream_buf is a helper class + * to assist in the packetization of stream transport protocols + * such as TCP. + */ + +static void +stream_buf_init(struct stream_buf *sb, struct buffer *buf, + const unsigned int sockflags, const int proto); + +static void +stream_buf_close(struct stream_buf *sb); + +static bool +stream_buf_added(struct stream_buf *sb, int length_added); + /* For stream protocols, allocate a buffer to build up packet. * Called after frame has been finalized. */ @@ -2500,7 +2516,7 @@ stream_buf_reset(struct stream_buf *sb) sb->len = -1; } -void +static void stream_buf_init(struct stream_buf *sb, struct buffer *buf, const unsigned int sockflags, @@ -2574,7 +2590,7 @@ stream_buf_read_setup_dowork(struct link_socket *sock) return !sock->stream_buf.residual_fully_formed; } -bool +static bool stream_buf_added(struct stream_buf *sb, int length_added) { @@ -2641,7 +2657,7 @@ stream_buf_added(struct stream_buf *sb, } } -void +static void stream_buf_close(struct stream_buf *sb) { free_buf(&sb->residual); diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h index 479d1150..7329a518 100644 --- a/src/openvpn/socket.h +++ b/src/openvpn/socket.h @@ -994,21 +994,6 @@ link_socket_set_outgoing_addr(const struct buffer *buf, } } -/* - * Stream buffer handling -- stream_buf is a helper class - * to assist in the packetization of stream transport protocols - * such as TCP. - */ - -void stream_buf_init(struct stream_buf *sb, - struct buffer *buf, - const unsigned int sockflags, - const int proto); - -void stream_buf_close(struct stream_buf *sb); - -bool stream_buf_added(struct stream_buf *sb, int length_added); - static inline bool stream_buf_read_setup(struct link_socket *sock) {