multicast.c (9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e) | multicast.c (07afe1ba288c04280622fa002ed385f1ac0b6fe6) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* Copyright (C) B.A.T.M.A.N. contributors: 3 * 4 * Linus Lüssing 5 */ 6 7#include "multicast.h" 8#include "main.h" --- 222 unchanged lines hidden (view full) --- 231 232 flags &= batadv_mcast_mla_rtr_flags_softif_get(bat_priv, bridge); 233 flags &= batadv_mcast_mla_rtr_flags_bridge_get(bat_priv, bridge); 234 235 return flags; 236} 237 238/** | 1// SPDX-License-Identifier: GPL-2.0 2/* Copyright (C) B.A.T.M.A.N. contributors: 3 * 4 * Linus Lüssing 5 */ 6 7#include "multicast.h" 8#include "main.h" --- 222 unchanged lines hidden (view full) --- 231 232 flags &= batadv_mcast_mla_rtr_flags_softif_get(bat_priv, bridge); 233 flags &= batadv_mcast_mla_rtr_flags_bridge_get(bat_priv, bridge); 234 235 return flags; 236} 237 238/** |
239 * batadv_mcast_mla_forw_flags_get() - get multicast forwarding flags 240 * @bat_priv: the bat priv with all the soft interface information 241 * 242 * Checks if all active hard interfaces have an MTU larger or equal to 1280 243 * bytes (IPv6 minimum MTU). 244 * 245 * Return: BATADV_MCAST_HAVE_MC_PTYPE_CAPA if yes, BATADV_NO_FLAGS otherwise. 246 */ 247static u8 batadv_mcast_mla_forw_flags_get(struct batadv_priv *bat_priv) 248{ 249 const struct batadv_hard_iface *hard_iface; 250 251 rcu_read_lock(); 252 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) { 253 if (hard_iface->if_status != BATADV_IF_ACTIVE) 254 continue; 255 256 if (hard_iface->soft_iface != bat_priv->soft_iface) 257 continue; 258 259 if (hard_iface->net_dev->mtu < IPV6_MIN_MTU) { 260 rcu_read_unlock(); 261 return BATADV_NO_FLAGS; 262 } 263 } 264 rcu_read_unlock(); 265 266 return BATADV_MCAST_HAVE_MC_PTYPE_CAPA; 267} 268 269/** |
|
239 * batadv_mcast_mla_flags_get() - get the new multicast flags 240 * @bat_priv: the bat priv with all the soft interface information 241 * 242 * Return: A set of flags for the current/next TVLV, querier and 243 * bridge state. 244 */ 245static struct batadv_mcast_mla_flags 246batadv_mcast_mla_flags_get(struct batadv_priv *bat_priv) --- 4 unchanged lines hidden (view full) --- 251 struct net_device *bridge; 252 253 bridge = batadv_mcast_get_bridge(dev); 254 255 memset(&mla_flags, 0, sizeof(mla_flags)); 256 mla_flags.enabled = 1; 257 mla_flags.tvlv_flags |= batadv_mcast_mla_rtr_flags_get(bat_priv, 258 bridge); | 270 * batadv_mcast_mla_flags_get() - get the new multicast flags 271 * @bat_priv: the bat priv with all the soft interface information 272 * 273 * Return: A set of flags for the current/next TVLV, querier and 274 * bridge state. 275 */ 276static struct batadv_mcast_mla_flags 277batadv_mcast_mla_flags_get(struct batadv_priv *bat_priv) --- 4 unchanged lines hidden (view full) --- 282 struct net_device *bridge; 283 284 bridge = batadv_mcast_get_bridge(dev); 285 286 memset(&mla_flags, 0, sizeof(mla_flags)); 287 mla_flags.enabled = 1; 288 mla_flags.tvlv_flags |= batadv_mcast_mla_rtr_flags_get(bat_priv, 289 bridge); |
290 mla_flags.tvlv_flags |= batadv_mcast_mla_forw_flags_get(bat_priv); |
|
259 260 if (!bridge) 261 return mla_flags; 262 263 dev_put(bridge); 264 265 mla_flags.bridged = 1; 266 qr4 = &mla_flags.querier_ipv4; --- 534 unchanged lines hidden (view full) --- 801 * 802 * Whenever the multicast TVLV flags this node announces change, this function 803 * should be used to notify userspace about the change. 804 */ 805static void batadv_mcast_flags_log(struct batadv_priv *bat_priv, u8 flags) 806{ 807 bool old_enabled = bat_priv->mcast.mla_flags.enabled; 808 u8 old_flags = bat_priv->mcast.mla_flags.tvlv_flags; | 291 292 if (!bridge) 293 return mla_flags; 294 295 dev_put(bridge); 296 297 mla_flags.bridged = 1; 298 qr4 = &mla_flags.querier_ipv4; --- 534 unchanged lines hidden (view full) --- 833 * 834 * Whenever the multicast TVLV flags this node announces change, this function 835 * should be used to notify userspace about the change. 836 */ 837static void batadv_mcast_flags_log(struct batadv_priv *bat_priv, u8 flags) 838{ 839 bool old_enabled = bat_priv->mcast.mla_flags.enabled; 840 u8 old_flags = bat_priv->mcast.mla_flags.tvlv_flags; |
809 char str_old_flags[] = "[.... . ]"; | 841 char str_old_flags[] = "[.... . .]"; |
810 | 842 |
811 sprintf(str_old_flags, "[%c%c%c%s%s]", | 843 sprintf(str_old_flags, "[%c%c%c%s%s%c]", |
812 (old_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES) ? 'U' : '.', 813 (old_flags & BATADV_MCAST_WANT_ALL_IPV4) ? '4' : '.', 814 (old_flags & BATADV_MCAST_WANT_ALL_IPV6) ? '6' : '.', 815 !(old_flags & BATADV_MCAST_WANT_NO_RTR4) ? "R4" : ". ", | 844 (old_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES) ? 'U' : '.', 845 (old_flags & BATADV_MCAST_WANT_ALL_IPV4) ? '4' : '.', 846 (old_flags & BATADV_MCAST_WANT_ALL_IPV6) ? '6' : '.', 847 !(old_flags & BATADV_MCAST_WANT_NO_RTR4) ? "R4" : ". ", |
816 !(old_flags & BATADV_MCAST_WANT_NO_RTR6) ? "R6" : ". "); | 848 !(old_flags & BATADV_MCAST_WANT_NO_RTR6) ? "R6" : ". ", 849 !(old_flags & BATADV_MCAST_HAVE_MC_PTYPE_CAPA) ? 'P' : '.'); |
817 818 batadv_dbg(BATADV_DBG_MCAST, bat_priv, | 850 851 batadv_dbg(BATADV_DBG_MCAST, bat_priv, |
819 "Changing multicast flags from '%s' to '[%c%c%c%s%s]'\n", | 852 "Changing multicast flags from '%s' to '[%c%c%c%s%s%c]'\n", |
820 old_enabled ? str_old_flags : "<undefined>", 821 (flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES) ? 'U' : '.', 822 (flags & BATADV_MCAST_WANT_ALL_IPV4) ? '4' : '.', 823 (flags & BATADV_MCAST_WANT_ALL_IPV6) ? '6' : '.', 824 !(flags & BATADV_MCAST_WANT_NO_RTR4) ? "R4" : ". ", | 853 old_enabled ? str_old_flags : "<undefined>", 854 (flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES) ? 'U' : '.', 855 (flags & BATADV_MCAST_WANT_ALL_IPV4) ? '4' : '.', 856 (flags & BATADV_MCAST_WANT_ALL_IPV6) ? '6' : '.', 857 !(flags & BATADV_MCAST_WANT_NO_RTR4) ? "R4" : ". ", |
825 !(flags & BATADV_MCAST_WANT_NO_RTR6) ? "R6" : ". "); | 858 !(flags & BATADV_MCAST_WANT_NO_RTR6) ? "R6" : ". ", 859 !(flags & BATADV_MCAST_HAVE_MC_PTYPE_CAPA) ? 'P' : '.'); |
826} 827 828/** 829 * batadv_mcast_mla_flags_update() - update multicast flags 830 * @bat_priv: the bat priv with all the soft interface information 831 * @flags: flags indicating the new multicast state 832 * 833 * Updates the own multicast tvlv with our current multicast related settings, --- 981 unchanged lines hidden (view full) --- 1815 * batadv_mcast_init() - initialize the multicast optimizations structures 1816 * @bat_priv: the bat priv with all the soft interface information 1817 */ 1818void batadv_mcast_init(struct batadv_priv *bat_priv) 1819{ 1820 batadv_tvlv_handler_register(bat_priv, batadv_mcast_tvlv_ogm_handler, 1821 NULL, NULL, BATADV_TVLV_MCAST, 2, 1822 BATADV_TVLV_HANDLER_OGM_CIFNOTFND); | 860} 861 862/** 863 * batadv_mcast_mla_flags_update() - update multicast flags 864 * @bat_priv: the bat priv with all the soft interface information 865 * @flags: flags indicating the new multicast state 866 * 867 * Updates the own multicast tvlv with our current multicast related settings, --- 981 unchanged lines hidden (view full) --- 1849 * batadv_mcast_init() - initialize the multicast optimizations structures 1850 * @bat_priv: the bat priv with all the soft interface information 1851 */ 1852void batadv_mcast_init(struct batadv_priv *bat_priv) 1853{ 1854 batadv_tvlv_handler_register(bat_priv, batadv_mcast_tvlv_ogm_handler, 1855 NULL, NULL, BATADV_TVLV_MCAST, 2, 1856 BATADV_TVLV_HANDLER_OGM_CIFNOTFND); |
1857 batadv_tvlv_handler_register(bat_priv, NULL, NULL, 1858 batadv_mcast_forw_tracker_tvlv_handler, 1859 BATADV_TVLV_MCAST_TRACKER, 1, 1860 BATADV_TVLV_HANDLER_OGM_CIFNOTFND); |
|
1823 1824 INIT_DELAYED_WORK(&bat_priv->mcast.work, batadv_mcast_mla_update); 1825 batadv_mcast_start_timer(bat_priv); 1826} 1827 1828/** 1829 * batadv_mcast_mesh_info_put() - put multicast info into a netlink message 1830 * @msg: buffer for the message --- 266 unchanged lines hidden --- | 1861 1862 INIT_DELAYED_WORK(&bat_priv->mcast.work, batadv_mcast_mla_update); 1863 batadv_mcast_start_timer(bat_priv); 1864} 1865 1866/** 1867 * batadv_mcast_mesh_info_put() - put multicast info into a netlink message 1868 * @msg: buffer for the message --- 266 unchanged lines hidden --- |