Commit Graph

400 Commits

Author SHA1 Message Date
lukem a9a927dd92 adapt to ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}
Simplify CWARNFLAGS to use ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}
which works for both clang and gcc, and remove compiler-specific
equivalents.
2023-06-03 21:26:27 +00:00
lukem c4b7a9e794 bsd.own.mk: rename GCC_NO_* to CC_WNO_*
Rename compiler-warning-disable variables from
	GCC_NO_warning
to
	CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 09:09:01 +00:00
lukem f937c412f3 bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBER
Provide a single variable
	CC_WNO_ADDRESS_OF_PACKED_MEMBER
with options for both clang and gcc, to replace
	CLANG_NO_ADDR_OF_PACKED_MEMBER
	CC_NO_ADDR_OF_PACKED_MEMBER
	GCC_NO_ADDR_OF_PACKED_MEMBER

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 08:52:53 +00:00
ozaki-r 3761620b42 tcp: separate syn cache stuffs into tcp_syncache.[ch] files
No functional change.
2022-09-20 07:19:14 +00:00
thorpej 63f0d21cf2 Machete-waving to fix mpls rump build after pktqueue changes. 2022-09-03 20:29:30 +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 6ffff4f242 Garbage-collect the remaining vestiges of netisr. 2022-09-03 02:47:59 +00:00
thorpej dd8687cce0 Convert MPLS from a legacy netisr to pktqueue. 2022-09-03 02:24:59 +00:00
thorpej ca257ba439 Convert CAN from a legacy netisr to pktqueue. 2022-09-03 02:07:32 +00:00
thorpej 63ae4dd2e0 Convert ARP from a legacy netisr to pktqueue. 2022-09-03 01:35:03 +00:00
riastradh 36c7c52a4c if_shmem(4): Use membar_acquire/release for lock acquire/release. 2022-04-09 23:45:02 +00:00
ozaki-r 58bf21983f Rump-ify ALTQ (librumpnet_altq.so) 2021-07-14 03:19:23 +00:00
ozaki-r f62bf30a39 shmif: support ALTQ 2021-07-14 03:16:06 +00:00
riastradh 076e35792d if_attach and if_initialize cannot fail, don't test return value
These were originally made failable back in 2017 when if_initialize
allocated a softint in every interface for link state changes, so
that it could fail gracefully instead of panicking:

https://mail-index.NetBSD.org/source-changes/2017/10/23/msg089053.html

However, this spawned many seldom- or never-tested error branches,
which are risky to have around.  And that softint in every interface
has since been replaced by a single global workqueue, because link
state changes require thread context but not low latency or high
throughput:

https://mail-index.NetBSD.org/source-changes/2020/02/06/msg113759.html

So there is no longer any reason for if_initialize to fail.  (The
subroutine if_stats_init can't fail because percpu_alloc can't fail
either.)

There is a snag: the softint_establish in if_percpuq_create could
fail, potentially leading to bad consequences later on trying to use
the softint.  This change doesn't introduce any new bugs because of
the snag -- if_percpuq_attach was already broken.  However, the snag
can be better addressed without spawning error branches, either by
using a single softint or making softints less scarce.

(Separate commit will change the signatures of if_attach and
if_initialize to return void, scheduled to ride whatever is the next
convenient kernel bump.)

Patch and testing on amd64 and evbmips64-eb by maya@; commit message
soliloquy, and compile-testing on evbppc/i386/earmv7hf, by me.
2021-06-16 00:21:17 +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
yamaguchi 34534503ff enabled PPPOE_DEBUG for librumpnet_pppoe* when RUMP_DEBUG is defined 2021-04-23 03:44:05 +00:00
mrg 7e5e03e2b7 new GCC_NO_* uses for warning issues. most of the users of the new
GCC_NO_RETURN_LOCAL_ADDR are bugs in GCC itself, not the code.
2021-04-12 06:08:30 +00:00
christos 447d94bacb remove ip{,6}_id.c 2021-03-08 20:43:22 +00:00
roy 6c00c3be34 rumpify vether(4) 2020-09-29 18:33:22 +00:00
roy 5f960c42fc libtap: Improve comment 2020-09-29 18:31:31 +00:00
roy 58e262a6e6 rump: Add nd.c to libnet 2020-09-12 10:44:32 +00:00
mrg cb93b81028 add support for new GCC 9 warnings that may be too much to fix
right now.  new address-of-packed-member and format-overflow
warnings have new GCC_NO_ADDR_OF_PACKED_MEMBER amd
GCC_NO_FORMAT_OVERFLOW variables to remove these warnings.

