Skip to content

Commit

Permalink
B #-: Do not use ERB with trim mode (alma8 fix) (#3250)
Browse files Browse the repository at this point in the history
  • Loading branch information
sk4zuzu authored Sep 27, 2024
1 parent 2345ff8 commit 0c6620c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/vnm_mad/remotes/lib/tproxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def self.enable_tproxy(nic, endpoints)
# Basically, we short-circuit any 169.254.16.9 communication and
# forcefully redirect every packet destined to 169.254.16.9 to be handled
# locally (regardless of the actual ARP resolution in guest VMs).
nft(ERB.new(<<~NFT, :trim_mode => '-').result(binding))
nft(ERB.new(<<~NFT).result(binding))
table bridge one_tproxy {
chain ch_<%= brdev %> {
type filter hook prerouting priority dstnat; policy accept;
Expand All @@ -122,7 +122,7 @@ def self.enable_tproxy(nic, endpoints)
# defined in nftables, that way users can manually restart tproxy on demand
# without the need for providing any command line arguments.
# All maps are managed by the driver, proxies only read their contents.
nft(ERB.new(<<~NFT, :trim_mode => '-').result(binding))
nft(ERB.new(<<~NFT).result(binding))
table ip one_tproxy {
map ep_<%= brdev %> {
type inet_service : ipv4_addr \\
Expand All @@ -132,19 +132,19 @@ def self.enable_tproxy(nic, endpoints)
flush map ip one_tproxy ep_<%= brdev %>;
<%- endpoints.each do |ep| -%>
<% endpoints.each do |ep| %>
add element ip one_tproxy ep_<%= brdev %> {
<%= ep[:service_port] %> : <%= ep[:remote_addr] %> \\
. <%= ep[:remote_port] %>
}
<%- end -%>
<% end %>
NFT
end

def self.disable_tproxy(nic, endpoints)
brdev = nic[:bridge]

nft(ERB.new(<<~NFT, :trim_mode => '-').result(binding))
nft(ERB.new(<<~NFT).result(binding))
table ip one_tproxy {
map ep_<%= brdev %> {
type inet_service : ipv4_addr \\
Expand All @@ -155,7 +155,7 @@ def self.disable_tproxy(nic, endpoints)
delete map ip one_tproxy ep_<%= brdev %>;
NFT

nft(ERB.new(<<~NFT, :trim_mode => '-').result(binding))
nft(ERB.new(<<~NFT).result(binding))
table bridge one_tproxy {
chain ch_<%= brdev %> {
type filter hook prerouting priority dstnat; policy accept;
Expand Down

0 comments on commit 0c6620c

Please sign in to comment.