From owner-freebsd-net@freebsd.org Wed Oct 10 20:33:30 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 DE0EC10BB565 for ; Wed, 10 Oct 2018 20:33:29 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [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 754A770DC1 for ; Wed, 10 Oct 2018 20:33:29 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (eg.sd.rdtc.ru [IPv6:2a03:3100:c:13:0:0:0:5]) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id w9AKXLL0076881 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Oct 2018 22:33:22 +0200 (CEST) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: freebsd-net@freebsd.org Received: from [10.58.0.4] ([10.58.0.4]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTPS id w9AKXLGV056291 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Thu, 11 Oct 2018 03:33:21 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: Patching ng_iface to allow setting the MTU via netgraph API To: freebsd-net@freebsd.org References: <33666112-c7e1-df6c-dfd5-22de0c1166fa@lysator.liu.se> From: Eugene Grosbein Cc: kempe@lysator.liu.se Message-ID: <48910140-ef82-dd21-3ca3-924e80e93b3b@grosbein.net> Date: Thu, 11 Oct 2018 03:33:16 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <33666112-c7e1-df6c-dfd5-22de0c1166fa@lysator.liu.se> X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,LOCAL_FROM,SPF_PASS 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] * -0.0 SPF_PASS SPF: sender matches SPF record * 2.6 LOCAL_FROM From my domains X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hz.grosbein.net Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.27 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, 10 Oct 2018 20:33:30 -0000 11.10.2018 2:43, Andreas Kempe wrote: > I am working on a meshnet concept and am using netgraph to put it right > on top of the MAC layer. I am using ng_iface to do some tunneling of IP > over my protocol and I thought it would be nice to be able to set the > MTU of the created interface using the netgraph interface. > > I created a patch to do just that and thought I could share it if > someone would find it worthwhile using for something, but I couldn't > really figure out where to share it. I couldn't really get clarity from > the contribution section in the handbook. > > If someone could point me in the right direction, it would be > appreciated. I'll attach the patch to this mail as well since it is a > quite small one. > > Cordially, > Andreas Kempe You can use our Bugzilla https://bugs.freebsd.org/bugzilla/enter_bug.cgi?product=Base%20System and use [change-request] tag in its Subject, and attach the patch. However, this patch does not seem quite right to me. It may serve your needs but it is incomplete in general case. You see, change in MTU should affect not only interface itself, it should also alter routing table and "interface link" routes that also have MTU attribute that is used for handling outgoing IP packets utilizing such routes. And we already have general network API that does it, and you may use it with ng_iface(4) as with every other interface: ifioctl(9) / SIOCSIFMTU. Calling it involves update of routing table with rt_updatemtu(). Why do you want to replicate this at NETGRAPH level? ng_iface(4) was created to be generic network interface to NOT duplicate such things.