apply to a bunch of the tree.  mostly, these are real bugs that
should be fixed, but in many cases, only by removing the 'packed'
attribute from some structure that doesn't really need it.  (i
looked at many different ones, and while perhaps 60-80% were
already properly aligned, it wasn't clear to me that the uses
were always coming from sane data vs network alignment, so it
doesn't seem safe to remove packed without careful research for
each affect struct.)  clang already warned (and was not erroring)
for many of these cases, but gcc picked up dozens more.
2020-09-06 07:20:26 +00:00
riastradh e88ecca629 Fix order of cleanup actions in rumpuser_wg_create error branch. 2020-08-27 02:51:15 +00:00
riastradh efb788bb64 Paranoia: use strlcpy rather than strcpy here and detect truncation.
Not an issue for the one caller in tree, but let's not leave rakes to
step on.
2020-08-27 02:50:44 +00:00
riastradh 25154f5f0c Clarify wg(4)'s relation to WireGuard, pending further discussion.
Still planning to replace wgconfig(8) and wg-keygen(8) by one wg(8)
tool compatible with wireguard-tools; update wg(4) for the minor
changes from the 2018-06-30 spec to the 2020-06-01 spec; &c.  This just
clarifies the current state of affairs as it exists in the development
tree for now.

Mark the man page EXPERIMENTAL for extra clarity.
2020-08-26 16:03:40 +00:00
riastradh 61fd7d67f5 [ozaki-r] Add wg files 2020-08-20 21:28:00 +00:00
pgoyette 95e145a85a Remove spurious call to canloopinit() in an attempt to fix kern/55489
This attempt at fixing is a result of IRC discussions with martin@ and
riastradh@
2020-07-21 18:38:18 +00:00
christos 82ca9ad99d make constant unsigned 2020-04-03 13:57:48 +00:00
ozaki-r 82bf8980a0 shmif: reduce the number of calls of cprng(9) 2020-02-25 03:26:18 +00:00
ozaki-r 056381ce4e shmif: s/sc_uuid/sc_uid/
It's not UUID :-/
2020-02-25 03:25:36 +00:00
ozaki-r 01d5ee543c shmif: use cprng_strong64 instead of cprng_fast64 to generate a unique ID
shmif uses random bytes generated by cprng(9) as a unique device ID
between rump kernels to identify packets fed by itself and not receive
them.  So if generated bytes are identical between shmif interfaces on
different rump kernels, shmif may drop incoming packets unintentionally.
This is one cause of recent ATF test failures of IPsec.

Fix it by using cprng_strong64 instead of cprng_fast64.  This is a
workaround and we should also investigate why cprng_fast64 starts
failing on rump kernels, although using cprng_strong64 in initialization
itself is feasible.

Fix PR kern/54897
2020-02-25 03:24:48 +00:00
ozaki-r e90f6c59d3 shmif: use cprng_strong32 to generate random bytes for a MAC address
cprng_fast32 sometimes returns indentical bytes, which look
"20:0e:11:33" in a MAC address, on different rump_server instances.
That leads MAC address duplications resulting in a test failure.

Fix it by using cprng_strong32 instead of cprng_fast32.  However
we should rather fix cprng_fast32 (or rump itself) somehow.

The fix mitigates PR kern/54897 but test failures due to other
causes still remain.
2020-02-20 08:06:15 +00:00
thorpej c85e2f36e5 Adopt <net/if_stats.h>. 2020-02-01 22:38:31 +00:00
thorpej a4525ace5e Add if_stats.c to rumpnet. 2020-01-29 06:13:02 +00:00
mrg de11d87641 introduce some common variables for use in GCC warning disables:
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
2019-10-13 07:28:04 +00:00
rmind dadc88e3b0 NPF improvements:
- Add support for dynamic NETMAP algorithm (stateful net-to-net).
- Add most of the support for the dynamic NAT rules; a little bit more
  userland work is needed to finish this up and enable.
