[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Proposal: Network configuration file format



On Wed, Aug 04, 1999 at 02:03:30PM +0200, Rene Mayrhofer wrote:
> > The source is my second attempt at a literate program, so *theoretically*
> > you should be able to take the source to bed and read it and *enjoy* it,
> > but in reality... Well, YMMV.
> It's written in ANSI C ?

Well, POSIX C, but yeah.

The real source uses the noweb literate programming tool (think of it as
a weird preprocessor) to generate nicely presented source. The order of
presentation is deterined by me instead of the compiler, so should be
easier to follow.

Either read ifupdown.nw in less or something, or, more sensibly, apt-get
install nowebm [0]; and run make ifupdown.ps.gz and print that out.

Or just read the generated C files if you prefer. Whatever.

> > If you download the source, and have a look at the *.defn files, you
> > should get some idea how to handle different address families (inet6, ipx,
> > or whatever). Patches to support some of those better would be welcome.
> I will try to implement something for ipv6, but it will take me some
> time to become familiar with your code (and to get ipv6 working on my
> server...).

*Hopefully* the .defn files should be fairly obvious. Basically you
have a bunch of commands with textual substitutions and optional bits.
Optional bits are surrounded by [[ ... ]]'s, and textual substitutions
look like
	ifconfig %iface% down

And optional thing looks like either:
	ifconfig %iface% netmask %netmask% [[ broadcast %broadcast% ]]
or
	[[ route add default gw %gateway% ]]
. It's only executed if the variables inside it were defined. There's
also some hacked up support for conditionals, like:

	route add -net %network%    if ( mylinuxver() >= mylinux(2,1,100) )

In reality, I'd like to do something cleverer than just straight out
textual substitution, so ifup/ifdown can convert
	address 1.2.3.4/24
into the appropriate netmask, network and broadcast addresses, but I
haven't been able to come up with an entirely satisfactory way of
saying that.

> > Patches, proposals, praise and prestidigitation on any of the above is
> > quite welcome.
> OK, after reading your repsonse I think I will drop my proposal and try
> to make some patches to your working code. This actually saves me some
> weeks of coding. 
> Thank you ;-)
> Let's work on this together to complete your system (I will look at it
> closely tomorrow).

Great. :)

> > iface eth0 inet4 static
> >         address 10.0.0.4
> >         netmask 255.0.0.0
> >         network 10.0.0.0
> >         broadcast 10.255.255.255
> How do you handle multiple addresses for an interface (kernel 2.2.x does
> that without the need of interface aliases) ?

I don't. Suggestions on syntax, and what commands should be run how
are quite welcome. Patches to defn2c.pl to make it "just work" equally
welcome :)

> > > # The ISDN connection to the outside
> > > network "isdn" {
> > >   interface "isdn0" {
> > >     addressv4 193.170.191.36;
> > >     ptpaddressv4 193.170.191.33;
> > >   }
> > >   networkv4 193.170.191.32;
> > >   netmaskv4 255.255.255.240;
> > >   arp false;
> > >   # A shell script sets this to true if I want automatic connections to
> > > be made
> > >   enabled false;
> > >   # Maybe we should put in the ISDN settings here too (telephone number,
> > >   # protocol, ...)
> > > }
> > 
> > I've never actually had the pleasure of setting up an ISDN interface. I
> > expect you'd want to write a special defn for it though, and have something
> > like:
> > 
> > iface isdn0 inet isdn
> >     noauto
> >     address 193.170.191.36
> >     ptpaddress 193.170.191.33
> >     network 193.170.191.32
> >     netmask 255.255.255.240
> >     # whatever other parameters isdn takes
> I will try your system on my server and contribute the ISDN defn file as
> soon as it is working. Can your system set up the isdn parameters at the
> moment or has this to be changed ?
> I only have an isdn connection (with a static ip address - I get a
> working internet connection in under 2 seconds....), but I can not test
> ppp or slip dialup. Does this work ?

I don't know the commands to setup ISDN satisfactorily, so I've done
nothing for this. Poke around the inet.defn file, it *should* be self
evident what you need to write to get it to work, more or less.

> > These I don't have at all. I'm not convinced they're *incredibly*
> > necessary.
> I am setting up a Debian based firewall distribution, therefore they are
> necessary for me. However, I would be happy to work on this with you
> commenting on my way to do things as I hope to get the firewall stuff in
> the netbase package (or - if more appropriate - I could make up another
> package).

Firewall stuff in netbase sounds like a good idea, tentatively, maybe.
I'd have to see it to be sure. I just dunno.

The other thing I'm *trying* to do, btw, is keep the Linux specific parts
of this minimal, so that a port to *BSD or whatever would be easy. I don't
really care whether this actually happens or not, but, well, I'm doing it
anyway. :)

Cheers,
aj

[0] You probably need to make a link from

	/usr/local/lib/texmf/tex/latex/litprog/noweb.sty
    to
        /usr/lib/texmf/tex/latex/litprog/noweb.sty

    so that tetex can find noweb.sty. The FHS strikes again. :) I
    presume this is a bug against nowebm, but I don't have the bandwidth
    to keep up with tetex to make sure tetex really can't find it.

-- 
Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. PGP encrypted mail preferred.

 ``The thing is: trying to be too generic is EVIL. It's stupid, it 
        results in slower code, and it results in more bugs.''
                                        -- Linus Torvalds

Attachment: pgpYsqi4vXtBB.pgp
Description: PGP signature


Reply to: