-
Notifications
You must be signed in to change notification settings - Fork 98
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
Links information module for shared state according to babeld #1056
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my inline comments
-- ! | ||
-- ! You should have received a copy of the GNU Affero General Public License | ||
-- ! along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
local JSON = require("luci.jsonc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better add an empty line here, between license and includes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
local utils = require('lime.utils') | ||
local ubus = require "ubus" | ||
|
||
local ifaceip = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this allocated outside the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a "cache" for IPV6 addresses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that each time the script is run this structure contains an empty list witch will be filled with each call to the get_ip method. Subsequent calls will use the information contained in the list.
|
||
local ifaceip = {} | ||
|
||
function get_interface_ip(ifname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function may fail, is it relevant to deal with the error conditions (for example an interface that miss IPv6 link local) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a new test, for ci and also tested locally, there is no problem with that kind of error, the result will be an empty string (non existing interfaces and no ipv6). Do you think the function should report error explicitly ? If
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #1056 +/- ##
==========================================
+ Coverage 79.56% 79.59% +0.03%
==========================================
Files 53 53
Lines 4566 4568 +2
==========================================
+ Hits 3633 3636 +3
+ Misses 933 932 -1 ☔ View full report in Codecov by Sentry. |
should be ported to shared-state-async before merging |
This module incorporates links information extracted from babel using ubus infrastructure.
The module has been tested in two librerouters and the output of the
shared-state-async get babel_links_info
in my setup is