diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/bridge/br_mdb.c | 4 | ||||
-rw-r--r-- | net/bridge/br_multicast.c | 169 | ||||
-rw-r--r-- | net/bridge/br_private.h | 22 |
3 files changed, 100 insertions, 95 deletions
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index b7b1914dfa25..5df05269d17a 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c | |||
@@ -418,13 +418,13 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry) | |||
418 | 418 | ||
419 | ip.proto = entry->addr.proto; | 419 | ip.proto = entry->addr.proto; |
420 | if (ip.proto == htons(ETH_P_IP)) { | 420 | if (ip.proto == htons(ETH_P_IP)) { |
421 | if (timer_pending(&br->ip4_querier.timer)) | 421 | if (timer_pending(&br->ip4_other_query.timer)) |
422 | return -EBUSY; | 422 | return -EBUSY; |
423 | 423 | ||
424 | ip.u.ip4 = entry->addr.u.ip4; | 424 | ip.u.ip4 = entry->addr.u.ip4; |
425 | #if IS_ENABLED(CONFIG_IPV6) | 425 | #if IS_ENABLED(CONFIG_IPV6) |
426 | } else { | 426 | } else { |
427 | if (timer_pending(&br->ip6_querier.timer)) | 427 | if (timer_pending(&br->ip6_other_query.timer)) |
428 | return -EBUSY; | 428 | return -EBUSY; |
429 | 429 | ||
430 | ip.u.ip6 = entry->addr.u.ip6; | 430 | ip.u.ip6 = entry->addr.u.ip6; |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 7b757b5dc773..5ccac62b4005 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include "br_private.h" | 35 | #include "br_private.h" |
36 | 36 | ||
37 | static void br_multicast_start_querier(struct net_bridge *br, | 37 | static void br_multicast_start_querier(struct net_bridge *br, |
38 | struct bridge_mcast_query *query); | 38 | struct bridge_mcast_own_query *query); |
39 | unsigned int br_mdb_rehash_seq; | 39 | unsigned int br_mdb_rehash_seq; |
40 | 40 | ||
41 | static inline int br_ip_equal(const struct br_ip *a, const struct br_ip *b) | 41 | static inline int br_ip_equal(const struct br_ip *a, const struct br_ip *b) |
@@ -761,7 +761,7 @@ static void br_multicast_local_router_expired(unsigned long data) | |||
761 | } | 761 | } |
762 | 762 | ||
763 | static void br_multicast_querier_expired(struct net_bridge *br, | 763 | static void br_multicast_querier_expired(struct net_bridge *br, |
764 | struct bridge_mcast_query *query) | 764 | struct bridge_mcast_own_query *query) |
765 | { | 765 | { |
766 | spin_lock(&br->multicast_lock); | 766 | spin_lock(&br->multicast_lock); |
767 | if (!netif_running(br->dev) || br->multicast_disabled) | 767 | if (!netif_running(br->dev) || br->multicast_disabled) |
@@ -777,7 +777,7 @@ static void br_ip4_multicast_querier_expired(unsigned long data) | |||
777 | { | 777 | { |
778 | struct net_bridge *br = (void *)data; | 778 | struct net_bridge *br = (void *)data; |
779 | 779 | ||
780 | br_multicast_querier_expired(br, &br->ip4_query); | 780 | br_multicast_querier_expired(br, &br->ip4_own_query); |
781 | } | 781 | } |
782 | 782 | ||
783 | #if IS_ENABLED(CONFIG_IPV6) | 783 | #if IS_ENABLED(CONFIG_IPV6) |
@@ -785,7 +785,7 @@ static void br_ip6_multicast_querier_expired(unsigned long data) | |||
785 | { | 785 | { |
786 | struct net_bridge *br = (void *)data; | 786 | struct net_bridge *br = (void *)data; |
787 | 787 | ||
788 | br_multicast_querier_expired(br, &br->ip6_query); | 788 | br_multicast_querier_expired(br, &br->ip6_own_query); |
789 | } | 789 | } |
790 | #endif | 790 | #endif |
791 | 791 | ||
@@ -810,11 +810,11 @@ static void __br_multicast_send_query(struct net_bridge *br, | |||
810 | 810 | ||
811 | static void br_multicast_send_query(struct net_bridge *br, | 811 | static void br_multicast_send_query(struct net_bridge *br, |
812 | struct net_bridge_port *port, | 812 | struct net_bridge_port *port, |
813 | struct bridge_mcast_query *query) | 813 | struct bridge_mcast_own_query *own_query) |
814 | { | 814 | { |
815 | unsigned long time; | 815 | unsigned long time; |
816 | struct br_ip br_group; | 816 | struct br_ip br_group; |
817 | struct bridge_mcast_querier *querier = NULL; | 817 | struct bridge_mcast_other_query *other_query = NULL; |
818 | 818 | ||
819 | if (!netif_running(br->dev) || br->multicast_disabled || | 819 | if (!netif_running(br->dev) || br->multicast_disabled || |
820 | !br->multicast_querier) | 820 | !br->multicast_querier) |
@@ -822,31 +822,32 @@ static void br_multicast_send_query(struct net_bridge *br, | |||
822 | 822 | ||
823 | memset(&br_group.u, 0, sizeof(br_group.u)); | 823 | memset(&br_group.u, 0, sizeof(br_group.u)); |
824 | 824 | ||
825 | if (port ? (query == &port->ip4_query) : | 825 | if (port ? (own_query == &port->ip4_own_query) : |
826 | (query == &br->ip4_query)) { | 826 | (own_query == &br->ip4_own_query)) { |
827 | querier = &br->ip4_querier; | 827 | other_query = &br->ip4_other_query; |
828 | br_group.proto = htons(ETH_P_IP); | 828 | br_group.proto = htons(ETH_P_IP); |
829 | #if IS_ENABLED(CONFIG_IPV6) | 829 | #if IS_ENABLED(CONFIG_IPV6) |
830 | } else { | 830 | } else { |
831 | querier = &br->ip6_querier; | 831 | other_query = &br->ip6_other_query; |
832 | br_group.proto = htons(ETH_P_IPV6); | 832 | br_group.proto = htons(ETH_P_IPV6); |
833 | #endif | 833 | #endif |
834 | } | 834 | } |
835 | 835 | ||
836 | if (!querier || timer_pending(&querier->timer)) | 836 | if (!other_query || timer_pending(&other_query->timer)) |
837 | return; | 837 | return; |
838 | 838 | ||
839 | __br_multicast_send_query(br, port, &br_group); | 839 | __br_multicast_send_query(br, port, &br_group); |
840 | 840 | ||
841 | time = jiffies; | 841 | time = jiffies; |
842 | time += query->startup_sent < br->multicast_startup_query_count ? | 842 | time += own_query->startup_sent < br->multicast_startup_query_count ? |
843 | br->multicast_startup_query_interval : | 843 | br->multicast_startup_query_interval : |
844 | br->multicast_query_interval; | 844 | br->multicast_query_interval; |
845 | mod_timer(&query->timer, time); | 845 | mod_timer(&own_query->timer, time); |
846 | } | 846 | } |
847 | 847 | ||
848 | static void br_multicast_port_query_expired(struct net_bridge_port *port, | 848 | static void |
849 | struct bridge_mcast_query *query) | 849 | br_multicast_port_query_expired(struct net_bridge_port *port, |
850 | struct bridge_mcast_own_query *query) | ||
850 | { | 851 | { |
851 | struct net_bridge *br = port->br; | 852 | struct net_bridge *br = port->br; |
852 | 853 | ||
@@ -868,7 +869,7 @@ static void br_ip4_multicast_port_query_expired(unsigned long data) | |||
868 | { | 869 | { |
869 | struct net_bridge_port *port = (void *)data; | 870 | struct net_bridge_port *port = (void *)data; |
870 | 871 | ||
871 | br_multicast_port_query_expired(port, &port->ip4_query); | 872 | br_multicast_port_query_expired(port, &port->ip4_own_query); |
872 | } | 873 | } |
873 | 874 | ||
874 | #if IS_ENABLED(CONFIG_IPV6) | 875 | #if IS_ENABLED(CONFIG_IPV6) |
@@ -876,7 +877,7 @@ static void br_ip6_multicast_port_query_expired(unsigned long data) | |||
876 | { | 877 | { |
877 | struct net_bridge_port *port = (void *)data; | 878 | struct net_bridge_port *port = (void *)data; |
878 | 879 | ||
879 | br_multicast_port_query_expired(port, &port->ip6_query); | 880 | br_multicast_port_query_expired(port, &port->ip6_own_query); |
880 | } | 881 | } |
881 | #endif | 882 | #endif |
882 | 883 | ||
@@ -886,11 +887,11 @@ void br_multicast_add_port(struct net_bridge_port *port) | |||
886 | 887 | ||
887 | setup_timer(&port->multicast_router_timer, br_multicast_router_expired, | 888 | setup_timer(&port->multicast_router_timer, br_multicast_router_expired, |
888 | (unsigned long)port); | 889 | (unsigned long)port); |
889 | setup_timer(&port->ip4_query.timer, br_ip4_multicast_port_query_expired, | 890 | setup_timer(&port->ip4_own_query.timer, |
890 | (unsigned long)port); | 891 | br_ip4_multicast_port_query_expired, (unsigned long)port); |
891 | #if IS_ENABLED(CONFIG_IPV6) | 892 | #if IS_ENABLED(CONFIG_IPV6) |
892 | setup_timer(&port->ip6_query.timer, br_ip6_multicast_port_query_expired, | 893 | setup_timer(&port->ip6_own_query.timer, |
893 | (unsigned long)port); | 894 | br_ip6_multicast_port_query_expired, (unsigned long)port); |
894 | #endif | 895 | #endif |
895 | } | 896 | } |
896 | 897 | ||
@@ -899,7 +900,7 @@ void br_multicast_del_port(struct net_bridge_port *port) | |||
899 | del_timer_sync(&port->multicast_router_timer); | 900 | del_timer_sync(&port->multicast_router_timer); |
900 | } | 901 | } |
901 | 902 | ||
902 | static void br_multicast_enable(struct bridge_mcast_query *query) | 903 | static void br_multicast_enable(struct bridge_mcast_own_query *query) |
903 | { | 904 | { |
904 | query->startup_sent = 0; | 905 | query->startup_sent = 0; |
905 | 906 | ||
@@ -916,9 +917,9 @@ void br_multicast_enable_port(struct net_bridge_port *port) | |||
916 | if (br->multicast_disabled || !netif_running(br->dev)) | 917 | if (br->multicast_disabled || !netif_running(br->dev)) |
917 | goto out; | 918 | goto out; |
918 | 919 | ||
919 | br_multicast_enable(&port->ip4_query); | 920 | br_multicast_enable(&port->ip4_own_query); |
920 | #if IS_ENABLED(CONFIG_IPV6) | 921 | #if IS_ENABLED(CONFIG_IPV6) |
921 | br_multicast_enable(&port->ip6_query); | 922 | br_multicast_enable(&port->ip6_own_query); |
922 | #endif | 923 | #endif |
923 | 924 | ||
924 | out: | 925 | out: |
@@ -938,9 +939,9 @@ void br_multicast_disable_port(struct net_bridge_port *port) | |||
938 | if (!hlist_unhashed(&port->rlist)) | 939 | if (!hlist_unhashed(&port->rlist)) |
939 | hlist_del_init_rcu(&port->rlist); | 940 | hlist_del_init_rcu(&port->rlist); |
940 | del_timer(&port->multicast_router_timer); | 941 | del_timer(&port->multicast_router_timer); |
941 | del_timer(&port->ip4_query.timer); | 942 | del_timer(&port->ip4_own_query.timer); |
942 | #if IS_ENABLED(CONFIG_IPV6) | 943 | #if IS_ENABLED(CONFIG_IPV6) |
943 | del_timer(&port->ip6_query.timer); | 944 | del_timer(&port->ip6_own_query.timer); |
944 | #endif | 945 | #endif |
945 | spin_unlock(&br->multicast_lock); | 946 | spin_unlock(&br->multicast_lock); |
946 | } | 947 | } |
@@ -1065,14 +1066,14 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, | |||
1065 | #endif | 1066 | #endif |
1066 | 1067 | ||
1067 | static void | 1068 | static void |
1068 | br_multicast_update_querier_timer(struct net_bridge *br, | 1069 | br_multicast_update_query_timer(struct net_bridge *br, |
1069 | struct bridge_mcast_querier *querier, | 1070 | struct bridge_mcast_other_query *query, |
1070 | unsigned long max_delay) | 1071 | unsigned long max_delay) |
1071 | { | 1072 | { |
1072 | if (!timer_pending(&querier->timer)) | 1073 | if (!timer_pending(&query->timer)) |
1073 | querier->delay_time = jiffies + max_delay; | 1074 | query->delay_time = jiffies + max_delay; |
1074 | 1075 | ||
1075 | mod_timer(&querier->timer, jiffies + br->multicast_querier_interval); | 1076 | mod_timer(&query->timer, jiffies + br->multicast_querier_interval); |
1076 | } | 1077 | } |
1077 | 1078 | ||
1078 | /* | 1079 | /* |
@@ -1125,14 +1126,14 @@ timer: | |||
1125 | 1126 | ||
1126 | static void br_multicast_query_received(struct net_bridge *br, | 1127 | static void br_multicast_query_received(struct net_bridge *br, |
1127 | struct net_bridge_port *port, | 1128 | struct net_bridge_port *port, |
1128 | struct bridge_mcast_querier *querier, | 1129 | struct bridge_mcast_other_query *query, |
1129 | int saddr, | 1130 | int saddr, |
1130 | bool is_general_query, | 1131 | bool is_general_query, |
1131 | unsigned long max_delay) | 1132 | unsigned long max_delay) |
1132 | { | 1133 | { |
1133 | if (saddr && is_general_query) | 1134 | if (saddr && is_general_query) |
1134 | br_multicast_update_querier_timer(br, querier, max_delay); | 1135 | br_multicast_update_query_timer(br, query, max_delay); |
1135 | else if (timer_pending(&querier->timer)) | 1136 | else if (timer_pending(&query->timer)) |
1136 | return; | 1137 | return; |
1137 | 1138 | ||
1138 | br_multicast_mark_router(br, port); | 1139 | br_multicast_mark_router(br, port); |
@@ -1190,8 +1191,8 @@ static int br_ip4_multicast_query(struct net_bridge *br, | |||
1190 | goto out; | 1191 | goto out; |
1191 | } | 1192 | } |
1192 | 1193 | ||
1193 | br_multicast_query_received(br, port, &br->ip4_querier, !!iph->saddr, | 1194 | br_multicast_query_received(br, port, &br->ip4_other_query, |
1194 | !group, max_delay); | 1195 | !!iph->saddr, !group, max_delay); |
1195 | 1196 | ||
1196 | if (!group) | 1197 | if (!group) |
1197 | goto out; | 1198 | goto out; |
@@ -1282,7 +1283,7 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1282 | goto out; | 1283 | goto out; |
1283 | } | 1284 | } |
1284 | 1285 | ||
1285 | br_multicast_query_received(br, port, &br->ip6_querier, | 1286 | br_multicast_query_received(br, port, &br->ip6_other_query, |
1286 | !ipv6_addr_any(&ip6h->saddr), | 1287 | !ipv6_addr_any(&ip6h->saddr), |
1287 | is_general_query, max_delay); | 1288 | is_general_query, max_delay); |
1288 | 1289 | ||
@@ -1315,11 +1316,12 @@ out: | |||
1315 | } | 1316 | } |
1316 | #endif | 1317 | #endif |
1317 | 1318 | ||
1318 | static void br_multicast_leave_group(struct net_bridge *br, | 1319 | static void |
1319 | struct net_bridge_port *port, | 1320 | br_multicast_leave_group(struct net_bridge *br, |
1320 | struct br_ip *group, | 1321 | struct net_bridge_port *port, |
1321 | struct bridge_mcast_querier *querier, | 1322 | struct br_ip *group, |
1322 | struct bridge_mcast_query *query) | 1323 | struct bridge_mcast_other_query *other_query, |
1324 | struct bridge_mcast_own_query *own_query) | ||
1323 | { | 1325 | { |
1324 | struct net_bridge_mdb_htable *mdb; | 1326 | struct net_bridge_mdb_htable *mdb; |
1325 | struct net_bridge_mdb_entry *mp; | 1327 | struct net_bridge_mdb_entry *mp; |
@@ -1330,7 +1332,7 @@ static void br_multicast_leave_group(struct net_bridge *br, | |||
1330 | spin_lock(&br->multicast_lock); | 1332 | spin_lock(&br->multicast_lock); |
1331 | if (!netif_running(br->dev) || | 1333 | if (!netif_running(br->dev) || |
1332 | (port && port->state == BR_STATE_DISABLED) || | 1334 | (port && port->state == BR_STATE_DISABLED) || |
1333 | timer_pending(&querier->timer)) | 1335 | timer_pending(&other_query->timer)) |
1334 | goto out; | 1336 | goto out; |
1335 | 1337 | ||
1336 | mdb = mlock_dereference(br->mdb, br); | 1338 | mdb = mlock_dereference(br->mdb, br); |
@@ -1344,7 +1346,7 @@ static void br_multicast_leave_group(struct net_bridge *br, | |||
1344 | time = jiffies + br->multicast_last_member_count * | 1346 | time = jiffies + br->multicast_last_member_count * |
1345 | br->multicast_last_member_interval; | 1347 | br->multicast_last_member_interval; |
1346 | 1348 | ||
1347 | mod_timer(&query->timer, time); | 1349 | mod_timer(&own_query->timer, time); |
1348 | 1350 | ||
1349 | for (p = mlock_dereference(mp->ports, br); | 1351 | for (p = mlock_dereference(mp->ports, br); |
1350 | p != NULL; | 1352 | p != NULL; |
@@ -1425,17 +1427,19 @@ static void br_ip4_multicast_leave_group(struct net_bridge *br, | |||
1425 | __u16 vid) | 1427 | __u16 vid) |
1426 | { | 1428 | { |
1427 | struct br_ip br_group; | 1429 | struct br_ip br_group; |
1428 | struct bridge_mcast_query *query = port ? &port->ip4_query : | 1430 | struct bridge_mcast_own_query *own_query; |
1429 | &br->ip4_query; | ||
1430 | 1431 | ||
1431 | if (ipv4_is_local_multicast(group)) | 1432 | if (ipv4_is_local_multicast(group)) |
1432 | return; | 1433 | return; |
1433 | 1434 | ||
1435 | own_query = port ? &port->ip4_own_query : &br->ip4_own_query; | ||
1436 | |||
1434 | br_group.u.ip4 = group; | 1437 | br_group.u.ip4 = group; |
1435 | br_group.proto = htons(ETH_P_IP); | 1438 | br_group.proto = htons(ETH_P_IP); |
1436 | br_group.vid = vid; | 1439 | br_group.vid = vid; |
1437 | 1440 | ||
1438 | br_multicast_leave_group(br, port, &br_group, &br->ip4_querier, query); | 1441 | br_multicast_leave_group(br, port, &br_group, &br->ip4_other_query, |
1442 | own_query); | ||
1439 | } | 1443 | } |
1440 | 1444 | ||
1441 | #if IS_ENABLED(CONFIG_IPV6) | 1445 | #if IS_ENABLED(CONFIG_IPV6) |
@@ -1445,18 +1449,19 @@ static void br_ip6_multicast_leave_group(struct net_bridge *br, | |||
1445 | __u16 vid) | 1449 | __u16 vid) |
1446 | { | 1450 | { |
1447 | struct br_ip br_group; | 1451 | struct br_ip br_group; |
1448 | struct bridge_mcast_query *query = port ? &port->ip6_query : | 1452 | struct bridge_mcast_own_query *own_query; |
1449 | &br->ip6_query; | ||
1450 | |||
1451 | 1453 | ||
1452 | if (ipv6_addr_is_ll_all_nodes(group)) | 1454 | if (ipv6_addr_is_ll_all_nodes(group)) |
1453 | return; | 1455 | return; |
1454 | 1456 | ||
1457 | own_query = port ? &port->ip6_own_query : &br->ip6_own_query; | ||
1458 | |||
1455 | br_group.u.ip6 = *group; | 1459 | br_group.u.ip6 = *group; |
1456 | br_group.proto = htons(ETH_P_IPV6); | 1460 | br_group.proto = htons(ETH_P_IPV6); |
1457 | br_group.vid = vid; | 1461 | br_group.vid = vid; |
1458 | 1462 | ||
1459 | br_multicast_leave_group(br, port, &br_group, &br->ip6_querier, query); | 1463 | br_multicast_leave_group(br, port, &br_group, &br->ip6_other_query, |
1464 | own_query); | ||
1460 | } | 1465 | } |
1461 | #endif | 1466 | #endif |
1462 | 1467 | ||
@@ -1723,7 +1728,7 @@ int br_multicast_rcv(struct net_bridge *br, struct net_bridge_port *port, | |||
1723 | } | 1728 | } |
1724 | 1729 | ||
1725 | static void br_multicast_query_expired(struct net_bridge *br, | 1730 | static void br_multicast_query_expired(struct net_bridge *br, |
1726 | struct bridge_mcast_query *query) | 1731 | struct bridge_mcast_own_query *query) |
1727 | { | 1732 | { |
1728 | spin_lock(&br->multicast_lock); | 1733 | spin_lock(&br->multicast_lock); |
1729 | if (query->startup_sent < br->multicast_startup_query_count) | 1734 | if (query->startup_sent < br->multicast_startup_query_count) |
@@ -1737,7 +1742,7 @@ static void br_ip4_multicast_query_expired(unsigned long data) | |||
1737 | { | 1742 | { |
1738 | struct net_bridge *br = (void *)data; | 1743 | struct net_bridge *br = (void *)data; |
1739 | 1744 | ||
1740 | br_multicast_query_expired(br, &br->ip4_query); | 1745 | br_multicast_query_expired(br, &br->ip4_own_query); |
1741 | } | 1746 | } |
1742 | 1747 | ||
1743 | #if IS_ENABLED(CONFIG_IPV6) | 1748 | #if IS_ENABLED(CONFIG_IPV6) |
@@ -1745,7 +1750,7 @@ static void br_ip6_multicast_query_expired(unsigned long data) | |||
1745 | { | 1750 | { |
1746 | struct net_bridge *br = (void *)data; | 1751 | struct net_bridge *br = (void *)data; |
1747 | 1752 | ||
1748 | br_multicast_query_expired(br, &br->ip6_query); | 1753 | br_multicast_query_expired(br, &br->ip6_own_query); |
1749 | } | 1754 | } |
1750 | #endif | 1755 | #endif |
1751 | 1756 | ||
@@ -1767,28 +1772,28 @@ void br_multicast_init(struct net_bridge *br) | |||
1767 | br->multicast_querier_interval = 255 * HZ; | 1772 | br->multicast_querier_interval = 255 * HZ; |
1768 | br->multicast_membership_interval = 260 * HZ; | 1773 | br->multicast_membership_interval = 260 * HZ; |
1769 | 1774 | ||
1770 | br->ip4_querier.delay_time = 0; | 1775 | br->ip4_other_query.delay_time = 0; |
1771 | #if IS_ENABLED(CONFIG_IPV6) | 1776 | #if IS_ENABLED(CONFIG_IPV6) |
1772 | br->ip6_querier.delay_time = 0; | 1777 | br->ip6_other_query.delay_time = 0; |
1773 | #endif | 1778 | #endif |
1774 | 1779 | ||
1775 | spin_lock_init(&br->multicast_lock); | 1780 | spin_lock_init(&br->multicast_lock); |
1776 | setup_timer(&br->multicast_router_timer, | 1781 | setup_timer(&br->multicast_router_timer, |
1777 | br_multicast_local_router_expired, 0); | 1782 | br_multicast_local_router_expired, 0); |
1778 | setup_timer(&br->ip4_querier.timer, br_ip4_multicast_querier_expired, | 1783 | setup_timer(&br->ip4_other_query.timer, |
1779 | (unsigned long)br); | 1784 | br_ip4_multicast_querier_expired, (unsigned long)br); |
1780 | setup_timer(&br->ip4_query.timer, br_ip4_multicast_query_expired, | 1785 | setup_timer(&br->ip4_own_query.timer, br_ip4_multicast_query_expired, |
1781 | (unsigned long)br); | 1786 | (unsigned long)br); |
1782 | #if IS_ENABLED(CONFIG_IPV6) | 1787 | #if IS_ENABLED(CONFIG_IPV6) |
1783 | setup_timer(&br->ip6_querier.timer, br_ip6_multicast_querier_expired, | 1788 | setup_timer(&br->ip6_other_query.timer, |
1784 | (unsigned long)br); | 1789 | br_ip6_multicast_querier_expired, (unsigned long)br); |
1785 | setup_timer(&br->ip6_query.timer, br_ip6_multicast_query_expired, | 1790 | setup_timer(&br->ip6_own_query.timer, br_ip6_multicast_query_expired, |
1786 | (unsigned long)br); | 1791 | (unsigned long)br); |
1787 | #endif | 1792 | #endif |
1788 | } | 1793 | } |
1789 | 1794 | ||
1790 | static void __br_multicast_open(struct net_bridge *br, | 1795 | static void __br_multicast_open(struct net_bridge *br, |
1791 | struct bridge_mcast_query *query) | 1796 | struct bridge_mcast_own_query *query) |
1792 | { | 1797 | { |
1793 | query->startup_sent = 0; | 1798 | query->startup_sent = 0; |
1794 | 1799 | ||
@@ -1800,9 +1805,9 @@ static void __br_multicast_open(struct net_bridge *br, | |||
1800 | 1805 | ||
1801 | void br_multicast_open(struct net_bridge *br) | 1806 | void br_multicast_open(struct net_bridge *br) |
1802 | { | 1807 | { |
1803 | __br_multicast_open(br, &br->ip4_query); | 1808 | __br_multicast_open(br, &br->ip4_own_query); |
1804 | #if IS_ENABLED(CONFIG_IPV6) | 1809 | #if IS_ENABLED(CONFIG_IPV6) |
1805 | __br_multicast_open(br, &br->ip6_query); | 1810 | __br_multicast_open(br, &br->ip6_own_query); |
1806 | #endif | 1811 | #endif |
1807 | } | 1812 | } |
1808 | 1813 | ||
@@ -1815,11 +1820,11 @@ void br_multicast_stop(struct net_bridge *br) | |||
1815 | int i; | 1820 | int i; |
1816 | 1821 | ||
1817 | del_timer_sync(&br->multicast_router_timer); | 1822 | del_timer_sync(&br->multicast_router_timer); |
1818 | del_timer_sync(&br->ip4_querier.timer); | 1823 | del_timer_sync(&br->ip4_other_query.timer); |
1819 | del_timer_sync(&br->ip4_query.timer); | 1824 | del_timer_sync(&br->ip4_own_query.timer); |
1820 | #if IS_ENABLED(CONFIG_IPV6) | 1825 | #if IS_ENABLED(CONFIG_IPV6) |
1821 | del_timer_sync(&br->ip6_querier.timer); | 1826 | del_timer_sync(&br->ip6_other_query.timer); |
1822 | del_timer_sync(&br->ip6_query.timer); | 1827 | del_timer_sync(&br->ip6_own_query.timer); |
1823 | #endif | 1828 | #endif |
1824 | 1829 | ||
1825 | spin_lock_bh(&br->multicast_lock); | 1830 | spin_lock_bh(&br->multicast_lock); |
@@ -1923,7 +1928,7 @@ unlock: | |||
1923 | } | 1928 | } |
1924 | 1929 | ||
1925 | static void br_multicast_start_querier(struct net_bridge *br, | 1930 | static void br_multicast_start_querier(struct net_bridge *br, |
1926 | struct bridge_mcast_query *query) | 1931 | struct bridge_mcast_own_query *query) |
1927 | { | 1932 | { |
1928 | struct net_bridge_port *port; | 1933 | struct net_bridge_port *port; |
1929 | 1934 | ||
@@ -1934,11 +1939,11 @@ static void br_multicast_start_querier(struct net_bridge *br, | |||
1934 | port->state == BR_STATE_BLOCKING) | 1939 | port->state == BR_STATE_BLOCKING) |
1935 | continue; | 1940 | continue; |
1936 | 1941 | ||
1937 | if (query == &br->ip4_query) | 1942 | if (query == &br->ip4_own_query) |
1938 | br_multicast_enable(&port->ip4_query); | 1943 | br_multicast_enable(&port->ip4_own_query); |
1939 | #if IS_ENABLED(CONFIG_IPV6) | 1944 | #if IS_ENABLED(CONFIG_IPV6) |
1940 | else | 1945 | else |
1941 | br_multicast_enable(&port->ip6_query); | 1946 | br_multicast_enable(&port->ip6_own_query); |
1942 | #endif | 1947 | #endif |
1943 | } | 1948 | } |
1944 | } | 1949 | } |
@@ -1974,9 +1979,9 @@ rollback: | |||
1974 | goto rollback; | 1979 | goto rollback; |
1975 | } | 1980 | } |
1976 | 1981 | ||
1977 | br_multicast_start_querier(br, &br->ip4_query); | 1982 | br_multicast_start_querier(br, &br->ip4_own_query); |
1978 | #if IS_ENABLED(CONFIG_IPV6) | 1983 | #if IS_ENABLED(CONFIG_IPV6) |
1979 | br_multicast_start_querier(br, &br->ip6_query); | 1984 | br_multicast_start_querier(br, &br->ip6_own_query); |
1980 | #endif | 1985 | #endif |
1981 | 1986 | ||
1982 | unlock: | 1987 | unlock: |
@@ -2001,16 +2006,16 @@ int br_multicast_set_querier(struct net_bridge *br, unsigned long val) | |||
2001 | 2006 | ||
2002 | max_delay = br->multicast_query_response_interval; | 2007 | max_delay = br->multicast_query_response_interval; |
2003 | 2008 | ||
2004 | if (!timer_pending(&br->ip4_querier.timer)) | 2009 | if (!timer_pending(&br->ip4_other_query.timer)) |
2005 | br->ip4_querier.delay_time = jiffies + max_delay; | 2010 | br->ip4_other_query.delay_time = jiffies + max_delay; |
2006 | 2011 | ||
2007 | br_multicast_start_querier(br, &br->ip4_query); | 2012 | br_multicast_start_querier(br, &br->ip4_own_query); |
2008 | 2013 | ||
2009 | #if IS_ENABLED(CONFIG_IPV6) | 2014 | #if IS_ENABLED(CONFIG_IPV6) |
2010 | if (!timer_pending(&br->ip6_querier.timer)) | 2015 | if (!timer_pending(&br->ip6_other_query.timer)) |
2011 | br->ip6_querier.delay_time = jiffies + max_delay; | 2016 | br->ip6_other_query.delay_time = jiffies + max_delay; |
2012 | 2017 | ||
2013 | br_multicast_start_querier(br, &br->ip6_query); | 2018 | br_multicast_start_querier(br, &br->ip6_own_query); |
2014 | #endif | 2019 | #endif |
2015 | 2020 | ||
2016 | unlock: | 2021 | unlock: |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index bc17210d4c52..2469aeeda1ec 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -68,13 +68,13 @@ struct br_ip | |||
68 | 68 | ||
69 | #ifdef CONFIG_BRIDGE_IGMP_SNOOPING | 69 | #ifdef CONFIG_BRIDGE_IGMP_SNOOPING |
70 | /* our own querier */ | 70 | /* our own querier */ |
71 | struct bridge_mcast_query { | 71 | struct bridge_mcast_own_query { |
72 | struct timer_list timer; | 72 | struct timer_list timer; |
73 | u32 startup_sent; | 73 | u32 startup_sent; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | /* other querier */ | 76 | /* other querier */ |
77 | struct bridge_mcast_querier { | 77 | struct bridge_mcast_other_query { |
78 | struct timer_list timer; | 78 | struct timer_list timer; |
79 | unsigned long delay_time; | 79 | unsigned long delay_time; |
80 | }; | 80 | }; |
@@ -178,9 +178,9 @@ struct net_bridge_port | |||
178 | #define BR_PROMISC 0x00000080 | 178 | #define BR_PROMISC 0x00000080 |
179 | 179 | ||
180 | #ifdef CONFIG_BRIDGE_IGMP_SNOOPING | 180 | #ifdef CONFIG_BRIDGE_IGMP_SNOOPING |
181 | struct bridge_mcast_query ip4_query; | 181 | struct bridge_mcast_own_query ip4_own_query; |
182 | #if IS_ENABLED(CONFIG_IPV6) | 182 | #if IS_ENABLED(CONFIG_IPV6) |
183 | struct bridge_mcast_query ip6_query; | 183 | struct bridge_mcast_own_query ip6_own_query; |
184 | #endif /* IS_ENABLED(CONFIG_IPV6) */ | 184 | #endif /* IS_ENABLED(CONFIG_IPV6) */ |
185 | unsigned char multicast_router; | 185 | unsigned char multicast_router; |
186 | struct timer_list multicast_router_timer; | 186 | struct timer_list multicast_router_timer; |
@@ -282,11 +282,11 @@ struct net_bridge | |||
282 | struct hlist_head router_list; | 282 | struct hlist_head router_list; |
283 | 283 | ||
284 | struct timer_list multicast_router_timer; | 284 | struct timer_list multicast_router_timer; |
285 | struct bridge_mcast_querier ip4_querier; | 285 | struct bridge_mcast_other_query ip4_other_query; |
286 | struct bridge_mcast_query ip4_query; | 286 | struct bridge_mcast_own_query ip4_own_query; |
287 | #if IS_ENABLED(CONFIG_IPV6) | 287 | #if IS_ENABLED(CONFIG_IPV6) |
288 | struct bridge_mcast_querier ip6_querier; | 288 | struct bridge_mcast_other_query ip6_other_query; |
289 | struct bridge_mcast_query ip6_query; | 289 | struct bridge_mcast_own_query ip6_own_query; |
290 | #endif /* IS_ENABLED(CONFIG_IPV6) */ | 290 | #endif /* IS_ENABLED(CONFIG_IPV6) */ |
291 | #endif | 291 | #endif |
292 | 292 | ||
@@ -493,7 +493,7 @@ static inline bool br_multicast_is_router(struct net_bridge *br) | |||
493 | 493 | ||
494 | static inline bool | 494 | static inline bool |
495 | __br_multicast_querier_exists(struct net_bridge *br, | 495 | __br_multicast_querier_exists(struct net_bridge *br, |
496 | struct bridge_mcast_querier *querier) | 496 | struct bridge_mcast_other_query *querier) |
497 | { | 497 | { |
498 | return time_is_before_jiffies(querier->delay_time) && | 498 | return time_is_before_jiffies(querier->delay_time) && |
499 | (br->multicast_querier || timer_pending(&querier->timer)); | 499 | (br->multicast_querier || timer_pending(&querier->timer)); |
@@ -504,10 +504,10 @@ static inline bool br_multicast_querier_exists(struct net_bridge *br, | |||
504 | { | 504 | { |
505 | switch (eth->h_proto) { | 505 | switch (eth->h_proto) { |
506 | case (htons(ETH_P_IP)): | 506 | case (htons(ETH_P_IP)): |
507 | return __br_multicast_querier_exists(br, &br->ip4_querier); | 507 | return __br_multicast_querier_exists(br, &br->ip4_other_query); |
508 | #if IS_ENABLED(CONFIG_IPV6) | 508 | #if IS_ENABLED(CONFIG_IPV6) |
509 | case (htons(ETH_P_IPV6)): | 509 | case (htons(ETH_P_IPV6)): |
510 | return __br_multicast_querier_exists(br, &br->ip6_querier); | 510 | return __br_multicast_querier_exists(br, &br->ip6_other_query); |
511 | #endif | 511 | #endif |
512 | default: | 512 | default: |
513 | return false; | 513 | return false; |