From patchwork Thu Apr 20 16:40:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arturo Borrero Gonzalez X-Patchwork-Id: 752930 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3w85tt6JxLz9s03 for ; Fri, 21 Apr 2017 03:48:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033532AbdDTRsF (ORCPT ); Thu, 20 Apr 2017 13:48:05 -0400 Received: from smtp3.cica.es ([150.214.5.190]:54546 "EHLO smtp.cica.es" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1033526AbdDTRsF (ORCPT ); Thu, 20 Apr 2017 13:48:05 -0400 Received: from localhost (unknown [127.0.0.1]) by smtp.cica.es (Postfix) with ESMTP id 94AFC51F352 for ; Thu, 20 Apr 2017 16:40:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at cica.es Received: from smtp.cica.es ([127.0.0.1]) by localhost (mail.cica.es [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hhs8NdN3ANBM for ; Thu, 20 Apr 2017 18:40:40 +0200 (CEST) Received: from nfdev2.cica.es (nfdev2.cica.es [IPv6:2a00:9ac0:c1ca:31::221]) (Authenticated sender: servers@cica.es) by smtp.cica.es (Postfix) with ESMTP id C137851F34B for ; Thu, 20 Apr 2017 18:40:40 +0200 (CEST) Subject: [conntrack-tools PATCH 2/4] conntrackd: warn users about queue allocation errors From: Arturo Borrero Gonzalez To: netfilter-devel@vger.kernel.org Date: Thu, 20 Apr 2017 18:40:40 +0200 Message-ID: <149270644006.7706.18396153922376350898.stgit@nfdev2.cica.es> In-Reply-To: <149270643473.7706.16087221625455760877.stgit@nfdev2.cica.es> References: <149270643473.7706.16087221625455760877.stgit@nfdev2.cica.es> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org These warnings, if they happen, should help users. Signed-off-by: Arturo Borrero Gonzalez --- src/channel.c | 6 +++++- src/queue_tx.c | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/src/channel.c b/src/channel.c index acbfa7d..b2f114d 100644 --- a/src/channel.c +++ b/src/channel.c @@ -19,6 +19,7 @@ #include "channel.h" #include "network.h" #include "queue.h" +#include "log.h" static struct channel_ops *ops[CHANNEL_MAX]; extern struct channel_ops channel_mcast; @@ -161,8 +162,11 @@ static void channel_enqueue_errors(struct channel *c) struct channel_error *error; qobj = queue_object_new(Q_ELEM_ERR, sizeof(struct channel_error)); - if (qobj == NULL) + if (qobj == NULL) { + dlog(LOG_WARNING, "could not enqueue channel errors, failed to" + " allocate memory"); return; + } error = (struct channel_error *)qobj->data; error->len = c->buffer->len; diff --git a/src/queue_tx.c b/src/queue_tx.c index 0c99163..83eb111 100644 --- a/src/queue_tx.c +++ b/src/queue_tx.c @@ -22,6 +22,7 @@ #include "queue.h" #include "conntrackd.h" #include "network.h" +#include "log.h" void tx_queue_add_ctlmsg(uint32_t flags, uint32_t from, uint32_t to) { @@ -29,8 +30,11 @@ void tx_queue_add_ctlmsg(uint32_t flags, uint32_t from, uint32_t to) struct nethdr_ack *ack; qobj = queue_object_new(Q_ELEM_CTL, sizeof(struct nethdr_ack)); - if (qobj == NULL) + if (qobj == NULL) { + dlog(LOG_WARNING, "could not queue ACK message. Failed to " + "allocate memory"); return; + } ack = (struct nethdr_ack *)qobj->data; ack->type = NET_T_CTL; @@ -48,8 +52,11 @@ void tx_queue_add_ctlmsg2(uint32_t flags) struct nethdr *ctl; qobj = queue_object_new(Q_ELEM_CTL, sizeof(struct nethdr_ack)); - if (qobj == NULL) + if (qobj == NULL) { + dlog(LOG_WARNING, "could not queue CTL message. Failed to " + "allocate memory"); return; + } ctl = (struct nethdr *)qobj->data; ctl->type = NET_T_CTL;