Skip to content
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 according to batman protocol #1055

Merged
merged 18 commits into from
Mar 12, 2024

Conversation

javierbrk
Copy link
Collaborator

@javierbrk javierbrk commented Sep 26, 2023

This module provides per interface links information associated with batman protocol basically using batclt nj command as source. The output is similar to the wifi_links_info to make data parsing easy.

This module depends on batctl-default witch is in use by kmod-batman-adv and batman-adv-auto-gw-mode.

This is a sample output of the command shared-state-async get bat_links_info run in one of two librerouters.

{
    "lrprimero": [
        {
            "dst_mac": "02:29:0f:1f:73:aa",
            "last_seen_msecs": 770,
            "tq": 238,
            "src_mac": "02:29:0f:1f:72:3a",
            "iface": "eth1-2_250"
        },
        {
            "dst_mac": "02:db:d6:fc:3a:bd",
            "last_seen_msecs": 510,
            "tq": 155,
            "src_mac": "02:29:0f:1f:72:3a",
            "iface": "eth1-2_250"
        }
    ],
    "lrsegundo": [
        {
            "dst_mac": "02:db:d6:fc:3a:bd",
            "last_seen_msecs": 480,
            "tq": 255,
            "src_mac": "02:29:0f:1f:73:aa",
            "iface": "eth1-2_250"
        },
        {
            "dst_mac": "02:29:0f:1f:72:3a",
            "last_seen_msecs": 750,
            "tq": 254,
            "src_mac": "02:29:0f:1f:73:aa",
            "iface": "eth1-2_250"
        }
    ]
}

@javierbrk javierbrk added this to the mesh-wide milestone Sep 26, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.68%. Comparing base (6992335) to head (1c099ca).

❗ Current head 1c099ca differs from pull request most recent head 1e1f379. Consider uploading reports for the commit 1e1f379 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1055      +/-   ##
==========================================
+ Coverage   79.54%   79.68%   +0.14%     
==========================================
  Files          53       53              
  Lines        4566     4574       +8     
==========================================
+ Hits         3632     3645      +13     
+ Misses        934      929       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ilario
Copy link
Member

ilario commented Sep 27, 2023

Great!

Just one comment:

$RANDOM will not be available in the upcoming LibreMesh releases.
See #800 and #991 (this means that the makefile should include a dependency from the replacement package and the uci-default package should include the random-numgen command instead of the $RANDOM)

Copy link
Member

@G10h4ck G10h4ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hard_ifindexshould be removed, it is an internal index not useful for other nodes or the used, and better to not spread it around. Plus see my comments inline.

assert.are.equal(1990, links_info[1].last_seen_msecs)
assert.are.equal("wlan0-mesh_250", links_info[1].iface)
end)
end)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New line missing at the end of file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done !

@javierbrk javierbrk marked this pull request as draft October 5, 2023 11:56
@javierbrk
Copy link
Collaborator Author

The last push includes the tq parameter for every neighbor

@javierbrk javierbrk marked this pull request as ready for review October 10, 2023 19:59
Copy link
Member

@G10h4ck G10h4ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comments

function get_bat_links_info()
local batneights_obj={}
local batlinks_obj={}
local batlinks = utils.unsafe_shell("batctl oj")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they aren't links, but all the nodes in the network and their distance, we could keep this variable and derivative named bat_originators_*

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if link_value.hard_ifname == neight_value.iface and
link_value.neigh_address== link_value.orig_address and
link_value.neigh_address== neight_value.dst_mac then
neight_value.tq = link_value.tq
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment explaining that tq stands for Batman Transmit Quality

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure !

@G10h4ck G10h4ck changed the title links information acording to batman protocol links information according to batman protocol Feb 8, 2024
@G10h4ck
Copy link
Member

G10h4ck commented Feb 8, 2024

should be ported to shared-state-async before merging

@javierbrk javierbrk marked this pull request as draft February 27, 2024 16:43
@javierbrk javierbrk marked this pull request as ready for review March 1, 2024 13:55
@ilario
Copy link
Member

ilario commented Mar 1, 2024 via email

@javierbrk
Copy link
Collaborator Author

At some point in the future, when we will have BATMAN_V working (the possibility to select it was introduced in #1004 as @lindnermarek said it is better than BATMAN_IV. But the first tests failed, as reported on #1059 . The progress on this is being tracked here: #1009 ), we should check if this works also for BATMAN_V.

-- Inviato dal mio smartstone

Nice ! this package gets info from batctl, I made a small poc and saw that if the network uses batmanV the json changes to this, instead of "tq" you get "throughput" and the information is directly in the originators table.

{
    "lrprimero": [
        {
            "last_seen_msecs": 430,
            "src_mac": "02:29:0f:1f:72:3a",
            "throughput": 1000000,
            "dst_mac": "02:29:0f:1f:73:aa",
            "iface": "eth1-2_250"
        }
    ],
    "lrsegundo": [
        {
            "last_seen_msecs": 310,
            "src_mac": "02:29:0f:1f:73:aa",
            "throughput": 1000000,
            "dst_mac": "02:29:0f:1f:72:3a",
            "iface": "eth1-2_250"
        }
    ]
}

@G10h4ck G10h4ck merged commit 069ac1a into libremesh:master Mar 12, 2024
1 check passed
@javierbrk javierbrk deleted the batmaninfo branch December 11, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants