Commit Graph

2018 Commits

Author SHA1 Message Date
ozaki-r 88620389b0 in6: don't send any IPv6 packets over a disabled interface 2023-08-03 05:45:36 +00:00
ozaki-r fc4db3454a in6: clear ND6_IFF_IFDISABLED to allow DAD again on link-up 2023-08-03 05:44:22 +00:00
ozaki-r 7dec41f044 in6: add missing rtcache_unref to in6_selectroute
By default, this issue is harmless.  However, if NET_MPSAFE
is enabled, it could eventually lead to a kernel panic.
2023-08-03 04:24:55 +00:00
kardel 619690a502 use carp mac address when replying to neighbor solicitations referring
to carp interface addresses.
unconfuses commercial routers
2023-03-29 13:01:44 +00:00
ozaki-r 10103a8a7b in6: make sure a user-specified checksum field is within a packet
From OpenBSD
2023-03-22 03:17:18 +00:00
ozaki-r 4ff5c0b228 in6: reject setting negative values but -1 via setsockopt(IPV6_CHECKSUM)
Same as OpenBSD.
2023-03-20 09:15:52 +00:00
ozaki-r 986909fbd3 ipsec: remove unnecessary splsoftnet
Because the code of IPsec itself is already MP-safe.
2023-01-27 09:33:43 +00:00
msaitoh 992eadb37c Fix typo in comment (s/mut be/msut be/). No functional change. 2022-12-22 02:52:35 +00:00
knakahara 45ca136d96 gif(4), ipsec(4) and l2tp(4) use encap_attach_addr(). 2022-12-07 08:30:15 +00:00
ozaki-r 0ead264d2f inpcb: get rid of parentheses for return value 2022-11-04 09:04:27 +00:00
ozaki-r 0fa740c7db inpcb: use in_port_t for port numbers 2022-11-04 09:03:20 +00:00
ozaki-r b000e63f05 inpcb: rename functions to in6pcb_* 2022-11-04 09:01:53 +00:00
ozaki-r 2ba9f052f6 inpcb: rename functions to inpcb_*
Inspired by rmind-smpnet patches.
2022-11-04 09:00:58 +00:00
ozaki-r 7118c214c7 Adjust dccp and sctp for struct inpcb separation 2022-10-28 05:26:29 +00:00
ozaki-r a071c82985 inpcb: separate inpcb again to reduce the size of PCB for IPv4
The data size of PCB for IPv4 increased because of the merge of
struct in6pcb.  The change decreases the size to the original size by
separating struct inpcb (again).  struct in4pcb and in6pcb that embed
struct inpcb are introduced.

Even after the separation, users don't need to realize the separation
and only have to use some macros to access dedicated data.  For example,
inp->inp_laddr is now accessed through in4p_laddr(inp).
2022-10-28 05:25:36 +00:00
ozaki-r f8c27a68f7 Adjust pf, wg, dccp and sctp for struct inpcb integration 2022-10-28 05:20:08 +00:00
ozaki-r 0e390eee90 inpcb: integrate data structures of PCB into one
Data structures of network protocol control blocks (PCBs), i.e.,
struct inpcb, in6pcb and inpcb_hdr, are not organized well.  Users of
the data structures have to handle them separately and thus the code
is cluttered and duplicated.

The commit integrates the data structures into one, struct inpcb.  As a
result, users of PCBs only have to handle just one data structure, so
the code becomes simple.

One drawback is that the data size of PCB for IPv4 increases by 40 bytes
(from 248 bytes to 288 bytes).
2022-10-28 05:18:39 +00:00
msaitoh ed81b00b71 Clear saved_flags to avoid compile error on some archs. 2022-10-24 14:15:19 +00:00
knakahara b54270a1ae Fix PR kern/57037
Be able to change the behavior sending parameter changing routing messages.
When set net.inet6.ip6.param_rt_msg=0, don't send parameter changing
routing messages.
When set net.inet6.ip6.param_rt_msg=1(default), send parameter changing
routing messages by RTM_NEWADDR.
2022-10-24 01:54:19 +00:00
ozaki-r bec975a5f9 frag6: don't use spin mutex for frag6_lock
frag6_lock is held during sending a packet (icmp6_error), so we must
not use a spin mutex because we can acquire sleep locks on sending
a packet.

