From 9e62a84a5f2e66bcd636a4fc6fc0bd14d921aa7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Martins?= Date: Fri, 31 Mar 2023 15:49:50 +0200 Subject: [PATCH] Revert "init.sh: take local lookup rule priority as an argument" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit e370f6e87f2d652d723bc2163efffecffed6b7e2. Signed-off-by: André Martins --- bpf/init.sh | 11 +++++------ pkg/datapath/loader/base.go | 2 -- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/bpf/init.sh b/bpf/init.sh index a9f2d50520227..dab18d5f26819 100755 --- a/bpf/init.sh +++ b/bpf/init.sh @@ -29,7 +29,6 @@ ENDPOINT_ROUTES=${22} PROXY_RULE=${23} FILTER_PRIO=${24} DEFAULT_RTPROTO=${25} -LOCAL_RULE_PRIO=${26} ID_HOST=1 ID_WORLD=2 @@ -76,13 +75,13 @@ function move_local_rules_af() return fi - # move the local table lookup rule from pref 0 to pref LOCAL_RULE_PRIO so we - # can insert the cilium ip rules before the local table. It is strictly + # move the local table lookup rule from pref 0 to pref 100 so we can + # insert the cilium ip rules before the local table. It is strictly # required to add the new local rule before deleting the old one as # otherwise local addresses will not be reachable for a short period of # time. - $IP rule list | grep "${LOCAL_RULE_PRIO}" | grep "lookup local" || { - $IP rule add from all lookup local pref ${LOCAL_RULE_PRIO} proto $DEFAULT_RTPROTO + $IP rule list | grep 100 | grep "lookup local" || { + $IP rule add from all lookup local pref 100 proto $DEFAULT_RTPROTO } $IP rule del from all lookup local pref 0 2> /dev/null || true @@ -90,7 +89,7 @@ function move_local_rules_af() # it otherwise if [ "$($IP rule list | grep "lookup local" | wc -l)" -eq "0" ]; then $IP rule add from all lookup local pref 0 proto $DEFAULT_RTPROTO - $IP rule del from all lookup local pref ${LOCAL_RULE_PRIO} + $IP rule del from all lookup local pref 100 echo "Error: The kernel does not support moving the local table routing rule" echo "Local routing rules:" $IP rule list lookup local diff --git a/pkg/datapath/loader/base.go b/pkg/datapath/loader/base.go index 817074324fb51..1e9e028965888 100644 --- a/pkg/datapath/loader/base.go +++ b/pkg/datapath/loader/base.go @@ -62,7 +62,6 @@ const ( initArgProxyRule initTCFilterPriority initDefaultRTProto - initLocalRulePriority initArgMax ) @@ -406,7 +405,6 @@ func (l *Loader) Reinitialize(ctx context.Context, o datapath.BaseProgramOwner, args[initTCFilterPriority] = strconv.Itoa(int(option.Config.TCFilterPriority)) args[initDefaultRTProto] = strconv.Itoa(linux_defaults.RTProto) - args[initLocalRulePriority] = strconv.Itoa(linux_defaults.RulePriorityLocalLookup) // "Legacy" datapath inizialization with the init.sh script // TODO(mrostecki): Rewrite the whole init.sh in Go, step by step.