Bug #200

Updated by Linus L├╝ssing over 6 years ago

There seems to be a memory leak for global translation table entries:

root@Linus-Debian:~# batctl o; batctl tg
[B.A.T.M.A.N. adv 2014.3.0-48-g4383006-dirty, MainIF/MAC: eth1/02:04:64:a4:39:c2 (bat0 BATMAN_IV)]
Originator last-seen (#/255) Nexthop [outgoingIF]: Potential nexthops ...
No batman nodes in range ...
Globally announced TT entries received via the mesh bat0
Client VID (TTVN) Originator (Curr TTVN) (CRC ) Flags
+ b6:55:75:a2:60:90 -1 ( 1) via 02:04:64:a4:39:c1 ( 1) (0x5416bae1) [....]
+ fa:22:c6:ae:eb:7a -1 ( 1) via 02:04:64:a4:39:c1 ( 1) (0xf1e21099) [....]
+ 1a:8b:63:a1:19:f8 -1 ( 1) via 02:04:64:a4:39:c1 ( 1) (0x8137a753) [....]
+ f6:04:1d:23:9a:e0 -1 ( 1) via 02:04:64:a4:39:c1 ( 1) (0xf182c149) [....]

This not only results in a memory leak for global TT entries but also the associated orig_node, now in invisible zombie state. Furthermore the leaking orig_node results in potentially bogus multicast counters (resulting in the multicast optimizations not always activating when they should).

The attached debug patch, basically decreasing intervals, makes it easy to reproduce the issue with the following two nodes setup:

[eth0--A--eth1] ~ [eth0--B]

(so eth1, the secondary interface, of node A is connected to eth0, the primary interface, of node B)

Running the following command on node A B results in a new leak on node B about every two seconds:

while true; do
batctl if del eth1; batctl if del eth0
sleep 2
batctl if add eth0; batctl if add eth1
sleep `echo 0.$((10*$RANDOM/32767))$((10*$RANDOM/32767))$((10*$RANDOM/32767))`

The log output of node B (batman+route+tt) is attached as well.