From patchwork Thu Jan 12 14:22:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Sutter X-Patchwork-Id: 714480 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3tznzD6qG3z9t1L for ; Fri, 13 Jan 2017 01:22:48 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750942AbdALOWr (ORCPT ); Thu, 12 Jan 2017 09:22:47 -0500 Received: from orbyte.nwl.cc ([151.80.46.58]:40965 "EHLO mail.nwl.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790AbdALOWq (ORCPT ); Thu, 12 Jan 2017 09:22:46 -0500 Received: from mail.nwl.cc (orbyte.nwl.cc [127.0.0.1]) by mail.nwl.cc (Postfix) with ESMTP id 567FA64E45; Thu, 12 Jan 2017 15:22:44 +0100 (CET) Received: from xsao (localhost [IPv6:::1]) by mail.nwl.cc (Postfix) with ESMTP id 341D164E44; Thu, 12 Jan 2017 15:22:44 +0100 (CET) From: Phil Sutter To: Stephen Hemminger Cc: netdev@vger.kernel.org Subject: [iproute PATCH] tc: m_xt: Fix segfault with iptables-1.6.0 Date: Thu, 12 Jan 2017 15:22:49 +0100 Message-Id: <20170112142249.13041-1-phil@nwl.cc> X-Mailer: git-send-email 2.11.0 X-Virus-Scanned: ClamAV using ClamSMTP Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Said iptables version introduced struct xtables_globals field 'compat_rev', a function pointer. Initializing it is mandatory as libxtables calls it without existence check. Without this, tc segfaults when using the xt action like so: | tc filter add dev d0 parent ffff: u32 match u32 0 0 \ | action xt -j MARK --set-mark 20 Signed-off-by: Phil Sutter --- tc/m_xt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tc/m_xt.c b/tc/m_xt.c index dbb54981462ee..57ed40d7aa3a8 100644 --- a/tc/m_xt.c +++ b/tc/m_xt.c @@ -77,6 +77,9 @@ static struct xtables_globals tcipt_globals = { .orig_opts = original_opts, .opts = original_opts, .exit_err = NULL, +#if (XTABLES_VERSION_CODE >= 11) + .compat_rev = xtables_compatible_revision, +#endif }; /*