From owner-freebsd-net@freebsd.org Sun Apr 1 17:21:06 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 DABD4F6F184 for ; Sun, 1 Apr 2018 17:21:06 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [78.47.246.247]) (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 5AD9275A66 for ; Sun, 1 Apr 2018 17:21:05 +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 w31HKxmk099496 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 1 Apr 2018 19:21:00 +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] ([10.58.0.4]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTPS id w31HKmKB069081 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 2 Apr 2018 00:20:49 +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: <5ABF973D.5070009@grosbein.net> <36DD471B-D88D-4074-A4D3-A480F5EC2392@gmail.com> <5AC0DFA5.3000509@grosbein.net> <984CD50A-A1B9-4185-8AFA-E910CB1A7DA3@gmail.com> From: Eugene Grosbein Message-ID: <5AC114EA.2060809@grosbein.net> Date: Mon, 2 Apr 2018 00:20:42 +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: <984CD50A-A1B9-4185-8AFA-E910CB1A7DA3@gmail.com> 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] * 1.9 RDNS_NONE Delivered to internal network by a host with no rDNS * 2.6 LOCAL_FROM From my domains 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: Sun, 01 Apr 2018 17:21:07 -0000 01.04.2018 23:19, Reshad Patuck wrote: > Yes I do remove the \" and replace it with just " in the file I use with the `ngctl -f` command. > ​ > Here is the link to the file and everything that I am using to setup the BPF program. > ​ > https://paste.ee/p/BHOoG > ​ > It contains the following: > - ngtl-command -> the ngctl command which runs correctly from a command line > - ngctl-config -> the ngctl config file with the same filter > - bpf.c -> a c file that takes netgraph node details a pcap-filter and converts it to a ngctl command > - ngctl -> debug 5 in a ngctl shell for running the config file Note that https://paste.ee/p/BHOoG#s=0&l=31 has garbage at the end of 31'st line. I've just looked at ngctl's code and see I was wrong, it has some limitations: total line length must be less than LINE_MAX (2048) and number of whitespace-separated arguments in this line must be no more than 512.