Commit Graph

85 Commits

Author SHA1 Message Date
tnn 93ea59e26b ndp: add gmt2local() from external/bsd/tcpdump instead of reachover
It is no longer shipped with the tcpdump distribution.
2023-08-18 13:07:38 +00:00
rillig 6f4965e060 usr.sbin: remove unnecessary CONSTCOND, lint no longer needs it
Since 2021-01-31, lint no longer requires a CONSTCOND comment in a
do-while-0 statement since this is a common code pattern, especially in
statement-like macros.

sed -i -E 's,} while \(/\* ?CONSTCOND ?\*/ ?0\),} while (0),' */*.[ch]
2021-11-27 22:30:25 +00:00
andvar c1d86c1466 fix few more typos in comments, messages and documentation. 2021-09-19 11:37:00 +00:00
roy 9613f51d0a ndp: Show U for Unreachable 2020-09-15 10:11:35 +00:00
roy 73dd2b525a ndp: Sync usage and SYNPOSIS with reality 2020-06-12 21:08:02 +00:00
roy b05648aa26 Remove in-kernel handling of Router Advertisements
This is much better handled by a user-land tool.
Proposed on tech-net here:
https://mail-index.netbsd.org/tech-net/2020/04/22/msg007766.html

Note that the ioctl SIOCGIFINFO_IN6 no longer sets flags. That now
needs to be done using the pre-existing SIOCSIFINFO_FLAGS ioctl.

Compat is fully provided where it makes sense, but trying to turn on
RA handling will obviously throw an error as it no longer exists.

Note that if you use IPv6 temporary addresses, this now needs to be
turned on in dhcpcd.conf(5) rather than in sysctl.conf(5).
2020-06-12 11:04:44 +00:00
roy b4a54cc1e6 ndp: SIOCSPFXFLUSH_IN6 and SIOCSRTRFLUSH_IN6 expect struct in6_ifreq
And not just a character string of the interface name.
This only worked before because the interface name is the first member
of the structure.
2018-12-16 08:47:43 +00:00
nonaka 72a00d12fb Use s6, not mysin. 2018-07-12 08:20:49 +00:00
nonaka 727d6d241c ndp(8): host_buf should not be used in delete().
host_buf is passed to the argument host of delete() in do_foreach().
2018-07-12 08:16:14 +00:00
nonaka 818060011e Remove duplicate rtrlist() function prototype. 2018-07-12 07:32:35 +00:00
christos 10a71a2955 PR/53371: Thomas Barabosch: Potential memory leak in usr.sbin/ndp/ndp.c 2018-06-16 13:09:41 +00:00
wiz ec5498f5ad Sort some lists. Use EXIT STATUS instead of RETURN VALUES. 2018-02-14 10:13:25 +00:00
maxv d33dbf4b86 Use .Cm instead of .Li, same as arp.8. 2018-02-14 06:52:41 +00:00
christos e68fbebd32 use librumpres 2017-10-10 19:30:41 +00:00
ozaki-r 3f42983046 Enable to remove multiple ARP/NDP entries for one destination
The kernel can have multiple ARP/NDP entries which have an indentical
destination on different interfaces. This is normal and can be
reproduce easily by ping -I or ping6 -S. We should be able to remove
such entries.

arp -d <ip> and ndp -d <ip> are changed to fetch all ARP/NDP entries
and remove matched entries. So we can remove multiple entries
described above. This fetch all and selective removal behavior is
the same as arp <ip> and ndp <ip>; they also do fetch all entries
and show only matched entries.

Related to PR 51179
2017-06-28 08:17:50 +00:00
ozaki-r 60f1157fbd Fix usage of routing messages on arp -d and ndp -d
It didn't work as we expected; we should set RTA_GATEWAY not
RTA_IFP on RTM_GET to return an if_index and the kernel should
use it on RTM_DELETE.
2017-06-26 03:13:40 +00:00
christos c66fd1e19a remove unused ancient code and widen v6 address so that columns are aligned. 2016-09-19 19:13:14 +00:00
ozaki-r 09973b35ac Separate nexthop caches from the routing table
By this change, nexthop caches (IP-MAC address pair) are not stored
in the routing table anymore. Instead nexthop caches are stored in
each network interface; we already have lltable/llentry data structure
for this purpose. This change also obsoletes the concept of cloning/cloned
routes. Cloned routes no longer exist while cloning routes still exist
with renamed to connected routes.

Noticeable changes are:
- Nexthop caches aren't listed in route show/netstat -r
  - sysctl(NET_RT_DUMP) doesn't return them
  - If RTF_LLDATA is specified, it returns nexthop caches
- Several definitions of routing flags and messages are removed
  - RTF_CLONING, RTF_XRESOLVE, RTF_LLINFO, RTF_CLONED and RTM_RESOLVE
- RTF_CONNECTED is added
  - It has the same value of RTF_CLONING for backward compatibility
- route's -xresolve, -[no]cloned and -llinfo options are removed
  - -[no]cloning remains because it seems there are users
  - -[no]connected is introduced and recommended
    to be used instead of -[no]cloning
- route show/netstat -r drops some flags
  - 'L' and 'c' are not seen anymore
  - 'C' now indicates a connected route
- Gateway value of a route of an interface address is now not
  a L2 address but "link#N" like a connected (cloning) route
- Proxy ARP: "arp -s ... pub" doesn't create a route

You can know details of behavior changes by seeing diffs under tests/.

Proposed on tech-net and tech-kern:
  http://mail-index.netbsd.org/tech-net/2016/03/11/msg005701.html
2016-04-04 07:37:07 +00:00
christos fb571d36af Don't forget to set sin_scope. From Ryota Ozaki 2015-12-14 18:24:06 +00:00
ozaki-r a3390d2a1a Add getaddrinfo.c to RUMPSRCS for link-local addresses 2015-12-14 06:17:05 +00:00
ozaki-r 3296ce621c Fix rump.ndp -I options by rump-ifying if_nametoindex(3)
From s-yamaguchi@IIJ
2015-09-01 09:54:34 +00:00
ozaki-r 10613e2fe6 Introduce rump.ndp
ndp(8) uses RTM that requires that getpid(2) works correctly. Unfortunately
supporting getpid(2) in librumphijack will be tricky so that we rump-ify
ndp(8) as well as arp(8).
2015-08-03 09:51:40 +00:00
christos 8ee626c9fa improve error messages (remove \n, use __func__, etc) 2015-06-16 23:04:13 +00:00
roy 0398025216 Add IPV6CTL_AUTO_LINKLOCAL and ND6_IFF_AUTO_LINKLOCAL toggles which
control the automatic creation of IPv6 link-local addresses when an
interface is brought up.

Taken from FreeBSD.
2014-06-05 16:06:49 +00:00
roy 263486c97b If IPv6 is disabled for an interface, mark all addresses as tentative.
If enabled, check for a duplicated link-local address and abort enabling
as per RFC 4862, section 5.4.5. If allowed to enable, perform DAD
on the tentative addresses.

Taken from FreeBSD.
2014-03-20 13:34:35 +00:00
martin 261edc5997 Simplify code to print the router/prefix list: use memcpy and local structs
properly aligned on the stack to decode the binary format passed by the
kernel - instead of (bogusly) assuming the format will obey all local
alignement requirements.
2013-12-17 20:26:46 +00:00
christos 94a96ec4ae use new scopeid functions 2013-10-19 17:16:25 +00:00
uwe fd21d10e53 Don't check MKINET6 - parent makefile doesn't descend to ndp if it's "no". 2013-06-21 12:50:50 +00:00
uwe 62fe4696d8 Remove this stub that hasn't been necessary in a decade or so. 2013-06-21 12:42:55 +00:00
joerg bec77c5f43 Use __dead 2011-08-31 13:32:36 +00:00
drochner 2125f0d5e4 make this work again after routing socket alignment changes 2011-06-06 16:50:46 +00:00
christos dc449ddee1 use new tcpdump. 2010-12-12 18:50:31 +00:00
dyoung 2bd83a5fc2 Update date. 2009-11-06 20:51:43 +00:00
dyoung 95d78285f1 Teach ndp(8) about override_rtadv. 2009-11-06 20:51:19 +00:00
lukem d877c4c3c0 Enable WARNS=4 by default, except for:
cpuctl  dumplfs  hprop  ipf  iprop-log  kadmin  kcm  kdc  kdigest
	kimpersonate  kstash  ktutil  makefs  ndbootd  ntp  pppd  quot
	racoon  racoonctl  rtadvd  sntp  sup  tcpdchk  tcpdmatch  tcpdump
	traceroute  traceroute6  user  veriexecgen  wsmoused  zic
(Mostly third-party applications)
2009-04-22 15:23:01 +00:00
joerg 4945fc29a8 Simplify markup by not using .Xo/.Xc. 2009-03-11 18:52:54 +00:00
tls 4147a3c54a Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry.  RedHat has
evidently built all "core system packages" with this option for some time.

This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.

This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros.  Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.

Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default.  Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
2007-05-28 12:06:17 +00:00
hubertf 889da1779b * Don't include headers twice
* Remove a few trailing whitespaces
 * Rearrange and join to one #if for some headers

Patch contributed by Slava Semushin <slava.semushin@gmail.com>
in private mail.
2007-01-16 17:32:04 +00:00
christos 9881dfaad3 c99 initializer 2006-10-22 21:24:44 +00:00
christos 01caf31f3a Cleanup KNF, WARNS=4.
Phew, this started just to make set() static so that coverity does not get
confused.
2006-05-13 20:46:15 +00:00
rpaulo 8c2379fd97 NDP-related improvements:
RFC4191
	- supports host-side router-preference

	RFC3542
	- if DAD fails on a interface, disables IPv6 operation on the
          interface
	- don't advertise MLD report before DAD finishes

	Others
	- fixes integer overflow for valid and preferred lifetimes
	- improves timer granularity for MLD, using callout-timer.
	- reflects rtadvd's IPv6 host variable information into kernel
	  (router only)
	- adds a sysctl option to enable/disable pMTUd for multicast
          packets
	- performs NUD on PPP/GRE interface by default
	- Redirect works regardless of ip6_accept_rtadv
	- removes RFC1885-related code

From the KAME project via SUZUKI Shinsuke.
Reviewed by core.
2006-03-05 23:47:08 +00:00
rpaulo 78678b130a Better support of IPv6 scoped addresses.
- most of the kernel code will not care about the actual encoding of
  scope zone IDs and won't touch "s6_addr16[1]" directly.
- similarly, most of the kernel code will not care about link-local
  scoped addresses as a special case.
- scope boundary check will be stricter.  For example, the current
  *BSD code allows a packet with src=::1 and dst=(some global IPv6
  address) to be sent outside of the node, if the application do:
    s = socket(AF_INET6);
    bind(s, "::1");
    sendto(s, some_global_IPv6_addr);
  This is clearly wrong, since ::1 is only meaningful within a single
  node, but the current implementation of the *BSD kernel cannot
  reject this attempt.
- and, while there, don't try to remove the ff02::/32 interface route
  entry in in6_ifdetach() as it's already gone.

This also includes some level of support for the standard source
address selection algorithm defined in RFC3484, which will be
completed on in the future.

From the KAME project via JINMEI Tatuya.
Approved by core@.
2006-01-21 00:15:35 +00:00
itojun e5802101b4 change description of -I to meet the current implementation. bump date 2004-10-26 06:42:14 +00:00
itojun 62eb5fae68 close(2) missing. Andrey Matveev 2004-05-24 03:51:04 +00:00
itojun 5d2c970d68 fflush(stdout) on -A. KAME-PR-584 2004-02-10 14:44:32 +00:00
itojun 71ee6e8bea typo (struct member name - has to be rtm_addrs). from fujitsu 2004-01-08 06:56:25 +00:00
agc 326b2259b7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22366, verified by myself.
2003-08-07 11:25:11 +00:00
itojun da2e0c851d err() cleanup, from openbsd-current via kame 2003-06-27 07:49:40 +00:00
itojun aa5672d8c5 sscanf overrun 2003-05-17 01:02:01 +00:00
lukem 17d72c8a6b use NETBSDSRCDIR as appropriate 2002-09-18 03:54:26 +00:00