- Replace 'stateful-ends' with more permissive 'stateful-all'.
- Add various tunable parameters and document them, see npf-params(7).
- Reduce the memory usage of the connection state table (conndb).
- Portmap rewrite: use memory more efficiently, handle addresses dynamically.
- Bug fix: add splsoftnet()/splx() around the thmap writers and comment.
- npftest: clean up and simplify; fix some memleaks to make ASAN happy.
2019-07-23 00:52:01 +00:00
kamil 2244e8ee17 Fix CVS Id usage 2019-04-11 14:38:05 +00:00
bad e0888b5db5 Protect __KERNEL_RCSID. It isn't available when compile rumpkernels under e.g. Linux. 2019-03-26 08:56:17 +00:00
pgoyette d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
rin f7201ab71a Add TX/RX offload capabilities to shmif(4). They are emulated in
software by ether_sw_offload_[tr]x().

For rump kernels, if_capabilities for shmemif(4) can be specified
by environmental variable RUMP_SHMIF_CAPENABLE:

 setenv RUMP_SHMIF_CAPENABLE 0x7ff80 (all offload)
 setenv RUMP_SHMIF_CAPENABLE 0x6aa80 (all TX)
 setenv RUMP_SHMIF_CAPENABLE 0x15500 (all RX)

part of PR kern/53562
OK msaitoh
2018-12-12 01:51:32 +00:00
rin 1cfdd1e3e5 PR kern/53562
Add ether_sw_offload_[tr]x: handle TX/RX offload options in software.
Since this violates separation b/w L2 and L3/L4, new files are added
rather than having the routines in sys/net/if_ethersubr.c.

OK msaitoh thorpej
2018-12-12 01:40:20 +00:00
alnsn a57097d054 Add missing RCSIDs. 2018-12-12 00:48:43 +00:00
christos 28e6c3de1b Back to using _NPF_TESTING now that it does not change the semantics of
the calls, but only adds extra functionality.
2018-10-29 15:37:45 +00:00
christos 544d488603 add an _NPF_RUMP define to expose the sampling function. 2018-10-26 23:34:32 +00:00
kre 7cb54cbbde Revert previous (unbreak build) - for now anyway.
It turns out _NPF_TESTING is needed for the (rump only) function
npf_state_setsampler() in sys/net/npf/npf_state.c
2018-10-26 06:23:02 +00:00
christos b6b4afa4da Comment out _NPF_TESTING (really should be removed) 2018-10-26 01:33:33 +00:00
christos 897d94d29b need libnvpair 2018-10-26 00:38:52 +00:00
rmind 39013e66c1 NPF: Major rework -- migrate NPF to the libnv library.
- This conversion significantly simplifies the code and moves NPF to
  a binary serialisation format (replacing the XML-like format).
- Fix some memory/reference leaks and possibly use-after-free bugs.
- Bump NPF_VERSION as this change makes libnpf incompatible with the
  previous versions.  Also, different serialisation format means NPF
  connection/config saving and loading is not compatible with the
  previous versions either.

Thanks to christos@ for extra testing.
2018-09-29 14:41:35 +00:00
ozaki-r 1350b04367 Fix net.inet6.ip6.ifq node doesn't exist
The node (and child nodes) is initialized in sysctl_net_pktq_setup, but the call
of sysctl_net_pktq_setup is skipped unexpectedly.

sysctl_net_pktq_setup is skipped if in6_present is false that indicates the
netinet6 component isn't loaded on rump kernels.  However the flag is
accidentally always false because the flag is turned on in in6_dom_init that is
called after if_sysctl_setup on both normal and rump kernels.

Fix the issue by moving if_sysctl_setup after in6_dom_init (domaininit on normal
kernels).  This fix is ad-hoc but good enough for netbsd-8.  We should refine
the initialization order of network components in the future.

Pointed out by hikaru@
2018-07-03 03:37:03 +00:00
msaitoh 3cd62456f9 Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

 This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
2018-06-26 06:47:57 +00:00