Commit Graph

1985 Commits

Author SHA1 Message Date
andvar 016e2181a9 s/quetion/question/ 2021-12-31 12:41:50 +00:00
msaitoh 1e4f69d0ff s/existance/existence/ in comment. 2021-12-05 04:42:54 +00:00
msaitoh 938f3e655e s/multple/multiple/ in comment. 2021-12-05 03:12:14 +00:00
christos 35c89f2941 don't opencode kauth_cred_get() 2021-09-21 14:59:14 +00:00
andvar 2e0bf311b3 fix multiplei repetitive typos in comments, messages and documentation. mainly because copy paste code big amount of files are affected. 2021-08-17 22:00:26 +00:00
ozaki-r de6f3b09a6 nd6: prevent ln from being freed while releasing held packets 2021-08-17 09:43:21 +00:00
kardel 8d545fd9de PR kern/56348
MTU discovery fails with IPv6 sockets bound to IPv4 mapped address

pick up the IPv4 route for IPv4 mapped IPv6 address to get the correct
MTU and not any unrelated/inappropriate MTU from IPv6 routes. IPv4 mapped
IPv6 addresses are always handled by the IPv4 stack and MTU discovery
is solely handled with the IPv4 routing table.
2021-08-10 06:29:56 +00:00
andvar 077d1c0f36 fix various typos in comments and log messages. 2021-08-02 12:56:22 +00:00
andvar 6f472043b4 fix typos in comments 2021-07-31 10:12:04 +00:00
yamaguchi f0101d0e08 Add a new link-aggregation pseudo interface named lagg(4)
- FreeBSD's lagg(4) based implementation
 - MP-safe and MP-scalable
2021-05-17 04:07:41 +00:00
ryo 798cc6a0c1 flowlabel will never return anything other than 1 or 0.
s/&&/&/
2021-03-11 11:10:22 +00:00
christos 23448aee49 byte-flipping a random number is not very useful. 2021-03-10 22:28:26 +00:00
christos 0b3745dbe8 no need for ip6_id.c... 2021-03-08 18:22:16 +00:00
christos ee87d87fd0 Amend missed messages:
netinet6: Pick IPv6 fragment ids uniformly at random.

Expected number of packets before collision is ~2^16, about the same
as we get for IPv4 with alternating disjoint random cycles.  Keep it
simple unless we determine we really need something much better for
IPv6 than what IPv4 can achieve anyway.

netinet6: Rip out now-unused IPv6 fragment id logic.

(from riastradh)
2021-03-07 15:03:32 +00:00
christos 4b58b6c56b netinet/netinet6: Add necessary includes to make these standalone.
(from riastradh)
2021-03-07 15:01:00 +00:00
christos 4b9f0c0a91 netinet6: Mark randomid unused.
Will make merging and bisection easier if anything goes wrong with
flow label or fragment id randomization changes.

(from riastradh)
2021-03-07 14:59:36 +00:00
christos 2143da8717 - Make ALIGNED_POINTER use __alignof(t) instead of sizeof(t). This is more
correct because it works with non-primitive types and provides the ABI
  alignment for the type the compiler will use.
- Remove all the *_HDR_ALIGNMENT macros and asserts
- Replace POINTER_ALIGNED_P with ACCESSIBLE_POINTER which is identical to
  ALIGNED_POINTER, but returns that the pointer is always aligned if the
  CPU supports unaligned accesses.
[ as proposed in tech-kern ]
2021-02-19 14:51:59 +00:00
christos fc0eb449a4 - pass the alignment instead of the mask (as Roy asked and to match the
other macro)
- use alignof to determine that alignment and CTASSERT what we expect
- remove unused macros
2021-02-17 22:32:04 +00:00
martin 50cbb763c2 Fix the build.
Maybe there should be a ICMP6_HDR_ALIGNMENT, but for now there is
only IP6_HDR_ALIGNMENT.
2021-02-15 10:13:45 +00:00
christos 9183889817 - centralize header align and pullup into a single inline function
- use a single macro to align pointers and expose the alignment, instead
  of hard-coding 3 in 1/2 the macros.
- fix an issue in the ipv6 lt2p where it was aligning for ipv4 and pulling
  for ipv6.
2021-02-14 20:58:34 +00:00
nia f421410cbc Add more guards against NULL deref, since KUBSAN still complains. 2020-12-28 20:19:50 +00:00
nia 72eb3e2596 Avoid NULL pointer dereference, noticed by KUBSAN.
"Looks fine" roy@
2020-12-26 10:43:39 +00:00
roy 76faeff505 inet: Treat LINK_STATE_UNKNOWN as LINK_STATE_UP when changing
It's something we have always done.
it's really rare for anything to transition to UNKNOWN from either
UP or DOWN, but technically it is possible.
2020-09-29 19:33:36 +00:00
roy e53a363e2b Implement RFC 7048, making Neighbor Unreachability Detection less impatient
RFC 7048 Section 3 says in the UNREACHABLE state packets continue to be
sent to the link-layer address and then backoff exponentially.
We adjust this slightly and move to the INCOMPLETE state after
`nd_mmaxtries` probes and then start backing off.

