Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
route: Clean up ip rules with "proto unspec"
This commit adds "removeStaleProxyRulesIPvX()" which removes any ip rules with "proto unspec" to ensure upgrade/downgrade goes smoothly. Scenario 1: upgrade from v1.15-old to v1.15-tip v1.15-old cilium installs ip rules with "proto unspec", then v1.15-tip will install "duplicate" ip rules with "proto kernel". This is the moment when "removeStaleProxyRulesIPvX()" plays a role, it cleans those "proto unspec" stale rules without breaking connectivity. Scenario 2: downgrade from v1.15-tip to v1.15-old v1.15-tip has rules with "proto kernel". When v1.15-old tries to "ReplaceRule()" with "proto unspec", thanks to [this](https://github.com/cilium/cilium/blob/v1.15.3/pkg/datapath/linux/route/route_linux.go#L402), "ReplaceRule()" won't replace the rules because they already exist (with a different proto). This ensures connectivity can survive the downgrade too. Scenario 3: upgrade from v1.15-tip to v1.16 Since v1.15-tip installs correct rules with "proto kernel", v1.16 will do nothing after confirming existance by "lookupRule()". It should be painless as well. This is a v1.15-only commit because: 1. v1.14 is still using bpf/init.sh which sets rules with "proto kernel" properly; 2. v1.16 has been fixed to set "proto kernel"; 3. v1.15-tip -> v1.16 upgrade has been discussed above without any issue; Also please note that we don't have to clean up leftover ip routes with "proto unspec", because we replace them via "route.Upsert()" which replaces the old ones unconditionally, leaving no stale routes. Signed-off-by: Zhichuan Liang <gray.liang@isovalent.com>
- Loading branch information