Skip to content

Commit

Permalink
Allow setting sysctls on a particular interface
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Skamruk <piotr.skamruk@gmail.com>
  • Loading branch information
jellonek committed Oct 1, 2021
1 parent 2a9114d commit c16cff9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugins/meta/tuning/tuning.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ func cmdAdd(args *skel.CmdArgs) error {

err = ns.WithNetNSPath(args.Netns, func(_ ns.NetNS) error {
for key, value := range tuningConf.SysCtl {
// If the key contains `IFNAME` - substitute it with args.IfName
// to allow setting sysctls on a particular interface, on which
// other operations (like mac/mtu setting) are performed
key = strings.Replace(key, "IFNAME", args.IfName, 1)

fileName := filepath.Join("/proc/sys", strings.Replace(key, ".", "/", -1))

// Refuse to modify sysctl parameters that don't belong
Expand Down

0 comments on commit c16cff9

Please sign in to comment.