Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bridge: rename struct bridge_mcast_query/querier

The current naming of these two structs is very random, in that
reversing their naming would not make any semantical difference.

This patch tries to make the naming less confusing by giving them a more
specific, distinguishable naming.

This is also useful for the upcoming patches reintroducing the
"struct bridge_mcast_querier" but for storing information about the
selected querier (no matter if our own or a foreign querier).

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Linus Lüssing and committed by
David S. Miller
90010b36 c4d4c255

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