aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/rtadvd/rtadvd.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove obsolete compatibility code from rtadvd.Mark Johnston2019-07-171-9/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=350086
* Update the "flag" for draft-ietf-6man-ipv6only-flag.Bjoern A. Zeeb2018-11-031-2/+2
| | | | | | | | | Having the flag named "6" can possibly be a problem for configurations where parsing strings and numbers can produce ambivalent results. Rename the "6" flag to the "S"ix (or Silence-IPv4) flag. Notes: svn path=/head/; revision=340098
* Initial implementation of draft-ietf-6man-ipv6only-flag.Bjoern A. Zeeb2018-10-301-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change defines the RA "6" (IPv6-Only) flag which routers may advertise, kernel logic to check if all routers on a link have the flag set and accordingly update a per-interface flag. If all routers agree that it is an IPv6-only link, ether_output_frame(), based on the interface flag, will filter out all ETHERTYPE_IP/ARP frames, drop them, and return EAFNOSUPPORT to upper layers. The change also updates ndp to show the "6" flag, ifconfig to display the IPV6_ONLY nd6 flag if set, and rtadvd to allow announcing the flag. Further changes to tcpdump (contrib code) are availble and will be upstreamed. Tested the code (slightly earlier version) with 2 FreeBSD IPv6 routers, a FreeBSD laptop on ethernet as well as wifi, and with Win10 and OSX clients (which did not fall over with the "6" flag set but not understood). We may also want to (a) implement and RX filter, and (b) over time enahnce user space to, say, stop dhclient from running when the interface flag is set. Also we might want to start IPv6 before IPv4 in the future. All the code is hidden under the EXPERIMENTAL option and not compiled by default as the draft is a work-in-progress and we cannot rely on the fact that IANA will assign the bits as requested by the draft and hence they may change. Dear 6man, you have running code. Discussed with: Bob Hinden, Brian E Carpenter Notes: svn path=/head/; revision=339929
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* usr.sbin: minor spelling fixes on comments.Pedro F. Giffuni2016-05-011-1/+1
| | | | | | | No functional change. Notes: svn path=/head/; revision=298886
* Now that we own the code, use arc4random(3) unconditionallyXin LI2015-10-061-17/+0
| | | | | | | | | and remove the corresponding HAVE_ARC4RANDOM conditions. MFC after: 2 weeks Notes: svn path=/head/; revision=288963
* Stop including if_var.h from userland.Gleb Smirnoff2015-04-061-1/+0
| | | | | | | Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=281143
* Fix the following -Werror warnings from clang 3.5.0, while buildingDimitry Andric2014-11-221-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=274898
* - Use time_uptime instead of time_second in data structures forHiroki Sato2013-08-051-21/+20
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=253970
* - Add missing "static" keywords.Hiroki Sato2013-07-091-2/+7
| | | | | | | | | | - Add a check for ifindex to if_indextoifinfo(). It returns NULL when if_indextoname() fails. MFC after: 3 days Notes: svn path=/head/; revision=253058
* Fix SIGSEGV when set_short_delay() is called when ifi->ifi_ra_timer is NULL.Hiroki Sato2013-03-061-0/+2
| | | | | | | | This can happen in a short period when a prefix is changed by a rtmsg and a new interface arrives. Notes: svn path=/head/; revision=247863
* - Implement and use usage().Dag-Erling Smørgrav2013-02-251-8/+12
| | | | | | | | | | | - Document the -C option. - Allow rtadvd to be invoked without any interfaces on the command line, and document that possibility. MFC after: 1 week Notes: svn path=/head/; revision=247270
* Spelling fixes for usr.sbin/Ulrich Spörlein2011-12-301-2/+2
| | | | Notes: svn path=/head/; revision=228990
* Remove RA timer on an interface with !IFF_UP actively after starting to sendHiroki Sato2011-09-201-0/+15
| | | | | | | | | | | | 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) Notes: svn path=/head/; revision=225683
* - Fix a bug that can lead to displaying an incorrect value. (r224210)Hiroki Sato2011-09-121-93/+100
| | | | | | | | | | | | | | | | | - 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) Notes: svn path=/head/; revision=225519
* - Improve interface list handling. The rtadvd(8) now supports dynamically-Hiroki Sato2011-07-171-470/+494
| | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=224144
* Support SIGHUP for reloading /etc/rtadvd.conf.Hiroki Sato2011-06-111-19/+17
| | | | Notes: svn path=/head/; revision=222972
* Fix build on 64-bit arch.Hiroki Sato2011-06-061-3/+3
| | | | | | | | Submitted by: dim Pointy hat to: hrs Notes: svn path=/head/; revision=222743
* - Implement RDNSS and DNSSL options (RFC 6106, IPv6 Router AdvertisementHiroki Sato2011-06-061-557/+727
| | | | | | | | | | | | | | | | | | | | | | | | 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] Notes: svn path=/head/; revision=222732
* Prevent crashes from a race when (cloned) interfaces go away.Bjoern A. Zeeb2011-03-021-4/+6
| | | | | | | | | | PR: bin/152143 Submitted by: Przemyslaw Frasunek (przemyslaw frasunek.com) Tested by: Przemyslaw Frasunek (przemyslaw frasunek.com) MFC after: 1 week Notes: svn path=/head/; revision=219184
* Allow overriding pidfile and dumpfile.Xin LI2010-12-221-14/+25
| | | | | | | | | PR: bin/153362 Submitted by: Joe Holden <joe rewt org uk> MFC after: 1 month Notes: svn path=/head/; revision=216675
* Change 2 arc4random modulo operations to arc4random_uniform() asAndrey A. Chernov2008-07-261-2/+2
| | | | | | | | | OpenBSD does, since modulo is not power of 2. Obtained from: OpenBSD Notes: svn path=/head/; revision=180823
* Cleanup of userland __P useKevin Lo2007-11-071-19/+19
| | | | Notes: svn path=/head/; revision=173412
* o Remove duplicate includes.Maxim Konovalov2007-01-201-1/+0
| | | | | | | Obtained from: Slava Semushin via NetBSD Notes: svn path=/head/; revision=166134
* changed syslog level to more appropriate onesSUZUKI Shinsuke2005-10-191-3/+3
| | | | | | | | | Obtained from: KAME Reviewd by: ume, gnn MFC after: 2 weeks Notes: svn path=/head/; revision=151470
* source link-layer address option should be marked to be checked later,SUZUKI Shinsuke2005-10-191-1/+1
| | | | | | | | | | | because rs_input() need this option. Obtained from: KAME Reviewed by: ume, gnn MFC after: 2 weeks Notes: svn path=/head/; revision=151469
* - supported a string notation for xxflags.Hajimu UMEMOTO2003-08-151-76/+101
| | | | | | | | | | | | | | | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=118968
* use arc4random.Hajimu UMEMOTO2003-08-151-0/+6
| | | | | | | | Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=118962
* variable shared with signal handler needs to be "volatile sig_atomic_t".Hajimu UMEMOTO2003-08-151-2/+2
| | | | | | | | Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=118961
* set LOG_PERROR for openlog() when running foreground.Hajimu UMEMOTO2003-08-151-3/+7
| | | | | | | | Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=118959
* daemon() has to be called prior to file descriptor setupsHajimu UMEMOTO2003-08-141-2/+2
| | | | | | | | | | (otherwise file descriptors could be closed mistakenly) Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=118920
* support poll(2).Hajimu UMEMOTO2003-08-141-1/+36
| | | | | | | | Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=118916
* - rename some variables.Hajimu UMEMOTO2003-08-141-27/+14
| | | | | | | | | | - remove unused block. Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=118913
* signal handler must take "int" arg.Hajimu UMEMOTO2003-08-141-4/+5
| | | | | | | | Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=118912
* avoid fd_set overrun.Hajimu UMEMOTO2003-08-141-9/+21
| | | | | | | | Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=118911
* Drop MIP6 code. We don't support MIP6 yet.Hajimu UMEMOTO2003-08-081-19/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=118672
* KNF, correct typos and cleanup spaces.Hajimu UMEMOTO2003-08-081-12/+10
| | | | | | | | Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=118664
* __FUNCTION__ --> __func__Hajimu UMEMOTO2003-08-081-77/+77
| | | | | | | | Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=118660
* tightened check for the length of ND options.Hajimu UMEMOTO2003-03-261-2/+25
| | | | | | | | Submitted by: jinmei@kame.net (JINMEI Tatuya) Obtained from: KAME Notes: svn path=/head/; revision=112676
* Use srandomdev() for FreeBSDAndrey A. Chernov2003-02-111-0/+4
| | | | Notes: svn path=/head/; revision=110668
* Changed the behavior when an interface-direct prefix being advertisedHajimu UMEMOTO2002-06-131-3/+11
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=98172
* Skip duplicated prefixes in get_prefix().Hajimu UMEMOTO2002-06-011-2/+0
| | | | | | | Obtained from: KAME Notes: svn path=/head/; revision=97719
* KNFHajimu UMEMOTO2002-06-011-286/+264
| | | | | | | Obtained from: KAME Notes: svn path=/head/; revision=97712
* Sync with recent KAME.Hajimu UMEMOTO2001-06-111-41/+168
| | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=78064
* make it easier to handle $FreeBSD$ tags (amount of diff matters).Jun-ichiro itojun Hagino2001-01-211-2/+1
| | | | Notes: svn path=/head/; revision=71333
* Sync with latest KAMEKris Kennaway2000-07-051-182/+441
| | | | | | | Obtained from: KAME Notes: svn path=/head/; revision=62656
* Print ifname when sendmsg failed.Yoshinobu Inoue2000-02-241-2/+2
| | | | | | | Approved by: jkh Notes: svn path=/head/; revision=57435
* -P option was not enabled, so enable itYoshinobu Inoue2000-02-151-1/+6
| | | | | | | | | | (The option specify IPsec policy for rtadvd to receive Router Renumbering messages.) Approved by: jkh Notes: svn path=/head/; revision=57238
* libipsec and IPsec related apps. (and some KAME related man pages)Yoshinobu Inoue2000-01-061-0/+1239
Reviewed by: freebsd-arch, cvs-committers Obtained from: KAME project Notes: svn path=/head/; revision=55505