Skip to content

Commit ac3e0ae

Browse files
authored
Merge pull request #524 from pb8o/net-toml-in-usr
netdog: look for net.toml under /usr
2 parents 9b8fe63 + 93ba2c3 commit ac3e0ae

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

sources/netdog/src/cli/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::net_config::{self, Interfaces};
99
use crate::{
1010
DEFAULT_NET_CONFIG_FILE, KERNEL_CMDLINE, OVERRIDE_NET_CONFIG_FILE, PRIMARY_INTERFACE,
1111
PRIMARY_MAC_ADDRESS, PRIMARY_SYSCTL_CONF, SYSCTL_MARKER_FILE, SYSTEMD_SYSCTL, SYS_CLASS_NET,
12+
USR_NET_CONFIG_FILE,
1213
};
1314
pub(crate) use generate_hostname::GenerateHostnameArgs;
1415
pub(crate) use generate_net_config::GenerateNetConfigArgs;
@@ -166,9 +167,10 @@ where
166167
fn fetch_net_config() -> Result<(Option<Box<dyn Interfaces>>, PathBuf)> {
167168
let override_path = PathBuf::from(OVERRIDE_NET_CONFIG_FILE);
168169
let default_path = PathBuf::from(DEFAULT_NET_CONFIG_FILE);
170+
let usr_path = PathBuf::from(USR_NET_CONFIG_FILE);
169171
let cmdline = PathBuf::from(KERNEL_CMDLINE);
170172

171-
for path in [override_path, default_path] {
173+
for path in [override_path, default_path, usr_path] {
172174
if Path::exists(&path) {
173175
return Ok((
174176
net_config::from_path(&path).context(error::NetConfigParseSnafu { path: &path })?,

sources/netdog/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ static PRIMARY_INTERFACE: &str = "/var/lib/netdog/primary_interface";
4949
static PRIMARY_MAC_ADDRESS: &str = "/var/lib/netdog/primary_mac_address";
5050
static DEFAULT_NET_CONFIG_FILE: &str = "/var/lib/bottlerocket/net.toml";
5151
static OVERRIDE_NET_CONFIG_FILE: &str = "/var/lib/netdog/net.toml";
52+
static USR_NET_CONFIG_FILE: &str = "/usr/share/bottlerocket/net.toml";
5253
static PRIMARY_SYSCTL_CONF: &str = "/etc/sysctl.d/90-primary_interface.conf";
5354
static SYSCTL_MARKER_FILE: &str = "/run/netdog/primary_sysctls_set";
5455
static SYS_CLASS_NET: &str = "/sys/class/net";

0 commit comments

Comments
 (0)