[PATCH batadv v3 0/5] batman-adv: allow to specify limits for remote learned objects

Sven Eckelmann <[email protected]> Fri, 24 Jul 2026 08:51:37 +0200
Newsgroups org.open-mesh.lists.batman
Message-ID <[email protected]>
There are some concerns that an external entity could spam the batman-adv
related interfaces with random mac addresses. The batman-adv would use more
and more resources to safe things like neighbors, originators, TT, ... and
would at some point run out of resources.

One idea is to limit the number of entries for each resource type could
have. Things which might need limits

* orig_node
* neigh_node
* tt_local_entry
* dat_entry
* bla_backbone_gw
* bla_claim

Things which are limited by other things (maybe)

* hardif_neigh_node
* gw_node
* orig_node_vlan
* orig_info

Unknown how to handle overly large tt_global_entries:

* tt_global_entry

This approach is also used for the bridge since commit bdb4dfda3b41 ("net:
bridge: Track and limit dynamically learned FDB entries"). And it is also
disabled by default.

For the moment, I just want to demonstrate how this might work with some
example code. I didn't invest any time to actually check out the other
items in the list. So, please consider these lists as vague suggestions.

Signed-off-by: Sven Eckelmann <[email protected]>
---
Changes in v3:
- remove RFC
- rebase
- adjust commit messages to mention correct bat_priv members
- exempt own_backbone from resource limit
- keep BLA counters in batadv_priv_bla
- keep DAT counters in batadv_priv_dat
- avoid new over-allocations by first incrementing and then deciding
  whether too many items would have been allocated
- move the decrement of learned to release function (when possible)
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- rebase patches
- Link to v1: https://patch.msgid.link/[email protected]

---
Sven Eckelmann (5):
      batman-adv: limit number of parallel learned neighbors
      batman-adv: limit number of parallel learned originators
      batman-adv: limit number of parallel learned DAT entries
      batman-adv: limit number of parallel learned BLA backbones
      batman-adv: limit number of parallel learned BLA claims

 include/uapi/linux/batman_adv.h        | 30 ++++++++++++++++++++
 net/batman-adv/bat_iv_ogm.c            | 15 ++++++++--
 net/batman-adv/bat_v_ogm.c             | 15 ++++++++--
 net/batman-adv/bridge_loop_avoidance.c | 46 ++++++++++++++++++++++++++++---
 net/batman-adv/distributed-arp-table.c | 17 ++++++++++--
 net/batman-adv/mesh-interface.c        | 15 ++++++++++
 net/batman-adv/netlink.c               | 50 ++++++++++++++++++++++++++++++++++
 net/batman-adv/originator.c            | 22 +++++++++++++--
 net/batman-adv/types.h                 | 36 ++++++++++++++++++++++++
 9 files changed, 234 insertions(+), 12 deletions(-)
---
base-commit: 95b6f66b2659f617ce1937e790f48dc578ee014c
change-id: 20260516-resource-limit-5c1a32898f7c

Best regards,
--  
Sven Eckelmann <[email protected]>