Update documentation for 0.2.2 and fix logging

This commit is contained in:
Daniel Adolfsson 2012-02-03 23:13:46 +01:00
parent 7956724a8e
commit 997499ec2b
6 changed files with 59 additions and 19 deletions

14
README
View File

@ -1,6 +1,6 @@
ndppd - NDP Proxy Daemon ndppd - NDP Proxy Daemon
Version 0.2.1 Version 0.2.2
------------------------------------------------------------------------ ------------------------------------------------------------------------
1. Legal 1. Legal
@ -78,14 +78,7 @@
3. Dependencies 3. Dependencies
------------------------------------------------------------------------ ------------------------------------------------------------------------
This daemon depends on 'libconfuse'. If you're running Debian or As of version 0.2.2, libconfuse is no longer needed.
Ubuntu you should be able to get that from the repositories.
apt-get install libconfuse0-dev
You can get it here otherwise:
http://www.nongnu.org/confuse/
------------------------------------------------------------------------ ------------------------------------------------------------------------
4. Compiling 4. Compiling
@ -123,6 +116,9 @@
-d Daemonize the process, putting it in the background. -d Daemonize the process, putting it in the background.
Also enables syslogging. Also enables syslogging.
-v Increase logging verbosity. Can be used several times in
order to increase even further.
------------------------------------------------------------------------ ------------------------------------------------------------------------
5. Website and contact 5. Website and contact
------------------------------------------------------------------------ ------------------------------------------------------------------------

View File

@ -5,7 +5,7 @@
.SH NAME .SH NAME
ndppd \- NDP Proxy Daemon ndppd \- NDP Proxy Daemon
.SH SYNOPSIS .SH SYNOPSIS
.B ndppd [-d] [-c <config-file>] [-p <pidfile>] .B ndppd [-d] [-vvv] [-c <config-file>] [-p <pidfile>]
.SH DESCRIPTION .SH DESCRIPTION
.BR ndppd, .BR ndppd,
or or
@ -26,6 +26,9 @@ enables syslogging.
Creates a Creates a
.I pidfile .I pidfile
at the specified location. at the specified location.
.IP -v
Increases logging verbosity. Can be specified several times to increase
verbosity even further.
.SH FILES .SH FILES
.I /etc/ndppd.conf .I /etc/ndppd.conf
.RS .RS

View File

@ -61,18 +61,42 @@ should send the
.I router .I router
bit when sending Neighbor Advertisement messages. The default bit when sending Neighbor Advertisement messages. The default
value here is value here is
.B yes. .BR yes .
.SH RULE OPTIONS .SH RULE OPTIONS
Specify a method here. See below.
.SH METHOD
One of the following options must be specified in the
.B rule
section. All of these are mutually exclusive options, and cannot
be combined.
.IP "iface <interface>" .IP "iface <interface>"
Specify which Specify which
.I interface .I interface
the Neighbor Solicitation message will be sent out through. the Neighbor Solicitation message will be sent out through.
If this option is not specified, .IP "auto"
.B (NEW)
If this option is specified
.B ndppd .B ndppd
will immediately answer with a Neighbor Advertisement message will attempt to detect which interface to use in order to forward
if the rule matches, without querying an interface. It's recommended Neighbor Solicitation Messages, by reading the routing table
that you set this value to avoid sending responses for IPs that does .BR /proc/sys/ipv6_route .
not exist. .IP "static"
.B (NEW)
This option tells
.B ndppd
that it should immediately respond to a Neighbor Solicitation Message
without querying an internal interface.
Note that it's recommended that you use this option sparingly, and with
as high prefix length as possible. This is to make sure upstream routers
are not polluted with spurious neighbor entries.
If no rule option has been specified, it will default to
.B static
in order to be compatible with
.BR 0.2.1 .
This will, however, produce a warning, and most likely not work in
future versions of
.BR ndppd .
.SH AUTHOR .SH AUTHOR
Daniel Adolfsson <daniel@priv.nu> Daniel Adolfsson <daniel@priv.nu>
.SH "SEE ALSO" .SH "SEE ALSO"

View File

@ -175,6 +175,18 @@ void logger::max_pri(int pri)
_max_pri = pri; _max_pri = pri;
} }
int logger::verbosity()
{
return _max_pri;
}
void logger::verbosity(int pri)
{
if ((pri >= 0) && (pri <= 7)) {
_max_pri = pri;
}
}
bool logger::verbosity(const std::string& name) bool logger::verbosity(const std::string& name)
{ {
const char* c_name = name.c_str(); const char* c_name = name.c_str();

View File

@ -51,6 +51,10 @@ public:
static bool verbosity(const std::string& name); static bool verbosity(const std::string& name);
static int verbosity();
static void verbosity(int pri);
logger& operator<<(const std::string& str); logger& operator<<(const std::string& str);
logger& operator<<(logger& (*pf)(logger& )); logger& operator<<(logger& (*pf)(logger& ));
logger& operator<<(int n); logger& operator<<(int n);

View File

@ -158,7 +158,7 @@ int main(int argc, char* argv[], char* env[])
{ 0, 0, 0, 0} { 0, 0, 0, 0}
}; };
c = getopt_long(argc, argv, "c:dp:v::", long_options,& opt); c = getopt_long(argc, argv, "c:dp:v", long_options,& opt);
if (c == -1) if (c == -1)
break; break;
@ -177,12 +177,13 @@ int main(int argc, char* argv[], char* env[])
break; break;
case 'v': case 'v':
if (optarg) { logger::verbosity(logger::verbosity() + 1);
/*if (optarg) {
if (!logger::verbosity(optarg)) if (!logger::verbosity(optarg))
logger::error() << "Unknown verbosity level '" << optarg << "'"; logger::error() << "Unknown verbosity level '" << optarg << "'";
} else { } else {
logger::max_pri(LOG_INFO); logger::max_pri(LOG_INFO);
} }*/
break; break;
} }
} }