File tree 2 files changed +10
-5
lines changed
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ impl firewall::FirewallDriver for IptablesDriver {
106
106
None => { }
107
107
Some ( i) => {
108
108
let localnet_path = format ! ( "net.ipv4.conf.{}.route_localnet" , i) ;
109
- CoreUtils :: apply_sysctl_value ( localnet_path. as_str ( ) , "1" ) ?;
109
+ CoreUtils :: apply_sysctl_value ( localnet_path, "1" ) ?;
110
110
}
111
111
}
112
112
// let container_network_address = setup_portfw.network_address.subnet;
Original file line number Diff line number Diff line change @@ -866,8 +866,8 @@ impl CoreUtils {
866
866
}
867
867
if ipv6_enabled {
868
868
// Do not accept Router Advertisements if ipv6 is enabled
869
- let k = format ! ( "net/ipv6/conf/{}/accept_ra" , ifname) ;
870
- match CoreUtils :: apply_sysctl_value ( & k , "0" ) {
869
+ match CoreUtils :: apply_sysctl_value ( format ! ( "net/ipv6/conf/{}/accept_ra" , ifname) , "0" )
870
+ {
871
871
Ok ( _) => { }
872
872
Err ( err) => {
873
873
return Err ( std:: io:: Error :: new (
@@ -1265,8 +1265,13 @@ impl CoreUtils {
1265
1265
ctl. value_string ( )
1266
1266
}
1267
1267
1268
- // set a sysctl value by value's namespace
1269
- pub fn apply_sysctl_value ( ns_value : & str , val : & str ) -> Result < String , SysctlError > {
1268
+ /// Set a sysctl value by value's namespace.
1269
+ pub fn apply_sysctl_value (
1270
+ ns_value : impl AsRef < str > ,
1271
+ val : impl AsRef < str > ,
1272
+ ) -> Result < String , SysctlError > {
1273
+ let ns_value = ns_value. as_ref ( ) ;
1274
+ let val = val. as_ref ( ) ;
1270
1275
debug ! ( "Setting sysctl value for {} to {}" , ns_value, val) ;
1271
1276
let ctl = sysctl:: Ctl :: new ( ns_value) ?;
1272
1277
ctl. set_value_string ( val)
You can’t perform that action at this time.
0 commit comments