Skip to content

Commit

Permalink
Revert "init.sh: take local lookup rule priority as an argument"
Browse files Browse the repository at this point in the history
This reverts commit e370f6e.

Signed-off-by: André Martins <[email protected]>
  • Loading branch information
aanm committed Apr 1, 2023
1 parent 63c2e2a commit 9e62a84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 5 additions & 6 deletions bpf/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -76,21 +75,21 @@ 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

# check if the move of the local table move was successful and restore
# 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
Expand Down
2 changes: 0 additions & 2 deletions pkg/datapath/loader/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ const (
initArgProxyRule
initTCFilterPriority
initDefaultRTProto
initLocalRulePriority
initArgMax
)

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 9e62a84

Please sign in to comment.