Skip to content

Commit

Permalink
Fix typo and add log
Browse files Browse the repository at this point in the history
  • Loading branch information
pappz committed Feb 2, 2025
1 parent b9029e0 commit 5930330
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/firewall/iptables/router_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ func (r *router) updateState() {
}

func (r *router) AddDNATRule(rule firewall.ForwardRule) (firewall.Rule, error) {
if err := r.ipFwdState.ReleaseForwarding(); err != nil {
if err := r.ipFwdState.RequestForwarding(); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion client/firewall/nftables/router_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ func (r *router) refreshRulesMap() error {
}

func (r *router) AddDNATRule(rule firewall.ForwardRule) (firewall.Rule, error) {
if err := r.ipFwdState.ReleaseForwarding(); err != nil {
if err := r.ipFwdState.RequestForwarding(); err != nil {
return nil, err
}

Expand Down
6 changes: 6 additions & 0 deletions client/internal/routemanager/ipfwdstate/ipfwdstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package ipfwdstate

import (
"fmt"

log "github.com/sirupsen/logrus"

"github.com/netbirdio/netbird/client/internal/routemanager/systemops"
)

Expand All @@ -23,6 +26,7 @@ func (f *IPForwardingState) RequestForwarding() error {
return fmt.Errorf("failed to enable IP forwarding with sysctl: %w", err)
}
f.enabledCounter = 1
log.Info("IP forwarding enabled")

return nil
}
Expand All @@ -43,5 +47,7 @@ func (f *IPForwardingState) ReleaseForwarding() error {
if err := systemops.DisableIPForwarding(); err != nil {

Check failure on line 47 in client/internal/routemanager/ipfwdstate/ipfwdstate.go

View workflow job for this annotation

GitHub Actions / test

undefined: systemops.DisableIPForwarding

Check failure on line 47 in client/internal/routemanager/ipfwdstate/ipfwdstate.go

View workflow job for this annotation

GitHub Actions / test (sqlite)

undefined: systemops.DisableIPForwarding

Check failure on line 47 in client/internal/routemanager/ipfwdstate/ipfwdstate.go

View workflow job for this annotation

GitHub Actions / lint (macos-latest)

undefined: systemops.DisableIPForwarding (typecheck)
return fmt.Errorf("failed to disable IP forwarding with sysctl: %w", err)
}
log.Info("IP forwarding disabled")

return nil
}

0 comments on commit 5930330

Please sign in to comment.