Commit Graph

43 Commits

Author SHA1 Message Date
Don Lewis
8afa1c3d7a Use strlcpy() instead of strncpy() when copying ifname to ensure
that it is NUL terminated.  Additional NUL padding is not required
for short names.

MFC after:	1 week
2016-05-15 22:06:21 +00:00
Conrad Meyer
5c4eb89746 rtadvd(8): Don't use-after-free
This whole block of code as committed fully formed in r224144.  I'm not really
sure what the intent was, but it seems plausible that !persist ifis could need
other member cleanup.  Don't free the object until after we've finished
cleaning its members.

Reported by:	Coverity
CID:		1006079
Sponsored by:	EMC / Isilon Storage Division
2016-05-12 04:54:32 +00:00
Hiroki Sato
c8b84e5330 - Fix a bug which prevented dnssl[0-9] and rdnss[0-9] parameters from
working.

- Fix a pointer calculation for padding when multiple dnssl[0-9]
  parameters are specified [*].

Reported by:	http://bugs.dragonflybsd.org/issues/2847 [*]
2015-10-22 09:55:40 +00:00
Gleb Smirnoff
56d5e0967c Stop including if_var.h from userland.
Sponsored by:	Nginx, Inc.
2015-04-06 09:42:23 +00:00
Hiroki Sato
e72e4280cf Check buffer length more strictly.
MFC after:	1 day
2014-10-11 23:24:09 +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
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
bba75509c1 Add a missing white space. 2013-07-09 07:03:54 +00:00
Ulrich Spörlein
3df5ecac8c Spelling fixes for usr.sbin/ 2011-12-30 10:58:14 +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
729d2abb51 Support SIGHUP for reloading /etc/rtadvd.conf. 2011-06-11 03:25:10 +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
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
Kevin Lo
784bddbc5b Cleanup of userland __P use 2007-11-07 10:53:41 +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
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
SUZUKI Shinsuke
72286081d0 removed compilation warning
PR:	bin/71624
2004-10-22 07:31:12 +00:00
Hajimu UMEMOTO
fc35a81b09 - 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
Hajimu UMEMOTO
d7f0819bf0 malloc() may return NULL.
Obtained from:	KAME
MFC after:	1 week
2003-08-12 16:58:32 +00:00
Hajimu UMEMOTO
b6ed844ff2 reduce #ifdef.
MFC after:	1 week
2003-08-11 15:51:54 +00:00
Hajimu UMEMOTO
bb58b617fb use strlcpy() and snprintf().
Obtained from:	KAME
MFC after:	1 week
2003-08-11 15:49:47 +00:00
Hajimu UMEMOTO
47742de0ef use int64_t instead of long long.
Obtained from:	KAME
MFC after:	1 week
2003-08-11 15:46:37 +00:00
Hajimu UMEMOTO
be9879af48 Drop MIP6 code. We don't support MIP6 yet.
MFC after:	1 week
2003-08-08 20:14:28 +00:00
Hajimu UMEMOTO
fa19f9be04 KNF, correct typos and cleanup spaces.
Obtained from:	KAME
MFC after:	1 week
2003-08-08 16:56:01 +00:00
Hajimu UMEMOTO
1533bed05b __FUNCTION__ --> __func__
Obtained from:	KAME
MFC after:	1 week
2003-08-08 16:38:23 +00:00
SUZUKI Shinsuke
a9379b2924 - 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
Nate Lawson
3f171d2283 Use assignment, not equivalence test.
No response from:	suz
2003-04-05 20:54:54 +00:00
SUZUKI Shinsuke
ac03f2af25 fixed invalid pointer reference
Obtained from: KAME
2003-04-02 11:35:51 +00:00
Jens Schweikhardt
d64ada501a 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
Hajimu UMEMOTO
c4a0032fe3 Do not issue deprecated ioctl.
Obtained from:	KAME
MFC after:	2 weeks
2002-06-15 18:56:32 +00:00
Hajimu UMEMOTO
0a5f3ef410 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
Hajimu UMEMOTO
c7aec5cc57 Skip duplicated prefixes in get_prefix().
Obtained from:	KAME
2002-06-01 19:16:13 +00:00
Hajimu UMEMOTO
bc89a11710 sprintf -> snprintf
Obtained from:	KAME
2002-06-01 16:50:21 +00:00
Hajimu UMEMOTO
3384154590 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
Hajimu UMEMOTO
1167992be6 zero-cleared allocated prefix information when configured.
Obtained from:	KAME
2001-01-23 17:29:12 +00:00
Jun-ichiro itojun Hagino
ae3267258a make it easier to handle $FreeBSD$ tags (amount of diff matters). 2001-01-21 15:25:46 +00:00
Kris Kennaway
b26e03e907 Sync with latest KAME
Obtained from:	KAME
2000-07-05 22:09:50 +00:00
Yoshinobu Inoue
32387b216d Added several socket close() which were mistakenly forgotten.
Reported by: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
2000-03-09 14:51:05 +00:00
Yoshinobu Inoue
1aa540eb03 Forbid include of soem inet6 header files from wrong place
KAME put INET6 related stuff into sys/netinet6 dir, but IPv6
  standard API(RFC2553) require following files to be under sys/netinet.
    netinet/ip6.h
    netinet/icmp6.h
  Now those header files just include each following files.
    netinet6/ip6.h
    netinet6/icmp6.h

  Also KAME has netinet6/in6.h for easy INET6 common defs
  sharing between different BSDs, but RFC2553 requires only
  netinet/in.h should be included from userland.
  So netinet/in.h also includes netinet6/in6.h inside.

  To keep apps portability, apps should not directly include
  above files from netinet6 dir.
  Ideally, all contents of,
    netinet6/ip6.h
    netinet6/icmp6.h
    netinet6/in6.h
  should be moved into
    netinet/ip6.h
    netinet/icmp6.h
    netinet/in.h
  but to avoid big changes in this stage, add some hack, that
    -Put some special macro define into those files under neitnet
    -Let files under netinet6 cause error if it is included
     from some apps, and, if the specifal macro define is not
     defined.
     (which should have been defined if files under netinet is
     included)
    -And let them print an error message which tells the
     correct name of the include file to be included.

  Also fix apps which includes invalid header files.

Approved by: jkh

Obtained from: KAME project
2000-02-10 19:33:58 +00:00
Yoshinobu Inoue
9a4365d0e0 libipsec and IPsec related apps. (and some KAME related man pages)
Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
2000-01-06 12:40:54 +00:00