This results in simpler code whilst providing a more robust model which
doubles the time to failure over what we did before.
We don't want to be back to the old ARP model where no unreachability
errors are returned because very few applications would look at
unreachability hints provided such as ND_LLINFO_UNREACHABLE or RTM_MISS.
2020-09-15 10:05:36 +00:00
roy 20c15691a3 nd: Name l3addr union of llentry and use in-place of nd_addr.
Probably makes more sense and makes nd.h less messy.
2020-09-14 15:09:57 +00:00
roy f456857b39 inet6: Use generic Neighor Detection rather than IPv6 specific
No functional change intended.
2020-09-11 15:03:33 +00:00
christos e5e40d965d Add IP_BINDANY, IPV6_BINDANY which can be used to bind to any address in
order to implement transparent proxies.
2020-09-08 14:12:57 +00:00
ozaki-r 9e214c7fd5 inet6: reduce silent packet discards 2020-08-28 06:32:24 +00:00
ozaki-r 4c639cc739 inet6: pass rcvif to ip6_forward to avoid extra psref_acquire 2020-08-28 06:28:58 +00:00
ozaki-r b494441ddd ipsec: rename ipsec_ip_input to ipsec_ip_input_checkpolicy
Because it just checks if a packet passes security policies.
2020-08-28 06:20:44 +00:00
ozaki-r c1e00d7df1 inet, inet6: count packets dropped by IPsec
The counters count packets dropped due to security policy checks.
2020-08-28 06:19:13 +00:00
riastradh a14187eca5 [ozaki-r] Changes to the kernel core for wireguard 2020-08-20 21:21:31 +00:00
roy 5fbf94c10a Sprinkle some const 2020-08-20 11:01:02 +00:00
roy 8314c396ba icmp6: Remove __packed attribute from icmp6 structures
They should naturally align.
Add compile time assertations to icmp6.c to prove this.
2020-07-27 14:52:55 +00:00
roy 6ef1c3277f ip6: Remove __packed attribute from ip6 structures
They should naturally align.
Add compile time assertations to ip6_input.c to prove this.
2020-07-27 14:06:58 +00:00
maxv 0551fa110c localify 2020-06-19 16:08:06 +00:00
maxv 3ec4b526b7 remove unused 2020-06-16 17:12:18 +00:00
roy 7fc6ab04d3 inet6: Allow addresses to be marked AUTOCONF from userland 2020-06-14 14:26:17 +00:00
mlelstv 6e32809d5a COMPAT_90 doesn't necessarily imply COMPAT_50. So include compat in6_var.h in
either case.

Fixes evbarm build that starts with COMPAT_60.
2020-06-13 06:05:08 +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 ba3b1f720c inet6: Ensure that route MTU is guarded by ARC_PHDS_MAXMTU
This mirrors the ARP behavior for ARCnet interfaces based on current
kernel RA handling.
2020-04-28 15:12:28 +00:00
rjs 1456480451 Call IPv4 handler for accept(). 2020-04-27 19:33:48 +00:00
rjs 7cd04caf48 Do sctp_connectx() handling using ioctl() for IPv6 as well. 2020-04-27 19:21:43 +00:00
jakllsch f39ac10042 Fill in .pr_usrreqs for SOCK_SEQPACKET and SOCK_STREAM variants of SCTP too.
This should allow these socket types of SCTP to operate on IPv6 family
sockets, as .pr_usrreqs must not be NULL for socreate() to succeed.
2020-04-24 17:36:55 +00:00
roy f28587cefa inet6: nd6_na_input() now considers ln_state <= ND6_LLINFO_INCOMPLETE
Otherwise if ln_state != ND6_LLINFO_INCOMPLETE and the is no lladdr
and this message was solicited then ln_state is set to ND6_LLINFO_REACHABLE
which could then cause a panic in nd6_resolve().
If ln_state > ND6_LLINFO_INCOMPLETE then it's assumed we have a lladdr.

Potentially this could have been triggered by the introduction of
ND6_LLINFO_PURGE in nd6.c r1.143 but also by the re-introduction of
ND6_LLINFO_INCOMPLETE in nd6.c r1.263.
Depending on the timing, it's technically possible to receive such
a message after the llentry is created with ND6_LLINFO_NOSTATE.
2020-04-22 19:32:11 +00:00
kim c729dd4278 Fix default route selection
The primary issue was that in revision 1.79 a check was added in the
nd6_defrouter_select() search loop to ignore the entry if RA processing
is enabled on its interface.  In practice this results in all entries
being ignored.

This fix reverses the condition, so that an entry is ignored when RA
processing is NOT enabled on its interface.  Further, the entry is
only ignored for being selected as the default router.  The currently
installed router must be identified regardless of the (current) status
of its interface, so that we can delete the route before installing a
new one.

I also added error logging when adding or deleting a route fails. This
should help the administrator (or kernel developer) in noticing possible
problems.

Finally, if deleting a route fails, the corresponding default route
entry no longer has its "installed" flag cleared, so that deletion will
be retried.  At a minimum, this will cause repeated messages about the
failed deletion as opposed to only getting repeated messages about the
installation of a new default route failing.

Fixes PR kern/55091 and also PR bin/54997 as far as the behaviour
observed with ndp(8).
2020-04-13 14:04:27 +00:00
roy 6530896d01 nd6: RTM_MISS reports RTA_AUTHOR once more
Just moves the logic to send RTM_MISS after the ICMP6 report as we
rely on that function to extract the requesting address.

Fixes PR kern/55164.
2020-04-12 12:13:52 +00:00
christos 54af335eb8 PR/55030: Avoid locking against myself panic by moving the icmp error outside
the lock. Thanks ozaki-r!
2020-04-03 14:04:27 +00:00
roy 5ff17943ef route: RTM_MISS now puts the message source address in RTA_AUTHOR
route(8) also reports this.
A userland app could use this to blacklist nodes who probe for machines
that doesn't exist on a subnet / prefix.
2020-03-09 21:20:55 +00:00
thorpej b331a82b58 Adopt <net/if_stats.h>. 2020-01-29 04:37:24 +00:00