35 Commits

Author SHA1 Message Date
Timmy Welch
fdc36b64ef Merge remote-tracking branch 'github/master' 2025-01-31 21:55:15 -08:00
Michael Stapelberg
07325dde93 netconfigd: do not hardcode 10.0.0.0/24 netmask for hairpinning
related to https://github.com/rtr7/router7/issues/53
2025-01-12 10:29:42 +01:00
Timmy Welch
ab82f05a21 Merge remote-tracking branch 'github/master' 2024-05-25 19:00:45 -07:00
Michael Stapelberg
f835cdf1d6 netconfig: do not re-create nftables ruleset from scratch
The current behavior stomps on the rules that programs like
podman or tailscale set up for port forwarding.

With this change, we split port forwardings into a separate chain,
which allows us to create the ruleset once at startup and then only
update the port forwardings specifically (the only dynamic part
of router7’s nftables ruleset).
2024-05-09 10:06:23 +02:00
Timmy Welch
bf58d46748 Merge remote-tracking branch 'github/master' 2024-01-20 11:49:11 -08:00
Timmy Welch
996061b126 Merge remote-tracking branch 'github/master' 2023-09-23 17:56:39 -07:00
Michael Stapelberg
ce66287189 netconfig: make the MTU configurable
Just in case we need to set it on an uplink0 interface at some point, for example.
2022-06-15 23:19:43 +02:00
Michael Stapelberg
7d936f4844 allow configuring extra routes
Useful for routing IPv6 subnets through a WireGuard tunnel.

related to https://github.com/rtr7/router7/issues/52
2022-06-06 14:25:25 +02:00
Michael Stapelberg
f52deeed03 allow configuring extra addresses on interfaces
Useful when you need IPv6 and IPv4 addresses on a WireGuard tunnel.
2022-06-06 14:25:25 +02:00
Michael Stapelberg
40f8eb5b1b fix wireguard availability test 2022-06-06 14:25:25 +02:00
Michael Stapelberg
593cd8c12d export input/output nftables counters as well as forwarded
Thus far, we have only had forwarded bytes metrics.

Notably, forwarded bytes does not include bytes that were sent by the router
itself, e.g. by the webserver or rsync server running on the machine.

fixes https://github.com/rtr7/router7/issues/71
2022-03-08 22:47:18 +01:00
Michael Stapelberg
8dc93c66c4 netconfig: enable NAT hairpinning for port forwardings
fixes https://github.com/rtr7/router7/issues/53
2022-03-08 09:32:09 +01:00
lordwelch
67711ee2c7 Merge branch 'master' of https://github.com/rtr7/router7 2022-03-04 13:30:38 -08:00
Michael Stapelberg
cffd872346 netconfig: implement bridge configuration
fixes https://github.com/rtr7/router7/issues/65
2021-06-06 15:43:55 +02:00
lordwelch
ef50f7c2e4 Merge remote-tracking branch 'origin/master' 2021-03-15 22:44:39 -07:00
Michael Stapelberg
876f8e320f netconfig: de-configure old DHCPv4 addresses from uplink0
It is generally not a good idea to have multiple IP addresses on the same
interface unless managing their relative priorities via metrics etc.

During an outage, I noticed that with multiple IP addresses,
Linux was using the old obsolete one to send out packets,
which does not work with the ISP.

With this change,
we still hold on to IP addresses for as long as possible,
but no longer.

fixes issue #57
2020-09-12 19:58:47 +02:00
lordwelch
2dc11ce1e3 Add additional test cases and fix some failing tests 2020-08-10 18:12:34 -07:00
Michael Stapelberg
281f876834 integration/netconfig: verify wg(8) is available
The kernel used on GitHub actions now allows creating wireguard interfaces
apparently.
2020-07-02 21:14:35 +02:00
Michael Stapelberg
9fe38edec0 netconfig_test: force an order for IP address golden output 2019-08-07 18:13:52 +02:00
Michael Stapelberg
c0067c5aa5 change diff order to -want +got
This is easier to read and consistent with how we do things at work.
2019-07-11 08:42:21 +02:00
Michael Stapelberg
414a7c025b use nft’s --numeric flag for stable output across 0.9.0 and 0.9.1
nftables 0.9.1 started printing e.g. “priority 0” as “priority filter”.
2019-07-11 08:39:08 +02:00
Michael Stapelberg
554d7fa8bf netconfig_test: fix goldens after nftables change
The nftables package started honoring the rule position (insert vs. append), and
it turns out our goldens have been wrong all along. Now the configured order
matches the golden order.
2019-07-11 08:28:33 +02:00
Michael Stapelberg
badee1eef8 netconfig_test: skip test if WireGuard is unavailable 2018-11-26 18:43:04 +01:00
Michael Stapelberg
ec4f1f4dc5 netconfig: implement WireGuard support
To set up a tunnel, create a /perm/wireguard.json as illustrated in
netconfig_test.go, and don’t forget to adjust your /perm/interfaces.json with
the address configuration for the WireGuard tunnel.

Note that static routes cannot currently be configured, so the usefulness is
limited. If you have a use-case you’d like to see covered, please explain it in
https://github.com/rtr7/router7/issues/14
2018-11-26 18:29:03 +01:00
Michael Stapelberg
b6a5227d49 netconfig_test: better diffs, refactor for clarity/brevity 2018-11-26 08:46:59 +01:00
Michael Stapelberg
127bdc466e netconfig_test: use ip -netns instead of ip netns exec ip 2018-11-26 08:32:38 +01:00
Michael Stapelberg
2e8e0daa0a implement TCP MSS clamping (for non-ethernet uplinks)
We didn’t have a need to clamp the TCP Maximum Segment Size (MSS) up until now,
because fiber7 uses an MTU of 1500.

Because Path MTU discovery is often broken on the internet, it’s best practice
to limit the Maximum Segment Size (MSS) of each TCP connection, achieving the
same effect (but only for TCP connections).

This change is beneficial when running router7 behind a non-ethernet uplink,
such as a Fritz!Box cable modem.

This has no adverse effect on fiber7: after clamping, the MSS is still 1440, as
without clamping.
2018-10-22 18:54:25 +02:00
Michael Stapelberg
f7638dfeaa netconfig_test: test updating port forwardings after installation
This uncovered an nftables issue:
695079ebff
2018-10-03 18:24:54 +02:00
Michael Stapelberg
b03596f1c5 nftables: use stateful object counters
This way, we can atomically get and reset them.

fixes https://github.com/rtr7/router7/issues/3
2018-08-08 23:15:21 +02:00
Michael Stapelberg
9e0f83a7cf integration tests: send ip netns add errors to stderr, too 2018-07-14 15:43:47 +02:00
Michael Stapelberg
b347ed74c5 update import paths 2018-07-09 08:54:04 +02:00
Michael Stapelberg
8615c40fac netconfig_test: reset DefaultCounter to catch preservation issues 2018-06-28 20:08:23 +02:00
Michael Stapelberg
ff7aa8f2cb add copyright notices 2018-06-28 20:08:23 +02:00
Michael Stapelberg
a881f6b61e cut down on test noise 2018-06-24 12:06:40 +02:00
Michael Stapelberg
5a07d6696d split integration tests into multiple packages
This makes them complete more quickly (because they are run in parallel) and
invalidates only the cache for the integration test I’m working on, not for all
of them.
2018-06-24 11:46:49 +02:00