]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
wg: Add netmap support
authorMark Johnston <markj@FreeBSD.org>
Sat, 20 Apr 2024 16:01:28 +0000 (12:01 -0400)
committerMark Johnston <markj@FreeBSD.org>
Sat, 20 Apr 2024 16:04:42 +0000 (12:04 -0400)
commitbf454ca88bdf4acfa873386e876ff5e772e6a830
tree1727d236de1a631ff054d406f60fec4a5f334f14
parent278d6950943a9fec2bddb037b547c04a847c54ba
wg: Add netmap support

When in netmap (emulated) mode, wireguard interfaces prepend or strip a
dummy ethernet header when interfacing with netmap.  The netmap
application thus sees unencrypted, de-encapsulated frames with a fixed
header.

In this mode, netmap hooks the if_input and if_transmit routines of the
ifnet.  Packets from the host TX ring are handled by wg_if_input(),
which simply hands them to the netisr layer; packets which would
otherwise be tunneled are intercepted in wg_output() and placed in the
host RX ring.

The "physical" TX ring is processed by wg_transmit(), which behaves
identically to wg_output() when netmap is not enabled, and packets
appear in the "physical" RX ring by hooking wg_deliver_in().

Reviewed by: vmaffione
MFC after: 1 month
Sponsored by: Klara, Inc.
Sponsored by: Zenarmor
Differential Revision: https://reviews.freebsd.org/D43460
share/man/man4/wg.4
sys/dev/wg/if_wg.c