Commit Graph

162 Commits

Author SHA1 Message Date
hrs
c74259338a Add sanity check for ifm_version in struct if_msghdr. 2011-07-04 03:19:06 +00:00
hrs
90aa2cef03 - Check RTM_VERSION.
- Fix WARNS.
2011-06-16 12:57:33 +00:00
hrs
b2a6f56003 Merge from HEAD@222975. 2011-06-11 06:56:26 +00:00
hrs
440c37ac62 Support SIGHUP for reloading /etc/rtadvd.conf. 2011-06-11 03:25:10 +00:00
hrs
af69660e0e Merge from HEAD@222848. 2011-06-08 12:03:34 +00:00
hrs
efd82720da Fix a bug that prevents tc=xxx from working. 2011-06-07 15:40:17 +00:00
hrs
9f4e390038 - Use ELM_MALLOC() for struct rainfo.
- Fix a missing back pointer assignment in struct prefix to struct rainfo
  when addr="" is specified.  This caused SIGSEGV.

- Insert a prefix element to a tail queue after setting parameters.
2011-06-07 12:00:29 +00:00
hrs
3f1de98b34 Set WARNS=1 temporarily to unbreak universe. 2011-06-06 20:14:50 +00:00
hrs
5eef59f051 Fix build on 64-bit arch.
Submitted by:	dim
Pointy hat to:	hrs
2011-06-06 10:51:00 +00:00
hrs
10df0af5a5 - Implement RDNSS and DNSSL options (RFC 6106, IPv6 Router Advertisement
Options for DNS Configuration) into rtadvd(8) and rtsold(8).  DNS
  information received by rtsold(8) will go to resolv.conf(5) by
  resolvconf(8) script.  This is based on work by J.R. Oldroyd (kern/156259)
  but revised extensively[1].

- rtadvd(8) now supports "noifprefix" to disable gathering on-link prefixes
  from interfaces when no "addr" is specified[2].  An entry in rtadvd.conf
  with "noifprefix" + no "addr" generates an RA message with no prefix
  information option.

- rtadvd(8) now supports RTM_IFANNOUNCE message to fix crashes when an
  interface is added or removed.

- Correct bogus ND_OPT_ROUTE_INFO value to one in RFC 4191.

