Skip to content

sync gold 1.981 staging #1478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions plugins/interface/intf_base_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,8 @@ class InterfaceBasePlugin extends Plugin {
}

async getIPv4Addresses() {
if (!this.networkConfig.enabled)
return null;
// if there is static ipv4 config, directly return it to reduce overhead of invoking ip command
const staticIpv4s = {};
if (_.isArray(this.networkConfig.ipv4s) && !_.isEmpty(this.networkConfig.ipv4s))
Expand All @@ -1074,6 +1076,8 @@ class InterfaceBasePlugin extends Plugin {
}

async getIPv6Addresses() {
if (!this.networkConfig.enabled)
return null;
// there may be link-local ipv6 on interface, which is not available in static ipv6 config, always try to get ipv6 addresses from ip addr output
let ip6s = await exec(`ip addr show dev ${this.name} | awk '/inet6 /' | awk '{print $2}'`, {encoding: "utf8"}).then((result) => result.stdout.trim() || null).catch((err) => null);
if (ip6s)
Expand Down