Skip to content

Commit

Permalink
libnetwork/iptables: deprecate Passthrough
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d688389)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Dec 17, 2024
1 parent b51622d commit eda0a20
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion libnetwork/iptables/firewalld.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,15 @@ func checkRunning() bool {
return err == nil
}

// Passthrough method simply passes args through to iptables/ip6tables
// Passthrough method simply passes args through to iptables/ip6tables.
//
// Deprecated: this function is only used internally and will be removed in the next release.
func Passthrough(ipv IPVersion, args ...string) ([]byte, error) {
return passthrough(ipv, args...)
}

// passthrough method simply passes args through to iptables/ip6tables
func passthrough(ipv IPVersion, args ...string) ([]byte, error) {
var output string
log.G(context.TODO()).Debugf("Firewalld passthrough: %s, %s", ipv, args)
if err := connection.sysObj.Call(dbusInterface+".direct.passthrough", 0, ipv, args).Store(&output); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion libnetwork/iptables/firewalld_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func TestPassthrough(t *testing.T) {
"-j", "ACCEPT",
}

_, err := Passthrough(IPv4, append([]string{"-A"}, rule1...)...)
_, err := passthrough(IPv4, append([]string{"-A"}, rule1...)...)
if err != nil {
t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion libnetwork/iptables/iptables.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ func filterOutput(start time.Time, output []byte, args ...string) []byte {
func (iptable IPTable) Raw(args ...string) ([]byte, error) {
if firewalldRunning {
startTime := time.Now()
output, err := Passthrough(iptable.ipVersion, args...)
output, err := passthrough(iptable.ipVersion, args...)
if err == nil || !strings.Contains(err.Error(), "was not provided by any .service files") {
return filterOutput(startTime, output, args...), err
}
Expand Down

0 comments on commit eda0a20

Please sign in to comment.