Reviewed by:	bz[1]
PR:		kern/156259 [1]
PR:		bin/152458 [2]
2011-06-06 03:06:43 +00:00
hrs
de63a2bf83 Specify requirements for RA sending/receiving based on lifetime,
IFF_ND6_ACCEPT_RTADV, and net.inet6.ip6.forwarding.

 ra_output:
  (lifetime == 0) = output
  (lifetime != 0 && (ACCEPT_RTADV || !ip6.forwarding) = no output

 ra_input:
  ACCEPT_RTADV = input
  !ACCEPT_RTADV = no input

Note that the current implementation sends RAs with zero-lifetime even if
ip6.forwarding == 0.  This behavior is derived from KAME and different from
RFC 4861.
2011-06-05 11:20:19 +00:00
hrs
ba519ba6ac Support dynamically-added/removed interfaces. The rtadvd(8) daemon detects an
interface addition/removal via RTM_IFANNOUNCE message and update the internal
structure.

TO BE FIXED:
 The advertising interface list still depends on the command line argument.
 The configuration file cannot be reloaded.
2011-06-05 07:55:51 +00:00
hrs
c471b1b104 Simplify -D for LOG_DEBUG and -d for LOG_INFO. 2011-06-05 02:44:04 +00:00
hrs
aca9d9cac2 Document -M flag and fix a bug in handling of it. 2011-06-05 02:31:57 +00:00
hrs
58336f4cc2 Rename: s/noonlinkprefix/noifprefix/. 2011-06-05 02:20:11 +00:00
hrs
d93e07bcd6 Reword noonlinkprefix sentences. It is related to prefixes on the network
interfaces, not in the routing table actually.

PR:	bin/152458
2011-06-04 17:31:06 +00:00
hrs
5c9df52313 "noonlinkprefix" directive has been added. This disables gathering on-link
prefixes from the kernel's routing table.  A rtadvd.conf with "noonlinkprefix"
+ no "addr" generates an RA message with no prefix information option.

PR:	bin/152458
2011-06-04 17:22:43 +00:00
hrs
6bc38bb776 Fix various inconsistencies in symbol naming and data handling which
made the logic behind them unnecessarily complicated.  This change is
a preparation to add support of dynamically-added/removed interfaces and the
link status changes in a more reliable way.  Changes include:

- Use queue(3) for linked-list manipulation.
- Use consistent variable names.
- Use (AF_INET6, s, d, sizeof(d)) instead of (AF_INET6, s, a, INET6_ADDRSTRLEN)
  for inet_ntop().
- style(9) fixes.

No functional change in this commit.
2011-06-04 16:42:51 +00:00
hrs
5ea968aede - INET6_ADDRSTRLEN does not include \0.
- Add link-local scope check for received RA messages.  RFC 4861 Section 6.1.2
  requires this.
- Refer RFC 4861 instead of obsoleted RFC 2461.
2011-06-04 04:35:12 +00:00
hrs
00e43e0cd5 - Fixes for WARNS=6.
- Use IFNAMSIZ for an interface name.
2011-06-04 02:51:12 +00:00
hrs
d3d16bccfc - Use IANA reserved example.com domain for rtadvd.conf(5).
- Fix 8-octet boundary calculation.  Extra 8 octets were added when it was
  already on an 8-octet boundary.
- Typos and style(9) fixes.

Submitted by:	bz
2011-06-04 01:20:47 +00:00
hrs
414167aef9 - Add another length check for DNSSL option. A malformed ICMP message can have
no '\0' in the search list and/or invalid length field.

- NI_MAXHOST is defined including \0.
2011-06-04 01:11:34 +00:00
hrs
d45e9a2064 Use strchr() instead of index(). 2011-06-03 06:34:29 +00:00
hrs
7e254a82b1 Fix label encoding/decoding function for RFC 1035 Section 3.1 encoding.
Each label can have 63 octets at most, and the length of whole domain name
is limited to NI_MAXHOST.
2011-06-03 05:33:38 +00:00
hrs
bf953fdd57 - Remove #ifdef RDNSS.
- Style(9).
- Define sin6_{linklocal,sitelocal}_all{nodes,routers} vars consistently.
2011-05-31 12:54:32 +00:00
hrs
fd7e38fffc Implemnt RDNSS and DNSSL options (RFC 6106, IPv6 Router Advertisement
Options for DNS Configuration) into rtadvd(8) and rtsold(8).  DNS
information received by rtsold(8) will go to resolv.conf(5) by
resolvconf(8) script.  Lifetime handling is not supported at this
moment.

Note: when receiving a link-local scope address rtsold(8) adds a scope
id into addresses in the script arguments based on the received
interface in a representation defined in RFC 4007 (e.g. fe80::1%bge0).
However, there are some shell scripts using printf(1) (including
resolvconf(8)) cannot process it properly because printf(1) can
recognize the character % as special.

Based on work by:	J.R. Oldroyd
PR:			kern/156259
2011-05-29 05:24:58 +00:00
bz
9791856c17 Prevent crashes from a race when (cloned) interfaces go away.
PR:		bin/152143
Submitted by:	Przemyslaw Frasunek (przemyslaw frasunek.com)
Tested by:	Przemyslaw Frasunek (przemyslaw frasunek.com)
MFC after:	1 week
2011-03-02 17:13:07 +00:00
delphij
67b29c50bb style.Makefile says tab between var= and value. 2010-12-23 01:45:48 +00:00
delphij
4684999621 Allow overriding pidfile and dumpfile.
PR:		bin/153362
Submitted by:	Joe Holden <joe rewt org uk>
MFC after:	1 month
2010-12-22 23:58:21 +00:00
uqs
07e9b6a42f Fix another "string" typo.
MFC after:	3 days
2010-10-28 22:28:45 +00:00
bz
a63e742296 Correct a typo.
MFC after:	3 days
2010-10-28 11:09:12 +00:00
uqs
64c451d29e mdoc: move remaining sections into consistent order
This pertains mostly to FILES, HISTORY, EXIT STATUS and AUTHORS sections.

Found by:	mdocml lint run
Reviewed by:	ru
2010-05-13 12:08:11 +00:00
ed
073cafdd42 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +00:00
imp
8391d4689d Properly convert bit value to a bit field. Before we were storing
values like 0x80 or 0x40 into a uint8_t foo:1 bitfield.  This would
result in the bit always being 0.  One of these caused a warning for
overflow (one that was 0x80), but the other didn't.  They were both
wrong.

This is why I hate code that mixes c struct bitfields and #defines.
The rest of the fields accessed by the program should be audited.
2009-02-19 16:30:11 +00:00
danger
f524a751ea - rename the RETURN VALUES section to EXIT STATUS [1]
- convert to .Ex macro
- not bumping a date as this is not a real content change

Approved by:	ru [1]
MFC after:	3 days
2009-01-07 01:01:26 +00:00
ache
0ef9f80522 Change 2 arc4random modulo operations to arc4random_uniform() as
OpenBSD does, since modulo is not power of 2.

Obtained from:  OpenBSD
2008-07-26 15:39:32 +00:00
kevlo
fa3791e1a7 Cleanup of userland __P use 2007-11-07 10:53:41 +00:00
maxim
202535955d o Remove duplicate includes.
Obtained from:	Slava Semushin via NetBSD
2007-01-20 08:24:02 +00:00
yar
b8f7c89828 These IPv6-only tools have no explicit dependency on the INET6 macro.
Tested with:	cmp(1)
2006-07-27 15:31:13 +00:00
suz
20b21e2a36 avoid heap overrun
Obtained from: KAME
MFC after: 1 day
2006-03-23 14:39:38 +00:00
suz
7c337042be fixed a typo in comment 2005-11-17 02:34:50 +00:00
suz
f584bb27ab changed syslog level to more appropriate ones
Obtained from: KAME
Reviewd by: ume, gnn
MFC after: 2 weeks
2005-10-19 15:19:06 +00:00
suz
1e68536f50 source link-layer address option should be marked to be checked later,
because rs_input() need this option.

Obtained from: KAME
Reviewed by: ume, gnn
MFC after: 2 weeks
2005-10-19 15:14:28 +00:00
suz
7cb7aed97b added an ioctl option in kernel so that ndp/rtadvd can change some NDP-related kernel variables based on their configurations (RFC2461 p.43 6.2.1 mandates this for IPv6 routers)
Obtained from: KAME
Reviewd by: ume, gnn
MFC after: 2 weeks
2005-10-19 15:05:42 +00:00
ume
c499ed16ea fix typo.
Submitted by:	suz
Obtained from:	KAME
2005-08-10 17:09:08 +00:00
ru
114ea39c76 Fixed the misplaced $FreeBSD$. 2005-02-09 18:07:17 +00:00
suz
1180ce1062 removed compilation warning
PR:	bin/71624
2004-10-22 07:31:12 +00:00
imp
9fbed704d5 Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived software
(with permission of addtional copyright holders where appropriate)
2004-08-07 04:28:56 +00:00
ru
c9514667b2 Fixed SEE ALSO references. 2004-07-02 22:50:25 +00:00
phk
70e8d575c7 libcompat doesn't seem to be necessary any more. 2004-06-21 16:09:29 +00:00
bde
7432091236 Fixed a misspelling of 0 as NULL. 2004-03-10 08:46:39 +00:00
suz
6e6824e4bc fixed memory leak.
Obtained From: KAME
2003-09-20 09:41:13 +00:00
ru
cc9d2aeb39 Get rid of duplicates. 2003-09-14 13:41:59 +00:00
ume
448f6abd90 - supported a string notation for xxflags.
- deprecate routes#N, as it is hard to keep consistency with
  rtprefixN.  accept any number of "rtprefix", "rtrefix0",
  ..., "rtprefix99".
- deprecate "addrs#N", as it is difficult for users to keep
  consistency with "addrN".
  accept 100 prefix info in maximum - like "addr", "addr0"
  ... "addr99".  WARNS=2 clean on netbsd.
  old configuration file should work just fine.
  behavior change:
  previously, we rejected "addrN" if there's "addr", and we rejected
  "addr" if there is "addrN".  now we accept both without problem.
- when an advertised prefix configured from the kernel has been added
  or invalidated, notice the change in a short delay.
- when invalidating a prefix, do not bark even if there is
  inconsistency about prefix lifetimes.
- wrap more specific route info code into ROUTEINFO.

Obtained from:	KAME
MFC after:	1 week
2003-08-15 19:13:53 +00:00
ume
2de9e4015b use arc4random.
Obtained from:	KAME
MFC after:	1 week
2003-08-15 17:51:51 +00:00
ume
8a6097d8de variable shared with signal handler needs to be "volatile sig_atomic_t".
Obtained from:	KAME
MFC after:	1 week
2003-08-15 17:20:49 +00:00
ume
03f660313d set LOG_PERROR for openlog() when running foreground.
Obtained from:	KAME
MFC after:	1 week
2003-08-15 17:15:10 +00:00
ume
7bd0c793c1 dump the content of route information options
Obtained from:	KAME
MFC after:	1 week
2003-08-15 17:04:28 +00:00
ume
eaf6d1de54 logged the fact to dump the status.
Obtained from:	KAME
MFC after:	1 week
2003-08-15 16:50:34 +00:00
ume
587cb35d19 daemon() has to be called prior to file descriptor setups
(otherwise file descriptors could be closed mistakenly)

Obtained from:	KAME
MFC after:	1 week
2003-08-14 19:05:24 +00:00
ume
3152567590 support poll(2).
Obtained from:	KAME
MFC after:	1 week
2003-08-14 18:43:57 +00:00
ume
41379bc0db - rename some variables.
- remove unused block.

Obtained from:	KAME
MFC after:	1 week
2003-08-14 16:51:13 +00:00
ume
076d01ff60 signal handler must take "int" arg.
Obtained from:	KAME
MFC after:	1 week
2003-08-14 16:23:39 +00:00
ume
607bd5ea24 avoid fd_set overrun.
Obtained from:	KAME
MFC after:	1 week
2003-08-14 16:19:59 +00:00
ume
5ac4d3d0e1 malloc() may return NULL.
Obtained from:	KAME
MFC after:	1 week
2003-08-12 16:58:32 +00:00
ume
a3738aa5cf reduce #ifdef.
MFC after:	1 week
2003-08-11 15:51:54 +00:00
ume
44f95bb1cf use strlcpy() and snprintf().
Obtained from:	KAME
MFC after:	1 week
2003-08-11 15:49:47 +00:00
ume
8fcac13acd use int64_t instead of long long.
Obtained from:	KAME
MFC after:	1 week
2003-08-11 15:46:37 +00:00
ume
59b29c0142 Drop MIP6 code. We don't support MIP6 yet.
MFC after:	1 week
2003-08-08 20:14:28 +00:00
ume
958362f6a8 KNF, correct typos and cleanup spaces.
Obtained from:	KAME
MFC after:	1 week
2003-08-08 16:56:01 +00:00
ume
bf86284d6c stop use of register.
Obtained from:	KAME
MFC after:	1 week
2003-08-08 16:47:06 +00:00
ume
52b4a696e0 __FUNCTION__ --> __func__
Obtained from:	KAME
MFC after:	1 week
2003-08-08 16:38:23 +00:00
suz
83d78951a7 fixed wrong parameter descriptions
Obtained from: KAME
MFC after: 1 day
2003-07-30 07:33:10 +00:00
suz
4b545f73d3 - fixed byte order of route lifetimes in route info opptions.
- corrected wording in a log message.

Obtained from: KAME
MFC after: 1 week
2003-04-10 07:31:34 +00:00
njl
29be5a9beb Use assignment, not equivalence test.
No response from:	suz
2003-04-05 20:54:54 +00:00
obrien
a920d12f89 style.Makefile(5) 2003-04-04 17:49:21 +00:00
suz
bd1430b43c fixed invalid pointer reference
Obtained from: KAME
2003-04-02 11:35:51 +00:00
ume
0a410e4e75 tightened check for the length of ND options.
Submitted by:	jinmei@kame.net (JINMEI Tatuya)
Obtained from:	KAME
2003-03-26 17:28:47 +00:00
ache
fdbf9035ad Use srandomdev() for FreeBSD 2003-02-11 02:21:41 +00:00
schweikh
86f7487fb6 Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.
2002-12-30 21:18:15 +00:00
schweikh
fec6546e12 english(4) police. 2002-12-27 12:15:40 +00:00
charnier
d2168fe021 The .Nm utility 2002-07-14 14:47:15 +00:00
ume
adc2ddac9e Do not issue deprecated ioctl.
Obtained from:	KAME
MFC after:	2 weeks
2002-06-15 18:56:32 +00:00
ume
a748c14225 Changed the behavior when an interface-direct prefix being advertised
was removed from the kernel;
Advertise the prefix with zero lifetimes rather than to remove the prefix
from the prefix list to be advertised.
This will help renumber a receiving host by deprecating the address
derived from the old prefix.

Obtained from:	KAME
MFC after:	2 weeks
2002-06-13 16:59:31 +00:00
ume
887cd7c01d Skip duplicated prefixes in get_prefix().
Obtained from:	KAME
2002-06-01 19:16:13 +00:00
ume
acb72828ee KNF
Obtained from:	KAME
2002-06-01 17:28:12 +00:00
ume
4f54232f46 sprintf -> snprintf
Obtained from:	KAME
2002-06-01 16:50:21 +00:00
ru
bde8ec1b70 mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
ru
4345758876 mdoc(7) police:
Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text.
Not only this slows down the mdoc(7) processing significantly, but it also
has an undesired (in this case) effect of disabling hyphenation within the
entire enclosed block.
2001-08-07 15:48:51 +00:00
sheldonh
9bfb9eedcd Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. The
definitions are more readable, and it's possible that they're
more portable to pathalogical platforms.

Submitted by:   David Hill <david@phobia.ms>
2001-07-26 11:02:39 +00:00
obrien
9c97c8f02d Perform a major cleanup of the usr.sbin Makefiles.
These are not perfectly in agreement with each other style-wise, but they
are orders of orders of magnitude more consistent style-wise than before.
2001-07-20 06:20:32 +00:00
dd
911ca14c87 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
dd
eaa6ee03b8 mdoc(7) police: remove extraneous .Pp before and/or after .Sh. 2001-07-09 09:54:33 +00:00
ru
05e503d80a mdoc(7) police: sort SEE ALSO xrefs (sort -b -f +2 -3 +1 -2). 2001-07-06 16:46:48 +00:00
ume
832f8d2249 Sync with recent KAME.
This work was based on kame-20010528-freebsd43-snap.tgz and some
critical problem after the snap was out were fixed.
There are many many changes since last KAME merge.

TODO:
  - The definitions of SADB_* in sys/net/pfkeyv2.h are still different
    from RFC2407/IANA assignment because of binary compatibility
    issue.  It should be fixed under 5-CURRENT.
  - ip6po_m member of struct ip6_pktopts is no longer used.  But, it
    is still there because of binary compatibility issue.  It should
    be removed under 5-CURRENT.

Reviewed by:	itojun
Obtained from:	KAME
MFC after:	3 weeks
2001-06-11 12:39:29 +00:00
ru
afd506414e - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:42:20 +00:00
ume
b20ff50272 zero-cleared allocated prefix information when configured.
Obtained from:	KAME
2001-01-23 17:29:12 +00:00
itojun
a458f7bcea make it easier to handle $FreeBSD$ tags (amount of diff matters). 2001-01-21 15:25:46 +00:00
itojun
23a36fd8e2 make it clearer that rtadvd.conf is optional (configs are grabbed from kernel). 2001-01-21 15:25:05 +00:00
ru
71e2293ad4 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 20:10:44 +00:00