Commit Graph

116 Commits

Author SHA1 Message Date
Gleb Smirnoff
56d5e0967c Stop including if_var.h from userland.
Sponsored by:	Nginx, Inc.
2015-04-06 09:42:23 +00:00
Joel Dahl
914f6e6290 mdoc: sort SEE ALSO. 2014-12-26 21:56:23 +00:00
Baptiste Daroussin
c6db8143ed Convert usr.sbin to LIBADD
Reduce overlinking
2014-11-25 16:57:27 +00:00
Dimitry Andric
f28c40aee0 Fix the following -Werror warnings from clang 3.5.0, while building
usr.sbin/rtadvd:

usr.sbin/rtadvd/rtadvd.c:1291:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                    abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) {
                    ^
usr.sbin/rtadvd/rtadvd.c:1291:7: note: remove the call to 'abs' since unsigned values cannot be negative
                    abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) {
                    ^~~
usr.sbin/rtadvd/rtadvd.c:1324:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                    abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) {
                    ^
usr.sbin/rtadvd/rtadvd.c:1324:7: note: remove the call to 'abs' since unsigned values cannot be negative
                    abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) {
                    ^~~
2 errors generated.

These warnings occur because both preferred_time and pfx_pltimeexpire
are uint32_t's, so the subtraction expression is also unsigned, and
calling abs() is a no-op.

However, the intention was to look at the absolute difference between
the two unsigned quantities.  Introduce a small static function to
clarify what we're doing, and call that instead.

Reviewed by:	hrs
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D1197
2014-11-22 23:04:33 +00:00
Hiroki Sato
e72e4280cf Check buffer length more strictly.
MFC after:	1 day
2014-10-11 23:24:09 +00:00
Hiroki Sato
0546aa1b97 Fix off-by-one.
MFC after:	1 day
2014-10-11 23:08:00 +00:00
Hiroki Sato
42f725eefb Ignore if the interface is not IPv6-capable.
Spotted by:	rpaulo
2013-09-02 20:44:19 +00:00
Hiroki Sato
6ce540f397 Fix a crash when reloading the configuration file.
Spotted by:	des
2013-08-27 11:50:33 +00:00
Dag-Erling Smørgrav
be22116353 Set the back pointer from the prefix to the interface before adding
the prefix to the interface's prefix list.  This shouldn't make a
difference, since rtadvd(8) is single-threaded, but I've seen it crash
in delete_prefix() with pfx_rainfo == NULL, and this is the only place
where a prefix can be added to the list with a NULL pfx_rainfo.

MFC after:	3 days
2013-08-23 10:57:05 +00:00
Hiroki Sato
3774384085 Fix build on arm and mips. 2013-08-06 15:49:18 +00:00
Hiroki Sato
7d26db1792 - Use time_uptime instead of time_second in data structures for
PF_INET6 in kernel.  This fixes various malfunction when the wall time
  clock is changed.  Bump __FreeBSD_version to 1000041.

- Use clock_gettime(CLOCK_MONOTONIC_FAST) in userland utilities.

MFC after:	1 month
2013-08-05 20:13:02 +00:00
Hiroki Sato
33631085f8 - Add missing "static" keywords.
- Add a check for ifindex to if_indextoifinfo().  It returns NULL when
  if_indextoname() fails.

MFC after:	3 days
2013-07-09 07:08:36 +00:00
Hiroki Sato
bba75509c1 Add a missing white space. 2013-07-09 07:03:54 +00:00
Eitan Adler
a32ae73071 Fix a typo in an error message.
Obtained From:	DragonFlyBSD (commit 66e72101cc32272ae370b895ca3d9e3e99c5c3a8)
2013-05-06 17:21:28 +00:00
Hiroki Sato
833d853cbf Fix SIGSEGV when set_short_delay() is called when ifi->ifi_ra_timer is NULL.
This can happen in a short period when a prefix is changed by a rtmsg and a
new interface arrives.
2013-03-06 04:58:48 +00:00
Dag-Erling Smørgrav
c1803a93a4 - Implement and use usage().
- Document the -C option.
- Allow rtadvd to be invoked without any interfaces on the command line,
  and document that possibility.

MFC after:	1 week
2013-02-25 16:47:09 +00:00
Warren Block
344c81a166 Fixes to man8 groff mandoc style, usage mistakes, or typos.
PR:		168016
Submitted by:	Nobuyuki Koganemaru
Approved by:	gjb
MFC after:	3 days
2012-05-24 02:24:03 +00:00
Eitan Adler
50d675f7a9 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
Joel Dahl
46355096e1 mdoc: correct .Bd/.Bl arguments.
Reviewed by:	brueffer
2012-03-26 21:22:53 +00:00
Ulrich Spörlein
3df5ecac8c Spelling fixes for usr.sbin/ 2011-12-30 10:58:14 +00:00
Hiroki Sato
8cdd0a8091 Remove RA timer on an interface with !IFF_UP actively after starting to send
clean-up RA messages for shutting down.  The RA timers could prevent the rtadvd
daemon from shutting down because ra_output() just ignored !IFF_UP interfaces
and TRANSITIVE->UNCONFIGURED state transition never happened due to it.

Spotted by:	kib
Approved by:	re (bz)
2011-09-20 00:32:30 +00:00
Hiroki Sato
aed378729e - Fix a bug that can lead to displaying an incorrect value. (r224210)
- Fix an abnormal termination caused by twice of "rtadvctl disable". (r224303)
- Use poll() to wait for the control message socket instead of a spin loop.
  (r224304)
- s/cmsg_/cm_/ to avoid conflict with CMSG_* symbols for struct cmsghdr.
  (r224619)
- Ignore an interface that never sent RAs for graceful shut-down. (r224620)
- Refine log messages. (r225148)
- Fix SIGSEGV when receiving RAs that contain RDNSS and/or DNSSL options.
  (r225149)

Approved by:	re (kib)
2011-09-12 23:52:55 +00:00
Hiroki Sato
3724189620 - Improve interface list handling. The rtadvd(8) now supports dynamically-
added/removed interfaces in a more consistent manner and reloading the
  configuration file.

- Implement burst unsolicited RA sending into the internal RA timer framework
  when AdvSendAdvertisements and/or configuration entries are changed as
  described in RFC 4861 6.2.4.  This fixes issues that make termination of the
  rtadvd(8) daemon take very long time.

  An interface now has three internal states, UNCONFIGURED, TRANSITIVE, or
  CONFIGURED, and the burst unsolicited sending happens in TRANSITIVE.
  See rtadvd.h for the details.

- rtadvd(8) now accepts non-existent interfaces as well in the command line.

- Add control socket support and rtadvctl(8) utility to show the RA information
  in rtadvd(8).  Dumping by SIGUSR1 has been removed in favor of it.
2011-07-17 19:24:54 +00:00
Hiroki Sato
adfd20273c Add sanity check for ifm_version in struct if_msghdr. 2011-07-04 03:19:06 +00:00
Hiroki Sato
729d2abb51 Support SIGHUP for reloading /etc/rtadvd.conf. 2011-06-11 03:25:10 +00:00
Hiroki Sato
5a10f1ccec Fix a bug that prevents tc=xxx from working. 2011-06-07 15:40:17 +00:00
Hiroki Sato
07a42575b4 - 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
Hiroki Sato
37a0ad8079 Set WARNS=1 temporarily to unbreak universe. 2011-06-06 20:14:50 +00:00
Hiroki Sato
587d184d3d Fix build on 64-bit arch.
Submitted by:	dim
Pointy hat to:	hrs
2011-06-06 10:51:00 +00:00
Hiroki Sato
db82af41db - 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
Bjoern A. Zeeb
5033bae6d0 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
Xin LI
24f2cbe959 style.Makefile says tab between var= and value. 2010-12-23 01:45:48 +00:00
Xin LI
f49f3df86a 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
Ulrich Spörlein
02ac77f222 Fix another "string" typo.
MFC after:	3 days
2010-10-28 22:28:45 +00:00
Bjoern A. Zeeb
9398643636 Correct a typo.
MFC after:	3 days
2010-10-28 11:09:12 +00:00
Ulrich Spörlein
0b31f1f731 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 Schouten
71ccf09269 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +00:00
Warner Losh
6f74a8c7a0 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
Daniel Gerzo
8411572050 - 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
Andrey A. Chernov
f90b161b21 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
Kevin Lo
784bddbc5b Cleanup of userland __P use 2007-11-07 10:53:41 +00:00
Maxim Konovalov
ba5b74d001 o Remove duplicate includes.
Obtained from:	Slava Semushin via NetBSD
2007-01-20 08:24:02 +00:00
Yaroslav Tykhiy
064aa4479f These IPv6-only tools have no explicit dependency on the INET6 macro.
Tested with:	cmp(1)
2006-07-27 15:31:13 +00:00
SUZUKI Shinsuke
94182c08be avoid heap overrun
Obtained from: KAME
MFC after: 1 day
2006-03-23 14:39:38 +00:00
SUZUKI Shinsuke
990634f5e8 fixed a typo in comment 2005-11-17 02:34:50 +00:00
SUZUKI Shinsuke
09f3617564 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
SUZUKI Shinsuke
375ef204cd 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
SUZUKI Shinsuke
b9204379a1 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
Hajimu UMEMOTO
9cc94db2fe fix typo.
Submitted by:	suz
Obtained from:	KAME
2005-08-10 17:09:08 +00:00
Ruslan Ermilov
6b806d21d1 Fixed the misplaced $FreeBSD$. 2005-02-09 18:07:17 +00:00