Commit 8772cc4
batman-adv: fix duplicate MAC address check
batadv_check_known_mac_addr() is both too lenient and too strict:
- It is called from batadv_hardif_add_interface(), which means that it
checked interfaces that are not used for batman-adv at all. Move it
to batadv_hardif_enable_interface(). Also, restrict it to hardifs of
the same mesh interface; different mesh interfaces should not interact
at all. The batadv_check_known_mac_addr() argument is changed from
`struct net_device` to `struct batadv_hard_iface` to achieve this.
- The check only cares about hardifs in BATADV_IF_ACTIVE and
BATADV_IF_TO_BE_ACTIVATED states, but interfaces in BATADV_IF_INACTIVE
state should be checked as well, or the following steps will not
result in a warning then they should:
- Add two interfaces in down state with different MAC addresses to
a mesh as hardifs
- Change the MAC addresses so they conflict
- Set interfaces to up state
Now there will be two active hardifs with the same MAC address, but no
warning. Fix by only ignoring hardifs in BATADV_IF_NOT_IN_USE state.
The RCU lock can be dropped, as we're holding RTNL anyways when the
function is called.
Fixes: c6c8fea ("net: Add batman-adv meshing protocol")
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>1 parent 61f96e6 commit 8772cc4
1 file changed
+18
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
509 | | - | |
| 509 | + | |
510 | 510 | | |
511 | | - | |
| 511 | + | |
| 512 | + | |
512 | 513 | | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
517 | 522 | | |
518 | 523 | | |
519 | | - | |
| 524 | + | |
520 | 525 | | |
521 | 526 | | |
522 | | - | |
523 | | - | |
| 527 | + | |
| 528 | + | |
524 | 529 | | |
525 | 530 | | |
526 | 531 | | |
527 | | - | |
| 532 | + | |
528 | 533 | | |
529 | 534 | | |
530 | | - | |
531 | 535 | | |
532 | 536 | | |
533 | 537 | | |
| |||
764 | 768 | | |
765 | 769 | | |
766 | 770 | | |
| 771 | + | |
| 772 | + | |
767 | 773 | | |
768 | 774 | | |
769 | 775 | | |
| |||
902 | 908 | | |
903 | 909 | | |
904 | 910 | | |
905 | | - | |
906 | 911 | | |
907 | 912 | | |
908 | 913 | | |
| |||
989 | 994 | | |
990 | 995 | | |
991 | 996 | | |
992 | | - | |
| 997 | + | |
993 | 998 | | |
994 | 999 | | |
995 | 1000 | | |
| |||
0 commit comments