From owner-freebsd-net Mon Oct 2 22: 5: 5 2000 Delivered-To: freebsd-net@freebsd.org Received: from xena.gsicomp.on.ca (cr677933-a.ktchnr1.on.wave.home.com [24.42.130.87]) by hub.freebsd.org (Postfix) with ESMTP id 4050737B503 for ; Mon, 2 Oct 2000 22:05:02 -0700 (PDT) Received: from hermes (hermes.gsicomp.on.ca [192.168.0.18]) by xena.gsicomp.on.ca (8.10.1/8.9.2) with SMTP id e9354xs98404; Tue, 3 Oct 2000 01:04:59 -0400 (EDT) (envelope-from matt@gsicomp.on.ca) Message-ID: <000a01c02cf7$c0cb0a10$1200a8c0@gsicomp.on.ca> From: "Matthew Emmerton" To: "Patrick Bihan-Faou" , References: <200010022329.e92NT9n37409@hak.lan.Awfulhak.org> <001101c02ccd$c1e96470$1200a8c0@gsicomp.on.ca> <038501c02ced$99936960$040aa8c0@local.mindstep.com> Subject: Re: natd and userland ppp Date: Tue, 3 Oct 2000 01:06:56 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > > > I think there's probably room for some sort of ascii interface to > > > libalias though, including (at least) the natd configuration file > > > parser. That way ppp could allow ``nat config /etc/natd.conf'' and > > > could have a generally more compatible (with natd) interface. > > > > And just in case anyone was wondering, I am currently working on a ``nat > > config '' feature for ppp. I'm just taking lots of time > > determining the best way to do it, since there is a considerable amount of > > code from natd that needs to be added to ppp (in other words, the config > > file parser is around 25% of natd's total code.) > > Ouch, that hurts... > > 25% code porting calls for drastic measures... It would definitely be nice > to have the same code for these two tools. Maybe extending the library or > creating a new one, I don't know. But if the code is not the same, there > will be some divergence at some point and that will be painfull... There > must be a better way (although I don't have the answer). It's actually closer to 30% (gasp!). This is simply the code to parse configuration files (and command line arguments, which are essentially aliases for config file directives) and the data structures to support the parsing. The rest is just daemonizing code and wrappers around the functions in libalias. Due to the nature of this "common" code, I don't think it belongs in libalias, but since I don't forsee anything other than ppp requiring embedded nat capabilities (hmm, perhaps netgraph), I don't see the need for libnat on the horizon either. My current idea is to split out enough of the natd code into separate files so that the ppp code can just refer to a few source files from natd. This method comes with two main drawbacks -- the introduction of a source dependency across the usr.sbin and sbin source trees, as well as the need to make ppp and natd do option processing in similar fashions (which they don't really do right now.) Since I like the way natd's option processing is done now, I think that I'm going to be patching ppp to work with "the natd way" (subject to Brian's review, of course.) The only other option is to use netgraph. I'm thinking that a ng_nat module would eliminate some situations -- however the majority would be would be those requiring natd as a daemon (such as plain Ethernet or PPPoE) and not the nat-enabled user-ppp. -- Matthew Emmerton GSI Computer Services +1 (800) 217 5409 (Canada) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message