diff --git a/Makefile b/Makefile index d651881cf3..cb97c8b82d 100644 --- a/Makefile +++ b/Makefile @@ -250,3 +250,74 @@ enable-bbr: echo "BBR is already enabled."; \ fi .PHONY: enable-bbr +<<<<<<< HEAD +======= + +## disable-bbr: Disable BBR congestion control algorithm and revert to default. +disable-bbr: + @echo "Disabling BBR and reverting to default congestion control algorithm..." + @if [ "$$(sysctl net.ipv4.tcp_congestion_control | awk '{print $$3}')" = "bbr" ]; then \ + echo "BBR is currently enabled. Reverting to Cubic..."; \ + sudo sed -i '/^net.core.default_qdisc=fq/d' /etc/sysctl.conf; \ + sudo sed -i '/^net.ipv4.tcp_congestion_control=bbr/d' /etc/sysctl.conf; \ + sudo modprobe -r tcp_bbr; \ + echo "net.ipv4.tcp_congestion_control=cubic" | sudo tee -a /etc/sysctl.conf; \ + sudo sysctl -p; \ + echo "BBR has been disabled, and Cubic is now the default congestion control algorithm."; \ + else \ + echo "BBR is not enabled. No changes made."; \ + fi +.PHONY: disable-bbr + +## enable-mptcp: Enable mptcp over multiple ports (not interfaces). Only works on Linux Kernel 5.6 and above. +enable-mptcp: + @echo "Configuring system to use mptcp..." + @sudo sysctl -w net.mptcp.enabled=1 + @sudo sysctl -w net.mptcp.mptcp_path_manager=ndiffports + @sudo sysctl -w net.mptcp.mptcp_ndiffports=16 + @echo "Making MPTCP settings persistent across reboots..." + @echo "net.mptcp.enabled=1" | sudo tee -a /etc/sysctl.conf + @echo "net.mptcp.mptcp_path_manager=ndiffports" | sudo tee -a /etc/sysctl.conf + @echo "net.mptcp.mptcp_ndiffports=16" | sudo tee -a /etc/sysctl.conf + @echo "MPTCP configuration complete and persistent!" + +.PHONY: enable-mptcp + +## disable-mptcp: Disables mptcp over multiple ports. Only works on Linux Kernel 5.6 and above. +disable-mptcp: + @echo "Disabling MPTCP..." + @sudo sysctl -w net.mptcp.enabled=0 + @sudo sysctl -w net.mptcp.mptcp_path_manager=default + @echo "Removing MPTCP settings from /etc/sysctl.conf..." + @sudo sed -i '/net.mptcp.enabled=1/d' /etc/sysctl.conf + @sudo sed -i '/net.mptcp.mptcp_path_manager=ndiffports/d' /etc/sysctl.conf + @sudo sed -i '/net.mptcp.mptcp_ndiffports=16/d' /etc/sysctl.conf + @echo "MPTCP configuration reverted!" + +.PHONY: disable-mptcp + +CONFIG_FILE ?= ${HOME}/.celestia-app/config/config.toml +SEND_RECV_RATE ?= 10485760 # 10 MiB + +configure-v3: + @echo "Using config file at: $(CONFIG_FILE)" + @if [ "$$(uname)" = "Darwin" ]; then \ + sed -i '' "s/^recv_rate = .*/recv_rate = $(SEND_RECV_RATE)/" $(CONFIG_FILE); \ + sed -i '' "s/^send_rate = .*/send_rate = $(SEND_RECV_RATE)/" $(CONFIG_FILE); \ + sed -i '' "s/ttl-num-blocks = .*/ttl-num-blocks = 12/" $(CONFIG_FILE); \ + else \ + sed -i "s/^recv_rate = .*/recv_rate = $(SEND_RECV_RATE)/" $(CONFIG_FILE); \ + sed -i "s/^send_rate = .*/send_rate = $(SEND_RECV_RATE)/" $(CONFIG_FILE); \ + sed -i "s/ttl-num-blocks = .*/ttl-num-blocks = 12/" $(CONFIG_FILE); \ + fi + +.PHONY: configure-v3 + + +## debug-version: Print the git tag and version. +debug-version: + @echo "GIT_TAG: $(GIT_TAG)" + @echo "VERSION: $(VERSION)" +.PHONY: debug-version + +>>>>>>> e90d616f (feat: script to disable bbr (#4047)) diff --git a/go.mod b/go.mod index dda7f6cb29..2b65e585d1 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.23.1 require ( cosmossdk.io/errors v1.0.1 - cosmossdk.io/math v1.3.0 + cosmossdk.io/math v1.4.0 github.com/celestiaorg/blobstream-contracts/v3 v3.1.0 github.com/celestiaorg/go-square v1.1.0 github.com/celestiaorg/go-square/merkle v0.0.0-20240117232118-fd78256df076 diff --git a/go.sum b/go.sum index a8ddad33fc..23d93e2fca 100644 --- a/go.sum +++ b/go.sum @@ -188,8 +188,8 @@ cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoIS collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= -cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= +cosmossdk.io/math v1.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ= +cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=