#!/bin/sh
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :

# shellcheck disable=SC1091
. /lib/functions.sh

multipath=
multipath_status=0
config_load network
config_get multipath globals multipath
[ "$multipath" = "enable" ] && multipath_status=1

# Global MPTCP configuration
sysctl -qw net.mptcp.enabled="$multipath_status"
ip mptcp endpoint flush
[ "$multipath_status" = "0" ] && {
	ip mptcp limits set add_addr_accepted 0 subflows 0
	exit 0
}

# Set mptcp limits to max
ip mptcp limits set add_addr_accepted 8 subflows 8