Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Oct 2000 21:22:27 -0400
From:      "Matthew Emmerton" <matt@gsicomp.on.ca>
To:        <freebsd-net@FreeBSD.ORG>
Cc:        <brian@FreeBSD.ORG>, <ru@FreeBSD.ORG>
Subject:   [DESIGN]: natd-style configuration for ppp's nat
Message-ID:  <000901c0357d$373e5570$1200a8c0@gsicomp.on.ca>

next in thread | raw e-mail | index | archive | help
All,

What follows are my notes on how I've modified natd so that its
configuration-file parsing routines can be used by other programs.  (Why?
Some of us would like ppp's nat to read it's configuration from a
natd(8)-style configuration file, rather than from ppp.conf.)  Currently ppp
is the only program to need natd's option parser, but a NAT node for
netgraph may require these routines as well.

I welcome any and all comments and suggestions.

--
Matthew Emmerton
GSI Computer Services
+1 (800) 217 5409 (Canada)

--------------------------------------

1a.  Modifications to sbin/natd

natd.c and natd.h have been modified in the following manner:

- Function ParseOption() split into two pieces:
    - ParseOption() to handle option parsing, moved to natd_config.c
    - ProcessOption() to handle option processing, remains in natd.c
- Functions ReadConfigFile() and ParseOption() moved to natd_config.c
- Functions StrToXXX() moved to natd_config.c

- Definitions of Option, Param, and OptionInfo moved to natd_config.h
- Macros dealing with ports moved to natd_config.h

1b. Additions to sbin/natd

- Strucure OptionValue added to natd_config.h, used to pass option data back
to ProcessOption()
- Function InitConfig added to natd_config.c, used to initialize hooks to
option processing routines and error/warning routines

2. Developer Notes

In general, all that is needed to take advantage of the common config
read/parse code is to:
 - include src/sbin/natd_config.h
 - link with src/sbin/natd_config.o
 - implement a ProcessOptions() routine which will act upon configuration
file directives

The required setup prior to using ReadConfigFile() is to call InitConfig()
with the appropriate functions for processing and error reporting.

After the function hooks are initialized, a call to ReadConfig() will read a
natd(8)-style configuration file, call ParseOption() to parse the
configuration file, and then call ProcessOption() to act upon all recognized
options.





To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000901c0357d$373e5570$1200a8c0>