Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.8: Add GSO support for TUN and WireGuard system interface #60

Merged
merged 3 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions htdocs/luci-static/resources/view/homeproxy/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,18 @@ return view.extend({
o.depends('routing_mode', 'custom');

ss = o.subsection;
so = ss.option(form.Flag, 'tun_gso', _('Generic segmentation offload'));
so.default = so.disabled;
so.depends('homeproxy.config.proxy_mode', 'redirect_tun');
so.depends('homeproxy.config.proxy_mode', 'tun');
so.rmempty = false;

so = ss.option(form.ListValue, 'tcpip_stack', _('TCP/IP stack'),
_('TCP/IP stack.'));
if (features.with_gvisor) {
so.value('mixed', _('Mixed'));
so.value('gvisor', _('gVisor'));
}
if (features.with_lwip)
so.value('lwip', _('LWIP'));
so.value('system', _('System'));
so.default = 'system';
so.depends('homeproxy.config.proxy_mode', 'redirect_tun');
Expand Down
11 changes: 11 additions & 0 deletions htdocs/luci-static/resources/view/homeproxy/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,12 @@ return view.extend({
/* Transport config end */

/* Wireguard config start */
so = ss.option(form.Flag, 'wireguard_gso', _('Generic segmentation offload'));
so.default = so.disabled;
so.depends('type', 'wireguard');
so.rmempty = false;
so.modalonly = true;

so = ss.option(form.DynamicList, 'wireguard_local_address', _('Local address'),
_('List of IP (v4 or v6) addresses prefixes to be assigned to the interface.'));
so.datatype = 'cidr';
Expand Down Expand Up @@ -1168,6 +1174,11 @@ return view.extend({
so.value('360', _('360'));
so.value('android', _('Android'));
so.value('chrome', _('Chrome'));
so.value('chrome_psk', _('Chrome PSK'));
so.value('chrome_psk_shuffle', _('Chrome PSK Shuffle'));
so.value('chrome_padding_psk_shuffle', _('Chrome Padding PSK Shuffle'));
so.value('chrome_pq', _('Chrome pq'));
so.value('chrome_pq_psk', _('Chrome pq PSK'));
so.value('edge', _('Edge'));
so.value('firefox', _('Firefox'));
so.value('ios', _('iOS'));
Expand Down
5 changes: 4 additions & 1 deletion root/etc/homeproxy/scripts/generate_client.uc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const proxy_mode = uci.get(uciconfig, ucimain, 'proxy_mode') || 'redirect_tproxy

const mixed_port = uci.get(uciconfig, uciinfra, 'mixed_port') || '5330';
let self_mark, redirect_port, tproxy_port,
tun_name, tun_addr4, tun_addr6, tun_mtu,
tun_name, tun_addr4, tun_addr6, tun_mtu, tun_gso,
tcpip_stack, endpoint_independent_nat;
if (match(proxy_mode, /redirect/)) {
self_mark = uci.get(uciconfig, 'infra', 'self_mark') || '100';
Expand All @@ -96,6 +96,7 @@ if (match(proxy_mode), /tun/) {
tun_addr4 = uci.get(uciconfig, uciinfra, 'tun_addr4') || '172.19.0.1/30';
tun_addr6 = uci.get(uciconfig, uciinfra, 'tun_addr6') || 'fdfe:dcba:9876::1/126';
tun_mtu = uci.get(uciconfig, uciinfra, 'tun_mtu') || '9000';
tun_gso = uci.get(uciconfig, uciinfra, 'tun_gso') || '0';
tcpip_stack = 'system';
if (routing_mode === 'custom') {
tcpip_stack = uci.get(uciconfig, uciroutingsetting, 'tcpip_stack') || 'system';
Expand Down Expand Up @@ -188,6 +189,7 @@ function generate_outbound(node) {
packet_encoding: node.packet_encoding,
/* WireGuard */
system_interface: (node.type === 'wireguard') || null,
gso: (node.wireguard_gso === '1') || null,
interface_name: (node.type === 'wireguard') ? 'wg-' + node['.name'] + '-out' : null,
local_address: node.wireguard_local_address,
private_key: node.wireguard_private_key,
Expand Down Expand Up @@ -480,6 +482,7 @@ if (match(proxy_mode, /tun/))
inet4_address: tun_addr4,
inet6_address: (ipv6_support === '1') ? tun_addr6 : null,
mtu: strToInt(tun_mtu),
gso: (tun_gso === '1'),
auto_route: false,
endpoint_independent_nat: strToBool(endpoint_independent_nat),
stack: tcpip_stack,
Expand Down