Skip to content

Commit

Permalink
route: Specify "proto kernel" for ip routes and rules
Browse files Browse the repository at this point in the history
v1.14 installs routes and rules with specific "proto kernel", v1.15
missed them. Without "proto kernel", it causes troubles when downgrade
from v1.15 to v1.14, as v1.14 is deleting routes with "proto kernel" but
there are no matching ones.

Signed-off-by: Zhichuan Liang <gray.liang@isovalent.com>
  • Loading branch information
jschwinger233 authored and julianwiedmann committed Apr 9, 2024
1 parent 0976a1b commit 318a648
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/proxy/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var (
Mark: int(linux_defaults.MagicMarkIsToProxy),
Mask: linux_defaults.MagicMarkHostMask,
Table: linux_defaults.RouteTableToProxy,
Protocol: linux_defaults.RTProto,
}

// Default IPv4 route for local delivery.
Expand All @@ -33,7 +34,8 @@ var (
Type: route.RTN_LOCAL,
Local: net.IPv4zero,
Device: "lo",
Proto: linux_defaults.RTProto}
Proto: linux_defaults.RTProto,
}

// Default IPv6 route for local delivery.
route6 = route.Route{
Expand Down Expand Up @@ -104,6 +106,7 @@ var (
Mark: linux_defaults.MagicMarkIsProxy,
Mask: linux_defaults.MagicMarkHostMask,
Table: linux_defaults.RouteTableFromProxy,
Protocol: linux_defaults.RTProto,
}
)

Expand All @@ -124,6 +127,7 @@ func installFromProxyRoutesIPv4(ipv4 net.IP, device string) error {
Table: linux_defaults.RouteTableFromProxy,
Nexthop: &ipv4,
Device: device,
Proto: linux_defaults.RTProto,
}

if err := route.ReplaceRule(fromProxyRule); err != nil {
Expand Down Expand Up @@ -168,6 +172,7 @@ func installFromProxyRoutesIPv6(ipv6 net.IP, device string) error {
Table: linux_defaults.RouteTableFromProxy,
Nexthop: &ipv6,
Device: device,
Proto: linux_defaults.RTProto,
}

if err := route.ReplaceRuleIPv6(fromProxyRule); err != nil {
Expand Down

0 comments on commit 318a648

Please sign in to comment.