1212
1313#include "interfaces.h"
1414
15+ static void warn_mcast_flood_port (struct lyd_node * port_cif )
16+ {
17+ struct lyd_node * bp , * flood ;
18+
19+ bp = lydx_get_child (port_cif , "bridge-port" );
20+ if (!bp )
21+ return ;
22+
23+ flood = lydx_get_child (bp , "flood" );
24+ if (!lydx_is_enabled (flood , "multicast" ))
25+ WARN ("%s: multicast flood disabled, topology changes will black-hole multicast until IGMP/MLD rejoin" ,
26+ lydx_get_cattr (port_cif , "name" ));
27+ }
28+
29+ static void warn_mcast_flood_bridge (struct lyd_node * cif , const char * brname )
30+ {
31+ struct ly_set * ports ;
32+ uint32_t i ;
33+
34+ ports = lydx_find_xpathf (cif , "../interface[bridge-port/bridge='%s']" , brname );
35+ if (!ports )
36+ return ;
37+
38+ for (i = 0 ; i < ports -> count ; i ++ )
39+ warn_mcast_flood_port (ports -> dnodes [i ]);
40+
41+ ly_set_free (ports , NULL );
42+ }
43+
44+ static void warn_mcast_flood_vlan (struct lyd_node * cif , struct lyd_node * vlan )
45+ {
46+ static const char * modes [] = { "tagged" , "untagged" , NULL };
47+ struct lyd_node * portentry ;
48+ struct ly_set * set ;
49+ const char * * mode ;
50+
51+ for (mode = modes ; * mode ; mode ++ ) {
52+ LYX_LIST_FOR_EACH (lyd_child (vlan ), portentry , * mode ) {
53+ set = lydx_find_xpathf (cif , "../interface[name='%s']" ,
54+ lyd_get_value (portentry ));
55+ if (!set || !set -> count ) {
56+ ly_set_free (set , NULL );
57+ continue ;
58+ }
59+ warn_mcast_flood_port (set -> dnodes [0 ]);
60+ ly_set_free (set , NULL );
61+ }
62+ }
63+ }
64+
1565static int gen_vlan (struct lyd_node * cif , struct lyd_node * vlan , FILE * conf )
1666{
1767 const char * iface , * querier , * upper ;
@@ -26,6 +76,8 @@ static int gen_vlan(struct lyd_node *cif, struct lyd_node *vlan, FILE *conf)
2676 if (!strcmp (querier , "off" ))
2777 return 0 ;
2878
79+ warn_mcast_flood_vlan (cif , vlan );
80+
2981 interval = atoi (lydx_get_cattr (mcast , "query-interval" ));
3082
3183 iface = lydx_get_cattr (cif , "name" );
@@ -66,6 +118,8 @@ static int gen_bridge(struct lyd_node *cif, FILE *conf)
66118
67119 interval = atoi (lydx_get_cattr (mcast , "query-interval" ));
68120
121+ warn_mcast_flood_bridge (cif , iface );
122+
69123 fprintf (conf , "iface %s enable %s igmpv3 query-interval %d\n" ,
70124 iface , !strcmp (querier , "proxy" ) ? "proxy-queries" : "" ,
71125 interval );
0 commit comments