Commit Graph

130 Commits

Author SHA1 Message Date
hrs
279128805f Ignore if the interface is not IPv6-capable.
Spotted by:	rpaulo
2013-09-02 20:44:19 +00:00
hrs
9a7e8d3357 Fix a crash when reloading the configuration file.
Spotted by:	des
2013-08-27 11:50:33 +00:00
des
36b6860de7 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
hrs
cd60e1fa27 Fix build on arm and mips. 2013-08-06 15:49:18 +00:00
hrs
13c1bcf2c1 - 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
hrs
044c45e416 - 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
hrs
9a4247565d Add a missing white space. 2013-07-09 07:03:54 +00:00
eadler
076d9b3125 Fix a typo in an error message.
Obtained From:	DragonFlyBSD (commit 66e72101cc32272ae370b895ca3d9e3e99c5c3a8)
2013-05-06 17:21:28 +00:00
hrs
684b694dcf 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
des
d4e1f873c1 - 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
wblock
9fa9a2acad 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
eadler
1ef5fe44d3 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
906214101c mdoc: correct .Bd/.Bl arguments.
Reviewed by:	brueffer
2012-03-26 21:22:53 +00:00
uqs
415a3a9b96 Spelling fixes for usr.sbin/ 2011-12-30 10:58:14 +00:00
hrs
b9c462d8c9 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
hrs
2652dfc6f9 - 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
hrs
0796dbc180 - 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
hrs
cdcbea6ad2 - Refactoring the interface list. It now supports dynamically
added/removed interfaces in a more consistent manner and reloading
  the configuration file.

- Add initial support for control socket.  RA information in the
  daemon can be obtained by rtadvctl(8) instead of SIGUSR1 in a similar
  manner to ifconfig(8).  The information dump has been removed in favor of it.

  (reload the configuration file)
  # rtadvctl reload

  (show RA messages being sent on each interfaces)
  # rtadvctl show
  em0: flags=<UP,CONFIGURED,PERSIST> status=<RA_SEND> mtu 1280
        DefaultLifetime: 30m
        MinAdvInterval/MaxAdvInterval: 3m20s/3m20s
        AdvLinkMTU: <none>, Flags: O, Preference: medium
        ReachableTime: 0s, RetransTimer: 0s, CurHopLimit: 64
        AdvIfPrefixes: yes

  (show RA messages being sent only on em0)
  # rtadvctl show em0

  (rtadvctl -v show provides additional information)
  # rtadvctl -v show em0
  em0: flags=<UP,CONFIGURED,PERSIST> status=<RA_SEND> mtu 1280
        DefaultLifetime: 30m
        MinAdvInterval/MaxAdvInterval: 3m20s/3m20s
        AdvLinkMTU: <none>, Flags: O, Preference: medium
        ReachableTime: 0s, RetransTimer: 0s, CurHopLimit: 64
        AdvIfPrefixes: yes
        Prefixes (1):
          2001:db8:1::/64 (CONFIG, vltime=30d, pltime=7d, flags=LA)
        RDNSS entries:
          2001:db8:1::128 (ltime=2m40s)

  (stop rtadvd)
  # rtadvctl shutdown

  A remaining issue when reloading the configuration file is that
  during that period rtadvd cannot communicate with rtadvctl due to some
  additional RA sending for graceful shutdown.  This will be fixed later.
2011-07-14 10:09:58 +00:00
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