You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/wgengine
Dmytro Shynkevych 33b2f30cea
wgengine: wrap tun.Device to support filtering and packet injection (#358)
Right now, filtering and packet injection in wgengine depend
on a patch to wireguard-go that probably isn't suitable for upstreaming.

This need not be the case: wireguard-go/tun.Device is an interface.
For example, faketun.go implements it to mock a TUN device for testing.

This patch implements the same interface to provide filtering
and packet injection at the tunnel device level,
at which point the wireguard-go patch should no longer be necessary.

This patch has the following performance impact on i7-7500U @ 2.70GHz,
tested in the following namespace configuration:
┌────────────────┐    ┌─────────────────────────────────┐     ┌────────────────┐
│      $ns1      │    │               $ns0              │     │      $ns2      │
│    client0     │    │      tailcontrol, logcatcher    │     │     client1    │
│  ┌─────┐       │    │  ┌──────┐         ┌──────┐      │     │  ┌─────┐       │
│  │vethc│───────┼────┼──│vethrc│         │vethrs│──────┼─────┼──│veths│       │
│  ├─────┴─────┐ │    │  ├──────┴────┐    ├──────┴────┐ │     │  ├─────┴─────┐ │
│  │10.0.0.2/24│ │    │  │10.0.0.1/24│    │10.0.1.1/24│ │     │  │10.0.1.2/24│ │
│  └───────────┘ │    │  └───────────┘    └───────────┘ │     │  └───────────┘ │
└────────────────┘    └─────────────────────────────────┘     └────────────────┘
Before:
---------------------------------------------------
| TCP send               | UDP send               |
|------------------------|------------------------|
| 557.0 (±8.5) Mbits/sec | 3.03 (±0.02) Gbits/sec |
---------------------------------------------------
After:
---------------------------------------------------
| TCP send               | UDP send               |
|------------------------|------------------------|
| 544.8 (±1.6) Mbits/sec | 3.13 (±0.02) Gbits/sec |
---------------------------------------------------
The impact on receive performance is similar.

Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
4 years ago
..
filter ipn, wgengine/filter: remove exported type aliases 4 years ago
magicsock wgengine: wrap tun.Device to support filtering and packet injection (#358) 4 years ago
monitor wgengine/monitor: disable monitor on Android 4 years ago
packet wgengine/filter: support subnet mask rules, not just /32 IPs. 4 years ago
router wgengine/router: rename config.Settings to config.Config, make pointer. 4 years ago
tstun wgengine: wrap tun.Device to support filtering and packet injection (#358) 4 years ago
winnet Move Linux client & common packages into a public repo. 4 years ago
rusage.go Move "logger" package to under types, now that we have it. 4 years ago
rusage_nowindows.go wgengine: flesh out some docs 4 years ago
rusage_windows.go Move Linux client & common packages into a public repo. 4 years ago
userspace.go wgengine: wrap tun.Device to support filtering and packet injection (#358) 4 years ago
watchdog.go wgengine/router: rename config.Settings to config.Config, make pointer. 4 years ago
watchdog_test.go wgengine: wrap tun.Device to support filtering and packet injection (#358) 4 years ago
wgengine.go wgengine/router: rename config.Settings to config.Config, make pointer. 4 years ago