Skip to content

Commit

Permalink
Merge pull request #638 from l1b0k/fix/set_sysctl_err
Browse files Browse the repository at this point in the history
cni: ignore link if not present
  • Loading branch information
BSWANG authored May 29, 2024
2 parents 879ee02 + aab435d commit b099995
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plugin/driver/utils/utils_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"net"
"os"

terwayIP "github.com/AliyunContainerService/terway/pkg/ip"
terwaySysctl "github.com/AliyunContainerService/terway/pkg/sysctl"
Expand Down Expand Up @@ -354,15 +355,19 @@ func EnsureNetConfSet(ipv4, ipv6 bool) error {
for _, cfg := range ipv4NetConfig {
innerErr := terwaySysctl.EnsureConf(fmt.Sprintf(cfg[0], link.Attrs().Name), cfg[1])
if innerErr != nil {
err = fmt.Errorf("%v, %w", err, innerErr)
if !os.IsNotExist(innerErr) {
err = fmt.Errorf("%v, %w", err, innerErr)
}
}
}
}
if ipv6 {
for _, cfg := range ipv6NetConfig {
innerErr := terwaySysctl.EnsureConf(fmt.Sprintf(cfg[0], link.Attrs().Name), cfg[1])
if innerErr != nil {
err = fmt.Errorf("%v, %w", err, innerErr)
if !os.IsNotExist(innerErr) {
err = fmt.Errorf("%v, %w", err, innerErr)
}
}
}
}
Expand Down

0 comments on commit b099995

Please sign in to comment.