From patchwork Thu Jun 20 20:11:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Oester X-Patchwork-Id: 253327 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 4F7002C040F for ; Sat, 22 Jun 2013 10:13:19 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423118Ab3FVANR (ORCPT ); Fri, 21 Jun 2013 20:13:17 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:52681 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423073Ab3FVANR (ORCPT ); Fri, 21 Jun 2013 20:13:17 -0400 Received: by mail-pa0-f49.google.com with SMTP id ld11so8557869pab.36 for ; Fri, 21 Jun 2013 17:13:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent:x-gm-message-state; bh=WUBQgDoTeBncnDThFFFw8xxJnMqS66hzIVxPZFQ+Ddo=; b=mLVAfAnkzSP3M6amGvoCdsqFyBJudMgj4XYlSCpULx28CO5Wr0a6FJ7JUQQ4AQUOEB lo4MiZH0RjexjI2NNGMzwl58nkRg6r8wsuSHWrn0wXfNWr2rT3fQjqAAf46bYy5YXWzl 7/09kuzf0O3cyjmire5drpVp9BbRS8IWPd0TTJ3Q/FIlSKa2RLPED8+3vBENOfwFW5BS jqYVMl9T9+KChdMvFzeeHGpmcrzEOnv0g6zVH63OcU+s051ZjCcEEq4qIKlTmQ+MuErG aaA3AYoEnumtzuBM1tFQBuACChJ1XVljjgPZv0YcNqqkiA39MMgvPjJ8Rb6rI44MQyyA AWCg== X-Received: by 10.66.218.168 with SMTP id ph8mr18083455pac.47.1371859996829; Fri, 21 Jun 2013 17:13:16 -0700 (PDT) Received: from gmail.com (pool-98-112-127-79.lsanca.fios.verizon.net. [98.112.127.79]) by mx.google.com with ESMTPSA id tq3sm7755194pab.7.2013.06.21.17.13.15 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 21 Jun 2013 17:13:15 -0700 (PDT) Date: Thu, 20 Jun 2013 16:11:38 -0400 From: Phil Oester To: netfilter-devel@vger.kernel.org Cc: pablo@netfilter.org Subject: [PATCH] ip6tables: don't print out /128 Message-ID: <20130620201138.GA11634@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQkT8tV53loleXd1O2E4rXfoHoZeV4o6gYBEw8KODkZiDiTC0e7VSGaC23djKrugDfHMsb97 Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Similar to how iptables does not print /32 on IPv4 addresses, ip6tables should not print out /128 on IPv6 addresses. Phil Signed-off-by: Phil Oester diff --git a/libxtables/xtables.c b/libxtables/xtables.c index ebc77b6..ef5bc07 100644 --- a/libxtables/xtables.c +++ b/libxtables/xtables.c @@ -1597,7 +1597,11 @@ const char *xtables_ip6mask_to_numeric(const struct in6_addr *addrp) strcat(buf, xtables_ip6addr_to_numeric(addrp)); return buf; } - sprintf(buf, "/%d", l); + /* we don't want to see "/128" */ + if (l == 128) + return ""; + else + sprintf(buf, "/%d", l); return buf; }