[Tinyos-2-commits] CVS: tinyos-2.x/support/sdk/c/blip/driver/radvd-1.0 CHANGES, NONE, 1.1 COPYRIGHT, NONE, 1.1 INTRO.html, NONE, 1.1 Makefile, NONE, 1.1 Makefile.am, NONE, 1.1 Makefile.in, NONE, 1.1 README, NONE, 1.1 TODO, NONE, 1.1 VERSION, NONE, 1.1 aclocal.m4, NONE, 1.1 config.cache, NONE, 1.1 config.guess, NONE, 1.1 config.h, NONE, 1.1 config.h.in, NONE, 1.1 config.log, NONE, 1.1 config.status, NONE, 1.1 config.sub, NONE, 1.1 configure, NONE, 1.1 configure.in, NONE, 1.1 copyright.blurb, NONE, 1.1 defaults.h, NONE, 1.1 depcomp, NONE, 1.1 device-bsd44.c, NONE, 1.1 device-common.c, NONE, 1.1 device-linux.c, NONE, 1.1 gram.c, NONE, 1.1 gram.h, NONE, 1.1 gram.y, NONE, 1.1 includes.h, NONE, 1.1 install-sh, NONE, 1.1 interface.c, NONE, 1.1 log.c, NONE, 1.1 missing, NONE, 1.1 mkinstalldirs, NONE, 1.1 pathnames.h, NONE, 1.1 process.c, NONE, 1.1 radvd.8.man, NONE, 1.1 radvd.c, NONE, 1.1 radvd.conf.5.man, NONE, 1.1 radvd.conf.example, NONE, 1.1 radvd.h, NONE, 1.1 radvdump.8.man, NONE, 1.1 radvdump.c, NONE, 1.1 recv.c, NONE, 1.1 scanner.c, NONE, 1.1 scanner.l, NONE, 1.1 send.c, NONE, 1.1 socket.c, NONE, 1.1 stamp-h, NONE, 1.1 stamp-h.in, NONE, 1.1 timer.c, NONE, 1.1 util.c, NONE, 1.1
sdhsdh
sdhsdh at users.sourceforge.net
Mon Jan 19 16:28:17 PST 2009
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/support/sdk/c/blip/driver Makefile, NONE, 1.1 config.c, NONE, 1.1 config.h, NONE, 1.1 hashtable.c, NONE, 1.1 hashtable.h, NONE, 1.1 hashtable_private.h, NONE, 1.1 logging.c, NONE, 1.1 logging.h, NONE, 1.1 nwstate.c, NONE, 1.1 nwstate.h, NONE, 1.1 radvd-wrapper.c, NONE, 1.1 routing.c, NONE, 1.1 routing.h, NONE, 1.1 serial_tun.c, NONE, 1.1 tun_dev.c, NONE, 1.1 tun_dev.h, NONE, 1.1 tunnel.c, NONE, 1.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/support/sdk/c/blip/include 6lowpan.h, NONE, 1.1 IEEE154.h, NONE, 1.1 devconf.h, NONE, 1.1 in_cksum.h, NONE, 1.1 ip.h, NONE, 1.1 ip_malloc.h, NONE, 1.1 lib6lowpan.h, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/support/sdk/c/blip/driver/radvd-1.0
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6583/support/sdk/c/blip/driver/radvd-1.0
Added Files:
CHANGES COPYRIGHT INTRO.html Makefile Makefile.am Makefile.in
README TODO VERSION aclocal.m4 config.cache config.guess
config.h config.h.in config.log config.status config.sub
configure configure.in copyright.blurb defaults.h depcomp
device-bsd44.c device-common.c device-linux.c gram.c gram.h
gram.y includes.h install-sh interface.c log.c missing
mkinstalldirs pathnames.h process.c radvd.8.man radvd.c
radvd.conf.5.man radvd.conf.example radvd.h radvdump.8.man
radvdump.c recv.c scanner.c scanner.l send.c socket.c stamp-h
stamp-h.in timer.c util.c
Log Message:
- initial commit of blip (berkeley low-power ip) stack
--- NEW FILE: CHANGES ---
$Id: CHANGES,v 1.1 2009/01/20 00:28:14 sdhsdh Exp $
11/01/2006 Release 1.0.
10/09/2006 Perform a static/dynamic code audit; plug some minor
bugs (see CVS changelogs for more information) and
perform minor clean-up.
08/07/2006 Implement MAX_INITIAL_RTR_ADVERT_INTERVAL handling,
patch from Yoshifuji Hideaki / USAGI.
05/23/2006 Unblock SIGALRM signals at startup. Some scripts/programs
seem to run radvd from ALRM-blocked context which breaks
the timers.
05/23/2006 Redefined IgnoreIfMissing: by default, radvd will now
try to reinitialize failed interfaces automatically.
IgnoreIfMissing is still needed if radvd is started when the
interface isn't up, and it also quenches some messages
relating to missing interfaces.
03/29/2006 Implement RDNSS draft, using non-allocated
IANA ND type value 25, by Lauréline Provost,
Mickaël Guérin, Adrien Clerc, Gaetan Eleouet,
Bahattin Demirplak, Lionel Guilmin (at the
ENSEEIHT, Toulouse)
03/06/2006 Fix the default STDERR+syslog logging methods, so
we don't try to unnecessarily log to STDERR after
forking.
01/18/2006 radvd-0.9.1 did not initialize AdvDefaultLifetime (etc.)
appropriately, unbreak the "clean-up".
01/13/2006 Release 0.9.1.
12/30/2005 Great cleanup of signed/unsigned values, add
-Wall and a number of other warnings to CFLAGS
by default. Do not allow signed values for
HomeAgentPreference anymore.
12/30/2005 Fix a couple of IPv6 Ready Logo Phase-2 IPv6 Core
Protocols Self Test issues, patches from Yoshifuji
Hideaki / USAGI.
11/13/2005 Create a short FAQ in README file.
10/28/2005 Get interface MTU automatically, so that you can
use jumboframes and advertise MTU >1500.
10/19/2005 Release 0.9.
10/18/2005 Transfer sole maintainership of radvd to Pekka Savola.
10/18/2005 Make the radvd.conf syntax dump default
in radvdump and remove the previous default to
reduce code duplication.
09/28/2005 Add NEMO Basic support (RFC3961) and fix default
HomeAgentLifetime, from Ville Nuorvala.
08/18/2005 Implement more robust timer handler, especially
because some Linux kernels don't seem to behave
all that well; see http://lkml.org/lkml/2005/4/29/163.
Based on extensive testing & reports by
Tomasz Grobelny. NB: the bug report was caused by
a bad timer patch in PLD's kernel package, and this
should not occur often with standard kernels.
07/24/2005 Implement a new logging method "stderr_syslog" which is
now also the default. Everything is logged on syslog,
while the most important messages (i.e., start-up failures)
are also logged on stderr.
07/08/2005 Release 0.8.
07/05/2005 Change the more-specific route ND option code
from de-facto '9' to the official '24'. Change
back in defaults.h if you need old behaviour.
07/05/2005 Fix wrongly calculated prefix with Base6to4Interface
on ppc and maybe other big endian arches, from
Debian #301543 by Sam Hathaway.
07/05/2005 Fix Linux-2.6.12-bk4+ error with HUP signal,
from YOSHIFUJI Hideaki / USAGI.
03/29/2005 Merge a part of MIPv6/non-MIPv6 code, make printing
error messages nicer.
03/22/2005 Be a bit more informative about config file parsing
errors.
02/21/2005 Release 0.7.3.
02/19/2005 Fix crash when reloading config with AdvSendAdvert off.
02/15/2005 Merge a few fixes and improvements from USAGI:
- support microsecond scheduling and fix RA intervals
- send zero router lifetime when forwarding is disabled
- use a more flexible inter-RA delay
01/07/2005 Accomodate interface indexes > 9999, from Hagen Fritsch.
12/15/2004 Advertise zero Router Lifetime when shutting down;
implements a SHOULD in RFC2461 section 6.2.5.
10/16/2004 Update Mobile IPv6 to match RFC 3775, from Greg Daley.
08/20/2004 Minor documentation cleanups.
03/09/2004 Implement "IgnoreIfMissing" interface flag, which can be
used on interfaces which aren't enabled when radvd starts
but will later become available (e.g., Bluetooth) --
and then you wish to send HUP to radvd to activate the
configs.
02/21/2004 Further cleanups, to fix autoconf/autoheader problems
with newer toolchain; mostly by Marko Myllynen.
02/20/2004 Clean up a bit: remove old junk from configure.in,
rename "log()" to "flog()" to satisfy newer GCCs,
allow underscores in the interface names (the last two
fixes already committed earlier).
01/19/2004 Make radvd check for forwarding status using procfs on
Linux; needed with 2.6 kernels. Loosely based on
a patch by USAGI.
11/21/2003 Add support for Router Preferences and More Specific
Routes from Markku Savela <msa at burp.tkv.asdf.org>.
NOTE! The specification is not final yet, there will be
changes! (Man page, documentation and radvdump support
by Pekka Savola.)
09/11/2003 When starting up, check if the MAC address is all zero
(could happen e.g. with bridge interfaces with no attached
physical interfaces), and warn if so. For more information,
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=103469
06/10/2003 When chrooting, check the possible return code
from chdir("/").
03/08/2003 Add patch from MAEDA Naoaki <maeda.naoaki at jp.fujitsu.com>
to discard RS's from the unspecied source address with
link-layer address option, as required by RFC2461.
10/28/2002 Release 0.7.2:
- add support for VLANs (from USAGI)
- make it compile better on newer NetBSD's (NetBSD)
- fix a syntax error in radvd.conf(5) sample documentation
- use IPV6_RECV{HOPLIMIT,PKTINFO} not
IPV6_{HOPLIMIT,PKTINFO} if supported
- (in Red Hat spec file) don't create radvd gid explicitly
- a lot of coding style cleanups
01/16/2002 Release 0.7.1.
01/12/2002 Update config.{guess,sub} from ftp.gnu.org; update INTRO.
Marko Myllynen and Debian bug #115992.
01/02/2002 Ensure NULL-termination with strncpy.
12/31/2001 Radvdump fixes: eliminate a warning of Prefix Information
sections with '-d -f'; add a note that
{Min,Max}RtrAdvInterval cannot be obtained with '-f';
implement '-e' to be used with '-f' which omits all
advertised default settings. Mostly by Marko Myllynen.
12/28/2001 Small cleanups. AdvSendAdvert is implicitly off by
default. Check configuration file permissions; must
not be writable by others, and if non-root,
not by self/own group. By Marko Myllynen.
12/21/2001 Check via sysctl that IPv6 forwarding is enabled;
exit unless debugging is enabled. Triggered by
Marko Myllynen.
11/22/2001 MinRtrAdvInterval for MIPv6 is 0.05 seconds, not 0.5.
(Note: untested).
11/20/2001 Rework BSD device memory management a bit, minor cleanups.
Version bumped to 0.7.0.
11/14/2001 Maintainership of radvd transferred from Lars Fenneberg
to Pekka Savola and Nathan Lutchansky. Lars' CVS
repository adopted, and changes merged from the -pX
branch.
08/29/2001 Minor change for NetBSD 1.5.1 compatibility.
(Nathan Lutchansky)
07/20/2001 Support for non-multicast links, like ISATAP.
(Nathan Lutchansky)
07/03/2001 Minimum MTU has been changed to 1280 in the latest RFC's.
(Pekka Savola)
06/30/2001 Check for possible buffer overflows; replace strcpy with
strncpy. No fatals found. Remove redunant radvd -t check.
(Pekka Savola)
06/24/2001 Fix 1-byte overflow in /proc/net/igmp6 handling,
clean out possible memory garbage when sending RA's
(patch from <yoshfuji at linux-ipv6.org>).
06/19/2001 When dropping root, also set up supplementary groups
properly. On Linux, when sending RA's, check that the
interface has joined all-routers multicast group. Add a few
RFC2461 MUST sanity checks when receiving datagrams. Clean
out non-EUI64 addressing scheme and other minor bits.
(Pekka Savola)
04/28/2001 Misc cleanup and bugfixes, automake support.
03/28/2001 Grammar cleanup. Integrated 6to4 support through
"Base6to4Interface" option in prefix configuration. Signal
handling fixed by blocking on select() rather than recvmsg()
so SIGTERM/HUP take effect immediately now. (Nathan Lutchansky)
03/27/2001 Security fixes: close stdin/out and chdir("/") via
daemon() to prevent possible exploits, and a flag to allow
radvd to set[ug]id to an unprivileged user (from Pekka Savola).
02/01/2001 scope_id is not supported in glibc2.1. So it is now
compiled conditionally.
01/31/2001 Add CC variable to Makefile. Fix bug with IPV6_ADD_MEMBERSHIP
handling. Set scope_id when sending packets.
12/02/2000 man pages update, rewritten pid file handling, rewritten
signal handling (SIGHUP and SIGTERM), gcc warnings cleanup,
new radvdump option -f: print received RAs in config file
format (by Marko)
11/19/2000 integrated the last two change entries into the main source
(patches by Marko Myllynen), fixed bug in log.c, fixed file
description leak in readin_config, rewrote code in timer.c,
updated man pages again (from Marko Myllynen, too), PID
file support (patch from Marko Myllynen, based on a patch
from Tommi.Komulainen at iki.fi)
15/08/2000 RFC 2461 updates, Mobile IPv6 extensions added
14/07/2000 added RA interval option and modified some default values
for timers
06/15/99 changed to run with glibc 2.1 on RedHat 6.0.
03/03/98 radvd now joins ipv6-allrouters on Linux. Fix contributed
by A.N.Kuznetsov <kuznet at ms2.inr.ac.ru>.
10/23/97 radvd will now accept any prefix length in its config
file but will warn about unusual ones
10/19/97 removed backwards compatibility code in recv.c.
IPV6_HOPLIMIT support is now assumed to exist.
10/19/97 fixed alignment problems in recv.c and send.c.
10/16/97 the Makefile install target now uses mkinstalldirs.
10/16/97 changed all u_int*_t to uint*_t for better POSIX
compliance and portability. Needs 2.1.57-CVS or glibc.
BSD seems to need patches.
10/16/97 more intelligent configure; tries to figure out
where the IPv6 libraries and inclues are (if not in
the standard places). Searches in /usr/inet6 and /usr/ipv6.
10/15/97 integrated small patches for glibc and BSD from Craig and
Philip
09/14/97 EUI-64 "support"
09/01/97 centralized all includes into includes.h for easier
maintainance
08/25/97 changed all occurences of IPV6_TXINFO/IPV6_RXINFO
to IPV6_PKTINFO
08/25/97 removed some compatibility stuff for older Linux kernels
03/17/97 changed linux/if_arp.h to net/if_arp.h in device-linux.c
and configure.in (for glibc compatibility)
03/17/97 integrated patch from Philip Blundell <pjb27 at cam.ac.uk>
into configure.in to check for inet_* in libc first and
then for libinet6 (for glibc compatibility).
03/16/97 corrected small error in radvd.conf(5) man page and other
small changes
03/16/97 removed linklocal.c source file from the distribution
because it wasn't used anymore
03/16/97 added html version of the INTRO, removed ascii version.
02/12/97 missing directories are now created on make install
01/19/97 now also the rest of a line followed by a '#' is treated
as a comment in the config file
01/16/97 added IPPROTO_IPV6/IPV6_HOPLIMIT support, so now incoming
RS' and RAs are checked if there hoplimit is 255 (on Linux
this only works with kernel version 2.1.21 and above)
01/15/97 lots of portability cleanups; radvd is now using autoconf
for automatic configuration; removed support for the
in. prefix
01/05/97 integrated BSD 4.4 patches from Craig <cmetz at inner.net>
12/21/96 release of version 0.3
12/15/96 the AdvSendAdvert flag works now
12/14/96 added radvdump, dumps all received RAs in a human
readable form
12/13/96 rewrote radvd to use new advanced API headers
12/08/96 added radvd.conf(5) man page
12/03/96 changed RAW_CHECKSUM to IPV6_CHECKSUM for kernels
2.1.14 and above
11/24/96 added checking of received RAs according to RFC 1970
11/20/96 rewrote the default handling, now it should conform
to RFC 1970
11/17/96 release of version 0.2
11/17/96 added -h (--help) and -f (--facility) option
11/17/96 added setsockopt(..., SOL_IPV6, IPV6_MULTICAST_HOPS), so
that radvd works for kernel versions >2.1.7 (without this
you get "NDISC: fake router advertisment received" on your
hosts)
11/17/96 added a man page for radvd(8)
11/17/96 some minor filename changes
11/13/96 first release of this version of in.radvd (0.1)
--- NEW FILE: COPYRIGHT ---
The author(s) grant permission for redistribution and use in source and
binary forms, with or without modification, of the software and documentation
provided that the following conditions are met:
0. If you receive a version of the software that is specifically labelled
as not being for redistribution (check the version message and/or README),
you are not permitted to redistribute that version of the software in any
way or form.
1. All terms of all other applicable copyrights and licenses must be
followed.
2. Redistributions of source code must retain the authors' copyright
notice(s), this list of conditions, and the following disclaimer.
3. Redistributions in binary form must reproduce the authors' copyright
notice(s), this list of conditions, and the following disclaimer in the
documentation and/or other materials provided with the distribution.
4. All advertising materials mentioning features or use of this software
must display the following acknowledgement with the name(s) of the
authors as specified in the copyright notice(s) substituted where
indicated:
This product includes software developed by the authors which are
mentioned at the start of the source files and other contributors.
5. Neither the name(s) of the author(s) nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- NEW FILE: INTRO.html ---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<!-- $Id: INTRO.html,v 1.1 2009/01/20 00:28:14 sdhsdh Exp $ -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>RADVD Introduction</title>
</head>
<body>
<h1>RADVD Introduction</h1>
<p>
by <a href="mailto:lf at elemental.net">Lars Fenneberg</a> et al. Updated
2002-01-12.
</p>
<p>
<a href="http://www.ietf.org/rfc/rfc2460.txt">IPv6</a> has a lot more
support for autoconfiguration than
<a href="http://www.ietf.org/rfc/rfc791.txt">IPv4</a>. But for this
autoconfiguration to work on the hosts of a network, the <em>routers</em>
of the local network have to run a program which answers the
autoconfiguration requests of the hosts.
</p>
<p>
On Linux this program is called
<a href="http://v6web.litech.org/radvd/">radvd</a>, which stands for
Router ADVertisement Daemon. This daemon listens to Router Solicitations
(RS) and answers with Router Advertisement (RA). Furthermore unsolicited
RAs are also send from time to time.
<a href="http://www.ietf.org/rfc/rfc2461.txt">RFC 2461</a> defines most
functions of radvd.
</p>
<p>
Router Advertisements contain information, which is used by hosts to
configure their interfaces. This information includes address prefixes,
the MTU of the link and information about default routers.
</p>
<p>
Of course the routers can't autoconfigure themselves, so the information
on the routers has to be provided by the administrator of the system.
This is done by manually configuring the interfaces and routes and by
configuring the router advertisement daemon.
</p>
<p>
A small and simple configuration file for radvd might look like this:
</p>
<p>
<pre>
interface eth0
{
AdvSendAdvert on;
prefix 2001:db8:0:1::/64
{
AdvOnLink on;
AdvAutonomous on;
};
};
</pre>
<p>
It says that radvd should advertise (AdvSendAdvert on) the prefix
2001:db8:0:1:: which has a lenght of 64 on the interface eth0.
Also the prefix is marked as autonomous (AdvAutonomous on) and as on-link
(AdvOnLink on). The both currently default to enabled but are included
here for introductory purposes; it isn't necessary to define them.
All the other options are left on their default values.
</p>
<p>
Autonomous means that the prefix can be used for automatic address
configuration and on-link means that the hosts can assume that all the hosts
which use this prefix are reachable via the interface on which the host
received this RA.
</p>
<p>
The prefix must be 64 bits long (apart from very few exceptions), as dictated by
<a href="http://www.ietf.org/rfc/rfc2464.txt">RFC 2464</a> and other
standards for different link-layer technologies. For more
details, see <a href="http://www.ietf.org/rfc/rfc2462.txt">RFC 2462</a>
(IPv6 Stateless Address Autoconfiguration) and
<a href="http://www.ietf.org/rfc/rfc2464.txt">RFC 2464</a>
(Transmission of IPv6 Packets over Ethernet Networks). For more information
on configuring radvd please look at the manual pages which are included in
the radvd distribution.
</p>
<p>
So, when an interface on a hosts is UPed and a RA is received, the host
can configure an address on the interface by using the prefix and
appending the EUI-64 identifier derived from the hardware address
(also called link-layer token). The EUI-64 identifier is simply appended
after the prefix. For example:
</p>
<p>
<pre>
Announced prefix: 2001:db8:0:1::
MAC address: 00:07:E9:7B:02:59
EUI-64 identifier: 0207:e9ff:fe7b:259
Configured address: 2001:db8:0:1:207:e9ff:fe7b:259
</pre>
<p>
The host can also choose a default router by examining the RA.
the rest works automatically.
</p>
<p>
So now we've configured radvd, but we still need to configure the interfaces
and set the routes (on the router). There's a lot of good material on
setting up IPv6, and the reader is encouraged to have a look
at it; for example:
</p>
<p>
<ul>
<li><a href="http://www.bieringer.de/linux/IPv6/IPv6-HOWTO/IPv6-HOWTO.html">http://www.bieringer.de/linux/IPv6/IPv6-HOWTO/IPv6-HOWTO.html</a></li>
<li><a href="http://people.debian.org/~csmall/ipv6/setup.html">http://people.debian.org/~csmall/ipv6/setup.html</a> (for non-Debian too)</li>
</ul>
<hr>
<p>
Copyright © 1997 <a href="mailto:lf at elemental.net">Lars Fenneberg</a>
</p>
</body>
</html>
--- NEW FILE: Makefile ---
# Generated automatically from Makefile.in by configure.
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
#
# $Id: Makefile,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
#
# Authors:
# Lars Fenneberg <lf at elemental.net>
#
# This software is Copyright 1996,1997 by the above mentioned author(s),
# All Rights Reserved.
#
# The license which is distributed with this software in the file COPYRIGHT
# applies to this software. If your distribution is missing this file, you
# may request it from <pekkas at netcore.fi>.
#
SHELL = /bin/sh
srcdir = .
top_srcdir = .
prefix = /usr/local
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
sbindir = ${exec_prefix}/sbin
libexecdir = ${exec_prefix}/libexec
datadir = ${prefix}/share
sysconfdir = ${prefix}/etc
sharedstatedir = ${prefix}/com
localstatedir = ${prefix}/var
libdir = ${exec_prefix}/lib
infodir = ${prefix}/info
mandir = ${prefix}/man
includedir = ${prefix}/include
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/radvd
pkglibdir = $(libdir)/radvd
pkgincludedir = $(includedir)/radvd
top_builddir = .
ACLOCAL = aclocal
AUTOCONF = autoconf
AUTOMAKE = automake
AUTOHEADER = autoheader
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL} $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_SCRIPT = ${INSTALL_PROGRAM}
transform = s,x,x,
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_alias = x86_64-unknown-linux-gnu
build_triplet = x86_64-unknown-linux-gnu
host_alias = x86_64-unknown-linux-gnu
host_triplet = x86_64-unknown-linux-gnu
target_alias = x86_64-unknown-linux-gnu
target_triplet = x86_64-unknown-linux-gnu
CC = gcc
GZIP = /bin/gzip
LEX = flex
LN = /bin/ln
LOG_FACILITY = LOG_DAEMON
MAKEINFO = makeinfo
PACKAGE = radvd
PATH_RADVD_CONF = ${prefix}/etc/radvd.conf
PATH_RADVD_LOG = /var/log/radvd.log
PATH_RADVD_PID = /var/run/radvd.pid
RM = /bin/rm
SED = /bin/sed
TAR = /bin/tar
VERSION = 1.0
YACC = bison -y
AUTOMAKE_OPTIONS = 1.2 foreign
DEFS = -DPATH_RADVD_CONF=\"$(PATH_RADVD_CONF)\" \
-DPATH_RADVD_LOG=\"$(PATH_RADVD_LOG)\" -DLOG_FACILITY=$(LOG_FACILITY) \
-DPATH_RADVD_PID=\"$(PATH_RADVD_PID)\" \
-DVERSION=\"$(VERSION)\" -DINET6=1
INCLUDES = -I$(srcdir) -I.
########################################################################
COMMON_SRC = log.c socket.c recv.c util.c radvd.h defaults.h pathnames.h \
includes.h
sbin_PROGRAMS = radvd radvdump
radvd_SOURCES = $(COMMON_SRC) radvd.c timer.c send.c process.c interface.c \
device.c device-common.c gram.y gram.h scanner.l
radvd_LDADD = -lfl
EXTRA_radvd_SOURCES = device-linux.c device-bsd44.c
YFLAGS = -d
CFLAGS = -g -O2 -Wall -Wpointer-arith -Wcast-qual -Wcast-align -Wconversion \
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
radvdump_SOURCES = $(COMMON_SRC) radvdump.c
man_MANS = radvd.8 radvdump.8 radvd.conf.5
EXTRA_DIST = radvd.8.man radvdump.8.man radvd.conf.5.man VERSION CHANGES \
COPYRIGHT INTRO.html copyright.blurb radvd.conf.example
BUILT_SOURCES = device.c
CLEANFILES = radvd.8 radvdump.8 radvd.conf.5
DISTCLEANFILES = device.c
SUFFIXES = .man
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(sbin_PROGRAMS)
CPPFLAGS =
LDFLAGS =
LIBS = -lc
radvd_OBJECTS = log.o socket.o recv.o util.o radvd.o timer.o send.o \
process.o interface.o device.o device-common.o gram.o scanner.o
radvd_DEPENDENCIES =
radvd_LDFLAGS =
radvdump_OBJECTS = log.o socket.o recv.o util.o radvdump.o
radvdump_LDADD = $(LDADD)
radvdump_DEPENDENCIES =
radvdump_LDFLAGS =
LEX_OUTPUT_ROOT = lex.yy
LEXLIB = -lfl
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
man5dir = $(mandir)/man5
man8dir = $(mandir)/man8
MANS = $(man_MANS)
NROFF = nroff
DIST_COMMON = README ./stamp-h.in Makefile.am Makefile.in TODO \
aclocal.m4 config.guess config.h.in config.sub configure configure.in \
gram.c install-sh missing mkinstalldirs scanner.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
GZIP_ENV = --best
DEP_FILES = .deps/device-bsd44.P .deps/device-common.P \
.deps/device-linux.P .deps/device.P .deps/gram.P .deps/interface.P \
.deps/log.P .deps/process.P .deps/radvd.P .deps/radvdump.P .deps/recv.P \
.deps/scanner.P .deps/send.P .deps/socket.P .deps/timer.P .deps/util.P
SOURCES = $(radvd_SOURCES) $(EXTRA_radvd_SOURCES) $(radvdump_SOURCES)
OBJECTS = $(radvd_OBJECTS) $(radvdump_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .l .man .o .s .y
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(ACLOCAL_M4): configure.in
cd $(srcdir) && $(ACLOCAL)
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
config.h: stamp-h
@if test ! -f $@; then \
rm -f stamp-h; \
$(MAKE) stamp-h; \
else :; fi
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES= CONFIG_HEADERS=config.h \
$(SHELL) ./config.status
@echo timestamp > stamp-h 2> /dev/null
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
@if test ! -f $@; then \
rm -f $(srcdir)/stamp-h.in; \
$(MAKE) $(srcdir)/stamp-h.in; \
else :; fi
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOHEADER)
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
mostlyclean-hdr:
clean-hdr:
distclean-hdr:
-rm -f config.h
maintainer-clean-hdr:
mostlyclean-sbinPROGRAMS:
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
distclean-sbinPROGRAMS:
maintainer-clean-sbinPROGRAMS:
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(sbindir)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(sbin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
radvd: $(radvd_OBJECTS) $(radvd_DEPENDENCIES)
@rm -f radvd
$(LINK) $(radvd_LDFLAGS) $(radvd_OBJECTS) $(radvd_LDADD) $(LIBS)
radvdump: $(radvdump_OBJECTS) $(radvdump_DEPENDENCIES)
@rm -f radvdump
$(LINK) $(radvdump_LDFLAGS) $(radvdump_OBJECTS) $(radvdump_LDADD) $(LIBS)
.l.c:
$(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
.y.c:
$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
if test -f y.tab.h; then \
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
else :; fi
gram.h: gram.c
install-man5:
$(mkinstalldirs) $(DESTDIR)$(man5dir)
@list='$(man5_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.5*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst; \
done
uninstall-man5:
@list='$(man5_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.5*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man5dir)/$$inst"; \
rm -f $(DESTDIR)$(man5dir)/$$inst; \
done
install-man8:
$(mkinstalldirs) $(DESTDIR)$(man8dir)
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
done
uninstall-man8:
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
rm -f $(DESTDIR)$(man8dir)/$$inst; \
done
install-man: $(MANS)
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-man5 install-man8
uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-man5 uninstall-man8
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
-rm -rf $(distdir)
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
dc_install_base=`cd $(distdir)/=inst && pwd`; \
cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) dist
-rm -rf $(distdir)
@banner="$(distdir).tar.gz is ready for distribution"; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"
dist: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
dist-all: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
distdir: $(DISTFILES)
-rm -rf $(distdir)
mkdir $(distdir)
-chmod 777 $(distdir)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
all-recursive-am: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
install-exec-am: install-sbinPROGRAMS
install-exec: install-exec-am
install-data-am: install-man
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-sbinPROGRAMS uninstall-man
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS) $(MANS) config.h
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man5 \
$(DESTDIR)$(mandir)/man8
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
-test -z "scannerlgramhgramc$(BUILT_SOURCES)" || rm -f scannerl gramh gramc $(BUILT_SOURCES)
mostlyclean-am: mostlyclean-hdr mostlyclean-sbinPROGRAMS \
mostlyclean-compile mostlyclean-tags mostlyclean-depend \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-hdr clean-sbinPROGRAMS clean-compile clean-tags \
clean-depend clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-hdr distclean-sbinPROGRAMS distclean-compile \
distclean-tags distclean-depend distclean-generic \
clean-am
distclean: distclean-am
-rm -f config.status
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-sbinPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-depend maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
-rm -f config.status
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS clean-sbinPROGRAMS \
maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \
install-sbinPROGRAMS mostlyclean-compile distclean-compile \
clean-compile maintainer-clean-compile install-man5 uninstall-man5 \
install-man8 uninstall-man8 install-man uninstall-man tags \
mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
distdir mostlyclean-depend distclean-depend clean-depend \
maintainer-clean-depend info-am info dvi-am dvi check check-am \
installcheck-am installcheck all-recursive-am install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
.man:
$(SED) -e 's,@''VERSION''@,$(VERSION),g' \
-e 's,@''sbindir''@,$(sbindir),g' \
-e 's,@''PATH_RADVD_CONF''@,$(PATH_RADVD_CONF),g' \
-e 's,@''PATH_RADVD_PID''@,$(PATH_RADVD_PID),g' \
-e 's,@''PATH_RADVD_LOG''@,$(PATH_RADVD_LOG),g' \
-e 's,@''LOG_FACILITY''@,$(LOG_FACILITY),g' \
$< > $@
dist-hook:
rm -f $(distdir)/device.c
mkdir $(distdir)/redhat
cp -p $(srcdir)/redhat/radvd.init $(srcdir)/redhat/radvd.spec \
$(srcdir)/redhat/radvd.sysconfig $(distdir)/redhat
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
--- NEW FILE: Makefile.am ---
#
# $Id: Makefile.am,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
#
# Authors:
# Lars Fenneberg <lf at elemental.net>
#
# This software is Copyright 1996,1997 by the above mentioned author(s),
# All Rights Reserved.
#
# The license which is distributed with this software in the file COPYRIGHT
# applies to this software. If your distribution is missing this file, you
# may request it from <pekkas at netcore.fi>.
#
AUTOMAKE_OPTIONS = 1.2 foreign
DEFS= -DPATH_RADVD_CONF=\"$(PATH_RADVD_CONF)\" \
-DPATH_RADVD_LOG=\"$(PATH_RADVD_LOG)\" -DLOG_FACILITY=$(LOG_FACILITY) \
-DPATH_RADVD_PID=\"$(PATH_RADVD_PID)\" \
-DVERSION=\"$(VERSION)\" -DINET6=1
INCLUDES=-I$(srcdir) -I.
########################################################################
COMMON_SRC = log.c socket.c recv.c util.c radvd.h defaults.h pathnames.h \
includes.h
sbin_PROGRAMS = radvd radvdump
radvd_SOURCES = $(COMMON_SRC) radvd.c timer.c send.c process.c interface.c \
device.c device-common.c gram.y gram.h scanner.l
radvd_LDADD = -lfl
EXTRA_radvd_SOURCES = device-linux.c device-bsd44.c
YFLAGS = -d
CFLAGS = @CFLAGS@ -Wall -Wpointer-arith -Wcast-qual -Wcast-align -Wconversion \
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
radvdump_SOURCES = $(COMMON_SRC) radvdump.c
man_MANS = radvd.8 radvdump.8 radvd.conf.5
EXTRA_DIST = radvd.8.man radvdump.8.man radvd.conf.5.man VERSION CHANGES \
COPYRIGHT INTRO.html copyright.blurb radvd.conf.example
BUILT_SOURCES = device.c
CLEANFILES = radvd.8 radvdump.8 radvd.conf.5
DISTCLEANFILES = device.c
SUFFIXES = .man
.man:
$(SED) -e 's,@''VERSION''@,$(VERSION),g' \
-e 's,@''sbindir''@,$(sbindir),g' \
-e 's,@''PATH_RADVD_CONF''@,$(PATH_RADVD_CONF),g' \
-e 's,@''PATH_RADVD_PID''@,$(PATH_RADVD_PID),g' \
-e 's,@''PATH_RADVD_LOG''@,$(PATH_RADVD_LOG),g' \
-e 's,@''LOG_FACILITY''@,$(LOG_FACILITY),g' \
$< > $@
dist-hook:
rm -f $(distdir)/device.c
mkdir $(distdir)/redhat
cp -p $(srcdir)/redhat/radvd.init $(srcdir)/redhat/radvd.spec \
$(srcdir)/redhat/radvd.sysconfig $(distdir)/redhat
--- NEW FILE: Makefile.in ---
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
#
# $Id: Makefile.in,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
#
# Authors:
# Lars Fenneberg <lf at elemental.net>
#
# This software is Copyright 1996,1997 by the above mentioned author(s),
# All Rights Reserved.
#
# The license which is distributed with this software in the file COPYRIGHT
# applies to this software. If your distribution is missing this file, you
# may request it from <pekkas at netcore.fi>.
#
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_alias = @build_alias@
build_triplet = @build@
host_alias = @host_alias@
host_triplet = @host@
target_alias = @target_alias@
target_triplet = @target@
CC = @CC@
GZIP = @GZIP@
LEX = @LEX@
LN = @LN@
LOG_FACILITY = @LOG_FACILITY@
MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@
PATH_RADVD_CONF = @PATH_RADVD_CONF@
PATH_RADVD_LOG = @PATH_RADVD_LOG@
PATH_RADVD_PID = @PATH_RADVD_PID@
RM = @RM@
SED = @SED@
TAR = @TAR@
VERSION = @VERSION@
YACC = @YACC@
AUTOMAKE_OPTIONS = 1.2 foreign
DEFS = -DPATH_RADVD_CONF=\"$(PATH_RADVD_CONF)\" \
-DPATH_RADVD_LOG=\"$(PATH_RADVD_LOG)\" -DLOG_FACILITY=$(LOG_FACILITY) \
-DPATH_RADVD_PID=\"$(PATH_RADVD_PID)\" \
-DVERSION=\"$(VERSION)\" -DINET6=1
INCLUDES = -I$(srcdir) -I.
########################################################################
COMMON_SRC = log.c socket.c recv.c util.c radvd.h defaults.h pathnames.h \
includes.h
sbin_PROGRAMS = radvd radvdump
radvd_SOURCES = $(COMMON_SRC) radvd.c timer.c send.c process.c interface.c \
device.c device-common.c gram.y gram.h scanner.l
radvd_LDADD = -lfl
EXTRA_radvd_SOURCES = device-linux.c device-bsd44.c
YFLAGS = -d
CFLAGS = @CFLAGS@ -Wall -Wpointer-arith -Wcast-qual -Wcast-align -Wconversion \
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
radvdump_SOURCES = $(COMMON_SRC) radvdump.c
man_MANS = radvd.8 radvdump.8 radvd.conf.5
EXTRA_DIST = radvd.8.man radvdump.8.man radvd.conf.5.man VERSION CHANGES \
COPYRIGHT INTRO.html copyright.blurb radvd.conf.example
BUILT_SOURCES = device.c
CLEANFILES = radvd.8 radvdump.8 radvd.conf.5
DISTCLEANFILES = device.c
SUFFIXES = .man
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(sbin_PROGRAMS)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
radvd_OBJECTS = log.o socket.o recv.o util.o radvd.o timer.o send.o \
process.o interface.o device.o device-common.o gram.o scanner.o
radvd_DEPENDENCIES =
radvd_LDFLAGS =
radvdump_OBJECTS = log.o socket.o recv.o util.o radvdump.o
radvdump_LDADD = $(LDADD)
radvdump_DEPENDENCIES =
radvdump_LDFLAGS =
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LEXLIB = @LEXLIB@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
man5dir = $(mandir)/man5
man8dir = $(mandir)/man8
MANS = $(man_MANS)
NROFF = nroff
DIST_COMMON = README ./stamp-h.in Makefile.am Makefile.in TODO \
aclocal.m4 config.guess config.h.in config.sub configure configure.in \
gram.c install-sh missing mkinstalldirs scanner.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
GZIP_ENV = --best
DEP_FILES = .deps/device-bsd44.P .deps/device-common.P \
.deps/device-linux.P .deps/device.P .deps/gram.P .deps/interface.P \
.deps/log.P .deps/process.P .deps/radvd.P .deps/radvdump.P .deps/recv.P \
.deps/scanner.P .deps/send.P .deps/socket.P .deps/timer.P .deps/util.P
SOURCES = $(radvd_SOURCES) $(EXTRA_radvd_SOURCES) $(radvdump_SOURCES)
OBJECTS = $(radvd_OBJECTS) $(radvdump_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .l .man .o .s .y
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(ACLOCAL_M4): configure.in
cd $(srcdir) && $(ACLOCAL)
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
config.h: stamp-h
@if test ! -f $@; then \
rm -f stamp-h; \
$(MAKE) stamp-h; \
else :; fi
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES= CONFIG_HEADERS=config.h \
$(SHELL) ./config.status
@echo timestamp > stamp-h 2> /dev/null
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
@if test ! -f $@; then \
rm -f $(srcdir)/stamp-h.in; \
$(MAKE) $(srcdir)/stamp-h.in; \
else :; fi
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOHEADER)
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
mostlyclean-hdr:
clean-hdr:
distclean-hdr:
-rm -f config.h
maintainer-clean-hdr:
mostlyclean-sbinPROGRAMS:
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
distclean-sbinPROGRAMS:
maintainer-clean-sbinPROGRAMS:
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(sbindir)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(sbin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
radvd: $(radvd_OBJECTS) $(radvd_DEPENDENCIES)
@rm -f radvd
$(LINK) $(radvd_LDFLAGS) $(radvd_OBJECTS) $(radvd_LDADD) $(LIBS)
radvdump: $(radvdump_OBJECTS) $(radvdump_DEPENDENCIES)
@rm -f radvdump
$(LINK) $(radvdump_LDFLAGS) $(radvdump_OBJECTS) $(radvdump_LDADD) $(LIBS)
.l.c:
$(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
.y.c:
$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
if test -f y.tab.h; then \
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
else :; fi
gram.h: gram.c
install-man5:
$(mkinstalldirs) $(DESTDIR)$(man5dir)
@list='$(man5_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.5*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst; \
done
uninstall-man5:
@list='$(man5_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.5*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man5dir)/$$inst"; \
rm -f $(DESTDIR)$(man5dir)/$$inst; \
done
install-man8:
$(mkinstalldirs) $(DESTDIR)$(man8dir)
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
done
uninstall-man8:
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
rm -f $(DESTDIR)$(man8dir)/$$inst; \
done
install-man: $(MANS)
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-man5 install-man8
uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-man5 uninstall-man8
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
-rm -rf $(distdir)
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
dc_install_base=`cd $(distdir)/=inst && pwd`; \
cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) dist
-rm -rf $(distdir)
@banner="$(distdir).tar.gz is ready for distribution"; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"
dist: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
dist-all: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
distdir: $(DISTFILES)
-rm -rf $(distdir)
mkdir $(distdir)
-chmod 777 $(distdir)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
all-recursive-am: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
install-exec-am: install-sbinPROGRAMS
install-exec: install-exec-am
install-data-am: install-man
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-sbinPROGRAMS uninstall-man
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS) $(MANS) config.h
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man5 \
$(DESTDIR)$(mandir)/man8
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
-test -z "scannerlgramhgramc$(BUILT_SOURCES)" || rm -f scannerl gramh gramc $(BUILT_SOURCES)
mostlyclean-am: mostlyclean-hdr mostlyclean-sbinPROGRAMS \
mostlyclean-compile mostlyclean-tags mostlyclean-depend \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-hdr clean-sbinPROGRAMS clean-compile clean-tags \
clean-depend clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-hdr distclean-sbinPROGRAMS distclean-compile \
distclean-tags distclean-depend distclean-generic \
clean-am
distclean: distclean-am
-rm -f config.status
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-sbinPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-depend maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
-rm -f config.status
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS clean-sbinPROGRAMS \
maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \
install-sbinPROGRAMS mostlyclean-compile distclean-compile \
clean-compile maintainer-clean-compile install-man5 uninstall-man5 \
install-man8 uninstall-man8 install-man uninstall-man tags \
mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
distdir mostlyclean-depend distclean-depend clean-depend \
maintainer-clean-depend info-am info dvi-am dvi check check-am \
installcheck-am installcheck all-recursive-am install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
.man:
$(SED) -e 's,@''VERSION''@,$(VERSION),g' \
-e 's,@''sbindir''@,$(sbindir),g' \
-e 's,@''PATH_RADVD_CONF''@,$(PATH_RADVD_CONF),g' \
-e 's,@''PATH_RADVD_PID''@,$(PATH_RADVD_PID),g' \
-e 's,@''PATH_RADVD_LOG''@,$(PATH_RADVD_LOG),g' \
-e 's,@''LOG_FACILITY''@,$(LOG_FACILITY),g' \
$< > $@
dist-hook:
rm -f $(distdir)/device.c
mkdir $(distdir)/redhat
cp -p $(srcdir)/redhat/radvd.init $(srcdir)/redhat/radvd.spec \
$(srcdir)/redhat/radvd.sysconfig $(distdir)/redhat
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
--- NEW FILE: README ---
$Id: README,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
Installation:
=============
Run configure, e.g.
./configure --prefix=/usr/local --sysconfdir=/etc --mandir=/usr/share/man
See configure --help for additional command line arguments.
Run 'make' and 'make install'. On BSD, you may need to use 'gmake'.
Configuration:
==============
See INTRO.html, radvd.conf(8) and radvd.conf.example.
Frequently Asked Questions:
===========================
Setting up radvd is very simple, so the most frequently asked
questions have been about what radvd _doesn't_ do...
1. How do I set up the router running radvd to automatically
configure an address from the prefix advertised in Route
Advertisements from upstream?
-- You don't. By the specification, routers ignore RAs.
You'll probably need to use manual configuration. But you
can't use the same prefix on two links in any case unless you
use something like proxy-ND (draft-ietf-ipv6-ndproxy-04.txt).
You may need to re-think your topology; prefix delegation
(e.g., manually or with RFC3633) may help.
2. How do I set up the router running radvd to automatically
configure the interfaces to use an EUI64-based address?
-- You don't. The design philosophy of radvd is that it's
not the _router's_ configuration tool, but a route advertising
daemon. You'll need to set up all the addresses, routes, etc.
yourself. These tasks are something that system initscripts
could possibly do instead.
3. I have a dynamic /48 prefix. How do I set up radvd to:
a) set up interface addresses and routes on downstream
interfaces, and
b) advertise /64 prefixes from the /48 on downstream interfaces?
-- For a), this isn't supported. For b), radvd includes special
support for 6to4 upstream interface but assumes that the interface
addresses/routes are set up manually. This should probably
be done in the initscripts or manually. (Though if someone were
to send a patch for b), it might be incorporated.)
4. How do I set up radvd to do either unicast or multicast routing?
-- You don't. Radvd is not a routing or forwarding daemon.
You need to set any appropriate routing/forwarding first,
and then radvd to only advertise the prefixes to hosts as
appropriate.
--- NEW FILE: TODO ---
$Id: TODO,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
NOTE WELL
=========
*NONE* of the items are being actively worked on.
So, if you're interested in one of these features,
it means you'll have to submit a patch... :-)
read list of interfaces with SIOCGIFCONF (AF_INET6 support in the kernel would
be nice) or from /proc
Quoting Peter Bieringer (peter at bieringer.de):
> Das war's schon. Ach ja, wenn Du mal eine neue Version machst, kannst Du
> noch einen Schalter einbauen, damit radvd trotz debug-level >0 auf Wunsch
> als daemon in den Hintergrund starten kann?
[ Peter wants that a debugging level greater than 0 doesn't stop radvd
from forking.]
support for few protocol constants defined in RFC 2461 Sec 10 is missing.
consider whether UnicastOnly flag should be detected by radvdump.
read the man pages one more time and make sure their are understandable
and English is correct
The following parts of RFC2461(bis) are not implemented:
- section 6.2.1: Adv{Valid,Preferred}Lifetime that decrements in real time,
that is, one that will result in a Lifetime of zero at the specified time in
the future. (MUST)
- section 6.2.5: when AdvSendAdvertisements changes to FALSE, we don't send
a final RA with zero Router Lifetime (we just send it when shutting down).
(SHOULD)
- section 6.2.8: if the link-local address of the router changes, it should
multicast a few RAs from the old address with zero router lifetime, and a
few from the new address. (SHOULD).
Consider whether to support RFC 4286 (Multicast Router Discovery).
Consider whether to support multiple IPv4 addresses with Base6to4Interface
(currently the code just uses the first one).
Consider whether to support a generalization of Base6to4Interface for
arbitrary IPv6 prefixes, to be used for automatic generation of downstream
prefixes. Also consider whether this would need to support multiple IPv6
prefixes on the upstream interfaces. See question 3 in README for more on
this.
Use getifaddrs() instead of ioctl SIOCGIFADDR and other friends. The
problem with this is that e.g. RHL73's glibc didn't support getifaddrs(),
and before glibc 2.3.3 getifaddrs() didn't use netlink so it didn't work
well with IPv6. So, some kind of compat library would be needed if this
would be used...
Consider whether radvd should work around missing/broken interfaces by
default, especially if a previously working interface gets disabled.
Implement Secure Neighbor Discovery (RFC 3971).
--- NEW FILE: VERSION ---
#
# $Id: VERSION,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
#
# this file is automatically processed by configure
#
1.0
--- NEW FILE: aclocal.m4 ---
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN([AM_MISSING_PROG],
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])
dnl AM_PROG_LEX
dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
AC_DEFUN([AM_PROG_LEX],
[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
AC_PROG_LEX
AC_DECL_YYTEXT])
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN([AM_CONFIG_HEADER],
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.
dnl This file resides in the same directory as the config header
dnl that is generated. We must strip everything past the first ":",
dnl and everything past the last "/".
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
<<am_indx=1
for am_file in <<$1>>; do
case " <<$>>CONFIG_HEADERS " in
*" <<$>>am_file "*<<)>>
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
;;
esac
am_indx=`expr "<<$>>am_indx" + 1`
done<<>>dnl>>)
changequote([,]))])
--- NEW FILE: config.cache ---
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs. It is not useful on other systems.
# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already. You can give configure
# the --cache-file=FILE option to use a different cache file; that is
# what configure does when it calls configure scripts in
# subdirectories, so they share the cache.
# Giving --cache-file=/dev/null disables caching, for debugging configure.
# config.status only pays attention to the cache file if you give it the
# --recheck option to rerun configure.
#
ac_cv_c_const=${ac_cv_c_const=yes}
ac_cv_func_getopt_long=${ac_cv_func_getopt_long=yes}
ac_cv_header_getopt_h=${ac_cv_header_getopt_h=yes}
ac_cv_header_inttypes_h=${ac_cv_header_inttypes_h=yes}
ac_cv_header_machine_limits_h=${ac_cv_header_machine_limits_h=no}
ac_cv_header_machine_param_h=${ac_cv_header_machine_param_h=no}
ac_cv_header_net_if_arp_h=${ac_cv_header_net_if_arp_h=yes}
ac_cv_header_net_if_dl_h=${ac_cv_header_net_if_dl_h=no}
ac_cv_header_net_if_types_h=${ac_cv_header_net_if_types_h=no}
ac_cv_header_netinet_ip6_h=${ac_cv_header_netinet_ip6_h=yes}
ac_cv_header_stdc=${ac_cv_header_stdc=yes}
ac_cv_header_sys_param_h=${ac_cv_header_sys_param_h=yes}
ac_cv_header_sys_sockio_h=${ac_cv_header_sys_sockio_h=no}
ac_cv_header_sys_time_h=${ac_cv_header_sys_time_h=yes}
ac_cv_header_time=${ac_cv_header_time=yes}
ac_cv_lib_c_inet_ntop=${ac_cv_lib_c_inet_ntop=yes}
ac_cv_lib_fl_yywrap=${ac_cv_lib_fl_yywrap=yes}
ac_cv_path_GZIP=${ac_cv_path_GZIP=/bin/gzip}
ac_cv_path_LN=${ac_cv_path_LN=/bin/ln}
ac_cv_path_RM=${ac_cv_path_RM=/bin/rm}
ac_cv_path_SED=${ac_cv_path_SED=/bin/sed}
ac_cv_path_TAR=${ac_cv_path_TAR=/bin/tar}
ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
ac_cv_prog_CC=${ac_cv_prog_CC=gcc}
ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
ac_cv_prog_LEX=${ac_cv_prog_LEX=flex}
ac_cv_prog_YACC=${ac_cv_prog_YACC='bison -y'}
ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no}
ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes}
ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes}
ac_cv_prog_gcc=${ac_cv_prog_gcc=yes}
ac_cv_prog_lex_root=${ac_cv_prog_lex_root=lex.yy}
ac_cv_prog_lex_yytext_pointer=${ac_cv_prog_lex_yytext_pointer=yes}
ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set=yes}
--- NEW FILE: config.guess ---
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2002-01-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
[...1280 lines suppressed...]
/bin/universe = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
UNAME_MACHINE = ${UNAME_MACHINE}
UNAME_RELEASE = ${UNAME_RELEASE}
UNAME_SYSTEM = ${UNAME_SYSTEM}
UNAME_VERSION = ${UNAME_VERSION}
EOF
exit 1
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
--- NEW FILE: config.h ---
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define if lex declares yytext as a char * by default, not a char[]. */
#define YYTEXT_POINTER 1
/* Define if you have the getopt_long function. */
#define HAVE_GETOPT_LONG 1
/* Define if you have the <getopt.h> header file. */
#define HAVE_GETOPT_H 1
/* Define if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define if you have the <machine/limits.h> header file. */
/* #undef HAVE_MACHINE_LIMITS_H */
/* Define if you have the <machine/param.h> header file. */
/* #undef HAVE_MACHINE_PARAM_H */
/* Define if you have the <net/if_arp.h> header file. */
#define HAVE_NET_IF_ARP_H 1
/* Define if you have the <net/if_dl.h> header file. */
/* #undef HAVE_NET_IF_DL_H */
/* Define if you have the <net/if_types.h> header file. */
/* #undef HAVE_NET_IF_TYPES_H */
/* Define if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define if you have the <sys/sockio.h> header file. */
/* #undef HAVE_SYS_SOCKIO_H */
/* Define if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define if you have the c library (-lc). */
#define HAVE_LIBC 1
/* whether struct sockaddr_in6 has sin6_scope_id */
#define HAVE_SIN6_SCOPE_ID 1
/* whether struct in6_addr has u6_addrXX and defines s6_addrXX */
#define HAVE_IN6_ADDR_S6_ADDR 1
--- NEW FILE: config.h.in ---
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define to empty if the keyword does not work. */
#undef const
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define if lex declares yytext as a char * by default, not a char[]. */
#undef YYTEXT_POINTER
/* Define if you have the getopt_long function. */
#undef HAVE_GETOPT_LONG
/* Define if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the <machine/limits.h> header file. */
#undef HAVE_MACHINE_LIMITS_H
/* Define if you have the <machine/param.h> header file. */
#undef HAVE_MACHINE_PARAM_H
/* Define if you have the <net/if_arp.h> header file. */
#undef HAVE_NET_IF_ARP_H
/* Define if you have the <net/if_dl.h> header file. */
#undef HAVE_NET_IF_DL_H
/* Define if you have the <net/if_types.h> header file. */
#undef HAVE_NET_IF_TYPES_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <sys/sockio.h> header file. */
#undef HAVE_SYS_SOCKIO_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the c library (-lc). */
#undef HAVE_LIBC
/* whether struct sockaddr_in6 has sin6_scope_id */
#undef HAVE_SIN6_SCOPE_ID
/* whether struct in6_addr has u6_addrXX and defines s6_addrXX */
#undef HAVE_IN6_ADDR_S6_ADDR
--- NEW FILE: config.log ---
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
configure:609: checking host system type
configure:630: checking target system type
configure:648: checking build system type
configure:683: checking for a BSD compatible install
configure:736: checking whether build environment is sane
configure:793: checking whether make sets ${MAKE}
configure:832: checking for working aclocal
configure:845: checking for working autoconf
configure:858: checking for working automake
configure:871: checking for working autoheader
configure:884: checking for working makeinfo
configure:919: checking for gcc
configure:1032: checking whether the C compiler (gcc ) works
configure:1048: gcc -o conftest conftest.c 1>&5
configure:1074: checking whether the C compiler (gcc ) is a cross-compiler
configure:1079: checking whether we are using GNU C
configure:1088: gcc -E conftest.c
configure:1107: checking whether gcc accepts -g
configure:1151: checking for a BSD compatible install
configure:1206: checking for rm
configure:1245: checking for sed
configure:1284: checking for ln
configure:1321: checking for bison
configure:1352: checking how to run the C preprocessor
configure:1373: gcc -E conftest.c >/dev/null 2>conftest.out
configure:1437: checking for flex
configure:1470: checking for flex
configure:1504: checking for yywrap in -lfl
configure:1523: gcc -o conftest -g -O2 conftest.c -lfl 1>&5
configure:1546: checking lex output file root
configure:1567: checking whether yytext is a pointer
configure:1586: gcc -o conftest -g -O2 conftest.c -lfl 1>&5
configure:1610: checking for tar
configure:1645: checking for gzip
configure:1679: checking where to put logfile
configure:1691: checking where to put pidfile
configure:1703: checking where to find configfile
configure:1715: checking which syslog facility to use
configure:1728: checking for inet_ntop in -lc
configure:1747: gcc -o conftest -g -O2 conftest.c -lc 1>&5
configure:1822: checking for ANSI C header files
configure:1835: gcc -E conftest.c >/dev/null 2>conftest.out
configure:1902: gcc -o conftest -g -O2 conftest.c -lc 1>&5
configure: In function 'main':
configure:1897: warning: incompatible implicit declaration of built-in function 'exit'
configure:1929: checking for sys/time.h
configure:1939: gcc -E conftest.c >/dev/null 2>conftest.out
configure:1966: checking whether time.h and sys/time.h may both be included
configure:1980: gcc -c -g -O2 conftest.c 1>&5
configure:2003: checking for netinet/ip6.h
configure:2013: gcc -E conftest.c >/dev/null 2>conftest.out
configure:2082: checking for sys/sockio.h
configure:2092: gcc -E conftest.c >/dev/null 2>conftest.out
configure:2088:24: error: sys/sockio.h: No such file or directory
configure: failed program was:
#line 2087 "configure"
#include "confdefs.h"
#include <sys/sockio.h>
configure:2082: checking for getopt.h
configure:2092: gcc -E conftest.c >/dev/null 2>conftest.out
configure:2082: checking for inttypes.h
configure:2092: gcc -E conftest.c >/dev/null 2>conftest.out
configure:2122: checking for net/if_dl.h
configure:2132: gcc -E conftest.c >/dev/null 2>conftest.out
configure:2128:23: error: net/if_dl.h: No such file or directory
configure: failed program was:
#line 2127 "configure"
#include "confdefs.h"
#include <net/if_dl.h>
configure:2122: checking for net/if_types.h
configure:2132: gcc -E conftest.c >/dev/null 2>conftest.out
configure:2128:26: error: net/if_types.h: No such file or directory
configure: failed program was:
#line 2127 "configure"
#include "confdefs.h"
#include <net/if_types.h>
configure:2122: checking for net/if_arp.h
configure:2132: gcc -E conftest.c >/dev/null 2>conftest.out
configure:2162: checking for sys/param.h
configure:2172: gcc -E conftest.c >/dev/null 2>conftest.out
configure:2202: checking for machine/param.h
configure:2212: gcc -E conftest.c >/dev/null 2>conftest.out
configure:2208:27: error: machine/param.h: No such file or directory
configure: failed program was:
#line 2207 "configure"
#include "confdefs.h"
#include <machine/param.h>
configure:2242: checking for machine/limits.h
configure:2252: gcc -E conftest.c >/dev/null 2>conftest.out
configure:2248:28: error: machine/limits.h: No such file or directory
configure: failed program was:
#line 2247 "configure"
#include "confdefs.h"
#include <machine/limits.h>
configure:2280: checking for working const
configure:2334: gcc -c -g -O2 conftest.c 1>&5
configure:2356: checking whether struct sockaddr_in6 has sin6_scope_id
configure:2367: gcc -c -g -O2 conftest.c 1>&5
configure:2382: checking whether struct in6_addr has u6_addrXX and defines s6_addrXX
configure:2392: gcc -c -g -O2 conftest.c 1>&5
configure: In function 'main':
configure:2388: warning: initialization makes integer from pointer without a cast
configure:2409: checking for getopt_long
configure:2437: gcc -o conftest -g -O2 conftest.c -lc 1>&5
--- NEW FILE: config.status ---
#! /bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host jackalope.cs.berkeley.edu:
#
# ./configure
#
# Compiler output produced by configure, useful for debugging
# configure, is in ./config.log if it exists.
ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]"
for ac_option
do
case "$ac_option" in
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
echo "running ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion"
exec ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "./config.status generated by autoconf version 2.13"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "$ac_cs_usage"; exit 0 ;;
*) echo "$ac_cs_usage"; exit 1 ;;
esac
done
ac_given_srcdir=.
ac_given_INSTALL="/usr/bin/install -c"
trap 'rm -fr Makefile config.h conftest*; exit 1' 1 2 15
# Protect against being on the right side of a sed subst in config.status.
sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g;
s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
/^[ ]*VPATH[ ]*=[^:]*$/d
s%@SHELL@%/bin/sh%g
s%@CFLAGS@%-g -O2%g
s%@CPPFLAGS@%%g
s%@CXXFLAGS@%%g
s%@FFLAGS@%%g
s%@DEFS@%-DHAVE_CONFIG_H%g
s%@LDFLAGS@%%g
s%@LIBS@%-lc %g
s%@exec_prefix@%${prefix}%g
s%@prefix@%/usr/local%g
s%@program_transform_name@%s,x,x,%g
s%@bindir@%${exec_prefix}/bin%g
s%@sbindir@%${exec_prefix}/sbin%g
s%@libexecdir@%${exec_prefix}/libexec%g
s%@datadir@%${prefix}/share%g
s%@sysconfdir@%${prefix}/etc%g
s%@sharedstatedir@%${prefix}/com%g
s%@localstatedir@%${prefix}/var%g
s%@libdir@%${exec_prefix}/lib%g
s%@includedir@%${prefix}/include%g
s%@oldincludedir@%/usr/include%g
s%@infodir@%${prefix}/info%g
s%@mandir@%${prefix}/man%g
s%@host@%x86_64-unknown-linux-gnu%g
s%@host_alias@%x86_64-unknown-linux-gnu%g
s%@host_cpu@%x86_64%g
s%@host_vendor@%unknown%g
s%@host_os@%linux-gnu%g
s%@target@%x86_64-unknown-linux-gnu%g
s%@target_alias@%x86_64-unknown-linux-gnu%g
s%@target_cpu@%x86_64%g
s%@target_vendor@%unknown%g
s%@target_os@%linux-gnu%g
s%@build@%x86_64-unknown-linux-gnu%g
s%@build_alias@%x86_64-unknown-linux-gnu%g
s%@build_cpu@%x86_64%g
s%@build_vendor@%unknown%g
s%@build_os@%linux-gnu%g
s%@INSTALL_PROGRAM@%${INSTALL}%g
s%@INSTALL_SCRIPT@%${INSTALL_PROGRAM}%g
s%@INSTALL_DATA@%${INSTALL} -m 644%g
s%@PACKAGE@%radvd%g
s%@VERSION@%1.0%g
s%@ACLOCAL@%aclocal%g
s%@AUTOCONF@%autoconf%g
s%@AUTOMAKE@%automake%g
s%@AUTOHEADER@%autoheader%g
s%@MAKEINFO@%makeinfo%g
s%@SET_MAKE@%%g
s%@CC@%gcc%g
s%@RM@%/bin/rm%g
s%@SED@%/bin/sed%g
s%@LN@%/bin/ln%g
s%@YACC@%bison -y%g
s%@LEX@%flex%g
s%@LEXLIB@%-lfl%g
s%@CPP@%gcc -E%g
s%@LEX_OUTPUT_ROOT@%lex.yy%g
s%@TAR@%/bin/tar%g
s%@GZIP@%/bin/gzip%g
s%@PATH_RADVD_CONF@%${prefix}/etc/radvd.conf%g
s%@PATH_RADVD_PID@%/var/run/radvd.pid%g
s%@PATH_RADVD_LOG@%/var/log/radvd.log%g
s%@LOG_FACILITY@%LOG_DAEMON%g
CEOF
# Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX.
ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
ac_file=1 # Number of current file.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_cmds # Line after last line for current file.
ac_more_lines=:
ac_sed_cmds=""
while $ac_more_lines; do
if test $ac_beg -gt 1; then
sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
else
sed "${ac_end}q" conftest.subs > conftest.s$ac_file
fi
if test ! -s conftest.s$ac_file; then
ac_more_lines=false
rm -f conftest.s$ac_file
else
if test -z "$ac_sed_cmds"; then
ac_sed_cmds="sed -f conftest.s$ac_file"
else
ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
fi
ac_file=`expr $ac_file + 1`
ac_beg=$ac_end
ac_end=`expr $ac_end + $ac_max_sed_cmds`
fi
done
if test -z "$ac_sed_cmds"; then
ac_sed_cmds=cat
fi
CONFIG_FILES=${CONFIG_FILES-"Makefile"}
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case "$ac_file" in
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
*) ac_file_in="${ac_file}.in" ;;
esac
# Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && mkdir "$ac_dir"
ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
# A "../" for each directory in $ac_dir_suffix.
ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
else
ac_dir_suffix= ac_dots=
fi
case "$ac_given_srcdir" in
.) srcdir=.
if test -z "$ac_dots"; then top_srcdir=.
else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
/*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
*) # Relative path.
srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
top_srcdir="$ac_dots$ac_given_srcdir" ;;
esac
case "$ac_given_INSTALL" in
[/$]*) INSTALL="$ac_given_INSTALL" ;;
*) INSTALL="$ac_dots$ac_given_INSTALL" ;;
esac
echo creating "$ac_file"
rm -f "$ac_file"
configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
case "$ac_file" in
*Makefile*) ac_comsub="1i\\
# $configure_input" ;;
*) ac_comsub= ;;
esac
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
sed -e "$ac_comsub
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
s%@INSTALL@%$INSTALL%g
" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
fi; done
rm -f conftest.s*
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
# NAME is the cpp macro being defined and VALUE is the value it is being given.
#
# ac_d sets the value in "#define NAME VALUE" lines.
ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
ac_dC='\3'
ac_dD='%g'
# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_uB='\([ ]\)%\1#\2define\3'
ac_uC=' '
ac_uD='\4%g'
# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_eB='$%\1#\2define\3'
ac_eC=' '
ac_eD='%g'
if test "${CONFIG_HEADERS+set}" != set; then
CONFIG_HEADERS="config.h"
fi
for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case "$ac_file" in
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
*) ac_file_in="${ac_file}.in" ;;
esac
echo creating $ac_file
rm -f conftest.frag conftest.in conftest.out
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
cat $ac_file_inputs > conftest.in
cat > conftest.frag <<CEOF
${ac_dA}YYTEXT_POINTER${ac_dB}YYTEXT_POINTER${ac_dC}1${ac_dD}
${ac_uA}YYTEXT_POINTER${ac_uB}YYTEXT_POINTER${ac_uC}1${ac_uD}
${ac_eA}YYTEXT_POINTER${ac_eB}YYTEXT_POINTER${ac_eC}1${ac_eD}
${ac_dA}HAVE_LIBC${ac_dB}HAVE_LIBC${ac_dC}1${ac_dD}
${ac_uA}HAVE_LIBC${ac_uB}HAVE_LIBC${ac_uC}1${ac_uD}
${ac_eA}HAVE_LIBC${ac_eB}HAVE_LIBC${ac_eC}1${ac_eD}
${ac_dA}STDC_HEADERS${ac_dB}STDC_HEADERS${ac_dC}1${ac_dD}
${ac_uA}STDC_HEADERS${ac_uB}STDC_HEADERS${ac_uC}1${ac_uD}
${ac_eA}STDC_HEADERS${ac_eB}STDC_HEADERS${ac_eC}1${ac_eD}
${ac_dA}HAVE_SYS_TIME_H${ac_dB}HAVE_SYS_TIME_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_SYS_TIME_H${ac_uB}HAVE_SYS_TIME_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_SYS_TIME_H${ac_eB}HAVE_SYS_TIME_H${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}TIME_WITH_SYS_TIME${ac_dB}TIME_WITH_SYS_TIME${ac_dC}1${ac_dD}
${ac_uA}TIME_WITH_SYS_TIME${ac_uB}TIME_WITH_SYS_TIME${ac_uC}1${ac_uD}
${ac_eA}TIME_WITH_SYS_TIME${ac_eB}TIME_WITH_SYS_TIME${ac_eC}1${ac_eD}
${ac_dA}HAVE_GETOPT_H${ac_dB}HAVE_GETOPT_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_GETOPT_H${ac_uB}HAVE_GETOPT_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_GETOPT_H${ac_eB}HAVE_GETOPT_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_INTTYPES_H${ac_dB}HAVE_INTTYPES_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_INTTYPES_H${ac_uB}HAVE_INTTYPES_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_INTTYPES_H${ac_eB}HAVE_INTTYPES_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_NET_IF_ARP_H${ac_dB}HAVE_NET_IF_ARP_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_NET_IF_ARP_H${ac_uB}HAVE_NET_IF_ARP_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_NET_IF_ARP_H${ac_eB}HAVE_NET_IF_ARP_H${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_SYS_PARAM_H${ac_dB}HAVE_SYS_PARAM_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_SYS_PARAM_H${ac_uB}HAVE_SYS_PARAM_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_SYS_PARAM_H${ac_eB}HAVE_SYS_PARAM_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_SIN6_SCOPE_ID${ac_dB}HAVE_SIN6_SCOPE_ID${ac_dC}1${ac_dD}
${ac_uA}HAVE_SIN6_SCOPE_ID${ac_uB}HAVE_SIN6_SCOPE_ID${ac_uC}1${ac_uD}
${ac_eA}HAVE_SIN6_SCOPE_ID${ac_eB}HAVE_SIN6_SCOPE_ID${ac_eC}1${ac_eD}
${ac_dA}HAVE_IN6_ADDR_S6_ADDR${ac_dB}HAVE_IN6_ADDR_S6_ADDR${ac_dC}1${ac_dD}
${ac_uA}HAVE_IN6_ADDR_S6_ADDR${ac_uB}HAVE_IN6_ADDR_S6_ADDR${ac_uC}1${ac_uD}
${ac_eA}HAVE_IN6_ADDR_S6_ADDR${ac_eB}HAVE_IN6_ADDR_S6_ADDR${ac_eC}1${ac_eD}
${ac_dA}HAVE_GETOPT_LONG${ac_dB}HAVE_GETOPT_LONG${ac_dC}1${ac_dD}
${ac_uA}HAVE_GETOPT_LONG${ac_uB}HAVE_GETOPT_LONG${ac_uC}1${ac_uD}
${ac_eA}HAVE_GETOPT_LONG${ac_eB}HAVE_GETOPT_LONG${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
rm -f conftest.frag conftest.h
echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
cat conftest.in >> conftest.h
rm -f conftest.in
if cmp -s $ac_file conftest.h 2>/dev/null; then
echo "$ac_file is unchanged"
rm -f conftest.h
else
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && mkdir "$ac_dir"
fi
rm -f $ac_file
mv conftest.h $ac_file
fi
fi; done
ac_sources="device-linux.c"
ac_dests="device.c"
srcdir=$ac_given_srcdir
while test -n "$ac_sources"; do
set $ac_dests; ac_dest=$1; shift; ac_dests=$*
set $ac_sources; ac_source=$1; shift; ac_sources=$*
echo "linking $srcdir/$ac_source to $ac_dest"
if test ! -r $srcdir/$ac_source; then
{ echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; }
fi
rm -f $ac_dest
# Make relative symlinks.
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'`
if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
# The dest file is in a subdirectory.
test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
# A "../" for each directory in $ac_dest_dir_suffix.
ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'`
else
ac_dest_dir_suffix= ac_dots=
fi
case "$srcdir" in
[/$]*) ac_rel_source="$srcdir/$ac_source" ;;
*) ac_rel_source="$ac_dots$srcdir/$ac_source" ;;
esac
# Make a symlink if possible; otherwise try a hard link.
if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
ln $srcdir/$ac_source $ac_dest; then :
else
{ echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; }
fi
done
test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
exit 0
--- NEW FILE: config.sub ---
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2002-01-02'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[...1401 lines suppressed...]
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
vendor=atari
;;
-vos*)
vendor=stratus
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
--- NEW FILE: configure ---
#! /bin/sh
# From configure.in ($Id: configure,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $)
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
#
# Check to make sure that the build environment is sane.
#
[...2872 lines suppressed...]
if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
ln $srcdir/$ac_source $ac_dest; then :
else
{ echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; }
fi
done
EOF
cat >> $CONFIG_STATUS <<EOF
EOF
cat >> $CONFIG_STATUS <<\EOF
test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
exit 0
EOF
chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
--- NEW FILE: configure.in ---
dnl
dnl $Id: configure.in,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
dnl
dnl Authors:
dnl Lars Fenneberg <lf at elemental.net>
dnl
dnl This software is Copyright 1996-2000 by the above mentioned author(s),
dnl All Rights Reserved.
dnl
dnl The license which is distributed with this software in the file COPYRIGHT
dnl applies to this software. If your distribution is missing this file, you
dnl may request it from <pekkas at netcore.fi>.
dnl
dnl
AC_REVISION ($Id: configure.in,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $)
AC_INIT(radvd.c)
AC_CANONICAL_SYSTEM
VERSION=`cat ${srcdir}/VERSION | grep -v '^#' | tr -d '\012'`
AM_INIT_AUTOMAKE(radvd,$VERSION,true)
echo $ac_n "building for architecture""... $ac_c" 1>&6
case "$target" in
*linux*)
AC_MSG_RESULT(linux)
arch=linux
;;
*bsd*)
AC_MSG_RESULT(bsd44)
arch=bsd44
;;
*)
AC_MSG_RESULT(unknown)
AC_MSG_ERROR(
[currently only Linux and BSD 4.4 with NRL's IPv6 code are
supported. If you have such a system and it is not guessed correctly
you must specifiy it with --target on the configure command line])
;;
esac
dnl Determine CC and preset CFLAGS
AC_PROG_CC
dnl Needed for normal compile
AC_PROG_INSTALL
AC_PATH_PROG(RM, rm, NOTFOUND)
if test "x$RM" = xNOTFOUND; then
AC_MSG_ERROR(can't find rm in your path - check PATH)
fi
AC_PATH_PROG(SED, sed, NOTFOUND)
if test "x$SED" = xNOTFOUND; then
AC_MSG_ERROR(can't find sed in your path - check PATH)
fi
dnl Not needed
AC_PATH_PROG(LN, ln)
AC_PROG_YACC
AM_PROG_LEX
AC_PATH_PROG(TAR, tar)
AC_PATH_PROG(GZIP, gzip)
dnl Check where to put the logfile
AC_MSG_CHECKING(where to put logfile)
AC_ARG_WITH(logfile,
[ --with-logfile Path to the radvd logfile [/var/log/radvd.log]],
PATH_RADVD_LOG=$withval,
PATH_RADVD_LOG=/var/log/radvd.log)
AC_MSG_RESULT($PATH_RADVD_LOG)
dnl Check where to put the pidfile
AC_MSG_CHECKING(where to put pidfile)
AC_ARG_WITH(pidfile,
[ --with-pidfile Path to the radvd pidfile [/var/run/radvd.pid]],
PATH_RADVD_PID=$withval,
PATH_RADVD_PID=/var/run/radvd.pid)
AC_MSG_RESULT($PATH_RADVD_PID)
dnl Check where to put the configfile
AC_MSG_CHECKING(where to find configfile)
AC_ARG_WITH(configfile,
[ --with-configfile Path to the radvd config file [SYSCONF/radvd.conf]],
PATH_RADVD_CONF=$withval,
PATH_RADVD_CONF=${sysconfdir}/radvd.conf)
AC_MSG_RESULT($PATH_RADVD_CONF)
dnl Checking which syslog facility to use
AC_MSG_CHECKING(which syslog facility to use)
AC_ARG_WITH(facility,
[ --with-facility Syslog facility to use when using syslog logging],
LOG_FACILITY=$withval,
LOG_FACILITY=LOG_DAEMON)
AC_MSG_RESULT($LOG_FACILITY)
dnl Checks for libraries.
AC_CHECK_LIB(c, inet_ntop,,
AC_CHECK_LIB(inet6, inet_ntop,
LIBS="$LIBS -linet6"
,
AC_MSG_ERROR(can't continue without libinet6.a library - check your LDFLAGS)
)
)
# prevent caching
unset ac_cv_lib_inet6_inet_ntop
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/time.h)
AC_HEADER_TIME
AC_CHECK_HEADER(netinet/ip6.h, hdrfound=yes, hdrfound=no)
if test "$hdrfound" = no
then
# deprecated
AC_CHECK_HEADER(netinet/ipv6.h, hdrfound=yes)
fi
if test "$hdrfound" = no
then
AC_MSG_RESULT(no)
fi
unset hdrfound
AC_CHECK_HEADERS(sys/sockio.h getopt.h inttypes.h)
AC_CHECK_HEADERS(net/if_dl.h net/if_types.h net/if_arp.h)
AC_CHECK_HEADERS(sys/param.h)
AC_CHECK_HEADERS(machine/param.h)
AC_CHECK_HEADERS(machine/limits.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_MSG_CHECKING(whether struct sockaddr_in6 has sin6_scope_id)
AC_TRY_COMPILE([#include <sys/types.h>
#include <netinet/in.h>], [static struct sockaddr_in6 ac_sin6; int ac_size =
sizeof (ac_sin6.sin6_scope_id);], [AC_MSG_RESULT(yes); AC_DEFINE([HAVE_SIN6_SCOPE_ID],
1, [whether struct sockaddr_in6 has sin6_scope_id])],
AC_MSG_RESULT(no))
AC_MSG_CHECKING(whether struct in6_addr has u6_addrXX and defines s6_addrXX)
AC_TRY_COMPILE([#include <netinet/in.h>], [static struct in6_addr in6_u;
int u = in6_u.s6_addr16;], [AC_MSG_RESULT(yes); AC_DEFINE([HAVE_IN6_ADDR_S6_ADDR],
1, [whether struct in6_addr has u6_addrXX and defines s6_addrXX])],
AC_MSG_RESULT(no))
dnl Checks for library functions.
AC_CHECK_FUNCS(getopt_long)
AC_LINK_FILES(device-${arch}.c, device.c)
AC_SUBST(VERSION)
AC_SUBST(PATH_RADVD_CONF)
AC_SUBST(PATH_RADVD_PID)
AC_SUBST(PATH_RADVD_LOG)
AC_SUBST(LOG_FACILITY)
AM_CONFIG_HEADER(config.h)
AC_OUTPUT(Makefile)
--- NEW FILE: copyright.blurb ---
/*
* $Id: copyright.blurb,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
--- NEW FILE: defaults.h ---
/*
* $Id: defaults.h,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#ifndef DEFAULTS_H
#define DEFAULTS_H
#include <config.h>
#include <includes.h>
#include <radvd.h>
/* maximum message size for incoming and outgoing RSs and RAs */
#define MSG_SIZE 4096
#define MAX2(X,Y) ( (( X ) >= ( Y )) ? ( X ) : ( Y ))
/* Router Configuration Variables: */
/* For each multicast interface: */
#define DFLT_IgnoreIfMissing 0
#define DFLT_AdvSendAdv 0
#define DFLT_MaxRtrAdvInterval 600
#define DFLT_MinRtrAdvInterval(iface) (0.33 * (iface)->MaxRtrAdvInterval)
#define DFLT_AdvManagedFlag 0
#define DFLT_AdvOtherConfigFlag 0
#define DFLT_AdvLinkMTU 0
#define DFLT_AdvReachableTime 0
#define DFLT_AdvRetransTimer 0
#define DFLT_AdvCurHopLimit 64 /* as per RFC 1700 or the
next incarnation of it :) */
#define DFLT_AdvDefaultLifetime(iface) MAX2(1, (int)(3.0 * (iface)->MaxRtrAdvInterval))
#define DFLT_MinDelayBetweenRAs MIN_DELAY_BETWEEN_RAS
#define DFLT_AdvDefaultPreference 0
/* Options sent with RA */
#define DFLT_AdvSourceLLAddress 1
/* Each prefix has an associated: */
#define DFLT_AdvValidLifetime 2592000 /* seconds */
#define DFLT_AdvOnLinkFlag 1
#define DFLT_AdvPreferredLifetime 604800 /* seconds */
#define DFLT_AdvAutonomousFlag 1
/* Each route has an associated: */
#define DFLT_AdvRouteLifetime(iface) (3 * (iface)->MaxRtrAdvInterval)
#define DFLT_AdvRoutePreference 0 /* medium*/
/* RDNSS */
#define DFLT_AdvRDNSSPreference 8 /* medium */
#define DFLT_AdvRDNSSOpenFlag 0
#define DFLT_AdvRDNSSLifetime(iface) (iface)->MaxRtrAdvInterval
/* Protocol (RFC2461) constants: */
/* Router constants: */
#define MAX_INITIAL_RTR_ADVERT_INTERVAL 16
#define MAX_INITIAL_RTR_ADVERTISEMENTS 3
#define MAX_FINAL_RTR_ADVERTISEMENTS 3
#define MIN_DELAY_BETWEEN_RAS 3.0
#define MIN_DELAY_BETWEEN_RAS_MIPv6 (30.0/1000.0)
#define MAX_RA_DELAY_TIME (1000.0/2.0) /* milliseconds */
/* Host constants: */
#define MAX_RTR_SOLICITATION_DELAY 1
#define RTR_SOLICITATION_INTERVAL 4
#define MAX_RTR_SOLICITATIONS 3
/* Node constants: */
#define MAX_MULTICAST_SOLICIT 3
#define MAX_UNICAST_SOLICIT 3
#define MAX_ANYCAST_DELAY_TIME 1
#define MAX_NEIGHBOR_ADVERTISEMENT 3
#define REACHABLE_TIME 30000 /* milliseconds */
#define RETRANS_TIMER 1000 /* milliseconds */
#define DELAY_FIRST_PROBE_TIME 5
#define MIN_RANDOM_FACTOR (1.0/2.0)
#define MAX_RANDOM_FACTOR (3.0/2.0)
/* MAX and MIN (RFC2461), Mobile IPv6 extensions will override if in use */
#define MIN_MaxRtrAdvInterval 4
#define MAX_MaxRtrAdvInterval 1800
#define MIN_MinRtrAdvInterval 3
#define MAX_MinRtrAdvInterval(iface) (0.75 * (iface)->MaxRtrAdvInterval)
#define MIN_AdvDefaultLifetime(iface) (MAX2(1,(iface)->MaxRtrAdvInterval))
#define MAX_AdvDefaultLifetime 9000
#define MIN_AdvLinkMTU 1280
#define MAX_AdvReachableTime 3600000 /* 1 hour in milliseconds */
#define MAX_AdvCurHopLimit 255
#define MAX_PrefixLen 128
/*
* Mobile IPv6 extensions, off by default
*/
#define DFLT_AdvRouterAddr 0
#define DFLT_AdvHomeAgentFlag 0
#define DFLT_AdvIntervalOpt 0
#define DFLT_AdvHomeAgentInfo 0
/* Option types (defined also at least in glibc 2.2's netinet/icmp6.h) */
#ifndef ND_OPT_RTR_ADV_INTERVAL
#define ND_OPT_RTR_ADV_INTERVAL 7
#endif
#ifndef ND_OPT_HOME_AGENT_INFO
#define ND_OPT_HOME_AGENT_INFO 8
#endif
/* de-facto codepoint used by many implementations was '9',
the official IANA assignment will be '24' */
#undef ND_OPT_ROUTE_INFORMATION
#define ND_OPT_ROUTE_INFORMATION 24
/* XXX: some libc's like KAME already had nd_opt_route_info! */
struct nd_opt_route_info_local /* route information */
{
uint8_t nd_opt_ri_type;
uint8_t nd_opt_ri_len;
uint8_t nd_opt_ri_prefix_len;
uint8_t nd_opt_ri_flags_reserved;
uint32_t nd_opt_ri_lifetime;
struct in6_addr nd_opt_ri_prefix;
};
/* the reserved field is 8 bits and we're interested of the middle two: 000xx000 */
#define ND_OPT_RI_PRF_SHIFT 3
#define ND_OPT_RI_PRF_MASK (3 << ND_OPT_RI_PRF_SHIFT) /* 00011000 = 0x18 */
#undef ND_OPT_RDNSS_INFORMATION
#define ND_OPT_RDNSS_INFORMATION 25
/* */
struct nd_opt_rdnss_info_local
{
uint8_t nd_opt_rdnssi_type;
uint8_t nd_opt_rdnssi_len;
uint16_t nd_opt_rdnssi_pref_flag_reserved;
uint32_t nd_opt_rdnssi_lifetime;
struct in6_addr nd_opt_rdnssi_addr1;
struct in6_addr nd_opt_rdnssi_addr2;
struct in6_addr nd_opt_rdnssi_addr3;
};
/* pref/flag/reserved field : yyyyx00000000000 (big endian) - 00000000yyyyx000 (little indian); where yyyy = pref, x = flag */
#if BYTE_ORDER == BIG_ENDIAN
#define ND_OPT_RDNSSI_PREF_SHIFT 12
#else
#define ND_OPT_RDNSSI_PREF_SHIFT 4
#endif
#define ND_OPT_RDNSSI_PREF_MASK (0xf << ND_OPT_RDNSSI_PREF_SHIFT)
/* Flags */
#ifndef ND_RA_FLAG_HOME_AGENT
#define ND_RA_FLAG_HOME_AGENT 0x20
#endif
#ifndef ND_OPT_PI_FLAG_RADDR
#define ND_OPT_PI_FLAG_RADDR 0x20
#endif
#ifndef ND_OPT_RDNSSI_FLAG_S
#if BYTE_ORDER == BIG_ENDIAN
#define ND_OPT_RDNSSI_FLAG_S 0x0800
#else
#define ND_OPT_RDNSSI_FLAG_S 0x0008
#endif
#endif
/* Configurable values */
#define DFLT_HomeAgentPreference 0
#define DFLT_HomeAgentLifetime(iface) ((iface)->AdvDefaultLifetime)
/* Other */
#define MIN_MinRtrAdvInterval_MIPv6 (3.0/100.0)
#define MIN_MaxRtrAdvInterval_MIPv6 (7.0/100.0)
#define RTR_SOLICITATION_INTERVAL_MIPv6 1 /* Recommended value by MIPv6 */
#define Cautious_MaxRtrAdvInterval (2.0/10.0)
#define Cautious_MaxRtrAdvInterval_Leeway (2.0/100.0)
#define MIN_HomeAgentLifetime 1 /* 0 must NOT be used */
#define MAX_HomeAgentLifetime 65520 /* 18.2 hours in secs */
/* #define MAX_RTR_SOLICITATIONS This MAY be ignored by MIPv6 */
/* NEMO extensions, off by default */
#define DFLT_AdvMobRtrSupportFlag 0
/* Flags */
#ifndef ND_OPT_HAI_FLAG_SUPPORT_MR
#if BYTE_ORDER == BIG_ENDIAN
#define ND_OPT_HAI_FLAG_SUPPORT_MR 0x8000
#else /* BYTE_ORDER == LITTLE_ENDIAN */
#define ND_OPT_HAI_FLAG_SUPPORT_MR 0x0080
#endif
#endif
#endif
--- NEW FILE: depcomp ---
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva at dcc.unicamp.br>.
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# `libtool' can also be set to `yes' or `no'.
if test -z "$depfile"; then
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
dir=`echo "$object" | sed 's,/.*$,/,'`
if test "$dir" = "$object"; then
dir=
fi
# FIXME: should be _deps on DOS.
depfile="$dir.deps/$base"
fi
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1="$dir.libs/$base.lo.d"
tmpdepfile2="$dir.libs/$base.d"
"$@" -Wc,-MD
else
tmpdepfile1="$dir$base.o.d"
tmpdepfile2="$dir$base.d"
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
else
tmpdepfile="$tmpdepfile2"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
--- NEW FILE: device-bsd44.c ---
/*
* $Id: device-bsd44.c,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Craig Metz <cmetz at inner.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#include <config.h>
#include <includes.h>
#include <radvd.h>
#include <defaults.h>
#include <pathnames.h> /* for PATH_PROC_NET_IF_INET6 */
static uint8_t ll_prefix[] = { 0xfe, 0x80 };
/*
* this function gets the hardware type and address of an interface,
* determines the link layer token length and checks it against
* the defined prefixes
*/
int
setup_deviceinfo(int sock, struct Interface *iface)
{
struct ifconf ifconf;
struct ifreq ifr;
unsigned int nlen;
uint8_t *p, *end;
struct AdvPrefix *prefix;
char zero[sizeof(iface->if_addr)];
/* just allocate 8192 bytes, should be more than enough.. */
if (!(ifconf.ifc_buf = malloc(ifconf.ifc_len = (32 << 8))))
{
flog(LOG_CRIT, "malloc failed: %s", strerror(errno));
goto ret;
}
if (ioctl(sock, SIOCGIFCONF, &ifconf) < 0)
{
flog(LOG_ERR, "ioctl(SIOCGIFCONF) failed: %s(%d)", strerror(errno), errno);
goto ret;
}
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, iface->Name, IFNAMSIZ-1);
ifr.ifr_name[IFNAMSIZ-1] = '\0';
if (ioctl(sock, SIOCGIFMTU, &ifr) < 0) {
flog(LOG_ERR, "ioctl(SIOCGIFMTU) failed for %s: %s", iface->Name, strerror(errno));
goto ret;
}
dlog(LOG_DEBUG, 3, "mtu for %s is %d", iface->Name, ifr.ifr_mtu);
iface->if_maxmtu = ifr.ifr_mtu;
p = (uint8_t *)ifconf.ifc_buf;
end = p + ifconf.ifc_len;
nlen = strlen(iface->Name);
while(p < end)
{
p += IFNAMSIZ;
if ((p + 2) >= end)
break;
if ((p + *p) >= end)
break;
if ((*(p + 1) == AF_LINK) &&
(((struct sockaddr_dl *)p)->sdl_nlen == nlen) &&
(!memcmp(iface->Name, ((struct sockaddr_dl *)p)->sdl_data, nlen)))
{
if (((struct sockaddr_dl *)p)->sdl_alen > sizeof(iface->if_addr))
{
flog(LOG_ERR, "address length %d too big for",
((struct sockaddr_dl *)p)->sdl_alen,
iface->Name);
goto ret;
}
memcpy(iface->if_hwaddr, LLADDR((struct sockaddr_dl *)p), ((struct sockaddr_dl *)p)->sdl_alen);
iface->if_hwaddr_len = ((struct sockaddr_dl *)p)->sdl_alen << 3;
switch(((struct sockaddr_dl *)p)->sdl_type) {
case IFT_ETHER:
case IFT_ISO88023:
iface->if_prefix_len = 64;
break;
case IFT_FDDI:
iface->if_prefix_len = 64;
break;
default:
iface->if_prefix_len = -1;
iface->if_maxmtu = -1;
break;
}
dlog(LOG_DEBUG, 3, "link layer token length for %s is %d", iface->Name,
iface->if_hwaddr_len);
dlog(LOG_DEBUG, 3, "prefix length for %s is %d", iface->Name,
iface->if_prefix_len);
if (iface->if_prefix_len != -1) {
memset(zero, 0, ((struct sockaddr_dl *)p)->sdl_alen);
if (!memcmp(iface->if_hwaddr, zero, ((struct sockaddr_dl *)p)->sdl_alen))
flog(LOG_WARNING, "WARNING, MAC address on %s is all zero!",
iface->Name);
}
prefix = iface->AdvPrefixList;
while (prefix)
{
if ((iface->if_prefix_len != -1) &&
(iface->if_prefix_len != prefix->PrefixLen))
{
flog(LOG_WARNING, "prefix length should be %d for %s",
iface->if_prefix_len, iface->Name);
}
prefix = prefix->next;
}
free(ifconf.ifc_buf);
return 0;
}
p += *p;
}
ret:
iface->if_maxmtu = -1;
iface->if_hwaddr_len = -1;
iface->if_prefix_len = -1;
free(ifconf.ifc_buf);
return -1;
}
int setup_linklocal_addr(int sock, struct Interface *iface)
{
struct ifconf ifconf;
unsigned int nlen;
uint8_t *p, *end;
int index = 0;
/* just allocate 8192 bytes, should be more than enough.. */
if (!(ifconf.ifc_buf = malloc(ifconf.ifc_len = (32 << 8))))
{
flog(LOG_CRIT, "malloc failed: %s", strerror(errno));
goto ret;
}
if (ioctl(sock, SIOCGIFCONF, &ifconf) < 0)
{
flog(LOG_ERR, "ioctl(SIOCGIFCONF) failed: %s(%d)", strerror(errno), errno);
goto ret;
}
p = (uint8_t *)ifconf.ifc_buf;
end = p + ifconf.ifc_len;
nlen = strlen(iface->Name);
while(p < end)
{
p += IFNAMSIZ;
if ((p + 2) >= end)
break;
if ((p + *p) >= end)
break;
if ((*(p + 1) == AF_LINK) &&
(((struct sockaddr_dl *)p)->sdl_nlen == nlen) &&
(!memcmp(iface->Name, ((struct sockaddr_dl *)p)->sdl_data, nlen)))
{
index = ((struct sockaddr_dl *)p)->sdl_index;
}
if (index && (*(p + 1) == AF_INET6))
if (!memcmp(&((struct sockaddr_in6 *)p)->sin6_addr, ll_prefix, sizeof(ll_prefix)))
{
memcpy(&iface->if_addr, &((struct sockaddr_in6 *)p)->sin6_addr, sizeof(struct in6_addr));
iface->if_index = index;
free(ifconf.ifc_buf);
return 0;
}
p += *p;
}
ret:
flog(LOG_ERR, "no linklocal address configured for %s", iface->Name);
free(ifconf.ifc_buf);
return -1;
}
int setup_allrouters_membership(int sock, struct Interface *iface)
{
return (0);
}
int check_allrouters_membership(int sock, struct Interface *iface)
{
return (0);
}
int
set_interface_linkmtu(const char *iface, uint32_t mtu)
{
dlog(LOG_DEBUG, 4, "setting LinkMTU (%u) for %s is not supported",
mtu, iface);
return -1;
}
int
set_interface_curhlim(const char *iface, uint8_t hlim)
{
dlog(LOG_DEBUG, 4, "setting CurHopLimit (%u) for %s is not supported",
hlim, iface);
return -1;
}
int
set_interface_reachtime(const char *iface, uint32_t rtime)
{
dlog(LOG_DEBUG, 4, "setting BaseReachableTime (%u) for %s is not supported",
rtime, iface);
return -1;
}
int
set_interface_retranstimer(const char *iface, uint32_t rettimer)
{
dlog(LOG_DEBUG, 4, "setting RetransTimer (%u) for %s is not supported",
rettimer, iface);
return -1;
}
--- NEW FILE: device-common.c ---
/*
* $Id: device-common.c,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#include <config.h>
#include <includes.h>
#include <radvd.h>
#include <defaults.h>
int
check_device(int sock, struct Interface *iface)
{
struct ifreq ifr;
strncpy(ifr.ifr_name, iface->Name, IFNAMSIZ-1);
ifr.ifr_name[IFNAMSIZ-1] = '\0';
if (ioctl(sock, SIOCGIFFLAGS, &ifr) < 0)
{
if (!iface->IgnoreIfMissing)
flog(LOG_ERR, "ioctl(SIOCGIFFLAGS) failed for %s: %s",
iface->Name, strerror(errno));
return (-1);
}
if (!(ifr.ifr_flags & IFF_UP))
{
if (!iface->IgnoreIfMissing)
flog(LOG_ERR, "interface %s is not UP", iface->Name);
return (-1);
}
if (! iface->UnicastOnly && !(ifr.ifr_flags & IFF_MULTICAST))
{
flog(LOG_WARNING, "interface %s does not support multicast",
iface->Name);
flog(LOG_WARNING, " do you need to add the UnicastOnly flag?");
}
#if 0
/* SDH : ignore these warnings... */
if (! iface->UnicastOnly && !(ifr.ifr_flags & IFF_BROADCAST))
{
flog(LOG_WARNING, "interface %s does not support broadcast",
iface->Name);
flog(LOG_WARNING, " do you need to add the UnicastOnly flag?");
}
#endif
return 0;
}
int
get_v4addr(const char *ifn, unsigned int *dst)
{
struct ifreq ifr;
struct sockaddr_in *addr;
int fd;
if( ( fd = socket(AF_INET,SOCK_DGRAM,0) ) < 0 )
{
flog(LOG_ERR, "create socket for IPv4 ioctl failed for %s: %s",
ifn, strerror(errno));
return (-1);
}
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, ifn, IFNAMSIZ-1);
ifr.ifr_name[IFNAMSIZ-1] = '\0';
ifr.ifr_addr.sa_family = AF_INET;
if (ioctl(fd, SIOCGIFADDR, &ifr) < 0)
{
flog(LOG_ERR, "ioctl(SIOCGIFADDR) failed for %s: %s",
ifn, strerror(errno));
close( fd );
return (-1);
}
addr = (struct sockaddr_in *)(&ifr.ifr_addr);
dlog(LOG_DEBUG, 3, "IPv4 address for %s is %s", ifn,
inet_ntoa( addr->sin_addr ) );
*dst = addr->sin_addr.s_addr;
close( fd );
return 0;
}
--- NEW FILE: device-linux.c ---
/*
* $Id: device-linux.c,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#include <config.h>
#include <includes.h>
#include <radvd.h>
#include <defaults.h>
#include <pathnames.h> /* for PATH_PROC_NET_IF_INET6 */
#ifndef IPV6_ADDR_LINKLOCAL
#define IPV6_ADDR_LINKLOCAL 0x0020U
#endif
/*
* this function gets the hardware type and address of an interface,
* determines the link layer token length and checks it against
* the defined prefixes
*/
int
setup_deviceinfo(int sock, struct Interface *iface)
{
struct ifreq ifr;
struct AdvPrefix *prefix;
char zero[sizeof(iface->if_addr)];
strncpy(ifr.ifr_name, iface->Name, IFNAMSIZ-1);
ifr.ifr_name[IFNAMSIZ-1] = '\0';
if (ioctl(sock, SIOCGIFMTU, &ifr) < 0) {
flog(LOG_ERR, "ioctl(SIOCGIFMTU) failed for %s: %s",
iface->Name, strerror(errno));
return (-1);
}
dlog(LOG_DEBUG, 3, "mtu for %s is %d", iface->Name, ifr.ifr_mtu);
iface->if_maxmtu = ifr.ifr_mtu;
if (ioctl(sock, SIOCGIFHWADDR, &ifr) < 0)
{
flog(LOG_ERR, "ioctl(SIOCGIFHWADDR) failed for %s: %s",
iface->Name, strerror(errno));
return (-1);
}
dlog(LOG_DEBUG, 3, "hardware type for %s is %d", iface->Name,
ifr.ifr_hwaddr.sa_family);
switch(ifr.ifr_hwaddr.sa_family)
{
case ARPHRD_ETHER:
iface->if_hwaddr_len = 48;
iface->if_prefix_len = 64;
break;
#ifdef ARPHRD_FDDI
case ARPHRD_FDDI:
iface->if_hwaddr_len = 48;
iface->if_prefix_len = 64;
break;
#endif /* ARPHDR_FDDI */
#ifdef ARPHRD_ARCNET
case ARPHRD_ARCNET:
iface->if_hwaddr_len = 8;
iface->if_prefix_len = -1;
iface->if_maxmtu = -1;
break;
#endif /* ARPHDR_ARCNET */
default:
iface->if_hwaddr_len = -1;
iface->if_prefix_len = -1;
iface->if_maxmtu = -1;
break;
}
dlog(LOG_DEBUG, 3, "link layer token length for %s is %d", iface->Name,
iface->if_hwaddr_len);
dlog(LOG_DEBUG, 3, "prefix length for %s is %d", iface->Name,
iface->if_prefix_len);
if (iface->if_hwaddr_len != -1) {
unsigned int if_hwaddr_len_bytes = (iface->if_hwaddr_len + 7) >> 3;
if (if_hwaddr_len_bytes > sizeof(iface->if_hwaddr)) {
flog(LOG_ERR, "address length %d too big for %s", if_hwaddr_len_bytes, iface->Name);
return(-2);
}
memcpy(iface->if_hwaddr, ifr.ifr_hwaddr.sa_data, if_hwaddr_len_bytes);
memset(zero, 0, sizeof(zero));
if (!memcmp(iface->if_hwaddr, zero, if_hwaddr_len_bytes))
flog(LOG_WARNING, "WARNING, MAC address on %s is all zero!",
iface->Name);
}
prefix = iface->AdvPrefixList;
while (prefix)
{
if ((iface->if_prefix_len != -1) &&
(iface->if_prefix_len != prefix->PrefixLen))
{
flog(LOG_WARNING, "prefix length should be %d for %s",
iface->if_prefix_len, iface->Name);
}
prefix = prefix->next;
}
return (0);
}
/*
* this function extracts the link local address and interface index
* from PATH_PROC_NET_IF_INET6. Note: 'sock' unused in Linux.
*/
int setup_linklocal_addr(int sock, struct Interface *iface)
{
FILE *fp;
char str_addr[40];
unsigned int plen, scope, dad_status, if_idx;
char devname[IFNAMSIZ];
if ((fp = fopen(PATH_PROC_NET_IF_INET6, "r")) == NULL)
{
flog(LOG_ERR, "can't open %s: %s", PATH_PROC_NET_IF_INET6,
strerror(errno));
return (-1);
}
while (fscanf(fp, "%32s %x %02x %02x %02x %15s\n",
str_addr, &if_idx, &plen, &scope, &dad_status,
devname) != EOF)
{
if (scope == IPV6_ADDR_LINKLOCAL &&
strcmp(devname, iface->Name) == 0)
{
struct in6_addr addr;
unsigned int ap;
int i;
for (i=0; i<16; i++)
{
sscanf(str_addr + i * 2, "%02x", &ap);
addr.s6_addr[i] = (unsigned char)ap;
}
memcpy(&iface->if_addr, &addr, sizeof(iface->if_addr));
iface->if_index = if_idx;
fclose(fp);
return 0;
}
}
flog(LOG_ERR, "no linklocal address configured for %s", iface->Name);
fclose(fp);
return (-1);
}
int setup_allrouters_membership(int sock, struct Interface *iface)
{
struct ipv6_mreq mreq;
memset(&mreq, 0, sizeof(mreq));
mreq.ipv6mr_interface = iface->if_index;
/* ipv6-allrouters: ff02::2 */
mreq.ipv6mr_multiaddr.s6_addr32[0] = htonl(0xFF020000);
mreq.ipv6mr_multiaddr.s6_addr32[3] = htonl(0x2);
if (setsockopt(sock, SOL_IPV6, IPV6_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0)
{
/* linux-2.6.12-bk4 returns error with HUP signal but keep listening */
if (errno != EADDRINUSE)
{
flog(LOG_ERR, "can't join ipv6-allrouters on %s", iface->Name);
return (-1);
}
}
return (0);
}
int check_allrouters_membership(int sock, struct Interface *iface)
{
#define ALL_ROUTERS_MCAST "ff020000000000000000000000000002"
FILE *fp;
unsigned int if_idx, allrouters_ok=0;
char addr[32+1];
int ret=0;
if ((fp = fopen(PATH_PROC_NET_IGMP6, "r")) == NULL)
{
flog(LOG_ERR, "can't open %s: %s", PATH_PROC_NET_IGMP6,
strerror(errno));
return (-1);
}
while ( (ret=fscanf(fp, "%u %*s %32[0-9A-Fa-f] %*x %*x %*x\n", &if_idx, addr)) != EOF) {
if (ret == 2) {
if (iface->if_index == if_idx) {
if (strncmp(addr, ALL_ROUTERS_MCAST, sizeof(addr)) == 0)
allrouters_ok = 1;
}
}
}
fclose(fp);
if (!allrouters_ok) {
flog(LOG_WARNING, "resetting ipv6-allrouters membership on %s", iface->Name);
setup_allrouters_membership(sock, iface);
}
return(0);
}
static int
set_interface_var(const char *iface,
const char *var, const char *name,
uint32_t val)
{
FILE *fp;
char spath[64+IFNAMSIZ]; /* XXX: magic constant */
snprintf(spath, sizeof(spath), var, iface);
fp = fopen(spath, "w");
if (!fp) {
if (name)
flog(LOG_ERR, "failed to set %s (%u) for %s",
name, val, iface);
return -1;
}
fprintf(fp, "%u", val);
fclose(fp);
return 0;
}
int
set_interface_linkmtu(const char *iface, uint32_t mtu)
{
return set_interface_var(iface,
PROC_SYS_IP6_LINKMTU, "LinkMTU",
mtu);
}
int
set_interface_curhlim(const char *iface, uint8_t hlim)
{
return set_interface_var(iface,
PROC_SYS_IP6_CURHLIM, "CurHopLimit",
hlim);
}
int
set_interface_reachtime(const char *iface, uint32_t rtime)
{
int ret;
ret = set_interface_var(iface,
PROC_SYS_IP6_BASEREACHTIME_MS,
NULL,
rtime);
if (ret)
ret = set_interface_var(iface,
PROC_SYS_IP6_BASEREACHTIME,
"BaseReachableTimer",
rtime / 1000);
return ret;
}
int
set_interface_retranstimer(const char *iface, uint32_t rettimer)
{
int ret;
ret = set_interface_var(iface,
PROC_SYS_IP6_RETRANSTIMER_MS,
NULL,
rettimer);
if (ret)
ret = set_interface_var(iface,
PROC_SYS_IP6_RETRANSTIMER,
"RetransTimer",
rettimer / 1000);
return ret;
}
--- NEW FILE: gram.c ---
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
[...2351 lines suppressed...]
if (iface)
free(iface);
if (prefix)
free(prefix);
if (route)
free(route);
if (rdnss)
free(rdnss);
}
static void
yyerror(char *msg)
{
cleanup();
flog(LOG_ERR, "%s in %s, line %d: %s", msg, conf_file, num_lines, yytext);
}
--- NEW FILE: gram.h ---
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
T_INTERFACE = 258,
T_PREFIX = 259,
T_ROUTE = 260,
T_RDNSS = 261,
STRING = 262,
NUMBER = 263,
SIGNEDNUMBER = 264,
DECIMAL = 265,
SWITCH = 266,
IPV6ADDR = 267,
INFINITY = 268,
T_IgnoreIfMissing = 269,
T_AdvSendAdvert = 270,
T_MaxRtrAdvInterval = 271,
T_MinRtrAdvInterval = 272,
T_MinDelayBetweenRAs = 273,
T_AdvManagedFlag = 274,
T_AdvOtherConfigFlag = 275,
T_AdvLinkMTU = 276,
T_AdvReachableTime = 277,
T_AdvRetransTimer = 278,
T_AdvCurHopLimit = 279,
T_AdvDefaultLifetime = 280,
T_AdvDefaultPreference = 281,
T_AdvSourceLLAddress = 282,
T_AdvOnLink = 283,
T_AdvAutonomous = 284,
T_AdvValidLifetime = 285,
T_AdvPreferredLifetime = 286,
T_AdvRouterAddr = 287,
T_AdvHomeAgentFlag = 288,
T_AdvIntervalOpt = 289,
T_AdvHomeAgentInfo = 290,
T_Base6to4Interface = 291,
T_UnicastOnly = 292,
T_HomeAgentPreference = 293,
T_HomeAgentLifetime = 294,
T_AdvRoutePreference = 295,
T_AdvRouteLifetime = 296,
T_AdvRDNSSPreference = 297,
T_AdvRDNSSOpenFlag = 298,
T_AdvRDNSSLifetime = 299,
T_AdvMobRtrSupportFlag = 300,
T_BAD_TOKEN = 301
};
#endif
/* Tokens. */
#define T_INTERFACE 258
#define T_PREFIX 259
#define T_ROUTE 260
#define T_RDNSS 261
#define STRING 262
#define NUMBER 263
#define SIGNEDNUMBER 264
#define DECIMAL 265
#define SWITCH 266
#define IPV6ADDR 267
#define INFINITY 268
#define T_IgnoreIfMissing 269
#define T_AdvSendAdvert 270
#define T_MaxRtrAdvInterval 271
#define T_MinRtrAdvInterval 272
#define T_MinDelayBetweenRAs 273
#define T_AdvManagedFlag 274
#define T_AdvOtherConfigFlag 275
#define T_AdvLinkMTU 276
#define T_AdvReachableTime 277
#define T_AdvRetransTimer 278
#define T_AdvCurHopLimit 279
#define T_AdvDefaultLifetime 280
#define T_AdvDefaultPreference 281
#define T_AdvSourceLLAddress 282
#define T_AdvOnLink 283
#define T_AdvAutonomous 284
#define T_AdvValidLifetime 285
#define T_AdvPreferredLifetime 286
#define T_AdvRouterAddr 287
#define T_AdvHomeAgentFlag 288
#define T_AdvIntervalOpt 289
#define T_AdvHomeAgentInfo 290
#define T_Base6to4Interface 291
#define T_UnicastOnly 292
#define T_HomeAgentPreference 293
#define T_HomeAgentLifetime 294
#define T_AdvRoutePreference 295
#define T_AdvRouteLifetime 296
#define T_AdvRDNSSPreference 297
#define T_AdvRDNSSOpenFlag 298
#define T_AdvRDNSSLifetime 299
#define T_AdvMobRtrSupportFlag 300
#define T_BAD_TOKEN 301
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 110 "gram.y"
{
unsigned int num;
int snum;
double dec;
int bool;
struct in6_addr *addr;
char *str;
struct AdvPrefix *pinfo;
struct AdvRoute *rinfo;
struct AdvRDNSS *rdnssinfo;
}
/* Line 1489 of yacc.c. */
#line 153 "y.tab.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE yylval;
--- NEW FILE: gram.y ---
/*
* $Id: gram.y,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Pedro Roque <roque at di.fc.ul.pt>
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996-2000 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
%{
#include <config.h>
#include <includes.h>
#include <radvd.h>
#include <defaults.h>
extern struct Interface *IfaceList;
struct Interface *iface = NULL;
struct AdvPrefix *prefix = NULL;
struct AdvRoute *route = NULL;
struct AdvRDNSS *rdnss = NULL;
extern char *conf_file;
extern int num_lines;
extern char *yytext;
extern int sock;
static void cleanup(void);
static void yyerror(char *msg);
#if 0 /* no longer necessary? */
#ifndef HAVE_IN6_ADDR_S6_ADDR
# ifdef __FreeBSD__
# define s6_addr32 __u6_addr.__u6_addr32
# define s6_addr16 __u6_addr.__u6_addr16
# endif
#endif
#endif
#define ABORT do { cleanup(); YYABORT; } while (0);
%}
%token T_INTERFACE
%token T_PREFIX
%token T_ROUTE
%token T_RDNSS
%token <str> STRING
%token <num> NUMBER
%token <snum> SIGNEDNUMBER
%token <dec> DECIMAL
%token <bool> SWITCH
%token <addr> IPV6ADDR
%token INFINITY
%token T_IgnoreIfMissing
%token T_AdvSendAdvert
%token T_MaxRtrAdvInterval
%token T_MinRtrAdvInterval
%token T_MinDelayBetweenRAs
%token T_AdvManagedFlag
%token T_AdvOtherConfigFlag
%token T_AdvLinkMTU
%token T_AdvReachableTime
%token T_AdvRetransTimer
%token T_AdvCurHopLimit
%token T_AdvDefaultLifetime
%token T_AdvDefaultPreference
%token T_AdvSourceLLAddress
%token T_AdvOnLink
%token T_AdvAutonomous
%token T_AdvValidLifetime
%token T_AdvPreferredLifetime
%token T_AdvRouterAddr
%token T_AdvHomeAgentFlag
%token T_AdvIntervalOpt
%token T_AdvHomeAgentInfo
%token T_Base6to4Interface
%token T_UnicastOnly
%token T_HomeAgentPreference
%token T_HomeAgentLifetime
%token T_AdvRoutePreference
%token T_AdvRouteLifetime
%token T_AdvRDNSSPreference
%token T_AdvRDNSSOpenFlag
%token T_AdvRDNSSLifetime
%token T_AdvMobRtrSupportFlag
%token T_BAD_TOKEN
%type <str> name
%type <pinfo> optional_prefixlist prefixdef prefixlist
%type <rinfo> optional_routelist routedef routelist
%type <rdnssinfo> optional_rdnsslist rdnssdef rdnsslist
%type <num> number_or_infinity
%union {
unsigned int num;
int snum;
double dec;
int bool;
struct in6_addr *addr;
char *str;
struct AdvPrefix *pinfo;
struct AdvRoute *rinfo;
struct AdvRDNSS *rdnssinfo;
};
%%
grammar : grammar ifacedef
| ifacedef
;
ifacedef : ifacehead '{' ifaceparams '}' ';'
{
struct Interface *iface2;
iface2 = IfaceList;
while (iface2)
{
if (!strcmp(iface2->Name, iface->Name))
{
flog(LOG_ERR, "duplicate interface "
"definition for %s", iface->Name);
ABORT;
}
iface2 = iface2->next;
}
if (check_device(sock, iface) < 0) {
if (iface->IgnoreIfMissing) {
dlog(LOG_DEBUG, 4, "interface %s did not exist, ignoring the interface", iface->Name);
goto skip_interface;
}
else {
flog(LOG_ERR, "interface %s does not exist", iface->Name);
ABORT;
}
}
if (setup_deviceinfo(sock, iface) < 0)
ABORT;
if (check_iface(iface) < 0)
ABORT;
if (setup_linklocal_addr(sock, iface) < 0)
ABORT;
if (setup_allrouters_membership(sock, iface) < 0)
ABORT;
iface->next = IfaceList;
IfaceList = iface;
dlog(LOG_DEBUG, 4, "interface definition for %s is ok", iface->Name);
skip_interface:
iface = NULL;
};
ifacehead : T_INTERFACE name
{
iface = malloc(sizeof(struct Interface));
if (iface == NULL) {
flog(LOG_CRIT, "malloc failed: %s", strerror(errno));
ABORT;
}
iface_init_defaults(iface);
strncpy(iface->Name, $2, IFNAMSIZ-1);
iface->Name[IFNAMSIZ-1] = '\0';
}
;
name : STRING
{
/* check vality */
$$ = $1;
}
;
ifaceparams : optional_ifacevlist optional_prefixlist optional_routelist optional_rdnsslist
{
iface->AdvPrefixList = $2;
iface->AdvRouteList = $3;
iface->AdvRDNSSList = $4;
}
;
optional_ifacevlist: /* empty */
| ifacevlist
;
optional_prefixlist: /* empty */
{
$$ = NULL;
}
| prefixlist
;
optional_routelist: /* empty */
{
$$ = NULL;
}
| routelist
;
optional_rdnsslist: /* empty */
{
$$ = NULL;
}
| rdnsslist
;
ifacevlist : ifacevlist ifaceval
| ifaceval
;
ifaceval : T_MinRtrAdvInterval NUMBER ';'
{
iface->MinRtrAdvInterval = $2;
}
| T_MaxRtrAdvInterval NUMBER ';'
{
iface->MaxRtrAdvInterval = $2;
}
| T_MinDelayBetweenRAs NUMBER ';'
{
iface->MinDelayBetweenRAs = $2;
}
| T_MinRtrAdvInterval DECIMAL ';'
{
iface->MinRtrAdvInterval = $2;
}
| T_MaxRtrAdvInterval DECIMAL ';'
{
iface->MaxRtrAdvInterval = $2;
}
| T_MinDelayBetweenRAs DECIMAL ';'
{
iface->MinDelayBetweenRAs = $2;
}
| T_IgnoreIfMissing SWITCH ';'
{
iface->IgnoreIfMissing = $2;
}
| T_AdvSendAdvert SWITCH ';'
{
iface->AdvSendAdvert = $2;
}
| T_AdvManagedFlag SWITCH ';'
{
iface->AdvManagedFlag = $2;
}
| T_AdvOtherConfigFlag SWITCH ';'
{
iface->AdvOtherConfigFlag = $2;
}
| T_AdvLinkMTU NUMBER ';'
{
iface->AdvLinkMTU = $2;
}
| T_AdvReachableTime NUMBER ';'
{
iface->AdvReachableTime = $2;
}
| T_AdvRetransTimer NUMBER ';'
{
iface->AdvRetransTimer = $2;
}
| T_AdvDefaultLifetime NUMBER ';'
{
iface->AdvDefaultLifetime = $2;
}
| T_AdvDefaultPreference SIGNEDNUMBER ';'
{
iface->AdvDefaultPreference = $2;
}
| T_AdvCurHopLimit NUMBER ';'
{
iface->AdvCurHopLimit = $2;
}
| T_AdvSourceLLAddress SWITCH ';'
{
iface->AdvSourceLLAddress = $2;
}
| T_AdvIntervalOpt SWITCH ';'
{
iface->AdvIntervalOpt = $2;
}
| T_AdvHomeAgentInfo SWITCH ';'
{
iface->AdvHomeAgentInfo = $2;
}
| T_AdvHomeAgentFlag SWITCH ';'
{
iface->AdvHomeAgentFlag = $2;
}
| T_HomeAgentPreference NUMBER ';'
{
iface->HomeAgentPreference = $2;
}
| T_HomeAgentLifetime NUMBER ';'
{
iface->HomeAgentLifetime = $2;
}
| T_UnicastOnly SWITCH ';'
{
iface->UnicastOnly = $2;
}
| T_AdvMobRtrSupportFlag SWITCH ';'
{
iface->AdvMobRtrSupportFlag = $2;
}
;
prefixlist : prefixdef
{
$$ = $1;
}
| prefixlist prefixdef
{
$2->next = $1;
$$ = $2;
}
;
prefixdef : prefixhead '{' optional_prefixplist '}' ';'
{
unsigned int dst;
if (prefix->AdvPreferredLifetime >
prefix->AdvValidLifetime)
{
flog(LOG_ERR, "AdvValidLifeTime must be "
"greater than AdvPreferredLifetime in %s, line %d",
conf_file, num_lines);
ABORT;
}
if( prefix->if6to4[0] )
{
if (get_v4addr(prefix->if6to4, &dst) < 0)
{
flog(LOG_ERR, "interface %s has no IPv4 addresses, disabling 6to4 prefix", prefix->if6to4 );
prefix->enabled = 0;
} else
{
*((uint16_t *)(prefix->Prefix.s6_addr)) = htons(0x2002);
memcpy( prefix->Prefix.s6_addr + 2, &dst, sizeof( dst ) );
}
}
$$ = prefix;
prefix = NULL;
}
;
prefixhead : T_PREFIX IPV6ADDR '/' NUMBER
{
prefix = malloc(sizeof(struct AdvPrefix));
if (prefix == NULL) {
flog(LOG_CRIT, "malloc failed: %s", strerror(errno));
ABORT;
}
prefix_init_defaults(prefix);
if ($4 > MAX_PrefixLen)
{
flog(LOG_ERR, "invalid prefix length in %s, line %d", conf_file, num_lines);
ABORT;
}
prefix->PrefixLen = $4;
memcpy(&prefix->Prefix, $2, sizeof(struct in6_addr));
}
;
optional_prefixplist: /* empty */
| prefixplist
;
prefixplist : prefixplist prefixparms
| prefixparms
;
prefixparms : T_AdvOnLink SWITCH ';'
{
prefix->AdvOnLinkFlag = $2;
}
| T_AdvAutonomous SWITCH ';'
{
prefix->AdvAutonomousFlag = $2;
}
| T_AdvRouterAddr SWITCH ';'
{
prefix->AdvRouterAddr = $2;
}
| T_AdvValidLifetime number_or_infinity ';'
{
prefix->AdvValidLifetime = $2;
}
| T_AdvPreferredLifetime number_or_infinity ';'
{
prefix->AdvPreferredLifetime = $2;
}
| T_Base6to4Interface name ';'
{
dlog(LOG_DEBUG, 4, "using interface %s for 6to4", $2);
strncpy(prefix->if6to4, $2, IFNAMSIZ-1);
prefix->if6to4[IFNAMSIZ-1] = '\0';
}
;
routelist : routedef
{
$$ = $1;
}
| routelist routedef
{
$2->next = $1;
$$ = $2;
}
;
routedef : routehead '{' optional_routeplist '}' ';'
{
$$ = route;
route = NULL;
}
;
routehead : T_ROUTE IPV6ADDR '/' NUMBER
{
route = malloc(sizeof(struct AdvRoute));
if (route == NULL) {
flog(LOG_CRIT, "malloc failed: %s", strerror(errno));
ABORT;
}
route_init_defaults(route, iface);
if ($4 > MAX_PrefixLen)
{
flog(LOG_ERR, "invalid route prefix length in %s, line %d", conf_file, num_lines);
ABORT;
}
route->PrefixLen = $4;
memcpy(&route->Prefix, $2, sizeof(struct in6_addr));
}
;
optional_routeplist: /* empty */
| routeplist
;
routeplist : routeplist routeparms
| routeparms
;
routeparms : T_AdvRoutePreference SIGNEDNUMBER ';'
{
route->AdvRoutePreference = $2;
}
| T_AdvRouteLifetime number_or_infinity ';'
{
route->AdvRouteLifetime = $2;
}
;
rdnsslist : rdnssdef
{
$$ = $1;
}
| rdnsslist rdnssdef
{
$2->next = $1;
$$ = $2;
}
;
rdnssdef : rdnsshead '{' optional_rdnssplist '}' ';'
{
$$ = rdnss;
rdnss = NULL;
}
;
rdnssaddrs : rdnssaddrs rdnssaddr
| rdnssaddr
;
rdnssaddr : IPV6ADDR
{
if (!rdnss) {
/* first IP found */
rdnss = malloc(sizeof(struct AdvRDNSS));
if (rdnss == NULL) {
flog(LOG_CRIT, "malloc failed: %s", strerror(errno));
ABORT;
}
rdnss_init_defaults(rdnss, iface);
}
switch (rdnss->AdvRDNSSNumber) {
case 0:
memcpy(&rdnss->AdvRDNSSAddr1, $1, sizeof(struct in6_addr));
rdnss->AdvRDNSSNumber++;
break;
case 1:
memcpy(&rdnss->AdvRDNSSAddr2, $1, sizeof(struct in6_addr));
rdnss->AdvRDNSSNumber++;
break;
case 2:
memcpy(&rdnss->AdvRDNSSAddr3, $1, sizeof(struct in6_addr));
rdnss->AdvRDNSSNumber++;
break;
default:
flog(LOG_CRIT, "Too many addresses in RDNSS section");
ABORT;
}
}
;
rdnsshead : T_RDNSS rdnssaddrs
{
if (!rdnss) {
flog(LOG_CRIT, "No address specified in RDNSS section");
ABORT;
}
}
;
optional_rdnssplist: /* empty */
| rdnssplist
;
rdnssplist : rdnssplist rdnssparms
| rdnssparms
;
rdnssparms : T_AdvRDNSSPreference NUMBER ';'
{
rdnss->AdvRDNSSPreference = $2;
}
| T_AdvRDNSSOpenFlag SWITCH ';'
{
rdnss->AdvRDNSSOpenFlag = $2;
}
| T_AdvRDNSSLifetime number_or_infinity ';'
{
if ($2 < iface->MaxRtrAdvInterval && $2 != 0) {
flog(LOG_ERR, "AdvRDNSSLifetime must be at least MaxRtrAdvInterval");
ABORT;
}
if ($2 > 2*(iface->MaxRtrAdvInterval))
flog(LOG_WARNING, "Warning: AdvRDNSSLifetime <= 2*MaxRtrAdvInterval would allow stale DNS servers to be deleted faster");
rdnss->AdvRDNSSLifetime = $2;
}
;
number_or_infinity : NUMBER
{
$$ = $1;
}
| INFINITY
{
$$ = (uint32_t)~0;
}
;
%%
static
void cleanup(void)
{
if (iface)
free(iface);
if (prefix)
free(prefix);
if (route)
free(route);
if (rdnss)
free(rdnss);
}
static void
yyerror(char *msg)
{
cleanup();
flog(LOG_ERR, "%s in %s, line %d: %s", msg, conf_file, num_lines, yytext);
}
--- NEW FILE: includes.h ---
/*
* $Id: includes.h,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#ifndef INCLUDES_H
#define INCLUDES_H
#include <config.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <time.h>
#include <syslog.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <netdb.h>
#include <pwd.h>
#include <grp.h>
#include <sys/types.h>
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#else
# ifdef HAVE_MACHINE_PARAM_H
# include <machine/param.h>
# endif
# ifdef HAVE_MACHINE_LIMITS_H
# include <machine/limits.h>
# endif
#endif
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netinet/ip6.h>
#include <netinet/icmp6.h>
#include <arpa/inet.h>
#include <sys/sysctl.h>
#include <net/if.h>
#ifdef HAVE_NET_IF_DL_H
# include <net/if_dl.h>
#endif
#ifdef HAVE_NET_IF_TYPES_H
# include <net/if_types.h>
#endif
#if defined(HAVE_NET_IF_ARP_H) && !defined(ARPHRD_ETHER)
# include <net/if_arp.h>
#endif /* defined(HAVE_NET_IF_ARP_H) && !defined(ARPHRD_ETHER) */
#ifdef HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
#endif
#ifdef HAVE_GETOPT_H
# include <getopt.h>
#endif
#endif /* INCLUDES_H */
--- NEW FILE: install-sh ---
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0
--- NEW FILE: interface.c ---
/*
* $Id: interface.c,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#include <config.h>
#include <includes.h>
#include <radvd.h>
#include <defaults.h>
void
iface_init_defaults(struct Interface *iface)
{
memset(iface, 0, sizeof(struct Interface));
iface->HasFailed = 0;
iface->IgnoreIfMissing = DFLT_IgnoreIfMissing;
iface->AdvSendAdvert = DFLT_AdvSendAdv;
iface->MaxRtrAdvInterval = DFLT_MaxRtrAdvInterval;
iface->AdvSourceLLAddress = DFLT_AdvSourceLLAddress;
iface->AdvReachableTime = DFLT_AdvReachableTime;
iface->AdvRetransTimer = DFLT_AdvRetransTimer;
iface->AdvLinkMTU = DFLT_AdvLinkMTU;
iface->AdvCurHopLimit = DFLT_AdvCurHopLimit;
iface->AdvIntervalOpt = DFLT_AdvIntervalOpt;
iface->AdvHomeAgentInfo = DFLT_AdvHomeAgentInfo;
iface->AdvHomeAgentFlag = DFLT_AdvHomeAgentFlag;
iface->HomeAgentPreference = DFLT_HomeAgentPreference;
iface->MinDelayBetweenRAs = DFLT_MinDelayBetweenRAs;
iface->AdvMobRtrSupportFlag = DFLT_AdvMobRtrSupportFlag;
iface->MinRtrAdvInterval = -1;
iface->AdvDefaultLifetime = -1;
iface->AdvDefaultPreference = DFLT_AdvDefaultPreference;
iface->HomeAgentLifetime = -1;
}
void
prefix_init_defaults(struct AdvPrefix *prefix)
{
memset(prefix, 0, sizeof(struct AdvPrefix));
prefix->AdvOnLinkFlag = DFLT_AdvOnLinkFlag;
prefix->AdvAutonomousFlag = DFLT_AdvAutonomousFlag;
prefix->AdvRouterAddr = DFLT_AdvRouterAddr;
prefix->AdvValidLifetime = DFLT_AdvValidLifetime;
prefix->AdvPreferredLifetime = DFLT_AdvPreferredLifetime;
prefix->if6to4[0] = 0;
prefix->enabled = 1;
}
void
route_init_defaults(struct AdvRoute *route, struct Interface *iface)
{
memset(route, 0, sizeof(struct AdvRoute));
route->AdvRouteLifetime = DFLT_AdvRouteLifetime(iface);
route->AdvRoutePreference = DFLT_AdvRoutePreference;
}
void
rdnss_init_defaults(struct AdvRDNSS *rdnss, struct Interface *iface)
{
memset(rdnss, 0, sizeof(struct AdvRDNSS));
rdnss->AdvRDNSSPreference = DFLT_AdvRDNSSPreference;
rdnss->AdvRDNSSOpenFlag = DFLT_AdvRDNSSOpenFlag;
rdnss->AdvRDNSSLifetime = DFLT_AdvRDNSSLifetime(iface);
rdnss->AdvRDNSSNumber = 0;
}
int
check_iface(struct Interface *iface)
{
struct AdvPrefix *prefix;
struct AdvRoute *route;
int res = 0;
int MIPv6 = 0;
/* Check if we use Mobile IPv6 extensions */
if (iface->AdvHomeAgentFlag || iface->AdvHomeAgentInfo ||
iface->AdvIntervalOpt)
{
MIPv6 = 1;
flog(LOG_INFO, "using Mobile IPv6 extensions");
}
prefix = iface->AdvPrefixList;
while (!MIPv6 && prefix)
{
if (prefix->AdvRouterAddr)
{
MIPv6 = 1;
}
prefix = prefix->next;
}
if (iface->MinRtrAdvInterval < 0)
iface->MinRtrAdvInterval = DFLT_MinRtrAdvInterval(iface);
if ((iface->MinRtrAdvInterval < (MIPv6 ? MIN_MinRtrAdvInterval_MIPv6 : MIN_MinRtrAdvInterval)) ||
(iface->MinRtrAdvInterval > MAX_MinRtrAdvInterval(iface)))
{
flog(LOG_ERR,
"MinRtrAdvInterval for %s (%.2f) must be at least %.2f but no more than 3/4 of MaxRtrAdvInterval (%.2f)",
iface->Name, iface->MinRtrAdvInterval,
MIPv6 ? MIN_MinRtrAdvInterval_MIPv6 : (int)MIN_MinRtrAdvInterval,
MAX_MinRtrAdvInterval(iface));
res = -1;
}
if ((iface->MaxRtrAdvInterval < (MIPv6 ? MIN_MaxRtrAdvInterval_MIPv6 : MIN_MaxRtrAdvInterval))
|| (iface->MaxRtrAdvInterval > MAX_MaxRtrAdvInterval))
{
flog(LOG_ERR,
"MaxRtrAdvInterval for %s (%.2f) must be between %.2f and %d",
iface->Name, iface->MaxRtrAdvInterval,
MIPv6 ? MIN_MaxRtrAdvInterval_MIPv6 : (int)MIN_MaxRtrAdvInterval,
MAX_MaxRtrAdvInterval);
res = -1;
}
if (iface->MinDelayBetweenRAs < (MIPv6 ? MIN_DELAY_BETWEEN_RAS_MIPv6 : MIN_DELAY_BETWEEN_RAS))
{
flog(LOG_ERR,
"MinDelayBetweenRAs for %s (%.2f) must be at least %.2f",
iface->Name, iface->MinDelayBetweenRAs,
MIPv6 ? MIN_DELAY_BETWEEN_RAS_MIPv6 : MIN_DELAY_BETWEEN_RAS);
res = -1;
}
if ((iface->AdvLinkMTU != 0) &&
((iface->AdvLinkMTU < MIN_AdvLinkMTU) ||
(iface->if_maxmtu != -1 && (iface->AdvLinkMTU > iface->if_maxmtu))))
{
flog(LOG_ERR, "AdvLinkMTU for %s (%u) must be zero or between %u and %u",
iface->Name, iface->AdvLinkMTU, MIN_AdvLinkMTU, iface->if_maxmtu);
res = -1;
}
if (iface->AdvReachableTime > MAX_AdvReachableTime)
{
flog(LOG_ERR,
"AdvReachableTime for %s (%u) must not be greater than %u",
iface->Name, iface->AdvReachableTime, MAX_AdvReachableTime);
res = -1;
}
if (iface->AdvCurHopLimit > MAX_AdvCurHopLimit)
{
flog(LOG_ERR, "AdvCurHopLimit for %s (%u) must not be greater than %u",
iface->Name, iface->AdvCurHopLimit, MAX_AdvCurHopLimit);
res = -1;
}
if (iface->AdvDefaultLifetime < 0)
iface->AdvDefaultLifetime = DFLT_AdvDefaultLifetime(iface);
if ((iface->AdvDefaultLifetime != 0) &&
((iface->AdvDefaultLifetime > MAX_AdvDefaultLifetime) ||
(iface->AdvDefaultLifetime < MIN_AdvDefaultLifetime(iface))))
{
flog(LOG_ERR,
"AdvDefaultLifetime for %s (%u) must be zero or between %u and %u",
iface->Name, iface->AdvDefaultLifetime, (int)MIN_AdvDefaultLifetime(iface),
MAX_AdvDefaultLifetime);
res = -1;
}
/* Mobile IPv6 ext */
if (iface->HomeAgentLifetime < 0)
iface->HomeAgentLifetime = DFLT_HomeAgentLifetime(iface);
/* Mobile IPv6 ext */
if (iface->AdvHomeAgentInfo)
{
if ((iface->HomeAgentLifetime > MAX_HomeAgentLifetime) ||
(iface->HomeAgentLifetime < MIN_HomeAgentLifetime))
{
flog(LOG_ERR,
"HomeAgentLifetime for %s (%u) must be between %u and %u",
iface->Name, iface->HomeAgentLifetime,
MIN_HomeAgentLifetime, MAX_HomeAgentLifetime);
res = -1;
}
}
/* Mobile IPv6 ext */
if (iface->AdvHomeAgentInfo && !(iface->AdvHomeAgentFlag))
{
flog(LOG_ERR,
"AdvHomeAgentFlag for %s must be set with HomeAgentInfo", iface->Name);
res = -1;
}
if (iface->AdvMobRtrSupportFlag && !(iface->AdvHomeAgentInfo))
{
flog(LOG_ERR,
"AdvHomeAgentInfo for %s must be set with AdvMobRtrSupportFlag", iface->Name);
res = -1;
}
/* XXX: need this? prefix = iface->AdvPrefixList; */
while (prefix)
{
if (prefix->PrefixLen > MAX_PrefixLen)
{
flog(LOG_ERR, "invalid prefix length (%u) for %s", prefix->PrefixLen, iface->Name);
res = -1;
}
if (prefix->AdvPreferredLifetime > prefix->AdvValidLifetime)
{
flog(LOG_ERR, "AdvValidLifetime for %s (%u) must be "
"greater than AdvPreferredLifetime for",
iface->Name, prefix->AdvValidLifetime);
res = -1;
}
prefix = prefix->next;
}
route = iface->AdvRouteList;
while(route)
{
if (route->PrefixLen > MAX_PrefixLen)
{
flog(LOG_ERR, "invalid route prefix length (%u) for %s", route->PrefixLen, iface->Name);
res = -1;
}
route = route->next;
}
return res;
}
--- NEW FILE: log.c ---
/*
* $Id: log.c,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file
* COPYRIGHT applies to this software. If your distribution is missing
* this file, you may request it from <pekkas at netcore.fi>.
*
*/
#include <config.h>
#include <includes.h>
#include <radvd.h>
static int log_method = L_NONE;
static char *log_ident;
static char *log_file;
static FILE *log_file_fd;
static int log_facility;
static int debug_level = 0;
int
log_open(int method, char *ident, char *log, int facility)
{
log_method = method;
log_ident = ident;
switch (log_method) {
case L_NONE:
case L_STDERR:
break;
case L_STDERR_SYSLOG:
/* fallthrough */
case L_SYSLOG:
if (facility == -1)
log_facility = LOG_DAEMON;
else
log_facility = facility;
openlog(log_ident, LOG_PID, log_facility);
break;
case L_LOGFILE:
if (!log)
{
fprintf(stderr, "%s: no logfile specified\n", log_ident);
return (-1);
}
log_file = log;
if ((log_file_fd = fopen(log_file, "a")) == NULL)
{
fprintf(stderr, "%s: can't open %s: %s\n", log_ident, log_file, strerror(errno));
return (-1);
}
break;
default:
fprintf(stderr, "%s: unknown logging method: %d\n", log_ident, log_method);
log_method = L_NONE;
return (-1);
}
return 0;
}
static int
vlog(int prio, char *format, va_list ap)
{
char tstamp[64], buff[1024];
struct tm *tm;
time_t current;
switch (log_method) {
case L_NONE:
break;
case L_SYSLOG:
vsnprintf(buff, sizeof(buff), format, ap);
syslog(prio, "%s", buff);
break;
case L_STDERR_SYSLOG:
vsnprintf(buff, sizeof(buff), format, ap);
syslog(prio, "%s", buff);
if (prio > LOG_ERR) /* fall through for messages with high priority */
break;
case L_STDERR:
current = time(NULL);
tm = localtime(¤t);
(void) strftime(tstamp, sizeof(tstamp), LOG_TIME_FORMAT, tm);
fprintf(stderr, "[%s] %s: ", tstamp, log_ident);
vfprintf(stderr, format, ap);
fputs("\n", stderr);
fflush(stderr);
break;
case L_LOGFILE:
current = time(NULL);
tm = localtime(¤t);
(void) strftime(tstamp, sizeof(tstamp), LOG_TIME_FORMAT, tm);
fprintf(log_file_fd, "[%s] %s: ", tstamp, log_ident);
vfprintf(log_file_fd, format, ap);
fputs("\n", log_file_fd);
fflush(log_file_fd);
break;
default:
fprintf(stderr, "%s: unknown logging method: %d\n", log_ident, log_method);
log_method = L_NONE;
return (-1);
}
return 0;
}
void
dlog(int prio, int level, char *format, ...)
{
va_list ap;
int res;
if (debug_level < level)
return;
va_start(ap, format);
res = vlog(prio, format, ap);
va_end(ap);
/* XXX: should we do something if res < 0.. */
}
void
flog(int prio, char *format, ...)
{
va_list ap;
int res;
va_start(ap, format);
res = vlog(prio, format, ap);
va_end(ap);
/* XXX: should we do something if res < 0.. */
}
int
log_close(void)
{
switch (log_method) {
case L_NONE:
case L_STDERR:
break;
case L_SYSLOG:
closelog();
break;
case L_LOGFILE:
fclose(log_file_fd);
break;
default:
fprintf(stderr, "%s: unknown logging method: %d\n", log_ident, log_method);
log_method = L_NONE;
return (-1);
}
return 0;
}
int
log_reopen(void)
{
log_close();
return log_open(log_method, log_ident, log_file, log_facility);
}
void
set_debuglevel(int level)
{
debug_level = level;
}
int
get_debuglevel(void)
{
return debug_level;
}
--- NEW FILE: missing ---
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing 0.4 - GNU automake"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
--- NEW FILE: mkinstalldirs ---
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman at prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here
--- NEW FILE: pathnames.h ---
/*
* $Id: pathnames.h,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Pedro Roque <roque at di.fc.ul.pt>
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#ifndef PATHNAMES_H
#define PATHNAMES_H
#ifndef PATH_RADVD_CONF
#define PATH_RADVD_CONF "/etc/radvd.conf"
#endif
#ifndef PATH_RADVD_PID
#define PATH_RADVD_PID "/var/run/radvd.pid"
#endif
#ifndef PATH_RADVD_LOG
#define PATH_RADVD_LOG "/var/log/radvd.log"
#endif
#define PATH_PROC_NET_IF_INET6 "/proc/net/if_inet6"
#define PATH_PROC_NET_IGMP6 "/proc/net/igmp6"
#ifdef __linux__
#define SYSCTL_IP6_FORWARDING CTL_NET, NET_IPV6, NET_IPV6_CONF, NET_PROTO_CONF_ALL, NET_IPV6_FORWARDING
#define PROC_SYS_IP6_FORWARDING "/proc/sys/net/ipv6/conf/all/forwarding"
#define PROC_SYS_IP6_LINKMTU "/proc/sys/net/ipv6/conf/%s/mtu"
#define PROC_SYS_IP6_CURHLIM "/proc/sys/net/ipv6/conf/%s/hop_limit"
#define PROC_SYS_IP6_BASEREACHTIME_MS "/proc/sys/net/ipv6/neigh/%s/base_reachable_time_ms"
#define PROC_SYS_IP6_BASEREACHTIME "/proc/sys/net/ipv6/neigh/%s/base_reachable_time"
#define PROC_SYS_IP6_RETRANSTIMER_MS "/proc/sys/net/ipv6/neigh/%s/retrans_time_ms"
#define PROC_SYS_IP6_RETRANSTIMER "/proc/sys/net/ipv6/neigh/%s/retrans_time"
#else /* BSD */
#define SYSCTL_IP6_FORWARDING CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_FORWARDING
#endif
#endif
--- NEW FILE: process.c ---
/*
* $Id: process.c,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Pedro Roque <roque at di.fc.ul.pt>
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#include <config.h>
#include <includes.h>
#include <radvd.h>
static void process_rs(int, struct Interface *, unsigned char *msg,
int len, struct sockaddr_in6 *);
static void process_ra(struct Interface *, unsigned char *msg, int len,
struct sockaddr_in6 *);
static int addr_match(struct in6_addr *a1, struct in6_addr *a2,
int prefixlen);
void
process(int sock, struct Interface *ifacel, unsigned char *msg, int len,
struct sockaddr_in6 *addr, struct in6_pktinfo *pkt_info, int hoplimit)
{
struct Interface *iface;
struct icmp6_hdr *icmph;
char addr_str[INET6_ADDRSTRLEN];
if ( ! pkt_info )
{
flog(LOG_WARNING, "received packet with no pkt_info!" );
return;
}
/*
* can this happen?
*/
if (len < sizeof(struct icmp6_hdr))
{
flog(LOG_WARNING, "received icmpv6 packet with invalid length: %d",
len);
return;
}
icmph = (struct icmp6_hdr *) msg;
if (icmph->icmp6_type != ND_ROUTER_SOLICIT &&
icmph->icmp6_type != ND_ROUTER_ADVERT)
{
/*
* We just want to listen to RSs and RAs
*/
flog(LOG_ERR, "icmpv6 filter failed");
return;
}
if (icmph->icmp6_type == ND_ROUTER_ADVERT)
{
if (len < sizeof(struct nd_router_advert)) {
flog(LOG_WARNING, "received icmpv6 RA packet with invalid length: %d",
len);
return;
}
if (!IN6_IS_ADDR_LINKLOCAL(&addr->sin6_addr)) {
flog(LOG_WARNING, "received icmpv6 RA packet with non-linklocal source address");
return;
}
}
if (icmph->icmp6_type == ND_ROUTER_SOLICIT)
{
if (len < sizeof(struct nd_router_solicit)) {
flog(LOG_WARNING, "received icmpv6 RS packet with invalid length: %d",
len);
return;
}
}
if (icmph->icmp6_code != 0)
{
flog(LOG_WARNING, "received icmpv6 RS/RA packet with invalid code: %d",
icmph->icmp6_code);
return;
}
dlog(LOG_DEBUG, 4, "if_index %u", pkt_info->ipi6_ifindex);
/* get iface by received if_index */
for (iface = ifacel; iface; iface=iface->next)
{
if (iface->if_index == pkt_info->ipi6_ifindex)
{
break;
}
}
if (iface == NULL)
{
dlog(LOG_DEBUG, 2, "received packet from unknown interface: %d",
pkt_info->ipi6_ifindex);
return;
}
if (hoplimit != 255)
{
print_addr(&addr->sin6_addr, addr_str);
flog(LOG_WARNING, "received RS or RA with invalid hoplimit %d from %s",
hoplimit, addr_str);
return;
}
if (!iface->AdvSendAdvert)
{
dlog(LOG_DEBUG, 2, "AdvSendAdvert is off for %s", iface->Name);
return;
}
dlog(LOG_DEBUG, 4, "found Interface: %s", iface->Name);
if (icmph->icmp6_type == ND_ROUTER_SOLICIT)
{
process_rs(sock, iface, msg, len, addr);
}
else if (icmph->icmp6_type == ND_ROUTER_ADVERT)
{
process_ra(iface, msg, len, addr);
}
}
static void
process_rs(int sock, struct Interface *iface, unsigned char *msg, int len,
struct sockaddr_in6 *addr)
{
double delay;
double next;
struct timeval tv;
uint8_t *opt_str;
/* validation */
len -= sizeof(struct nd_router_solicit);
opt_str = (uint8_t *)(msg + sizeof(struct nd_router_solicit));
while (len > 0)
{
int optlen;
if (len < 2)
{
flog(LOG_WARNING, "trailing garbage in RS");
return;
}
optlen = (opt_str[1] << 3);
if (optlen == 0)
{
flog(LOG_WARNING, "zero length option in RS");
return;
}
else if (optlen > len)
{
flog(LOG_WARNING, "option length greater than total length in RS");
return;
}
if (*opt_str == ND_OPT_SOURCE_LINKADDR &&
IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr)) {
flog(LOG_WARNING, "received icmpv6 RS packet with unspecified source address and there is a lladdr option");
return;
}
len -= optlen;
opt_str += optlen;
}
gettimeofday(&tv, NULL);
delay = MAX_RA_DELAY_TIME*rand()/(RAND_MAX+1.0);
dlog(LOG_DEBUG, 3, "random mdelay for %s: %.2f", iface->Name, delay);
if (iface->UnicastOnly) {
mdelay(delay);
send_ra(sock, iface, &addr->sin6_addr);
}
else if ((tv.tv_sec + tv.tv_usec / 1000000.0) - (iface->last_multicast_sec +
iface->last_multicast_usec / 1000000.0) < iface->MinDelayBetweenRAs) {
/* last RA was sent only a few moments ago, don't send another immediately */
clear_timer(&iface->tm);
next = iface->MinDelayBetweenRAs - (tv.tv_sec + tv.tv_usec / 1000000.0) +
(iface->last_multicast_sec + iface->last_multicast_usec / 1000000.0) + delay/1000.0;
set_timer(&iface->tm, next);
}
else {
/* no RA sent in a while, send an immediate multicast reply */
clear_timer(&iface->tm);
send_ra(sock, iface, NULL);
next = rand_between(iface->MinRtrAdvInterval, iface->MaxRtrAdvInterval);
set_timer(&iface->tm, next);
}
}
/*
* check router advertisements according to RFC 2461, 6.2.7
*/
static void
process_ra(struct Interface *iface, unsigned char *msg, int len,
struct sockaddr_in6 *addr)
{
struct nd_router_advert *radvert;
char addr_str[INET6_ADDRSTRLEN];
uint8_t *opt_str;
print_addr(&addr->sin6_addr, addr_str);
radvert = (struct nd_router_advert *) msg;
if ((radvert->nd_ra_curhoplimit && iface->AdvCurHopLimit) &&
(radvert->nd_ra_curhoplimit != iface->AdvCurHopLimit))
{
flog(LOG_WARNING, "our AdvCurHopLimit on %s doesn't agree with %s",
iface->Name, addr_str);
}
if ((radvert->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED) && !iface->AdvManagedFlag)
{
flog(LOG_WARNING, "our AdvManagedFlag on %s doesn't agree with %s",
iface->Name, addr_str);
}
if ((radvert->nd_ra_flags_reserved & ND_RA_FLAG_OTHER) && !iface->AdvOtherConfigFlag)
{
flog(LOG_WARNING, "our AdvOtherConfigFlag on %s doesn't agree with %s",
iface->Name, addr_str);
}
/* note: we don't check the default router preference here, because they're likely different */
if ((radvert->nd_ra_reachable && iface->AdvReachableTime) &&
(ntohl(radvert->nd_ra_reachable) != iface->AdvReachableTime))
{
flog(LOG_WARNING, "our AdvReachableTime on %s doesn't agree with %s",
iface->Name, addr_str);
}
if ((radvert->nd_ra_retransmit && iface->AdvRetransTimer) &&
(ntohl(radvert->nd_ra_retransmit) != iface->AdvRetransTimer))
{
flog(LOG_WARNING, "our AdvRetransTimer on %s doesn't agree with %s",
iface->Name, addr_str);
}
len -= sizeof(struct nd_router_advert);
if (len == 0)
return;
opt_str = (uint8_t *)(msg + sizeof(struct nd_router_advert));
while (len > 0)
{
int optlen;
struct nd_opt_prefix_info *pinfo;
struct nd_opt_rdnss_info_local *rdnssinfo;
struct nd_opt_mtu *mtu;
struct AdvPrefix *prefix;
struct AdvRDNSS *rdnss;
char prefix_str[INET6_ADDRSTRLEN];
char rdnss_str[INET6_ADDRSTRLEN];
uint32_t preferred, valid, count;
if (len < 2)
{
flog(LOG_ERR, "trailing garbage in RA on %s from %s",
iface->Name, addr_str);
break;
}
optlen = (opt_str[1] << 3);
if (optlen == 0)
{
flog(LOG_ERR, "zero length option in RA on %s from %s",
iface->Name, addr_str);
break;
}
else if (optlen > len)
{
flog(LOG_ERR, "option length greater than total"
" length in RA on %s from %s",
iface->Name, addr_str);
break;
}
switch (*opt_str)
{
case ND_OPT_MTU:
mtu = (struct nd_opt_mtu *)opt_str;
if (iface->AdvLinkMTU && (ntohl(mtu->nd_opt_mtu_mtu) != iface->AdvLinkMTU))
{
flog(LOG_WARNING, "our AdvLinkMTU on %s doesn't agree with %s",
iface->Name, addr_str);
}
break;
case ND_OPT_PREFIX_INFORMATION:
pinfo = (struct nd_opt_prefix_info *) opt_str;
preferred = ntohl(pinfo->nd_opt_pi_preferred_time);
valid = ntohl(pinfo->nd_opt_pi_valid_time);
prefix = iface->AdvPrefixList;
while (prefix)
{
if (prefix->enabled &&
(prefix->PrefixLen == pinfo->nd_opt_pi_prefix_len) &&
addr_match(&prefix->Prefix, &pinfo->nd_opt_pi_prefix,
prefix->PrefixLen))
{
print_addr(&prefix->Prefix, prefix_str);
if (valid != prefix->AdvValidLifetime)
{
flog(LOG_WARNING, "our AdvValidLifetime on"
" %s for %s doesn't agree with %s",
iface->Name,
prefix_str,
addr_str
);
}
if (preferred != prefix->AdvPreferredLifetime)
{
flog(LOG_WARNING, "our AdvPreferredLifetime on"
" %s for %s doesn't agree with %s",
iface->Name,
prefix_str,
addr_str
);
}
}
prefix = prefix->next;
}
break;
case ND_OPT_ROUTE_INFORMATION:
/* not checked: these will very likely vary a lot */
break;
case ND_OPT_SOURCE_LINKADDR:
/* not checked */
break;
case ND_OPT_TARGET_LINKADDR:
case ND_OPT_REDIRECTED_HEADER:
flog(LOG_ERR, "invalid option %d in RA on %s from %s",
(int)*opt_str, iface->Name, addr_str);
break;
/* Mobile IPv6 extensions */
case ND_OPT_RTR_ADV_INTERVAL:
case ND_OPT_HOME_AGENT_INFO:
/* not checked */
break;
case ND_OPT_RDNSS_INFORMATION:
rdnssinfo = (struct nd_opt_rdnss_info_local *) opt_str;
count = rdnssinfo->nd_opt_rdnssi_len;
/* Check the RNDSS addresses received */
switch (count) {
case 7:
rdnss = iface->AdvRDNSSList;
if (!check_rdnss_presence(rdnss, &rdnssinfo->nd_opt_rdnssi_addr3 )) {
/* no match found in iface->AdvRDNSSList */
print_addr(&rdnssinfo->nd_opt_rdnssi_addr3, rdnss_str);
flog(LOG_WARNING, "RDNSS address %s received on %s from %s is not advertised by us",
rdnss_str, iface->Name, addr_str);
}
/* FALLTHROUGH */
case 5:
rdnss = iface->AdvRDNSSList;
if (!check_rdnss_presence(rdnss, &rdnssinfo->nd_opt_rdnssi_addr2 )) {
/* no match found in iface->AdvRDNSSList */
print_addr(&rdnssinfo->nd_opt_rdnssi_addr2, rdnss_str);
flog(LOG_WARNING, "RDNSS address %s received on %s from %s is not advertised by us",
rdnss_str, iface->Name, addr_str);
}
/* FALLTHROUGH */
case 3:
rdnss = iface->AdvRDNSSList;
if (!check_rdnss_presence(rdnss, &rdnssinfo->nd_opt_rdnssi_addr1 )) {
/* no match found in iface->AdvRDNSSList */
print_addr(&rdnssinfo->nd_opt_rdnssi_addr1, rdnss_str);
flog(LOG_WARNING, "RDNSS address %s received on %s from %s is not advertised by us",
rdnss_str, iface->Name, addr_str);
}
break;
default:
flog(LOG_ERR, "invalid len %i in RDNSS option on %s from %s",
count, iface->Name, addr_str);
}
break;
default:
dlog(LOG_DEBUG, 1, "unknown option %d in RA on %s from %s",
(int)*opt_str, iface->Name, addr_str);
break;
}
len -= optlen;
opt_str += optlen;
}
}
static int
addr_match(struct in6_addr *a1, struct in6_addr *a2, int prefixlen)
{
unsigned int pdw;
unsigned int pbi;
pdw = prefixlen >> 0x05; /* num of whole uint32_t in prefix */
pbi = prefixlen & 0x1f; /* num of bits in incomplete uint32_t in prefix */
if (pdw)
{
if (memcmp(a1, a2, pdw << 2))
return 0;
}
if (pbi)
{
uint32_t w1, w2;
uint32_t mask;
w1 = *((uint32_t *)a1 + pdw);
w2 = *((uint32_t *)a2 + pdw);
mask = htonl(((uint32_t) 0xffffffff) << (0x20 - pbi));
if ((w1 ^ w2) & mask)
return 0;
}
return 1;
}
--- NEW FILE: radvd.8.man ---
.\"
.\" $Id: radvd.8.man,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
.\"
.\" Authors:
.\" Lars Fenneberg <lf at elemental.net>
.\"
.\" This software is Copyright 1996-2000 by the above mentioned author(s),
.\" All Rights Reserved.
.\"
.\" The license which is distributed with this software in the file COPYRIGHT
.\" applies to this software. If your distribution is missing this file, you
.\" may request it from <pekkas at netcore.fi>.
.\"
.\"
.\"
.TH RADVD 8 "29 Mar 2001" "radvd @VERSION@" ""
.SH NAME
radvd \- router advertisement daemon for IPv6
.SH SYNOPSIS
.B radvd
.B "[ \-vh ]"
.BI "[ \-d " debuglevel " ]"
.BI "[ \-C " configfile " ]"
.BI "[ \-p " pidfile " ]"
.BI "[ \-m " logmethod " ]"
.BI "[ \-l " logfile " ]"
.BI "[ \-f " facility " ]"
.BI "[ \-t " chrootdir " ]"
.BI "[ \-u " username " ]"
.SH DESCRIPTION
.B radvd
is the router advertisement daemon for IPv6. It listens to router
solicitations and sends router advertisements as described in
"Neighbor Discovery for IP Version 6 (IPv6)" (RFC 2461).
With these advertisements hosts can automatically configure their
addresses and some other parameters. They also can choose a default
router based on these advertisements.
Note that if debugging is not enabled,
.B radvd
will not start if IPv6 forwarding is disabled. IPv6 forwarding can be
controlled via sysctl(8),
.B net.ipv6.conf.all.forwarding
on Linux or
.B net.inet6.ip6.forwarding
on BSD.
Similarly, the configuration file must not be writable by others, and if
non-root operation is requested, not even by self/own group.
.SH OPTIONS
For every one character option there is also a long option, which
is listed right next to the "short" option name:
.TP
.BR "\-v" , " \-\-version"
Displays the version of
.I radvd
and then aborts.
.TP
.BR "\-h" , " \-\-help"
Displays a short usage description and then aborts.
.TP
.BR "\-d " debuglevel, " \-\-debug " debuglevel
With this option you turn on debugging information. The debugging level is
an integer in the range from 1 to 5, from quiet to very verbose. A
debugging level of 0 completely turns off debugging. If a debugging level
greater than 0 is used,
.I radvd
doesn't background itself on start. The default debugging level is 0.
.TP
.BR "\-C " configfile, " \-\-config " configfile
Specifies an alternate config file. Normally the compiled in default
.I @PATH_RADVD_CONF@
is used.
.TP
.BR "\-p " pidfile, " \-\-pidfile " pidfile
Specifies an alternate pidfile. Normally the compiled in default
.I @PATH_RADVD_PID@
is used.
.TP
.BR "\-m " method, " \-\-logmethod " method
Specifies the logging method to use. Possibly values are:
.RS
.TP
.B none
Completely disables any logging.
.TP
.B logfile
Logs to the logfile which is specified by the
.I \-l
option. If no logfile is specified on the command line, then
a compiled in default is used (see next option).
.TP
.B stderr
Logs to standard error.
.TP
.B stderr_syslog
Logs only the high messages (of at least LOG_ERR priority) to standard
error, and everything to syslog (default method).
.TP
.B syslog
Logs to syslog.
.RE
.PP
.TP
.BR "\-l " logfile, " \-\-logfile " logfile
Specifies the logfile to use when using the logging method
.IR logfile .
The default logfile is
.IR @PATH_RADVD_LOG@ .
.TP
.BR "\-f " facility, " \-\-facility " facility
Specifies the facility (as an integer) when using syslog logging. Default
is @LOG_FACILITY at .
.TP
.BR "\-t " chrootdir, " \-\-chrootdir " chrootdir
If specified, switches to
.I chrootdir
before doing anything else. This directory and its
subdirectories must have been populated first.
For security reasons,
.I \-u
must always be used when using
.IR chrootdir .
Note that on Linux
.I radvd
requires access to the
.I /proc
filesystem,
so it is more challenging to set up the chroot environment.
.TP
.BR "\-u " username, " \-\-username " username
If specified, drops root privileges and changes user ID to
.I username
and group ID to the primary group of
.IR username .
This is recommended for security reasons.
You might also need to use
.I \-p
to point to a file in a
.I username
-writable directory (e.g. /var/run/radvd/radvd.pid).
.SH FILES
.nf
@sbindir@/radvd
@PATH_RADVD_CONF@
@PATH_RADVD_PID@
@PATH_RADVD_LOG@
.fi
.SH BUGS
There certainly are some bugs. If you find them or have other
suggestions please contact Pekka Savola <pekkas at netcore.fi>.
.SH "SEE ALSO"
.BR radvd.conf (5),
.BR radvdump (8)
.SH AUTHORS
.nf
Pedro Roque <roque at di.fc.ul.pt> - wrote first version for Linux
Lars Fenneberg <lf at elemental.net> - previous maintainer
Nathan Lutchansky <lutchann at litech.org> - previous maintainer
Pekka Savola <pekkas at netcore.fi> - current maintainer
Craig Metz <cmetz at inner.net> - port to NRL's IPv6 code for BSD4.4
Marko Myllynen <myllynen at lut.fi> - RFC 2461 update, Mobile IPv6 support
.fi
--- NEW FILE: radvd.c ---
/*
* $Id: radvd.c,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Pedro Roque <roque at di.fc.ul.pt>
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996-2000 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#include <config.h>
#include <includes.h>
#include <radvd.h>
#include <pathnames.h>
struct Interface *IfaceList = NULL;
char usage_str[] =
"[-vh] [-d level] [-C config_file] [-m log_method] [-l log_file]\n"
"\t[-f facility] [-p pid_file] [-u username] [-t chrootdir]";
#ifdef HAVE_GETOPT_LONG
struct option prog_opt[] = {
{"debug", 1, 0, 'd'},
{"config", 1, 0, 'C'},
{"pidfile", 1, 0, 'p'},
{"logfile", 1, 0, 'l'},
{"logmethod", 1, 0, 'm'},
{"facility", 1, 0, 'f'},
{"username", 1, 0, 'u'},
{"chrootdir", 1, 0, 't'},
{"version", 0, 0, 'v'},
{"help", 0, 0, 'h'},
{NULL, 0, 0, 0}
};
#endif
extern FILE *yyin;
char *conf_file = NULL;
char *pname;
int sock = -1;
volatile int sighup_received = 0;
volatile int sigterm_received = 0;
volatile int sigint_received = 0;
void sighup_handler(int sig);
void sigterm_handler(int sig);
void sigint_handler(int sig);
void timer_handler(void *data);
void config_interface(void);
void kickoff_adverts(void);
void stop_adverts(void);
void version(void);
void usage(void);
int drop_root_privileges(const char *);
int readin_config(char *);
int check_conffile_perm(const char *, const char *);
int
main(int argc, char *argv[])
{
unsigned char msg[MSG_SIZE];
char pidstr[16];
int c, log_method;
char *logfile, *pidfile;
sigset_t oset, nset;
int facility, fd;
char *username = NULL;
char *chrootdir = NULL;
#ifdef HAVE_GETOPT_LONG
int opt_idx;
#endif
pname = ((pname=strrchr(argv[0],'/')) != NULL)?pname+1:argv[0];
srand((unsigned int)time(NULL));
log_method = L_STDERR_SYSLOG;
logfile = PATH_RADVD_LOG;
conf_file = PATH_RADVD_CONF;
facility = LOG_FACILITY;
pidfile = PATH_RADVD_PID;
/* parse args */
#ifdef HAVE_GETOPT_LONG
while ((c = getopt_long(argc, argv, "d:C:l:m:p:t:u:vh", prog_opt, &opt_idx)) > 0)
#else
while ((c = getopt(argc, argv, "d:C:l:m:p:t:u:vh")) > 0)
#endif
{
switch (c) {
case 'C':
conf_file = optarg;
break;
case 'd':
set_debuglevel(atoi(optarg));
break;
case 'f':
facility = atoi(optarg);
break;
case 'l':
logfile = optarg;
break;
case 'p':
pidfile = optarg;
break;
case 'm':
if (!strcmp(optarg, "syslog"))
{
log_method = L_SYSLOG;
}
else if (!strcmp(optarg, "stderr_syslog"))
{
log_method = L_STDERR_SYSLOG;
}
else if (!strcmp(optarg, "stderr"))
{
log_method = L_STDERR;
}
else if (!strcmp(optarg, "logfile"))
{
log_method = L_LOGFILE;
}
else if (!strcmp(optarg, "none"))
{
log_method = L_NONE;
}
else
{
fprintf(stderr, "%s: unknown log method: %s\n", pname, optarg);
exit(1);
}
break;
case 't':
chrootdir = strdup(optarg);
break;
case 'u':
username = strdup(optarg);
break;
case 'v':
version();
break;
case 'h':
usage();
#ifdef HAVE_GETOPT_LONG
case ':':
fprintf(stderr, "%s: option %s: parameter expected\n", pname,
prog_opt[opt_idx].name);
exit(1);
#endif
case '?':
exit(1);
}
}
if (chrootdir) {
if (!username) {
fprintf(stderr, "Chroot as root is not safe, exiting\n");
exit(1);
}
if (chroot(chrootdir) == -1) {
perror("chroot");
exit (1);
}
if (chdir("/") == -1) {
perror("chdir");
exit (1);
}
/* username will be switched later */
}
if (log_open(log_method, pname, logfile, facility) < 0)
exit(1);
flog(LOG_INFO, "version %s started", VERSION);
/* get a raw socket for sending and receiving ICMPv6 messages */
sock = open_icmpv6_socket();
if (sock < 0)
exit(1);
/* drop root privileges if requested. */
if (username) {
if (drop_root_privileges(username) < 0)
exit(1);
}
/* check that 'other' cannot write the file
* for non-root, also that self/own group can't either
*/
if (check_conffile_perm(username, conf_file) < 0) {
if (get_debuglevel() == 0)
exit(1);
else
flog(LOG_WARNING, "Insecure file permissions, but continuing anyway");
}
/* if we know how to do it, check whether forwarding is enabled */
if (check_ip6_forwarding()) {
if (get_debuglevel() == 0) {
flog(LOG_ERR, "IPv6 forwarding seems to be disabled, exiting");
exit(1);
}
else
flog(LOG_WARNING, "IPv6 forwarding seems to be disabled, but continuing anyway.");
}
/* parse config file */
if (readin_config(conf_file) < 0)
exit(1);
/* FIXME: not atomic if pidfile is on an NFS mounted volume */
if ((fd = open(pidfile, O_CREAT|O_EXCL|O_WRONLY, 0644)) < 0)
{
flog(LOG_ERR, "another radvd seems to be already running, terminating");
exit(1);
}
/*
* okay, config file is read in, socket and stuff is setup, so
* lets fork now...
*/
if (get_debuglevel() == 0) {
/* Detach from controlling terminal */
if (daemon(0, 0) < 0)
perror("daemon");
/* close old logfiles, including stderr */
log_close();
/* reopen logfiles, but don't log to stderr unless explicitly requested */
if (log_method == L_STDERR_SYSLOG)
log_method = L_SYSLOG;
if (log_open(log_method, pname, logfile, facility) < 0)
exit(1);
}
/*
* config signal handlers, also make sure ALRM isn't blocked and raise a warning if so
* (some stupid scripts/pppd appears to do this...)
*/
sigemptyset(&nset);
sigaddset(&nset, SIGALRM);
sigprocmask(SIG_UNBLOCK, &nset, &oset);
if (sigismember(&oset, SIGALRM))
flog(LOG_WARNING, "SIGALRM has been unblocked. Your startup environment might be wrong.");
signal(SIGHUP, sighup_handler);
signal(SIGTERM, sigterm_handler);
signal(SIGINT, sigint_handler);
snprintf(pidstr, sizeof(pidstr), "%d\n", getpid());
write(fd, pidstr, strlen(pidstr));
close(fd);
config_interface();
kickoff_adverts();
/* enter loop */
for (;;)
{
int len, hoplimit;
struct sockaddr_in6 rcv_addr;
struct in6_pktinfo *pkt_info = NULL;
len = recv_rs_ra(sock, msg, &rcv_addr, &pkt_info, &hoplimit);
if (len > 0)
process(sock, IfaceList, msg, len,
&rcv_addr, pkt_info, hoplimit);
if (sigterm_received || sigint_received) {
stop_adverts();
break;
}
if (sighup_received)
{
reload_config();
sighup_received = 0;
}
}
unlink(pidfile);
exit(0);
}
void
timer_handler(void *data)
{
struct Interface *iface = (struct Interface *) data;
double next;
dlog(LOG_DEBUG, 4, "timer_handler called for %s", iface->Name);
send_ra(sock, iface, NULL);
next = rand_between(iface->MinRtrAdvInterval, iface->MaxRtrAdvInterval);
if (iface->init_racount < MAX_INITIAL_RTR_ADVERTISEMENTS)
{
iface->init_racount++;
next = min(MAX_INITIAL_RTR_ADVERT_INTERVAL, next);
}
set_timer(&iface->tm, next);
}
void
config_interface(void)
{
struct Interface *iface;
for(iface=IfaceList; iface; iface=iface->next)
{
if (iface->AdvLinkMTU)
set_interface_linkmtu(iface->Name, iface->AdvLinkMTU);
if (iface->AdvCurHopLimit)
set_interface_curhlim(iface->Name, iface->AdvCurHopLimit);
if (iface->AdvReachableTime)
set_interface_reachtime(iface->Name, iface->AdvReachableTime);
if (iface->AdvRetransTimer)
set_interface_retranstimer(iface->Name, iface->AdvRetransTimer);
}
}
void
kickoff_adverts(void)
{
struct Interface *iface;
/*
* send initial advertisement and set timers
*/
for(iface=IfaceList; iface; iface=iface->next)
{
if( ! iface->UnicastOnly )
{
init_timer(&iface->tm, timer_handler, (void *) iface);
if (iface->AdvSendAdvert)
{
/* send an initial advertisement */
send_ra(sock, iface, NULL);
iface->init_racount++;
set_timer(&iface->tm,
min(MAX_INITIAL_RTR_ADVERT_INTERVAL,
iface->MaxRtrAdvInterval));
}
}
}
}
void
stop_adverts(void)
{
struct Interface *iface;
/*
* send final RA (a SHOULD in RFC2461 section 6.2.5)
*/
for (iface=IfaceList; iface; iface=iface->next) {
if( ! iface->UnicastOnly ) {
if (iface->AdvSendAdvert) {
/* send a final advertisement with zero Router Lifetime */
iface->AdvDefaultLifetime = 0;
send_ra(sock, iface, NULL);
}
}
}
}
void reload_config(void)
{
struct Interface *iface;
flog(LOG_INFO, "attempting to reread config file");
dlog(LOG_DEBUG, 4, "reopening log");
if (log_reopen() < 0)
exit(1);
/* disable timers, free interface and prefix structures */
for(iface=IfaceList; iface; iface=iface->next)
{
/* check that iface->tm was set in the first place */
if (iface->tm.next && iface->tm.prev)
{
dlog(LOG_DEBUG, 4, "disabling timer for %s", iface->Name);
clear_timer(&iface->tm);
}
}
iface=IfaceList;
while(iface)
{
struct Interface *next_iface = iface->next;
struct AdvPrefix *prefix;
struct AdvRoute *route;
struct AdvRDNSS *rdnss;
dlog(LOG_DEBUG, 4, "freeing interface %s", iface->Name);
prefix = iface->AdvPrefixList;
while (prefix)
{
struct AdvPrefix *next_prefix = prefix->next;
free(prefix);
prefix = next_prefix;
}
route = iface->AdvRouteList;
while (route)
{
struct AdvRoute *next_route = route->next;
free(route);
route = next_route;
}
rdnss = iface->AdvRDNSSList;
while (rdnss)
{
struct AdvRDNSS *next_rdnss = rdnss->next;
free(rdnss);
rdnss = next_rdnss;
}
free(iface);
iface = next_iface;
}
IfaceList = NULL;
/* reread config file */
if (readin_config(conf_file) < 0)
exit(1);
config_interface();
kickoff_adverts();
flog(LOG_INFO, "resuming normal operation");
}
void
sighup_handler(int sig)
{
/* Linux has "one-shot" signals, reinstall the signal handler */
signal(SIGHUP, sighup_handler);
dlog(LOG_DEBUG, 4, "sighup_handler called");
sighup_received = 1;
}
void
sigterm_handler(int sig)
{
/* Linux has "one-shot" signals, reinstall the signal handler */
signal(SIGTERM, sigterm_handler);
dlog(LOG_DEBUG, 4, "sigterm_handler called");
sigterm_received = 1;
}
void
sigint_handler(int sig)
{
/* Linux has "one-shot" signals, reinstall the signal handler */
signal(SIGINT, sigint_handler);
dlog(LOG_DEBUG, 4, "sigint_handler called");
sigint_received = 1;
}
int
drop_root_privileges(const char *username)
{
struct passwd *pw = NULL;
pw = getpwnam(username);
if (pw) {
if (initgroups(username, pw->pw_gid) != 0 || setgid(pw->pw_gid) != 0 || setuid(pw->pw_uid) != 0) {
flog(LOG_ERR, "Couldn't change to '%.32s' uid=%d gid=%d\n",
username, pw->pw_uid, pw->pw_gid);
return (-1);
}
}
else {
flog(LOG_ERR, "Couldn't find user '%.32s'\n", username);
return (-1);
}
return 0;
}
int
check_conffile_perm(const char *username, const char *conf_file)
{
struct stat *st = NULL;
struct passwd *pw = NULL;
FILE *fp = fopen(conf_file, "r");
if (fp == NULL) {
flog(LOG_ERR, "can't open %s: %s", conf_file, strerror(errno));
return (-1);
}
fclose(fp);
st = malloc(sizeof(struct stat));
if (st == NULL)
goto errorout;
if (!username)
username = "root";
pw = getpwnam(username);
if (stat(conf_file, st) || pw == NULL)
goto errorout;
if (st->st_mode & S_IWOTH) {
flog(LOG_ERR, "Insecure file permissions (writable by others): %s", conf_file);
goto errorout;
}
/* for non-root: must not be writable by self/own group */
if (strncmp(username, "root", 5) != 0 &&
((st->st_mode & S_IWGRP && pw->pw_gid == st->st_gid) ||
(st->st_mode & S_IWUSR && pw->pw_uid == st->st_uid))) {
flog(LOG_ERR, "Insecure file permissions (writable by self/group): %s", conf_file);
goto errorout;
}
free(st);
return 0;
errorout:
if (st)
free(st);
return(-1);
}
int
check_ip6_forwarding(void)
{
int forw_sysctl[] = { SYSCTL_IP6_FORWARDING };
int value;
size_t size = sizeof(value);
FILE *fp = NULL;
#ifdef __linux__
fp = fopen(PROC_SYS_IP6_FORWARDING, "r");
if (fp) {
fscanf(fp, "%d", &value);
fclose(fp);
}
else
flog(LOG_DEBUG, "Correct IPv6 forwarding procfs entry not found, "
"perhaps the procfs is disabled, "
"or the kernel interface has changed?");
#endif /* __linux__ */
if (!fp && sysctl(forw_sysctl, sizeof(forw_sysctl)/sizeof(forw_sysctl[0]),
&value, &size, NULL, 0) < 0) {
flog(LOG_DEBUG, "Correct IPv6 forwarding sysctl branch not found, "
"perhaps the kernel interface has changed?");
return(0); /* this is of advisory value only */
}
if (value != 1) {
flog(LOG_DEBUG, "IPv6 forwarding setting is: %u, should be 1", value);
return(-1);
}
return(0);
}
int
readin_config(char *fname)
{
if ((yyin = fopen(fname, "r")) == NULL)
{
flog(LOG_ERR, "can't open %s: %s", fname, strerror(errno));
return (-1);
}
if (yyparse() != 0)
{
flog(LOG_ERR, "error parsing or activating the config file: %s", fname);
return (-1);
}
fclose(yyin);
return 0;
}
void
version(void)
{
fprintf(stderr, "Version: %s\n\n", VERSION);
fprintf(stderr, "Compiled in settings:\n");
fprintf(stderr, " default config file \"%s\"\n", PATH_RADVD_CONF);
fprintf(stderr, " default pidfile \"%s\"\n", PATH_RADVD_PID);
fprintf(stderr, " default logfile \"%s\"\n", PATH_RADVD_LOG);
fprintf(stderr, " default syslog facililty %d\n", LOG_FACILITY);
fprintf(stderr, "Please send bug reports or suggestions to %s.\n",
CONTACT_EMAIL);
exit(1);
}
void
usage(void)
{
fprintf(stderr, "usage: %s %s\n", pname, usage_str);
exit(1);
}
--- NEW FILE: radvd.conf.5.man ---
.\"
.\" $Id: radvd.conf.5.man,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
.\"
.\" Authors:
.\" Lars Fenneberg <lf at elemental.net>
.\" Marko Myllynen <myllynen at lut.fi>
.\"
.\" This software is Copyright 1996-2000 by the above mentioned author(s),
.\" All Rights Reserved.
.\"
.\" The license which is distributed with this software in the file COPYRIGHT
.\" applies to this software. If your distribution is missing this file, you
.\" may request it from <pekkas at netcore.fi>.
.\"
.\"
.\"
.TH RADVD.CONF 5 "20 Aug 2004" "radvd @VERSION@" ""
.SH NAME
radvd.conf \- configuration file of the router advertisement daemon
.B radvd
.SH DESCRIPTION
This file describes the information which is included in the router
advertisement (RA) of a specific interface.
.P
The file contains one or more interface definitions of the form:
.nf
.BR "interface " "name " {
list of interface specific options
list of prefix definitions
list of route definitions
list of RDNSS definitions
.B };
.fi
All the possible interface specific options are detailed below. Each
option has to be terminated by a semicolon.
Prefix definitions are of the form:
.nf
.BR "prefix " prefix / "length " {
list of prefix specific options
.B };
.fi
Prefix can be network prefix or the address of the inferface.
The address of interface should be used when using Mobile IPv6
extensions.
All the possible prefix specific options are described below. Each
option has to be terminated by a semicolon.
Decimal values are allowed only for MinDelayBetweenRAs,
MaxRtrAdvInterval and MinRtrAdvInterval. Decimal values should
be used only when using Mobile IPv6 extensions.
Route definitions are of the form:
.nf
.BR "route " prefix / "length " {
list of route specific options
.B };
.fi
The prefix of a route definition should be network prefix; it can be used to
advertise more specific routes to the hosts.
RDNSS (Recursive DNS server) definitions are of the form:
.nf
.BR "RDNSS " "ip [ip] [ip] " {
list of rdnss specific options
.B };
.fi
.SH INTERFACE SPECIFIC OPTIONS
.TP
.BR IgnoreIfMissing " " on | off
A flag indicating whether or not the interface is ignored
if it does not exist at start-up. By default, radvd exits.
This is useful for dynamic interfaces which are not active when radvd
starts or which are dynamically disabled and re-enabled during the time
radvd runs.
Current versions of radvd automatically try to re-enable interfaces.
Enabling IgnoreIfMissing also quenches certain warnings in log messages
relating to missing interfaces.
Default: off
.TP
.BR AdvSendAdvert " " on | off
A flag indicating whether or not the router sends
periodic router advertisements and responds to
router solicitations.
This option no longer has to be specified first, but it
needs to be
.B on
to enable advertisement on this interface.
Default: off
.TP
.BR UnicastOnly " " on | off
Indicates that the interface link type only supports unicast.
This will prevent unsolicited advertisements from being sent, and
will cause solicited advertisements to be unicast to the
soliciting node. This option is necessary for non-broadcast,
multiple-access links, such as ISATAP.
Default: off
.TP
.BR "MaxRtrAdvInterval " seconds
The maximum time allowed between sending unsolicited multicast
router advertisements from the interface, in seconds.
Must be no less than 4 seconds and no greater than 1800 seconds.
Minimum when using Mobile IPv6 extensions: 0.07.
For values less than 0.2 seconds, 0.02 seconds is added to account for
scheduling granularities as specified in RFC3775.
Default: 600 seconds
.TP
.BR "MinRtrAdvInterval " seconds
The minimum time allowed between sending unsolicited multicast
router advertisements from the interface, in seconds.
Must be no less than 3 seconds and no greater than 0.75 *
MaxRtrAdvInterval.
Minimum when using Mobile IPv6 extensions: 0.03.
Default: 0.33 * MaxRtrAdvInterval
.TP
.BR "MinDelayBetweenRAs " seconds
The minimum time allowed between sending multicast
router advertisements from the interface, in seconds.
This applies to solicited multicast RAs.
This is defined as the protocol constant MIN_DELAY_BETWEEN_RAS in RFC2461.
MIPv6 redefines this parameter to have a minimum of 0.03 seconds.
Minimum when using Mobile IPv6 extensions: 0.03.
Default: 3
.TP
.BR AdvManagedFlag " " on | off
When set, hosts use the administered (stateful) protocol for address
autoconfiguration in addition to any addresses autoconfigured using
stateless address autoconfiguration. The use of this flag is
described in RFC 2462.
Default: off
.TP
.BR AdvOtherConfigFlag " " on | off
When set, hosts use the administered (stateful) protocol for
autoconfiguration of other (non-address) information. The use of
this flag is described in RFC 2462.
Default: off
.TP
.BR "AdvLinkMTU " integer
The MTU option is used in router advertisement messages to insure
that all nodes on a link use the same MTU value in those cases where
the link MTU is not well known.
If specified, i.e. not 0, must not be smaller than 1280 and not greater
than the maximum MTU allowed for this link (e.g. ethernet has
a maximum MTU of 1500. See RFC 2464).
Default: 0
.TP
.BR "AdvReachableTime " milliseconds
The time, in milliseconds, that a node assumes a neighbor is
reachable after having received a reachability confirmation. Used
by the Neighbor Unreachability Detection algorithm (see Section
7.3 of RFC 2461). A value of zero means unspecified (by this router).
Must be no greater than 3,600,000 milliseconds (1 hour).
Default: 0
.TP
.BR "AdvRetransTimer " milliseconds
The time, in milliseconds, between retransmitted Neighbor
Solicitation messages. Used by address resolution and the Neighbor
Unreachability Detection algorithm (see Sections 7.2 and 7.3 of RFC 2461).
A value of zero means unspecified (by this router).
Default: 0
.TP
.BR "AdvCurHopLimit " integer
The default value that should be placed in the Hop Count field of
the IP header for outgoing (unicast) IP packets. The value should
be set to the current diameter of the Internet. The value zero
means unspecified (by this router).
Default: 64
.TP
.BR "AdvDefaultLifetime " seconds
The lifetime associated with the default router in units of seconds.
The maximum value corresponds to 18.2 hours. A lifetime of 0
indicates that the router is not a default router and should not
appear on the default router list. The router lifetime applies only
to the router's usefulness as a default router; it does not apply to
information contained in other message fields or options. Options
that need time limits for their information include their own
lifetime fields.
Must be either zero or between MaxRtrAdvInterval and 9000 seconds.
Default: 3 * MaxRtrAdvInterval (Minimum 1 second).
.TP
.BR AdvDefaultPreference " " low | medium | high
The preference associated with the default router, as either "low",
"medium", or "high".
Default: medium
.TP
.BR AdvSourceLLAddress " " on | off
When set, the link-layer address of the outgoing interface is
included in the RA.
Default: on
.TP
.BR AdvHomeAgentFlag " " on | off
When set, indicates that sending router is able to serve as Mobile
IPv6 Home Agent. When set, minimum limits specified by Mobile IPv6
are used for MinRtrAdvInterval and MaxRtrAdvInterval.
Default: off
.TP
.BR AdvHomeAgentInfo " " on | off
When set, Home Agent Information Option (specified by Mobile IPv6)
is included in Router Advertisements. AdvHomeAgentFlag must also
be set when using this option.
Default: off
.TP
.BR "HomeAgentLifetime " seconds
The length of time in seconds (relative to the time the packet is
sent) that the router is offering Mobile IPv6 Home Agent services.
A value 0 must not be used. The maximum lifetime is 65520 seconds
(18.2 hours). This option is ignored, if AdvHomeAgentInfo is not
set.
If both HomeAgentLifetime and HomeAgentPreference are set to their
default values, Home Agent Information Option will not be sent.
Default: AdvDefaultLifetime
.TP
.BR "HomeAgentPreference " integer
The preference for the Home Agent sending this Router Advertisement.
Values greater than 0 indicate more preferable Home Agent, values
less than 0 indicate less preferable Home Agent. This option is
ignored, if AdvHomeAgentInfo is not set.
If both HomeAgentLifetime and HomeAgentPreference are set to their
default values, Home Agent Information Option will not be sent.
Default: 0
.TP
.BR AdvMobRtrSupportFlag " " on | off
When set, the Home Agent signals it supports Mobile Router
registrations (specified by NEMO Basic). AdvHomeAgentInfo must also
be set when using this option.
Default: off
.TP
.BR AdvIntervalOpt " " on | off
When set, Advertisement Interval Option (specified by Mobile IPv6)
is included in Router Advertisements. When set, minimum limits
specified by Mobile IPv6 are used for MinRtrAdvInterval and
MaxRtrAdvInterval.
The advertisement interval is based on the configured MaxRtrAdvInterval
parameter except where this is less than 200ms. In this case,
the advertised interval is ( MaxRtrAdvInterval + 20ms ).
Default: off
.SH PREFIX SPECIFIC OPTIONS
.TP
.BR AdvOnLink " " on | off
When set, indicates that this prefix can be used for on-link
determination. When not set the advertisement makes no statement
about on-link or off-link properties of the prefix. For instance,
the prefix might be used for address configuration with some of the
addresses belonging to the prefix being on-link and others being
off-link.
Default: on
.TP
.BR AdvAutonomous " " on | off
When set, indicates that this prefix can be used for autonomous
address configuration as specified in RFC 2462.
Default: on
.TP
.BR AdvRouterAddr " " on | off
When set, indicates that the address of interface is sent instead of
network prefix, as is required by Mobile IPv6. When set, minimum
limits specified by Mobile IPv6 are used for MinRtrAdvInterval and
MaxRtrAdvInterval.
Default: off
.TP
.BR "AdvValidLifetime " seconds "" | infinity
The length of time in seconds (relative to the time the packet is
sent) that the prefix is valid for the purpose of on-link
determination. The symbolic value
.B infinity
represents infinity (i.e. a value of all one bits (0xffffffff)).
The valid lifetime is also used by RFC 2462.
Default: 2592000 seconds (30 days)
.TP
.BR "AdvPreferredLifetime " seconds "" | infinity
The length of time in seconds (relative to the time the packet is
sent) that addresses generated from the prefix via stateless address
autoconfiguration remain preferred.
The symbolic value
.B infinity
represents infinity (i.e. a value of all one bits (0xffffffff)).
See RFC 2462.
Default: 604800 seconds (7 days)
.TP
.BR "Base6to4Interface " name
If this option is specified, this prefix will be combined with the
IPv4 address of interface
.B name
to produce a valid 6to4 prefix. The first 16 bits of this prefix
will be replaced by
.B 2002
and the next 32 bits of this prefix will be replaced by the IPv4
address assigned to interface
.B name
at configuration time. The remaining 80 bits of the prefix (including
the SLA ID) will be advertised as specified in the configuration file.
See the next section for an example.
If interface
.B name
is not available at configuration time, a warning will be written to
the log and this prefix will be disabled until radvd is reconfigured.
This option enables systems with dynamic IPv4 addresses to update their
advertised 6to4 prefixes simply by restarting radvd or sending a SIGHUP
signal to cause radvd to reconfigure itself.
Note that 6to4 prefixes derived from dynamically-assigned IPv4 addresses
should be advertised with a significantly shorter lifetime (see the
.B AdvValidLifetime
and
.B AdvPreferredLifetime
options).
For more information on 6to4, see RFC 3056.
Default: 6to4 is not used
.SH ROUTE SPECIFIC OPTIONS
.TP
.BR "AdvRouteLifetime " seconds "" | infinity
The lifetime associated with the route in units of seconds.
The symbolic value
.B infinity
represents infinity (i.e. a value of all one bits (0xffffffff)).
Default: 3 * MaxRtrAdvInterval
.TP
.BR AdvRoutePreference " " low | medium | high
The preference associated with the default router, as either "low",
"medium", or "high".
Default: medium
.SH RDNSS SPECIFIC OPTIONS
.TP
.BR "AdvRDNSSPreference " integer;
The preference of the DNS server, compared to other DNS servers advertised and used.
0 to 7 means less important than manually configured nameservers in resolv.conf, while 12 to 15 means more important.
Default: 8
.TP
.BR "AdvRDNSSOpen " on | off;
"Service Open" flag. When set, indicates that RDNSS continues to be available to hosts even if they moved to a different subnet.
Default: off
.TP
.BR "AdvRDNSSLifetime " seconds | infinity;
The maximum duration how long the RDNSS entries are used for name resolution. A value of 0 means the nameserver should no longer be used.
The maximum duration how long the RDNSS entries are used for name resolution. A value of 0 means the nameserver should no longer be used.
The value, if not 0, must be at least MaxRtrAdvInterval. To ensure stale
RDNSS info gets removed in a timely fashion, this should not be greater than
2*MaxRtrAdvInterval.
Default: 2*MaxRtrAdvInterval
.SH EXAMPLES
.nf
interface eth0
{
AdvSendAdvert on;
prefix 2001:db8:0:1::/64
{
AdvOnLink on;
AdvAutonomous on;
};
};
.fi
It says that router advertisement daemon should advertise
(AdvSendAdvert on;) the prefix 2001:db8:0:1:: which has a lenght of 64
on the interface eth0. Also the prefix should be marked as autonomous
(AdvAutonomous on;) and as on-link (AdvOnLink on;). All the other
options are left on their default values.
To support movement detection of Mobile IPv6 Mobile Nodes, the
address of interface should be used instead of network prefix:
.nf
interface eth0
{
AdvSendAdvert on;
prefix 2001:db8:0:1::4/64
{
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr on;
};
};
.fi
For 6to4 support, include the
.B Base6to4Interface
option in each prefix section. When using a dynamic IPv4 address, set
small prefix lifetimes to prevent hosts from retaining unreachable
prefixes after a new IPv4 address has been assigned. When advertising to on
a dynamic interface (e.g., Bluetooth), skip the interface if it is not
active yet.
.nf
interface bnep0
{
IgnoreIfMissing on;
AdvSendAdvert on;
# Advertise at least every 30 seconds
MaxRtrAdvInterval 30;
prefix 0:0:0:5678::/64
{
AdvOnLink on;
AdvAutonomous on;
Base6to4Interface ppp0;
# Very short lifetimes for dynamic addresses
AdvValidLifetime 300;
AdvPreferredLifetime 120;
};
};
.fi
Since 6to4 is enabled, the prefix will be advertised as
2002:WWXX:YYZZ:5678::/64, where WW.XX.YY.ZZ is the IPv4 address of
ppp0 at configuration time. (IPv6 addresses are written in hexadecimal
whereas IPv4 addresses are written in decimal, so the IPv4 address
WW.XX.YY.ZZ in the 6to4 prefix will be represented in hex.)
In this specific case, the configuration scripts may send HUP signal to
radvd when taking bnep0 up or down to notify about the status; in the
current radvd releases, sending HUP is no longer mandatory when the link
comes back up.
.SH FILES
.nf
@sbindir@/radvd
@PATH_RADVD_CONF@
@PATH_RADVD_PID@
@PATH_RADVD_LOG@
.fi
.SH CREDIT
The description of the different flags and variables is in large
parts taken from RFC 2461.
.SH RFCS
Narten, T., E. Nordmark, W. Simpson, "Neighbor Discovery for IP
Version 6 (IPv6)", RFC 2461, December 1998
.PP
Thomson, S., and T. Narten, "IPv6 Stateless Address Autoconfiguration",
RFC 2462, December 1998.
.PP
Deering, S., and R. Hinden, "IP Version 6 Addressing
Architecture", RFC 3513, April 2003.
.PP
Conta, A., and S. Deering, "Internet Control Message Protocol (ICMPv6)
for the Internet Protocol Version 6 (IPv6)", RFC 2463, December 1998.
.PP
Crawford, M., "Transmission of IPv6 Packets over Ethernet Networks",
RFC 2464, December 1998.
.PP
Carpenter B., K. Moore, "Connection of IPv6 Domains via IPv4 Clouds",
RFC 3056, February 2001. (6to4 specification)
.PP
Draves, R., D. Thaler, "Default Router Preferences and More-Specific Routes",
RFC 4191, November 2005.
.PP
Johnson, D., Perkins, C., and J. Arkko, "Mobility Support in IPv6",
RFC 3775, June 2004.
.PP
Devarapalli, V., Wakikawa, R., Petrescu, A., and P. Thubert "Network Mobility (NEMO) Basic Support Protocol",
RFC 3963, January 2005.
.PP
J. Jeong, L. Beloeil, and S. Madanapalli, "IPv6 Router Advertisement Option for DNS Configuration",
IETF Draft v08 (January 18, 2006).
.SH "SEE ALSO"
.BR radvd (8),
.BR radvdump (8)
--- NEW FILE: radvd.conf.example ---
#
# NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
# NOTE NOTE
# NOTE This is an EXAMPLE, which serves only to demonstrate the NOTE
# NOTE syntax of radvd.conf, and is not meant to be used for a NOTE
# NOTE real radvd configuration. NOTE
# NOTE NOTE
# NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
#
interface eth0
{
AdvSendAdvert on;
# This may be needed on some interfaces which are not active when
# radvd starts, but becomoe available later on; see man page for details.
# IgnoreIfMissing on;
#
# These settings cause advertisements to be sent every 3-10 seconds. This
# range is good for 6to4 with a dynamic IPv4 address, but can be greatly
# increased when not using 6to4 prefixes.
#
MinRtrAdvInterval 3;
MaxRtrAdvInterval 10;
#
# You can use AdvDefaultPreference setting to advertise the preference of
# the router for the purposes of default router determination.
# NOTE: This feature is still being specified and is not widely supported!
#
AdvDefaultPreference low;
#
# Disable Mobile IPv6 support
#
AdvHomeAgentFlag off;
#
# example of a standard prefix
#
prefix 2001:db8:1:0::/64
{
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr off;
};
#
# example of a 6to4 prefix
#
# Note that the first 48 bits are specified here as zeros. These will be
# replaced with the appropriate 6to4 address when radvd starts or is
# reconfigured. Be sure that the SLA ID (1234 in this case) is specified
# here!
#
prefix 0:0:0:1234::/64
{
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr off;
#
# This setting causes radvd to replace the first 48 bits of the prefix
# with the 6to4 address generated from the specified interface. For example,
# if the address of ppp0 is 192.0.2.25 when radvd configures itself, this
# prefix will be advertised as 2002:C000:0219:1234::/64.
#
# If ppp0 is not available at configuration time, this prefix will not be
# advertised, but other prefixes listed in the configuration will be
# advertised as usual.
#
# When using the Base6to4Interface option, make sure radvd receives a
# SIGHUP every time the ppp0 interface goes up, down, or is assigned a
# new IPv4 address. The SIGHUP will cause radvd to recognize that the
# ppp0 interface has changed and will adjust the advertisements
# accordingly.
#
Base6to4Interface ppp0;
#
# If the IP address of ppp0 is assigned dynamically, be sure to set the
# lifetimes for this prefix to be small. Otherwise, hosts on your network
# may continue to use a prefix that no longer corresponds to the address
# on ppp0!
#
AdvPreferredLifetime 120;
AdvValidLifetime 300;
};
#
# example of a more specific route
# NOTE: This feature is still being specified and is not widely supported!
#
route 2001:db0:fff::/48
{
AdvRoutePreference high;
AdvRouteLifetime 3600;
};
#
# RDNSS
# NOTE: This feature is still a draft has no IANA number type for the moment
#
RDNSS 2001:db8::1 2001:db8::2
{
AdvRDNSSPreference 8;
AdvRDNSSOpen off;
AdvRDNSSLifetime 30;
};
};
--- NEW FILE: radvd.h ---
/*
* $Id: radvd.h,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Pedro Roque <roque at di.fc.ul.pt>
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#ifndef RADV_H
#define RADV_H
#include <config.h>
#include <includes.h>
#include <defaults.h>
#define CONTACT_EMAIL "Pekka Savola <pekkas at netcore.fi>"
/* for log.c */
#define L_NONE 0
#define L_SYSLOG 1
#define L_STDERR 2
#define L_STDERR_SYSLOG 3
#define L_LOGFILE 4
#define LOG_TIME_FORMAT "%b %d %H:%M:%S"
struct timer_lst {
struct timeval expires;
void (*handler)(void *);
void * data;
struct timer_lst *next;
struct timer_lst *prev;
};
#define min(a,b) (((a) < (b)) ? (a) : (b))
struct AdvPrefix;
#define HWADDR_MAX 16
struct Interface {
char Name[IFNAMSIZ]; /* interface name */
struct in6_addr if_addr;
unsigned int if_index;
uint8_t init_racount; /* Initial RAs */
uint8_t if_hwaddr[HWADDR_MAX];
int if_hwaddr_len;
int if_prefix_len;
int if_maxmtu;
int IgnoreIfMissing;
int AdvSendAdvert;
double MaxRtrAdvInterval;
double MinRtrAdvInterval;
double MinDelayBetweenRAs;
int AdvManagedFlag;
int AdvOtherConfigFlag;
uint32_t AdvLinkMTU;
uint32_t AdvReachableTime;
uint32_t AdvRetransTimer;
uint8_t AdvCurHopLimit;
int32_t AdvDefaultLifetime; /* XXX: really uint16_t but we need to use -1 */
int AdvDefaultPreference;
int AdvSourceLLAddress;
int UnicastOnly;
/* Mobile IPv6 extensions */
int AdvIntervalOpt;
int AdvHomeAgentInfo;
int AdvHomeAgentFlag;
uint16_t HomeAgentPreference;
int32_t HomeAgentLifetime; /* XXX: really uint16_t but we need to use -1 */
/* NEMO extensions */
int AdvMobRtrSupportFlag;
struct AdvPrefix *AdvPrefixList;
struct AdvRoute *AdvRouteList;
struct AdvRDNSS *AdvRDNSSList;
struct timer_lst tm;
time_t last_multicast_sec;
suseconds_t last_multicast_usec;
/* Info whether this interface has failed in the past (and may need to be reinitialized) */
int HasFailed;
struct Interface *next;
};
struct AdvPrefix {
struct in6_addr Prefix;
uint8_t PrefixLen;
int AdvOnLinkFlag;
int AdvAutonomousFlag;
uint32_t AdvValidLifetime;
uint32_t AdvPreferredLifetime;
/* Mobile IPv6 extensions */
int AdvRouterAddr;
/* 6to4 extensions */
char if6to4[IFNAMSIZ];
int enabled;
struct AdvPrefix *next;
};
/* More-Specific Routes extensions */
struct AdvRoute {
struct in6_addr Prefix;
uint8_t PrefixLen;
int AdvRoutePreference;
uint32_t AdvRouteLifetime;
struct AdvRoute *next;
};
/* Option for DNS configuration */
struct AdvRDNSS {
int AdvRDNSSNumber;
uint8_t AdvRDNSSPreference;
int AdvRDNSSOpenFlag;
uint32_t AdvRDNSSLifetime;
struct in6_addr AdvRDNSSAddr1;
struct in6_addr AdvRDNSSAddr2;
struct in6_addr AdvRDNSSAddr3;
struct AdvRDNSS *next;
};
/* Mobile IPv6 extensions */
struct AdvInterval {
uint8_t type;
uint8_t length;
uint16_t reserved;
uint32_t adv_ival;
};
struct HomeAgentInfo {
uint8_t type;
uint8_t length;
uint16_t flags_reserved;
uint16_t preference;
uint16_t lifetime;
};
/* gram.y */
int yyparse(void);
/* scanner.l */
int yylex(void);
/* radvd.c */
int check_ip6_forwarding(void);
void reload_config(void);
/* timer.c */
void set_timer(struct timer_lst *tm, double);
void clear_timer(struct timer_lst *tm);
void init_timer(struct timer_lst *, void (*)(void *), void *);
/* log.c */
int log_open(int, char *, char*, int);
void flog(int, char *, ...);
void dlog(int, int, char *, ...);
int log_close(void);
int log_reopen(void);
void set_debuglevel(int);
int get_debuglevel(void);
/* device.c */
int setup_deviceinfo(int, struct Interface *);
int check_device(int, struct Interface *);
int setup_linklocal_addr(int, struct Interface *);
int setup_allrouters_membership(int, struct Interface *);
int check_allrouters_membership(int, struct Interface *);
int get_v4addr(const char *, unsigned int *);
int set_interface_linkmtu(const char *, uint32_t);
int set_interface_curhlim(const char *, uint8_t);
int set_interface_reachtime(const char *, uint32_t);
int set_interface_retranstimer(const char *, uint32_t);
/* interface.c */
void iface_init_defaults(struct Interface *);
void prefix_init_defaults(struct AdvPrefix *);
void route_init_defaults(struct AdvRoute *, struct Interface *);
void rdnss_init_defaults(struct AdvRDNSS *, struct Interface *);
int check_iface(struct Interface *);
/* socket.c */
int open_icmpv6_socket(void);
/* send.c */
void send_ra(int, struct Interface *iface, struct in6_addr *dest);
/* process.c */
void process(int sock, struct Interface *, unsigned char *, int,
struct sockaddr_in6 *, struct in6_pktinfo *, int);
/* recv.c */
int recv_rs_ra(int, unsigned char *, struct sockaddr_in6 *, struct in6_pktinfo **, int *);
/* util.c */
void mdelay(double);
double rand_between(double, double);
void print_addr(struct in6_addr *, char *);
int check_rdnss_presence(struct AdvRDNSS *, struct in6_addr *);
#endif
--- NEW FILE: radvdump.8.man ---
.\"
.\" $Id: radvdump.8.man,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
.\"
.\" Authors:
.\" Lars Fenneberg <lf at elemental.net>
.\" Marko Myllynen <myllynen at lut.fi>
.\"
.\" This software is Copyright 1996 by the above mentioned author(s),
.\" All Rights Reserved.
.\"
.\" The license which is distributed with this software in the file COPYRIGHT
.\" applies to this software. If your distribution is missing this file, you
.\" may request it from <pekkas at netcore.fi>.
.\"
.\"
.\"
.TH RADVDUMP 8 "29 Dec 2001" "radvd @VERSION@" ""
.SH NAME
radvdump \- dump router advertisements
.SH SYNOPSIS
.B radvdump
.B "[ \-vhfe ]"
.BI "[ \-d " debuglevel " ]"
.SH DESCRIPTION
.B radvdump
prints out the contents of incoming router advertisements sent by
.B radvd
or some other software implementing (parts of)
"Neighbor Discovery for IP Version 6 (IPv6)" (RFC 2461).
.SH OPTIONS
For every one character option there is also a long option, which
is listed right next to the "short" option name:
.TP
.BR "\-v" , " \-\-version"
Displays the version of
.I radvdump
and then aborts.
.TP
.BR "\-h" , " \-\-help"
Displays a short usage description and then aborts.
.TP
.BR "\-f" , " \-\-file\-format"
Output received router advertisements in the format of the
.B radvd
configuration file.
Since radvd 0.9, this is the default and the switch is provided
for backward compatibility only.
.TP
.BR "\-e" , " \-\-exclude-defaults"
Exclude default valued options from configuration file format.
This option is ignored if option
.B "\-f"
is not set.
.TP
.BR "\-d " debuglevel, " \-\-debug " debuglevel
With this option you turn on debugging information. The debugging level is
an integer in the range from 1 to 4, from quiet to very verbose. A
debugging level of 0 completely turns off debugging.
The default debugging level is 0.
.SH FILES
.nf
@sbindir@/radvdump
.fi
.SH BUGS
There certainly are some bugs. If you find them or have other
suggestions please contact Pekka Savola <pekkas at netcore.fi>.
.SH "SEE ALSO"
.BR radvd (8),
.BR radvd.conf (5)
.SH AUTHORS
.nf
Lars Fenneberg <lf at elemental.net> - previous maintainer
Nathan Lutchansky <lutchann at litech.org> - previous maintainer
Pekka Savola <pekkas at netcore.fi> - current maintainer
Marko Myllynen <myllynen at lut.fi> - Mobile IPv6 support
.fi
--- NEW FILE: radvdump.c ---
/*
* $Id: radvdump.c,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Lars Fenneberg <lf at elemental.net>
* Marko Myllynen <myllynen at lut.fi>
*
* This software is Copyright 1996-2000 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#include <config.h>
#include <includes.h>
#include <radvd.h>
char usage_str[] = "[-vhfe] [-d level]";
#ifdef HAVE_GETOPT_LONG
struct option prog_opt[] = {
{"debug", 1, 0, 'd'},
{"file-format", 0, 0, 'f'},
{"exclude-defaults", 0, 0, 'e'},
{"version", 0, 0, 'v'},
{"help", 0, 0, 'h'},
{NULL, 0, 0, 0}
};
#endif
char *pname;
int sock = -1;
void version(void);
void usage(void);
void print_ff(unsigned char *, int, struct sockaddr_in6 *, int, unsigned int, int);
void print_preferences(int);
int
main(int argc, char *argv[])
{
unsigned char msg[MSG_SIZE];
int c, len, hoplimit;
int edefs = 0;
struct sockaddr_in6 rcv_addr;
struct in6_pktinfo *pkt_info = NULL;
#ifdef HAVE_GETOPT_LONG
int opt_idx;
#endif
pname = ((pname=strrchr(argv[0],'/')) != NULL)?pname+1:argv[0];
/* parse args */
#ifdef HAVE_GETOPT_LONG
while ((c = getopt_long(argc, argv, "d:fehv", prog_opt, &opt_idx)) > 0)
#else
while ((c = getopt(argc, argv, "d:fehv")) > 0)
#endif
{
switch (c) {
case 'd':
set_debuglevel(atoi(optarg));
break;
case 'f':
break;
case 'e':
edefs = 1;
break;
case 'v':
version();
break;
case 'h':
usage();
#ifdef HAVE_GETOPT_LONG
case ':':
fprintf(stderr, "%s: option %s: parameter expected\n", pname,
prog_opt[opt_idx].name);
exit(1);
#endif
case '?':
exit(1);
}
}
if (log_open(L_STDERR, pname, NULL, 0) < 0)
exit(1);
/* get a raw socket for sending and receiving ICMPv6 messages */
sock = open_icmpv6_socket();
if (sock < 0)
exit(1);
for(;;)
{
len = recv_rs_ra(sock, msg, &rcv_addr, &pkt_info, &hoplimit);
if (len > 0)
{
struct icmp6_hdr *icmph;
/*
* can this happen?
*/
if (len < sizeof(struct icmp6_hdr))
{
flog(LOG_WARNING, "received icmpv6 packet with invalid length: %d",
len);
exit(1);
}
icmph = (struct icmp6_hdr *) msg;
if (icmph->icmp6_type != ND_ROUTER_SOLICIT &&
icmph->icmp6_type != ND_ROUTER_ADVERT)
{
/*
* We just want to listen to RSs and RAs
*/
flog(LOG_ERR, "icmpv6 filter failed");
exit(1);
}
dlog(LOG_DEBUG, 4, "receiver if_index: %u", pkt_info->ipi6_ifindex);
if (icmph->icmp6_type == ND_ROUTER_SOLICIT)
{
/* not yet */
}
else if (icmph->icmp6_type == ND_ROUTER_ADVERT)
print_ff(msg, len, &rcv_addr, hoplimit, (unsigned int)pkt_info->ipi6_ifindex, edefs);
}
else if (len == 0)
{
flog(LOG_ERR, "received zero lenght packet");
exit(1);
}
else
{
flog(LOG_ERR, "recv_rs_ra: %s", strerror(errno));
exit(1);
}
}
exit(0);
}
void
print_ff(unsigned char *msg, int len, struct sockaddr_in6 *addr, int hoplimit, unsigned int if_index, int edefs)
{
/* XXX: hoplimit not being used for anything here.. */
struct nd_router_advert *radvert;
char addr_str[INET6_ADDRSTRLEN];
uint8_t *opt_str;
int orig_len = len;
char if_name[IFNAMSIZ] = "";
print_addr(&addr->sin6_addr, addr_str);
printf("#\n# radvd configuration generated by radvdump %s\n", VERSION);
printf("# based on Router Advertisement from %s\n", addr_str);
if_indextoname(if_index, if_name);
printf("# received by interface %s\n", if_name);
printf("#\n\ninterface %s\n{\n\tAdvSendAdvert on;\n", if_name);
printf("\t# Note: {Min,Max}RtrAdvInterval cannot be obtained with radvdump\n");
radvert = (struct nd_router_advert *) msg;
if (!edefs || DFLT_AdvManagedFlag != (ND_RA_FLAG_MANAGED == (radvert->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED)))
printf("\tAdvManagedFlag %s;\n",
(radvert->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED)?"on":"off");
if (!edefs || DFLT_AdvOtherConfigFlag != (ND_RA_FLAG_OTHER == (radvert->nd_ra_flags_reserved & ND_RA_FLAG_OTHER)))
printf("\tAdvOtherConfigFlag %s;\n",
(radvert->nd_ra_flags_reserved & ND_RA_FLAG_OTHER)?"on":"off");
if (!edefs || DFLT_AdvReachableTime != ntohl(radvert->nd_ra_reachable))
printf("\tAdvReachableTime %u;\n", ntohl(radvert->nd_ra_reachable));
if (!edefs || DFLT_AdvRetransTimer != ntohl(radvert->nd_ra_retransmit))
printf("\tAdvRetransTimer %u;\n", ntohl(radvert->nd_ra_retransmit));
if (!edefs || DFLT_AdvCurHopLimit != radvert->nd_ra_curhoplimit)
printf("\tAdvCurHopLimit %u;\n", radvert->nd_ra_curhoplimit);
/* Mobile IPv6 ext */
if (!edefs || DFLT_AdvHomeAgentFlag != (ND_RA_FLAG_HOME_AGENT == (radvert->nd_ra_flags_reserved & ND_RA_FLAG_HOME_AGENT)))
printf("\tAdvHomeAgentFlag %s;\n",
(radvert->nd_ra_flags_reserved & ND_RA_FLAG_HOME_AGENT)?"on":"off");
/* Route Preferences and more specific routes */
/* XXX two middlemost bits from 8 bit field */
if (!edefs || (((radvert->nd_ra_flags_reserved & 0x18) >> 3) & 0xff) != DFLT_AdvDefaultPreference) {
printf("\tAdvDefaultPreference ");
print_preferences(((radvert->nd_ra_flags_reserved & 0x18) >> 3) & 0xff);
printf(";\n");
}
len -= sizeof(struct nd_router_advert);
if (len == 0)
return;
opt_str = (uint8_t *)(msg + sizeof(struct nd_router_advert));
while (len > 0)
{
int optlen;
struct nd_opt_mtu *mtu;
struct HomeAgentInfo *ha_info;
if (len < 2)
{
flog(LOG_ERR, "trailing garbage in RA from %s",
addr_str);
break;
}
optlen = (opt_str[1] << 3);
if (optlen == 0)
{
flog(LOG_ERR, "zero length option in RA");
break;
}
else if (optlen > len)
{
flog(LOG_ERR, "option length greater than total"
" length in RA (type %d, optlen %d, len %d)",
(int)*opt_str, optlen, len);
break;
}
switch (*opt_str)
{
case ND_OPT_MTU:
mtu = (struct nd_opt_mtu *)opt_str;
if (!edefs || DFLT_AdvLinkMTU != ntohl(mtu->nd_opt_mtu_mtu))
printf("\tAdvLinkMTU %u;\n", ntohl(mtu->nd_opt_mtu_mtu));
break;
case ND_OPT_SOURCE_LINKADDR:
/* XXX: !DFLT depends on current DFLT_ value */
if (!edefs || !DFLT_AdvSourceLLAddress)
printf("\tAdvSourceLLAddress on;\n");
break;
/* Mobile IPv6 ext */
case ND_OPT_RTR_ADV_INTERVAL:
/* XXX: !DFLT depends on current DFLT_ value */
if (!edefs || !DFLT_AdvIntervalOpt)
printf("\tAdvIntervalOpt on;\n");
break;
/* Mobile IPv6 ext */
case ND_OPT_HOME_AGENT_INFO:
ha_info = (struct HomeAgentInfo *)opt_str;
/* XXX: we check DFLT_HomeAgentInfo by interface, and it's outside
of context here, so we always need to print it out.. */
printf("\tAdvHomeAgentInfo on;\n");
/* NEMO ext */
if (!edefs || DFLT_AdvMobRtrSupportFlag != (ha_info->flags_reserved & ND_OPT_HAI_FLAG_SUPPORT_MR))
printf("\tAdvMobRtrSupportFlag %s;\n", (ha_info->flags_reserved & ND_OPT_HAI_FLAG_SUPPORT_MR)?"on":"off");
if (!edefs || DFLT_HomeAgentPreference != ntohs(ha_info->preference))
printf("\tHomeAgentPreference %hu;\n", ntohs(ha_info->preference));
/* Hum.. */
if (!edefs || (3*DFLT_MaxRtrAdvInterval) != ntohs(ha_info->lifetime))
printf("\tHomeAgentLifetime %hu;\n", ntohs(ha_info->lifetime));
break;
case ND_OPT_TARGET_LINKADDR:
case ND_OPT_REDIRECTED_HEADER:
flog(LOG_ERR, "invalid option %d in RA", (int)*opt_str);
break;
case ND_OPT_PREFIX_INFORMATION:
break;
case ND_OPT_ROUTE_INFORMATION:
break;
case ND_OPT_RDNSS_INFORMATION:
break;
default:
dlog(LOG_DEBUG, 1, "unknown option %d in RA",
(int)*opt_str);
break;
}
len -= optlen;
opt_str += optlen;
}
orig_len -= sizeof(struct nd_router_advert);
if (orig_len == 0)
return;
opt_str = (uint8_t *)(msg + sizeof(struct nd_router_advert));
while (orig_len > 0)
{
int optlen;
struct nd_opt_prefix_info *pinfo;
struct nd_opt_route_info_local *rinfo;
struct nd_opt_rdnss_info_local *rdnss_info;
char prefix_str[INET6_ADDRSTRLEN];
if (orig_len < 2)
{
flog(LOG_ERR, "trailing garbage in RA from %s",
addr_str);
break;
}
optlen = (opt_str[1] << 3);
if (optlen == 0)
{
flog(LOG_ERR, "zero length option in RA");
break;
}
else if (optlen > orig_len)
{
flog(LOG_ERR, "option length greater than total"
" length in RA (type %d, optlen %d, len %d)",
(int)*opt_str, optlen, orig_len);
break;
}
switch (*opt_str)
{
case ND_OPT_PREFIX_INFORMATION:
pinfo = (struct nd_opt_prefix_info *) opt_str;
print_addr(&pinfo->nd_opt_pi_prefix, prefix_str);
printf("\n\tprefix %s/%d\n\t{\n", prefix_str, pinfo->nd_opt_pi_prefix_len);
if (ntohl(pinfo->nd_opt_pi_valid_time) == 0xffffffff)
{
if (!edefs || DFLT_AdvValidLifetime != 0xffffffff)
printf("\t\tAdvValidLifetime infinity; # (0xffffffff)\n");
}
else
{
if (!edefs || DFLT_AdvValidLifetime != ntohl(pinfo->nd_opt_pi_valid_time))
printf("\t\tAdvValidLifetime %u;\n", ntohl(pinfo->nd_opt_pi_valid_time));
}
if (ntohl(pinfo->nd_opt_pi_preferred_time) == 0xffffffff)
{
if (!edefs || DFLT_AdvPreferredLifetime != 0xffffffff)
printf("\t\tAdvPreferredLifetime infinity; # (0xffffffff)\n");
}
else
{
if (!edefs || DFLT_AdvPreferredLifetime != ntohl(pinfo->nd_opt_pi_preferred_time))
printf("\t\tAdvPreferredLifetime %u;\n", ntohl(pinfo->nd_opt_pi_preferred_time));
}
if (!edefs || DFLT_AdvOnLinkFlag != (ND_OPT_PI_FLAG_ONLINK == (pinfo->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_ONLINK)))
printf("\t\tAdvOnLink %s;\n",
(pinfo->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_ONLINK)?"on":"off");
if (!edefs || DFLT_AdvAutonomousFlag != (ND_OPT_PI_FLAG_AUTO == (pinfo->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_AUTO)))
printf("\t\tAdvAutonomous %s;\n",
(pinfo->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_AUTO)?"on":"off");
/* Mobile IPv6 ext */
if (!edefs || DFLT_AdvRouterAddr != (ND_OPT_PI_FLAG_RADDR == (pinfo->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_RADDR)))
printf("\t\tAdvRouterAddr %s;\n",
(pinfo->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_RADDR)?"on":"off");
printf("\t}; # End of prefix definition\n\n");
break;
case ND_OPT_ROUTE_INFORMATION:
rinfo = (struct nd_opt_route_info_local *) opt_str;
print_addr(&rinfo->nd_opt_ri_prefix, prefix_str);
printf("\n\troute %s/%d\n\t{\n", prefix_str, rinfo->nd_opt_ri_prefix_len);
if (!edefs || (((radvert->nd_ra_flags_reserved & 0x18) >> 3) & 0xff) != DFLT_AdvRoutePreference) {
printf("\t\tAdvRoutePreference ");
print_preferences(((rinfo->nd_opt_ri_flags_reserved & 0x18) >> 3) & 0xff);
printf(";\n");
}
/* XXX: we check DFLT_AdvRouteLifetime by interface, and it's outside of context here */
if (ntohl(rinfo->nd_opt_ri_lifetime) == 0xffffffff)
printf("\t\tAdvRouteLifetime infinity; # (0xffffffff)\n");
else
printf("\t\tAdvRouteLifetime %u;\n", ntohl(rinfo->nd_opt_ri_lifetime));
printf("\t}; # End of route definition\n\n");
break;
case ND_OPT_RDNSS_INFORMATION:
rdnss_info = (struct nd_opt_rdnss_info_local *) opt_str;
printf("\n\tRDNSS");
print_addr(&rdnss_info->nd_opt_rdnssi_addr1, prefix_str);
printf(" %s", prefix_str);
if (rdnss_info->nd_opt_rdnssi_len >= 5) {
print_addr(&rdnss_info->nd_opt_rdnssi_addr2, prefix_str);
printf(" %s", prefix_str);
}
if (rdnss_info->nd_opt_rdnssi_len >= 7) {
print_addr(&rdnss_info->nd_opt_rdnssi_addr3, prefix_str);
printf(" %s", prefix_str);
}
printf("\n\t{\n");
if (!edefs
|| ((rdnss_info->nd_opt_rdnssi_pref_flag_reserved & ND_OPT_RDNSSI_PREF_MASK) >> ND_OPT_RDNSSI_PREF_SHIFT) != DFLT_AdvRDNSSPreference)
printf("\t\tAdvRDNSSPreference %d;\n",
(rdnss_info->nd_opt_rdnssi_pref_flag_reserved & ND_OPT_RDNSSI_PREF_MASK) >> ND_OPT_RDNSSI_PREF_SHIFT);
if (!edefs
|| ((rdnss_info->nd_opt_rdnssi_pref_flag_reserved & ND_OPT_RDNSSI_FLAG_S) == 0 ) == DFLT_AdvRDNSSOpenFlag)
printf("\t\tAdvRDNSSOpen %s;\n", rdnss_info->nd_opt_rdnssi_pref_flag_reserved & ND_OPT_RDNSSI_FLAG_S ? "on" : "off");
/* as AdvRDNSSLifetime may depend on MaxRtrAdvInterval, it could change */
if (ntohl(rdnss_info->nd_opt_rdnssi_lifetime) == 0xffffffff)
printf("\t\tAdvRDNSSLifetime infinity; # (0xffffffff)\n");
else
printf("\t\tAdvRDNSSLifetime %u;\n", ntohl(rdnss_info->nd_opt_rdnssi_lifetime));
printf("\t}; # End of RDNSS definition\n\n");
break;
default:
break;
}
orig_len -= optlen;
opt_str += optlen;
}
printf("}; # End of interface definition\n");
fflush(stdout);
}
void
print_preferences(int p)
{
switch (p) {
case 0:
printf("medium");
break;
case 1:
printf("high");
break;
case 2:
/* reserved, ignore */
break;
case 3:
printf("low");
break;
}
}
void
version(void)
{
fprintf(stderr,"Version: %s\n\n", VERSION);
fprintf(stderr,"Please send bug reports and suggestions to %s\n",
CONTACT_EMAIL);
exit(1);
}
void
usage(void)
{
fprintf(stderr,"usage: %s %s\n", pname, usage_str);
exit(1);
}
--- NEW FILE: recv.c ---
/*
* $Id: recv.c,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Pedro Roque <roque at di.fc.ul.pt>
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#include <config.h>
#include <includes.h>
#include <radvd.h>
int
recv_rs_ra(int sock, unsigned char *msg, struct sockaddr_in6 *addr,
struct in6_pktinfo **pkt_info, int *hoplimit)
{
struct msghdr mhdr;
struct cmsghdr *cmsg;
struct iovec iov;
static unsigned char *chdr = NULL;
static unsigned int chdrlen = 0;
int len;
fd_set rfds;
if( ! chdr )
{
chdrlen = CMSG_SPACE(sizeof(struct in6_pktinfo)) +
CMSG_SPACE(sizeof(int));
if ((chdr = malloc(chdrlen)) == NULL) {
flog(LOG_ERR, "recv_rs_ra: malloc: %s", strerror(errno));
return -1;
}
}
FD_ZERO( &rfds );
FD_SET( sock, &rfds );
if( select( sock+1, &rfds, NULL, NULL, NULL ) < 0 )
{
if (errno != EINTR)
flog(LOG_ERR, "select: %s", strerror(errno));
return -1;
}
iov.iov_len = MSG_SIZE;
iov.iov_base = (caddr_t) msg;
memset(&mhdr, 0, sizeof(mhdr));
mhdr.msg_name = (caddr_t)addr;
mhdr.msg_namelen = sizeof(*addr);
mhdr.msg_iov = &iov;
mhdr.msg_iovlen = 1;
mhdr.msg_control = (void *)chdr;
mhdr.msg_controllen = chdrlen;
len = recvmsg(sock, &mhdr, 0);
if (len < 0)
{
if (errno != EINTR)
flog(LOG_ERR, "recvmsg: %s", strerror(errno));
return len;
}
*hoplimit = 255;
for (cmsg = CMSG_FIRSTHDR(&mhdr); cmsg != NULL; cmsg = CMSG_NXTHDR(&mhdr, cmsg))
{
if (cmsg->cmsg_level != IPPROTO_IPV6)
continue;
switch(cmsg->cmsg_type)
{
#ifdef IPV6_HOPLIMIT
case IPV6_HOPLIMIT:
if ((cmsg->cmsg_len == CMSG_LEN(sizeof(int))) &&
(*(int *)CMSG_DATA(cmsg) >= 0) &&
(*(int *)CMSG_DATA(cmsg) < 256))
{
*hoplimit = *(int *)CMSG_DATA(cmsg);
}
else
{
flog(LOG_ERR, "received a bogus IPV6_HOPLIMIT from the kernel! len=%d, data=%d",
cmsg->cmsg_len, *(int *)CMSG_DATA(cmsg));
return (-1);
}
break;
#endif /* IPV6_HOPLIMIT */
case IPV6_PKTINFO:
if ((cmsg->cmsg_len == CMSG_LEN(sizeof(struct in6_pktinfo))) &&
((struct in6_pktinfo *)CMSG_DATA(cmsg))->ipi6_ifindex)
{
*pkt_info = (struct in6_pktinfo *)CMSG_DATA(cmsg);
}
else
{
flog(LOG_ERR, "received a bogus IPV6_PKTINFO from the kernel! len=%d, index=%d",
cmsg->cmsg_len, ((struct in6_pktinfo *)CMSG_DATA(cmsg))->ipi6_ifindex);
return (-1);
}
break;
}
}
dlog(LOG_DEBUG, 4, "recvmsg len=%d", len);
return len;
}
--- NEW FILE: scanner.c ---
#line 3 "lex.yy.c"
#define YY_INT_ALIGNED short int
/* A lexical scanner generated by flex */
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 33
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
/* First, we deal with platform-specific or compiler-specific issues. */
/* begin standard C headers. */
#include <stdio.h>
[...2359 lines suppressed...]
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
* because both ANSI C and C++ allow castless assignment from
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
return (void *) realloc( (char *) ptr, size );
}
void yyfree (void * ptr )
{
free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
}
#define YYTABLES_NAME "yytables"
#line 153 "scanner.l"
--- NEW FILE: scanner.l ---
/*
* $Id: scanner.l,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Pedro Roque <roque at di.fc.ul.pt>
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996-2000 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
%{
#include <config.h>
#include <includes.h>
#include <radvd.h>
#include <gram.h>
extern char *conf_file;
int num_lines = 1;
%}
digit [0-9]
number ({digit})+
snum -?({digit})+
decimal ({number}"."{number})
hexdigit ([a-f]|[A-F]|[0-9])
addr1 {hexdigit}{1,4}":"({hexdigit}{1,4}":")*(":"{hexdigit}{1,4})+
addr2 {hexdigit}{1,4}(":"{hexdigit}{1,4})*"::"
addr3 ({hexdigit}{1,4}":"){7}{hexdigit}{1,4}
addr ({addr1}|{addr2}|{addr3}|"::")
whitespace ([ \t])+
string [a-z]([a-z]|{digit}|_)*([:.]{digit}+)?
%%
#.*$ {/* ignore comments */}
\n {num_lines++;}
{whitespace} {}
interface { return T_INTERFACE; }
prefix { return T_PREFIX; }
route { return T_ROUTE; }
RDNSS { return T_RDNSS; }
IgnoreIfMissing { return T_IgnoreIfMissing; }
AdvSendAdvert { return T_AdvSendAdvert; }
MaxRtrAdvInterval { return T_MaxRtrAdvInterval; }
MinRtrAdvInterval { return T_MinRtrAdvInterval; }
AdvManagedFlag { return T_AdvManagedFlag; }
AdvOtherConfigFlag { return T_AdvOtherConfigFlag; }
AdvLinkMTU { return T_AdvLinkMTU; }
AdvReachableTime { return T_AdvReachableTime; }
AdvRetransTimer { return T_AdvRetransTimer; }
AdvCurHopLimit { return T_AdvCurHopLimit; }
AdvDefaultLifetime { return T_AdvDefaultLifetime; }
AdvDefaultPreference { return T_AdvDefaultPreference; }
AdvSourceLLAddress { return T_AdvSourceLLAddress; }
AdvOnLink { return T_AdvOnLink; }
AdvAutonomous { return T_AdvAutonomous; }
AdvValidLifetime { return T_AdvValidLifetime; }
AdvPreferredLifetime { return T_AdvPreferredLifetime; }
AdvRouterAddr { return T_AdvRouterAddr; }
AdvHomeAgentFlag { return T_AdvHomeAgentFlag; }
AdvIntervalOpt { return T_AdvIntervalOpt; }
AdvHomeAgentInfo { return T_AdvHomeAgentInfo; }
UnicastOnly { return T_UnicastOnly; }
Base6to4Interface { return T_Base6to4Interface; }
HomeAgentPreference { return T_HomeAgentPreference; }
HomeAgentLifetime { return T_HomeAgentLifetime; }
AdvRoutePreference { return T_AdvRoutePreference; }
AdvRouteLifetime { return T_AdvRouteLifetime; }
AdvRDNSSPreference { return T_AdvRDNSSPreference; }
AdvRDNSSOpen { return T_AdvRDNSSOpenFlag; }
AdvRDNSSLifetime { return T_AdvRDNSSLifetime; }
MinDelayBetweenRAs { return T_MinDelayBetweenRAs; }
AdvMobRtrSupportFlag { return T_AdvMobRtrSupportFlag; }
{addr} {
static struct in6_addr addr;
int i;
i = inet_pton(AF_INET6, yytext, &addr);
dlog(LOG_DEBUG, 4, "inet_pton returned %d", i);
/* BSD API draft and NRL's code don't aggree on
* this. the draft specifies a return value of 1 on
* success, NRL's code returns the address length in
* bytes on success (16 for an IPv6 address)
*/
if (i < 1) {
flog(LOG_ERR, "invalid address in %s, line %d", conf_file,
num_lines);
return T_BAD_TOKEN;
}
yylval.addr = &addr;
return IPV6ADDR;
}
{number} {
unsigned long lnum;
char *endp;
lnum = strtoul(yytext, &endp, 10);
if (*yytext == '\0' || *endp != '\0')
return T_BAD_TOKEN;
if (lnum > 0xFFFFFFFFUL)
return T_BAD_TOKEN; /* XXX */
yylval.num = lnum;
return NUMBER;
}
{snum} { yylval.snum = atoi(yytext); return SIGNEDNUMBER; }
{decimal} { yylval.dec = atof(yytext); return DECIMAL; }
infinity { return INFINITY; }
on { yylval.bool = 1; return SWITCH; }
off { yylval.bool = 0; return SWITCH; }
low { yylval.snum = -1; return SIGNEDNUMBER; }
medium { yylval.snum = 0; return SIGNEDNUMBER; }
high { yylval.snum = 1; return SIGNEDNUMBER; }
{string} {
static char name[IFNAMSIZ];
strncpy(name, yytext, IFNAMSIZ-1);
name[IFNAMSIZ-1] = '\0';
yylval.str = name;
return STRING;
}
"{"|"}"|";"|"/" { return *yytext; }
. { return T_BAD_TOKEN; }
%%
--- NEW FILE: send.c ---
/*
* $Id: send.c,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Pedro Roque <roque at di.fc.ul.pt>
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#include <config.h>
#include <includes.h>
#include <radvd.h>
void
send_ra(int sock, struct Interface *iface, struct in6_addr *dest)
{
uint8_t all_hosts_addr[] = {0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
struct sockaddr_in6 addr;
struct in6_pktinfo *pkt_info;
struct msghdr mhdr;
struct cmsghdr *cmsg;
struct iovec iov;
char chdr[CMSG_SPACE(sizeof(struct in6_pktinfo))];
struct nd_router_advert *radvert;
struct AdvPrefix *prefix;
struct AdvRoute *route;
struct AdvRDNSS *rdnss;
/* XXX: we don't keep track if buff gets overflowed. In theory the sysadmin could
do that with e.g., too many advertised prefixes or routes, but buff is just so
large that this should never happen and if it does, it's admin's fault :-) */
unsigned char buff[MSG_SIZE];
int len = 0;
int err;
/* First we need to check that the interface hasn't been removed or deactivated */
if(check_device(sock, iface) < 0) {
if (iface->IgnoreIfMissing) /* a bit more quiet warning message.. */
dlog(LOG_DEBUG, 4, "interface %s does not exist, ignoring the interface", iface->Name);
else {
flog(LOG_WARNING, "interface %s does not exist, ignoring the interface", iface->Name);
}
iface->HasFailed = 1;
} else {
/* check_device was successful, act if it has failed previously */
if (iface->HasFailed == 1) {
flog(LOG_WARNING, "interface %s seems to have come back up, trying to reinitialize", iface->Name);
iface->HasFailed = 0;
/* XXX: reinitializes 'iface', so this probably isn't going to work until next send_ra().. */
/* SDH : don't do this since we're not doing config the same way */
/* reload_config(); */
}
}
/* Make sure that we've joined the all-routers multicast group */
if (check_allrouters_membership(sock, iface) < 0)
flog(LOG_WARNING, "problem checking all-routers membership on %s", iface->Name);
dlog(LOG_DEBUG, 3, "sending RA on %s", iface->Name);
if (dest == NULL)
{
struct timeval tv;
dest = (struct in6_addr *)all_hosts_addr;
gettimeofday(&tv, NULL);
iface->last_multicast_sec = tv.tv_sec;
iface->last_multicast_usec = tv.tv_usec;
}
memset((void *)&addr, 0, sizeof(addr));
addr.sin6_family = AF_INET6;
addr.sin6_port = htons(IPPROTO_ICMPV6);
memcpy(&addr.sin6_addr, dest, sizeof(struct in6_addr));
memset(&buff, 0, sizeof(buff));
radvert = (struct nd_router_advert *) buff;
radvert->nd_ra_type = ND_ROUTER_ADVERT;
radvert->nd_ra_code = 0;
radvert->nd_ra_cksum = 0;
radvert->nd_ra_curhoplimit = iface->AdvCurHopLimit;
radvert->nd_ra_flags_reserved =
(iface->AdvManagedFlag)?ND_RA_FLAG_MANAGED:0;
radvert->nd_ra_flags_reserved |=
(iface->AdvOtherConfigFlag)?ND_RA_FLAG_OTHER:0;
/* Mobile IPv6 ext */
radvert->nd_ra_flags_reserved |=
(iface->AdvHomeAgentFlag)?ND_RA_FLAG_HOME_AGENT:0;
/* if forwarding is disabled, send zero router lifetime */
/* SDH : disable this check too */
/* radvert->nd_ra_router_lifetime = !check_ip6_forwarding() ? htons(iface->AdvDefaultLifetime) : 0; */
radvert->nd_ra_flags_reserved |=
(iface->AdvDefaultPreference << ND_OPT_RI_PRF_SHIFT) & ND_OPT_RI_PRF_MASK;
radvert->nd_ra_reachable = htonl(iface->AdvReachableTime);
radvert->nd_ra_retransmit = htonl(iface->AdvRetransTimer);
len = sizeof(struct nd_router_advert);
prefix = iface->AdvPrefixList;
/*
* add prefix options
*/
while(prefix)
{
if( prefix->enabled )
{
struct nd_opt_prefix_info *pinfo;
pinfo = (struct nd_opt_prefix_info *) (buff + len);
pinfo->nd_opt_pi_type = ND_OPT_PREFIX_INFORMATION;
pinfo->nd_opt_pi_len = 4;
pinfo->nd_opt_pi_prefix_len = prefix->PrefixLen;
pinfo->nd_opt_pi_flags_reserved =
(prefix->AdvOnLinkFlag)?ND_OPT_PI_FLAG_ONLINK:0;
pinfo->nd_opt_pi_flags_reserved |=
(prefix->AdvAutonomousFlag)?ND_OPT_PI_FLAG_AUTO:0;
/* Mobile IPv6 ext */
pinfo->nd_opt_pi_flags_reserved |=
(prefix->AdvRouterAddr)?ND_OPT_PI_FLAG_RADDR:0;
pinfo->nd_opt_pi_valid_time = htonl(prefix->AdvValidLifetime);
pinfo->nd_opt_pi_preferred_time = htonl(prefix->AdvPreferredLifetime);
pinfo->nd_opt_pi_reserved2 = 0;
memcpy(&pinfo->nd_opt_pi_prefix, &prefix->Prefix,
sizeof(struct in6_addr));
len += sizeof(*pinfo);
}
prefix = prefix->next;
}
route = iface->AdvRouteList;
/*
* add route options
*/
while(route)
{
struct nd_opt_route_info_local *rinfo;
rinfo = (struct nd_opt_route_info_local *) (buff + len);
rinfo->nd_opt_ri_type = ND_OPT_ROUTE_INFORMATION;
/* XXX: the prefixes are allowed to be sent in smaller chunks as well */
rinfo->nd_opt_ri_len = 3;
rinfo->nd_opt_ri_prefix_len = route->PrefixLen;
rinfo->nd_opt_ri_flags_reserved =
(route->AdvRoutePreference << ND_OPT_RI_PRF_SHIFT) & ND_OPT_RI_PRF_MASK;
rinfo->nd_opt_ri_lifetime = htonl(route->AdvRouteLifetime);
memcpy(&rinfo->nd_opt_ri_prefix, &route->Prefix,
sizeof(struct in6_addr));
len += sizeof(*rinfo);
route = route->next;
}
rdnss = iface->AdvRDNSSList;
/*
* add rdnss options
*/
while(rdnss)
{
struct nd_opt_rdnss_info_local *rdnssinfo;
rdnssinfo = (struct nd_opt_rdnss_info_local *) (buff + len);
rdnssinfo->nd_opt_rdnssi_type = ND_OPT_RDNSS_INFORMATION;
rdnssinfo->nd_opt_rdnssi_len = 1 + 2*rdnss->AdvRDNSSNumber;
rdnssinfo->nd_opt_rdnssi_pref_flag_reserved =
((rdnss->AdvRDNSSPreference << ND_OPT_RDNSSI_PREF_SHIFT) & ND_OPT_RDNSSI_PREF_MASK);
rdnssinfo->nd_opt_rdnssi_pref_flag_reserved |=
((rdnss->AdvRDNSSOpenFlag)?ND_OPT_RDNSSI_FLAG_S:0);
rdnssinfo->nd_opt_rdnssi_lifetime = htonl(rdnss->AdvRDNSSLifetime);
memcpy(&rdnssinfo->nd_opt_rdnssi_addr1, &rdnss->AdvRDNSSAddr1,
sizeof(struct in6_addr));
memcpy(&rdnssinfo->nd_opt_rdnssi_addr2, &rdnss->AdvRDNSSAddr2,
sizeof(struct in6_addr));
memcpy(&rdnssinfo->nd_opt_rdnssi_addr3, &rdnss->AdvRDNSSAddr3,
sizeof(struct in6_addr));
len += sizeof(*rdnssinfo) - (3-rdnss->AdvRDNSSNumber)*sizeof(struct in6_addr);
rdnss = rdnss->next;
}
/*
* add MTU option
*/
if (iface->AdvLinkMTU != 0) {
struct nd_opt_mtu *mtu;
mtu = (struct nd_opt_mtu *) (buff + len);
mtu->nd_opt_mtu_type = ND_OPT_MTU;
mtu->nd_opt_mtu_len = 1;
mtu->nd_opt_mtu_reserved = 0;
mtu->nd_opt_mtu_mtu = htonl(iface->AdvLinkMTU);
len += sizeof(*mtu);
}
/*
* add Source Link-layer Address option
*/
if (iface->AdvSourceLLAddress && iface->if_hwaddr_len != -1)
{
uint8_t *ucp;
unsigned int i;
ucp = (uint8_t *) (buff + len);
*ucp++ = ND_OPT_SOURCE_LINKADDR;
*ucp++ = (uint8_t) ((iface->if_hwaddr_len + 16 + 63) >> 6);
len += 2 * sizeof(uint8_t);
i = (iface->if_hwaddr_len + 7) >> 3;
memcpy(buff + len, iface->if_hwaddr, i);
len += i;
}
/*
* Mobile IPv6 ext: Advertisement Interval Option to support
* movement detection of mobile nodes
*/
if(iface->AdvIntervalOpt)
{
struct AdvInterval a_ival;
uint32_t ival;
if(iface->MaxRtrAdvInterval < Cautious_MaxRtrAdvInterval){
ival = ((iface->MaxRtrAdvInterval +
Cautious_MaxRtrAdvInterval_Leeway ) * 1000);
}
else {
ival = (iface->MaxRtrAdvInterval * 1000);
}
a_ival.type = ND_OPT_RTR_ADV_INTERVAL;
a_ival.length = 1;
a_ival.reserved = 0;
a_ival.adv_ival = htonl(ival);
memcpy(buff + len, &a_ival, sizeof(a_ival));
len += sizeof(a_ival);
}
/*
* Mobile IPv6 ext: Home Agent Information Option to support
* Dynamic Home Agent Address Discovery
*/
if(iface->AdvHomeAgentInfo &&
(iface->AdvMobRtrSupportFlag || iface->HomeAgentPreference != 0 ||
iface->HomeAgentLifetime != iface->AdvDefaultLifetime))
{
struct HomeAgentInfo ha_info;
ha_info.type = ND_OPT_HOME_AGENT_INFO;
ha_info.length = 1;
ha_info.flags_reserved =
(iface->AdvMobRtrSupportFlag)?ND_OPT_HAI_FLAG_SUPPORT_MR:0;
ha_info.preference = htons(iface->HomeAgentPreference);
ha_info.lifetime = htons(iface->HomeAgentLifetime);
memcpy(buff + len, &ha_info, sizeof(ha_info));
len += sizeof(ha_info);
}
iov.iov_len = len;
iov.iov_base = (caddr_t) buff;
memset(chdr, 0, sizeof(chdr));
cmsg = (struct cmsghdr *) chdr;
cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
cmsg->cmsg_level = IPPROTO_IPV6;
cmsg->cmsg_type = IPV6_PKTINFO;
pkt_info = (struct in6_pktinfo *)CMSG_DATA(cmsg);
pkt_info->ipi6_ifindex = iface->if_index;
memcpy(&pkt_info->ipi6_addr, &iface->if_addr, sizeof(struct in6_addr));
#ifdef HAVE_SIN6_SCOPE_ID
if (IN6_IS_ADDR_LINKLOCAL(&addr.sin6_addr) ||
IN6_IS_ADDR_MC_LINKLOCAL(&addr.sin6_addr))
addr.sin6_scope_id = iface->if_index;
#endif
memset(&mhdr, 0, sizeof(mhdr));
mhdr.msg_name = (caddr_t)&addr;
mhdr.msg_namelen = sizeof(struct sockaddr_in6);
mhdr.msg_iov = &iov;
mhdr.msg_iovlen = 1;
mhdr.msg_control = (void *) cmsg;
mhdr.msg_controllen = sizeof(chdr);
err = sendmsg(sock, &mhdr, 0);
if (err < 0) {
if (!iface->IgnoreIfMissing || !(errno == EINVAL || errno == ENODEV))
flog(LOG_WARNING, "sendmsg: %s", strerror(errno));
else
dlog(LOG_DEBUG, 3, "sendmsg: %s", strerror(errno));
}
}
--- NEW FILE: socket.c ---
/*
* $Id: socket.c,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Pedro Roque <roque at di.fc.ul.pt>
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#include <config.h>
#include <includes.h>
#include <radvd.h>
/* Note: these are applicable to receiving sockopts only */
#if defined IPV6_HOPLIMIT && !defined IPV6_RECVHOPLIMIT
# define IPV6_RECVHOPLIMIT IPV6_HOPLIMIT
#endif
#if defined IPV6_PKTINFO && !defined IPV6_RECVPKTINFO
# define IPV6_RECVPKTINFO IPV6_PKTINFO
#endif
int
open_icmpv6_socket(void)
{
int sock;
struct icmp6_filter filter;
int err, val;
sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
if (sock < 0)
{
flog(LOG_ERR, "can't create socket(AF_INET6): %s", strerror(errno));
return (-1);
}
val = 1;
err = setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &val, sizeof(val));
if (err < 0)
{
flog(LOG_ERR, "setsockopt(IPV6_RECVPKTINFO): %s", strerror(errno));
return (-1);
}
val = 2;
#ifdef __linux__
err = setsockopt(sock, IPPROTO_RAW, IPV6_CHECKSUM, &val, sizeof(val));
#else
err = setsockopt(sock, IPPROTO_IPV6, IPV6_CHECKSUM, &val, sizeof(val));
#endif
if (err < 0)
{
flog(LOG_ERR, "setsockopt(IPV6_CHECKSUM): %s", strerror(errno));
return (-1);
}
val = 255;
err = setsockopt(sock, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &val, sizeof(val));
if (err < 0)
{
flog(LOG_ERR, "setsockopt(IPV6_UNICAST_HOPS): %s", strerror(errno));
return (-1);
}
val = 255;
err = setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &val, sizeof(val));
if (err < 0)
{
flog(LOG_ERR, "setsockopt(IPV6_MULTICAST_HOPS): %s", strerror(errno));
return (-1);
}
#ifdef IPV6_RECVHOPLIMIT
val = 1;
err = setsockopt(sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &val, sizeof(val));
if (err < 0)
{
flog(LOG_ERR, "setsockopt(IPV6_RECVHOPLIMIT): %s", strerror(errno));
return (-1);
}
#endif
/*
* setup ICMP filter
*/
ICMP6_FILTER_SETBLOCKALL(&filter);
ICMP6_FILTER_SETPASS(ND_ROUTER_SOLICIT, &filter);
ICMP6_FILTER_SETPASS(ND_ROUTER_ADVERT, &filter);
err = setsockopt(sock, IPPROTO_ICMPV6, ICMP6_FILTER, &filter,
sizeof(filter));
if (err < 0)
{
flog(LOG_ERR, "setsockopt(ICMPV6_FILTER): %s", strerror(errno));
return (-1);
}
return sock;
}
--- NEW FILE: stamp-h ---
timestamp
--- NEW FILE: stamp-h.in ---
--- NEW FILE: timer.c ---
/*
* $Id: timer.c,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Pedro Roque <roque at di.fc.ul.pt>
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996-2000 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#include <config.h>
#include <includes.h>
#include <radvd.h>
static struct timer_lst timers_head = {
{LONG_MAX, LONG_MAX},
NULL, NULL,
&timers_head, &timers_head
};
static void alarm_handler(int sig);
int inline check_time_diff(struct timer_lst *tm, struct timeval tv);
static void
schedule_timer(void)
{
struct timer_lst *tm = timers_head.next;
struct timeval tv;
gettimeofday(&tv, NULL);
if (tm != &timers_head)
{
struct itimerval next;
memset(&next, 0, sizeof(next));
timersub(&tm->expires, &tv, &next.it_value);
signal(SIGALRM, alarm_handler);
if ((next.it_value.tv_sec > 0) ||
((next.it_value.tv_sec == 0) && (next.it_value.tv_usec > 0)))
{
dlog(LOG_DEBUG, 4, "calling alarm: %ld secs, %ld usecs",
next.it_value.tv_sec, next.it_value.tv_usec);
if(setitimer(ITIMER_REAL, &next, NULL))
flog(LOG_WARNING, "schedule_timer setitimer for %ld.%ld failed: %s",
next.it_value.tv_sec, next.it_value.tv_usec, strerror(errno));
}
else
{
dlog(LOG_DEBUG, 4, "next timer has already expired, queueing signal");
kill(getpid(), SIGALRM);
}
}
}
void
set_timer(struct timer_lst *tm, double secs)
{
struct timeval tv;
struct timer_lst *lst;
sigset_t bmask, oldmask;
struct timeval firein;
dlog(LOG_DEBUG, 3, "setting timer: %.2f secs", secs);
firein.tv_sec = (long)secs;
firein.tv_usec = (long)((secs - (double)firein.tv_sec) * 1000000);
dlog(LOG_DEBUG, 5, "setting timer: %ld secs %ld usecs", firein.tv_sec, firein.tv_usec);
gettimeofday(&tv, NULL);
timeradd(&tv, &firein, &tm->expires);
sigemptyset(&bmask);
sigaddset(&bmask, SIGALRM);
sigprocmask(SIG_BLOCK, &bmask, &oldmask);
lst = &timers_head;
/* the timers are in the list in the order they expire, the soonest first */
do {
lst = lst->next;
} while ((tm->expires.tv_sec > lst->expires.tv_sec) ||
((tm->expires.tv_sec == lst->expires.tv_sec) &&
(tm->expires.tv_usec > lst->expires.tv_usec)));
tm->next = lst;
tm->prev = lst->prev;
lst->prev = tm;
tm->prev->next = tm;
dlog(LOG_DEBUG, 5, "calling schedule_timer from set_timer context");
schedule_timer();
sigprocmask(SIG_SETMASK, &oldmask, NULL);
}
void
clear_timer(struct timer_lst *tm)
{
sigset_t bmask, oldmask;
sigemptyset(&bmask);
sigaddset(&bmask, SIGALRM);
sigprocmask(SIG_BLOCK, &bmask, &oldmask);
tm->prev->next = tm->next;
tm->next->prev = tm->prev;
tm->prev = tm->next = NULL;
dlog(LOG_DEBUG, 5, "calling schedule_timer from clear_timer context");
schedule_timer();
sigprocmask(SIG_SETMASK, &oldmask, NULL);
}
static void
alarm_handler(int sig)
{
struct timer_lst *tm, *back;
struct timeval tv;
gettimeofday(&tv, NULL);
tm = timers_head.next;
/*
* This handler is called when the alarm goes off, so at least one of
* the interfaces' timers should satisfy the while condition.
*
* Sadly, this is not always the case, at least on Linux kernels:
* see http://lkml.org/lkml/2005/4/29/163. :-(. It seems some
* versions of timers are not accurate and get called up to a couple of
* hundred microseconds before they expire.
*
* Therefore we allow some inaccuracy here; it's sufficient for us
* that a timer should go off in a millisecond.
*/
/* unused timers are initialized to LONG_MAX so we skip them */
while (tm->expires.tv_sec != LONG_MAX && check_time_diff(tm, tv))
{
tm->prev->next = tm->next;
tm->next->prev = tm->prev;
back = tm;
tm = tm->next;
back->prev = back->next = NULL;
(*back->handler)(back->data);
}
dlog(LOG_DEBUG, 5, "calling schedule_timer from alarm_handler context");
schedule_timer();
}
void
init_timer(struct timer_lst *tm, void (*handler)(void *), void *data)
{
memset(tm, 0, sizeof(struct timer_lst));
tm->handler = handler;
tm->data = data;
}
int inline
check_time_diff(struct timer_lst *tm, struct timeval tv)
{
struct itimerval diff;
memset(&diff, 0, sizeof(diff));
#define ALLOW_CLOCK_USEC 1000
timersub(&tm->expires, &tv, &diff.it_value);
dlog(LOG_DEBUG, 5, "check_time_diff, difference: %ld sec + %ld usec",
diff.it_value.tv_sec, diff.it_value.tv_usec);
if (diff.it_value.tv_sec <= 0) {
/* already gone, this is the "good" case */
if (diff.it_value.tv_sec < 0)
return 1;
#ifdef __linux__ /* we haven't seen this on other OSes */
/* still OK if the expiry time is not too much in the future */
else if (diff.it_value.tv_usec > 0 &&
diff.it_value.tv_usec <= ALLOW_CLOCK_USEC) {
dlog(LOG_DEBUG, 4, "alarm_handler clock was probably off by %ld usec, allowing %u",
tm->expires.tv_usec-tv.tv_usec, ALLOW_CLOCK_USEC);
return 2;
}
#endif /* __linux__ */
else /* scheduled intentionally in the future? */
return 0;
}
return 0;
}
--- NEW FILE: util.c ---
/*
* $Id: util.c,v 1.1 2009/01/20 00:28:15 sdhsdh Exp $
*
* Authors:
* Lars Fenneberg <lf at elemental.net>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas at netcore.fi>.
*
*/
#include <config.h>
#include <includes.h>
#include <radvd.h>
void
mdelay(double msecs)
{
struct timeval tv;
tv.tv_sec = (time_t)(msecs / 1000.0);
tv.tv_usec = (suseconds_t)((msecs - tv.tv_sec * 1000.0) * 1000.0);
select(0,(fd_set *)NULL,(fd_set *)NULL,(fd_set *)NULL, &tv);
}
double
rand_between(double lower, double upper)
{
return ((upper - lower) / (RAND_MAX + 1.0) * rand() + lower);
}
void
print_addr(struct in6_addr *addr, char *str)
{
const char *res;
/* XXX: overflows 'str' if it isn't big enough */
res = inet_ntop(AF_INET6, (void *)addr, str, INET6_ADDRSTRLEN);
if (res == NULL)
{
flog(LOG_ERR, "print_addr: inet_ntop: %s", strerror(errno));
strcpy(str, "[invalid address]");
}
}
/* Check if an in6_addr exists in the rdnss list */
int
check_rdnss_presence(struct AdvRDNSS *rdnss, struct in6_addr *addr)
{
while (rdnss) {
if ( !memcmp(&rdnss->AdvRDNSSAddr1, addr, sizeof(struct in6_addr))
|| !memcmp(&rdnss->AdvRDNSSAddr2, addr, sizeof(struct in6_addr))
|| !memcmp(&rdnss->AdvRDNSSAddr3, addr, sizeof(struct in6_addr)) )
break; /* rdnss address found in the list */
else
rdnss = rdnss->next; /* no match */
}
return (rdnss != NULL);
}
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/support/sdk/c/blip/driver Makefile, NONE, 1.1 config.c, NONE, 1.1 config.h, NONE, 1.1 hashtable.c, NONE, 1.1 hashtable.h, NONE, 1.1 hashtable_private.h, NONE, 1.1 logging.c, NONE, 1.1 logging.h, NONE, 1.1 nwstate.c, NONE, 1.1 nwstate.h, NONE, 1.1 radvd-wrapper.c, NONE, 1.1 routing.c, NONE, 1.1 routing.h, NONE, 1.1 serial_tun.c, NONE, 1.1 tun_dev.c, NONE, 1.1 tun_dev.h, NONE, 1.1 tunnel.c, NONE, 1.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/support/sdk/c/blip/include 6lowpan.h, NONE, 1.1 IEEE154.h, NONE, 1.1 devconf.h, NONE, 1.1 in_cksum.h, NONE, 1.1 ip.h, NONE, 1.1 ip_malloc.h, NONE, 1.1 lib6lowpan.h, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list