From patchwork Thu Apr 28 09:18:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Dedecker X-Patchwork-Id: 616083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (caladan.dune.hu [78.24.191.180]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qwWVY6yxkz9t3k for ; Thu, 28 Apr 2016 19:19:17 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=ZxWxXeOn; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id C7B6FB91611; Thu, 28 Apr 2016 11:19:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP; Thu, 28 Apr 2016 11:19:10 +0200 (CEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 5F14DB91610 for ; Thu, 28 Apr 2016 11:19:08 +0200 (CEST) X-policyd-weight: using cached result; rate: -7 Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Thu, 28 Apr 2016 11:19:07 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id r12so21206719wme.0 for ; Thu, 28 Apr 2016 02:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=e0oZDYgyJXXg2El9vLYWDT/9dBFtZ5qOH50jGuqwfKE=; b=ZxWxXeOnNIQK6T5D5QwA/AHEKAwMZe+swK56e42LSFQ88jaRAXfCHfmMByzK7/eOI3 5xbsWr/e+S6kIa1hwOjbnkQKnNRFm4UYOiXO2DVDk23h49bYe/GX5c3w7LH6EWpLdj3P XJehyg49xMIfkORpOfsXFZYDNADDv/foiSQPYb6a+6FVCk2WX0CdWqwsvJw1pnM17Fba oIzVKWeAuEpvOFMHMiAqXczE0zOR+3/jWUUotzZi0s/Eksmq0+PanSGZxkpYyKw1NWZ/ oEunL9uraqor5vsqKF9QCj9yNzZfT4EEA6H83vGmRlnNGHqc4tMNuVF0tAd9Ob8ZuNp8 cXQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=e0oZDYgyJXXg2El9vLYWDT/9dBFtZ5qOH50jGuqwfKE=; b=Tb/yODHmexlRyGQvLiG2znRwhoYM5kKo54Xcdkgo1MdmPFYqCtVItkXw7REN06gc7O VghtVOxbR3EZfHfCSHpYUDlKE1J4E456Kuwe/ouSyzmhlIl0bhZzY6MswO6DndYUE8dB wAaCPEYsxTrfu2/HUbqUSF6sveiZslugsle9rpjn1u5RrfZuTO4MueNUT40uDN439n31 HiB4/2lR4pr0U5ymP0Oj0igZ4d7jo9z8dASM0Xdq8lGugKCKUIaAbaPspPu/8dBD11l1 L3FXxzbhBO7nOZEOb8CRjKU3m8BcRR+wvc80kglA4RDpI8oF/qBgzKsJAyrjejSvSgOS yzCQ== X-Gm-Message-State: AOPr4FWO3Mz0N9CxPbNsp55HONDx5uJsqZIUK/d/VU9Js1yYk2SW4bnXdDdUswfqLw43gg== X-Received: by 10.28.154.73 with SMTP id c70mr894772wme.12.1461835147091; Thu, 28 Apr 2016 02:19:07 -0700 (PDT) Received: from cplx43.eu.thmulti.com ([141.11.62.7]) by smtp.gmail.com with ESMTPSA id f135sm13014153wmf.22.2016.04.28.02.19.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Apr 2016 02:19:06 -0700 (PDT) From: Hans Dedecker To: openwrt-devel@lists.openwrt.org Date: Thu, 28 Apr 2016 11:18:56 +0200 Message-Id: <1461835136-24929-1-git-send-email-dedeckeh@gmail.com> X-Mailer: git-send-email 1.9.1 Subject: [OpenWrt-Devel] [PATCH] xtables-addons: Fix Lua packet script implementation X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans Dedecker , cyrus@openwrt.org, Stijn Cleynhens MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" lua_packet_segment parameter start has type char pointer; in function lua_tg it's assigned an uint16 value generating compiler warnings obviously indicating posssible seg fault problems. Fix the issue by using the correct skb functions so the parameter points to the position inside the sk_buff Signed-off-by: Hans Dedecker Signed-off-by: Stijn Cleynhens --- .../xtables-addons/patches/201-fix-lua-packetscript.patch | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch b/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch index 06a4a17..ebc952b 100644 --- a/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch +++ b/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch @@ -13,6 +13,21 @@ { uint32_t verdict; lua_packet_segment *p; +@@ -88,11 +88,11 @@ lua_tg(struct sk_buff *pskb, const struc + /* push the lua_packet_segment as a parameter */ + p = (lua_packet_segment *)lua_newuserdata(L, sizeof(lua_packet_segment)); + if (pskb->mac_header) +- p->start = pskb->mac_header; ++ p->start = skb_mac_header(pskb); + else if (pskb->network_header) +- p->start = pskb->network_header; ++ p->start = skb_network_header(pskb); + else if (pskb->transport_header) +- p->start = pskb->transport_header; ++ p->start = skb_transport_header(pskb); + p->offset = 0; + p->length = (unsigned long)pskb->tail - (unsigned long)p->start; + p->changes = NULL; @@ -208,16 +208,16 @@ static bool load_script_into_state(uint3 * some workqueue initialization. So far this is done each time this function * is called, subject to change.