lime-packages icon indicating copy to clipboard operation
lime-packages copied to clipboard

links information according to batman protocol

Open javierbrk opened this issue 1 year ago • 4 comments

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 echo | shared-state reqsync bat_links_info run in one of three tplinks3500. Two of them are wired. this link is nice representation of the output

{
  "primero": {
    "bleachTTL": 30,
    "data": [
      {
        "dst_mac": "02:ab:46:fc:3a:bd",
        "last_seen_msecs": 1830,
        "tq": 255,
        "src_mac": "02:ab:46:46:28:95",
        "iface": "wlan1-mesh_250"
      },
      {
        "dst_mac": "02:ab:46:da:4e:aa",
        "last_seen_msecs": 190,
        "tq": 255,
        "src_mac": "02:ab:46:46:28:95",
        "iface": "wlan1-mesh_250"
      },
      {
        "dst_mac": "02:58:47:fc:3a:bd",
        "last_seen_msecs": 3990,
        "tq": 252,
        "src_mac": "02:58:47:46:28:95",
        "iface": "wlan0-mesh_250"
      },
      {
        "dst_mac": "02:58:47:da:4e:aa",
        "last_seen_msecs": 110,
        "tq": 243,
        "src_mac": "02:58:47:46:28:95",
        "iface": "wlan0-mesh_250"
      }
    ],
    "author": "primero"
  },
  "segundo": {
    "bleachTTL": 25,
    "data": [
      {
        "dst_mac": "02:58:47:46:28:95",
        "last_seen_msecs": 1090,
        "tq": 244,
        "src_mac": "02:58:47:da:4e:aa",
        "iface": "wlan0-mesh_250"
      },
      {
        "dst_mac": "02:58:47:fc:3a:bd",
        "last_seen_msecs": 910,
        "tq": 238,
        "src_mac": "02:58:47:da:4e:aa",
        "iface": "wlan0-mesh_250"
      },
      {
        "dst_mac": "02:ab:46:fc:3a:bd",
        "last_seen_msecs": 1310,
        "tq": 255,
        "src_mac": "02:ab:46:da:4e:aa",
        "iface": "wlan1-mesh_250"
      },
      {
        "dst_mac": "02:ab:46:46:28:95",
        "last_seen_msecs": 930,
        "tq": 255,
        "src_mac": "02:ab:46:da:4e:aa",
        "iface": "wlan1-mesh_250"
      }
    ],
    "author": "segundo"
  },
  "tercero": {
    "bleachTTL": 24,
    "data": [
      {
        "dst_mac": "02:58:47:46:28:95",
        "last_seen_msecs": 730,
        "tq": 250,
        "iface": "wlan0-mesh_250",
        "src_mac": "02:58:47:fc:3a:bd"
      },
      {
        "dst_mac": "02:58:47:da:4e:aa",
        "last_seen_msecs": 1390,
        "tq": 255,
        "iface": "wlan0-mesh_250",
        "src_mac": "02:58:47:fc:3a:bd"
      },
      {
        "dst_mac": "02:ab:46:46:28:95",
        "last_seen_msecs": 1130,
        "tq": 251,
        "iface": "wlan1-mesh_250",
        "src_mac": "02:ab:46:fc:3a:bd"
      },
      {
        "dst_mac": "02:ab:46:da:4e:aa",
        "last_seen_msecs": 270,
        "tq": 255,
        "iface": "wlan1-mesh_250",
        "src_mac": "02:ab:46:fc:3a:bd"
      }
    ],
    "author": "tercero"
  }
}

javierbrk avatar Sep 26 '23 17:09 javierbrk

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

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

:exclamation: 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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Sep 26 '23 17:09 codecov-commenter

Great!

Just one comment:

$RANDOM will not be available in the upcoming LibreMesh releases. See https://github.com/libremesh/lime-packages/issues/800 and https://github.com/libremesh/lime-packages/pull/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)

ilario avatar Sep 27 '23 08:09 ilario

The last push includes the tq parameter for every neighbor

javierbrk avatar Oct 10 '23 19:10 javierbrk

should be ported to shared-state-async before merging

G10h4ck avatar Feb 08 '24 18:02 G10h4ck

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

-- Inviato dal mio smartstone

ilario avatar Mar 01 '24 13:03 ilario

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"
        }
    ]
}

javierbrk avatar Mar 04 '24 15:03 javierbrk