From patchwork Wed Nov 30 22:06:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 701251 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 3tTZJc2xMNz9t1L for ; Thu, 1 Dec 2016 09:06:56 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753815AbcK3WGz (ORCPT ); Wed, 30 Nov 2016 17:06:55 -0500 Received: from mail.us.es ([193.147.175.20]:44092 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754862AbcK3WGy (ORCPT ); Wed, 30 Nov 2016 17:06:54 -0500 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id 8252B13C0D9 for ; Wed, 30 Nov 2016 23:06:53 +0100 (CET) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id 75515DA7F6 for ; Wed, 30 Nov 2016 23:06:53 +0100 (CET) Received: by antivirus1-rhel7.int (Postfix, from userid 99) id 6AAC1DA7E0; Wed, 30 Nov 2016 23:06:53 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on antivirus1-rhel7.int X-Spam-Level: X-Spam-Status: No, score=-107.2 required=7.5 tests=BAYES_50,SMTPAUTH_US, URIBL_BLOCKED,USER_IN_WHITELIST autolearn=disabled version=3.4.1 Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id 64C22DA804 for ; Wed, 30 Nov 2016 23:06:49 +0100 (CET) Received: from 192.168.1.13 (192.168.1.13) by antivirus1-rhel7.int (F-Secure/fsigk_smtp/530/antivirus1-rhel7.int); Wed, 30 Nov 2016 23:06:49 +0100 (CET) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/antivirus1-rhel7.int) Received: (qmail 22988 invoked from network); 30 Nov 2016 23:06:49 +0100 Received: from 129.166.216.87.static.jazztel.es (HELO salvia.here) (pneira@us.es@87.216.166.129) by mail.us.es with SMTP; 30 Nov 2016 23:06:49 +0100 From: Pablo Neira Ayuso To: netfilter-devel@vger.kernel.org Subject: [PATCH nft] datatype: honor -nn option from inet_service_type_print() Date: Wed, 30 Nov 2016 23:06:41 +0100 Message-Id: <1480543601-10228-1-git-send-email-pablo@netfilter.org> X-Mailer: git-send-email 2.1.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org If -nn is passed, we have to display ports in numbers, not as a symbol. Reported-by: Florian Westphal Fixes: ccc5da470e76 ("datatype: Replace getnameinfo() by internal lookup table") Signed-off-by: Pablo Neira Ayuso --- src/datatype.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/datatype.c b/src/datatype.c index c92f9276f838..b5d73bc045e2 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -559,6 +559,10 @@ const struct datatype inet_protocol_type = { static void inet_service_type_print(const struct expr *expr) { + if (numeric_output >= NUMERIC_PORT) { + integer_type_print(expr); + return; + } symbolic_constant_print(&inet_service_tbl, expr, false); }