From owner-freebsd-net@freebsd.org Wed Apr 25 15:15:22 2018 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4F96FA8A24 for ; Wed, 25 Apr 2018 15:15:22 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (unknown [IPv6:2a01:4f8:d12:604::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 579607BE62 for ; Wed, 25 Apr 2018 15:15:21 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221] (may be forged)) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id w3PFFFAJ022963 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Apr 2018 17:15:15 +0200 (CEST) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: reshadpatuck1@gmail.com Received: from [10.58.0.4] (dadv@[10.58.0.4]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTPS id w3PFF4v1015052 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 25 Apr 2018 22:15:04 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: [netgraph] ng_bpf filter large list of IP addresses To: Reshad Patuck , freebsd-net@freebsd.org References: <5AC118E8.1020800@grosbein.net> From: Eugene Grosbein Message-ID: <5AE09B77.3090607@grosbein.net> Date: Wed, 25 Apr 2018 22:15:03 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.2 required=5.0 tests=BAYES_00, LOCAL_FROM, RDNS_NONE autolearn=no autolearn_force=no version=3.4.1 X-Spam-Report: * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 2.6 LOCAL_FROM From my domains * 1.9 RDNS_NONE Delivered to internal network by a host with no rDNS X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hz.grosbein.net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2018 15:15:23 -0000 25.04.2018 21:40, Reshad Patuck пишет: > Hey, > ​ > I have tried to write some c code to add a bpf filter to my ng_bpf node, but its just segfaulting. > My c is not good enough to debug this. > ​ > What baffles me is that when I load a filter for 250 IP addresses using the command in this link https://paste.ee/d/BHOoG/3 it loads fine. > If I use 'ngctl -f' with the file in this link https://paste.ee/d/BHOoG/2 I get an error saying 'ngctl: send msg: Invalid argument; ngctl: line 1: error in file' > The BPF filter and arguments in that command are exactly the same. > ​ > My problem is that I need to load thousands of IP addresses in a blocking filter, which I am not able to pass over a command line because the list becomes too long and I hit either the kern.argmax limit of 262144 bytes or the LINE_MAX (2048) for ngctl. > ​ > I can share the c code I am using to attempt this using NgSendAsciiMsg(), but I don't think that would be too useful. Have you tried changing limits in ngctl's sources and recompile it?