Also we don't need to use spin mutex for frag6_lock anymore because
frag6_lock is now not used from hardware interrupt context.
2022-10-21 09:21:17 +00:00
ryo 0563f74f12 Avoid error of "-Wreturn-local-addr", and simplify the logic.
However, -Wreturn-local-addr is still disabled by default by GCC_NO_RETURN_LOCAL_ADDR
in bsd.own.mk because it causes errors in other parts.
2022-10-14 19:39:32 +00:00
knakahara bf4e44ab86 Remove routes on an address removal if the routes referencing to the address. Implemented by ozaki-r@n.o.
A route that has a gateway is on a connected route can be invalid if the
connected route is deleted, i.e., an associated address is removed.
Traditionally NetBSD doesn't sweep such a route on the address removal.  Sending
packets over the route fails with "No route to host".  Also the route holds an
orphan ifaddr as rt_ifa that is destructed say by in_purgeaddr.

If the same address is assgined again in such a state, there can be two
different ifaddr objects with the same address.  Until recently it's not a
big problem because we can send packets anyway.  However after MP-ification
of the network stack, we can't send packets because we strictly check if rt_ifa
(i.e., the (old) ifaddr) is valid.

This change automatically removes such routes on a removal of an associated
address to avoid keeping inconsistent routes.
2022-09-20 02:23:37 +00:00
thorpej 97fd514741 Garbage-collect everything related to struct domain::dom_ifqueues
(except dom_ifqueues itself, until the next kernel version bump).
It's no longer used now that nothing uses the legacy netisr mechanism.
2022-09-03 02:53:18 +00:00
thorpej 0c0a3f29e3 pktqueue: Re-factor sysctl handling.
Provide a new pktq_sysctl_setup() function that attaches standard
pktq sysctl nodes below a specified parent node, with either a
fixed node ID or CTL_CREATE to dynamically assign node IDs.  Make
all of the sysctl handlers private to pktqueue.c, and remove the
INET- and INET6-specific pktqueue sysctl code from net/if.c.
2022-09-02 03:50:00 +00:00
riastradh 7295f80b8b nd6: Take ifnet psref around cprng_fast in nd6_slowtimo.
This may sleep on an adpative mutex, the global entropy lock, so
pserialize is forbidden.
2022-09-01 18:32:17 +00:00
knakahara 9362ee0dbf Add sysctl entry to control to send routing message for RTM_DYNAMIC.
Some routing daemons require such routing message to keep coherency.

If we want to let kernel send such message, set net.inet.icmp.dynamic_rt_msg=1
for IPv4, net.inet6.icmp6.dynamic_rt_msg=1 for IPv6.
Default(=0) is the same as before, that is, not send such routing message.
2022-08-29 09:14:02 +00:00
knakahara fb9a6b5142 Add sysctl entry to enable/disable to use path MTU discovery for icmpv6 reflecting.
If we want to use path MTU discovery for icmp reflecting set
net.inet6.icmp6.reflect_pmtu=1.  Default(=0) is the same as before, that is,
use IPV6_MINMTU.
2022-08-22 09:25:55 +00:00
tsutsui 12c45423e9 Remove extra whitespaces added by an ancient stupid script. 2022-08-07 20:14:00 +00:00
knakahara 7bd2716d02 Remove obsoleted comments.
These comments are added with IFNET_LOCK by in_pcb.c:r1.180 and
in6_pcb.c:r1.162.  And then, IFNET_LOCK codes are removed in
in_pcb.c:r1.183 and in6_pcb.c:r1.166, however the comments have
remained.
2022-07-29 07:35:16 +00:00
knakahara b962bef537 in6p_hash isn't used, either. 2022-06-15 04:31:22 +00:00
knakahara 73a0e19f24 refactor: use TAILQ_FOREACH instead of TAILQ_FOREACH_SAFE about inpt_queue.
They don't use "ninph" pointer and don't remove elements.
2022-06-09 07:01:27 +00:00
andvar 86c307248f fix various typos, mainly in comments. 2022-05-28 10:36:21 +00:00
andvar 1daa1a7b85 fix various typos in comments, mainly immediatly/immediately/,
as well shared and recently fixed typos in OpenBSD code by Jonathan Grey.
2022-02-23 21:54:40 +00:00
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