mirror of
https://github.com/rancher/plugins.git
synced 2025-07-08 12:45:19 +00:00
Allow setting sysctls on a particular interface
Signed-off-by: Piotr Skamruk <piotr.skamruk@gmail.com>
This commit is contained in:
parent
2a9114d1af
commit
c16cff9805
@ -325,6 +325,11 @@ func cmdAdd(args *skel.CmdArgs) error {
|
|||||||
|
|
||||||
err = ns.WithNetNSPath(args.Netns, func(_ ns.NetNS) error {
|
err = ns.WithNetNSPath(args.Netns, func(_ ns.NetNS) error {
|
||||||
for key, value := range tuningConf.SysCtl {
|
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))
|
fileName := filepath.Join("/proc/sys", strings.Replace(key, ".", "/", -1))
|
||||||
|
|
||||||
// Refuse to modify sysctl parameters that don't belong
|
// Refuse to modify sysctl parameters that don't belong
|
||||||
|
Loading…
Reference in New Issue
Block a user