From owner-freebsd-net@freebsd.org Thu Dec 14 22:08:21 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DDCAE91653 for ; Thu, 14 Dec 2017 22:08:21 +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 084447BAD7 for ; Thu, 14 Dec 2017 22:08:19 +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 vBEM864Y040033 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2017 23:08:07 +0100 (CET) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: johnllyon@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 vBEM82dV096907 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 15 Dec 2017 05:08:02 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: Need Netgraph Help To: John Lyon , Harry Schmalzbauer References: <5A3225BF.6020205@omnilan.de> Cc: freebsd-net@freebsd.org From: Eugene Grosbein Message-ID: <5A32F63E.8010205@grosbein.net> Date: Fri, 15 Dec 2017 05:07:58 +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: Thu, 14 Dec 2017 22:08:21 -0000 15.12.2017 4:27, John Lyon wrote: >>> I'm a new Netgraph user, but am having some problems with a simple >>> Netgraph >>> script I have written. Unfortunately, the error message is cryptic and I >>> can't tell what I am doing wrong since my script closely follows the >>> example provided in the ng_etf man page. >>> >>> For some context, I'm trying to filter EAP traffic coming in on my LAN >>> interface. Any ethernet frames that correspond to EAP traffic need to be >>> immediately forwarded from the LAN interface to my WAN interface. All >>> other ethernet frames coming in on my LAN interface need to be handled by >>> the kernel's network stack. A (horrid) ASCII art representation of my >>> desired netgraph would look like this: >>> >>> lower -> em0 -> downstream -> ETF -> no match -> upper em0 >>> -> match -> >>> lower em1 >>> >>> The script I have written is this: >>> >>> #! /bin/sh >>> ngctl mkpeer em0: etf lower downstream >>> ngctl name em0:lower lan_filter >>> ngctl connect em0: lan_filter: upper nomatch >>> ngctl msg lan_filter: setfilter { matchhook="em1:lower" >>> ethertype=0x888e } >>> >>> Unfortunately, the last line of my script generates the following error >>> message: >>> >>> ngctl: send msg: Invalid Argument For "setfilter" command to work, ng_etf requires that: 1) referenced "matchook" exists and you should not use "indirect name" here, only hook own name, or else you get error ENOENT (No such file or directory); 2) referenced "matchook" is *not* downstream hook, or else you get error EINVAL (Invalid argument); 3) it was not already configured, or else you get error EEXIST (File exists).