troglobit / pimd

PIM-SM/SSM multicast routing for UNIX and Linux
http://troglobit.com/projects/pimd/
BSD 3-Clause "New" or "Revised" License
194 stars 86 forks source link

fix erroneous infos about DR in show neighbors/interfaces #215

Closed stormshield-rlibaert closed 2 years ago

stormshield-rlibaert commented 2 years ago

Description of problem

Pimctl can show wrong information about the DR identity for a given subnet. (in both sh neighbors and sh interfaces). If it is not itself, Pimd does not care about who is the DR but yet the information can be misleading. So even though the patch is mostly in pimd, it really just fixes info displayed by pimctl.

Solution

Fixing algorithm for electing the DR. Fixing display bug in the neihgbor table.

Tests

Mounted a multicast network with 3 routers in parallel, with especially: Router IP Prio
1 192.168.20.171 5030
2 192.168.20.177 5020
3 192.168.20.181 5010
Before :
_______________________________________________________________________________
PIM Interface Table
===============================================================================
Interface         State     Address          Nbr  Hello  Prio  DR Address 
===============================================================================
vtnet1            Up        192.168.20.171     2      5  5030  192.168.20.171 
vtnet2            Up        192.168.21.182     2      5     1  192.168.21.186

===============================================================================
vtnet1            Up        192.168.20.177     2      5  5010  192.168.20.181 
vtnet2            Up        192.168.21.186     2      5     1  192.168.21.186

===============================================================================
vtnet1            Up        192.168.20.181     2      5  5020  192.168.20.177 
vtnet2            Up        192.168.21.140     2      5     1  192.168.21.186
After:
_______________________________________________________________________________
PIM Interface Table
===============================================================================
Interface         State     Address          Nbr  Hello  Prio  DR Address 
===============================================================================
vtnet1            Up        192.168.20.171     2      5  5030  192.168.20.171 
vtnet2            Up        192.168.21.182     2      5     1  192.168.21.186

===============================================================================
vtnet1            Up        192.168.20.177     2      5  5030  192.168.20.171 
vtnet2            Up        192.168.21.186     2      5     1  192.168.21.186

===============================================================================
vtnet1            Up        192.168.20.181     2      5  5030  192.168.20.171 
vtnet2            Up        192.168.21.140     2      5     1  192.168.21.186
troglobit commented 2 years ago

Wow, awesome work on this! :100::+1:

There are only some minor whitespace/coding style issues, but I'll fix them up myself when I merge this later tonight.