Multicast optimizations for bridges
Subsystems (2)
v13 cover Multicast optimizations for bridges
This patchset enables the usage of the batman-adv multicast optimizations for scenarios involving bridges on top of e.g. bat0, too.
The first one alters the forwarding behaviour for IGMP and MLD reports which is a prerequisite before enabling multicast optimizations in bridged setups. It also increases the MCAST TVLV version number to 2. More on the issue of insufficient report handling with the v1 MCAST TVLV can be found here:
http://www.open-mesh.org/projects/batman-adv/wiki/Multicast-optimizations-listener-reports
The second patch finally enables the multicast optimizations for bridged setups.
Along come two more patches adding according debugging facilities to make it possible for the user to check why the multicast optimizations might not work ideally to give hints about what they might change about their topology.
This patchset can be found in the current linus/multicast-bridge branch.
Cheers, Linus
-----
Changes in v13:
* Substituted a non-breaking space with a boring one
* Dropped compat code for kernels < 3.2
* Removed mcast tvlv container and handler support for v1 completely
* Rebase to current master branch
(automatic 3-way merge without issues)
Changes in v12:
* Rebase to current master branch
(automatic 3-way merge, then batadv_hardif_free_ref() -> batadv_hardif_put())
* Adding Linux upstream fix to compat-sources/net/core/skbuff.c
-> "net: fix bridge multicast packet checksum validation"
(9b368814b33, present since v4.5, queued for stable)
Changes in v11:
* Rewording of commit messages (PATCH 1/4+2/4)
* Rebasing to master (solving conflict with kernel doc "return" changes)
* Updating kerneldoc to proper "Return:" syntax
* Using eth_zero_addr() over memset (fixes a new checkpatch warning)
* Changing uint8_t to u8 and uint32_t to u32 (fixes new checkpatch warnings)
* Turning some batadv_dbg() into batadv_info(), making querier presence more visible (i.e. in dmesg too) (PATCH 3/4)
Changes in v10:
- PATCH 1/4:
* Former "[PATCH 4/4] batman-adv: Forward IGMP/MLD reports to selected querier (only)" substituted by the interim branch "batman-adv: Always flood IGMP/MLD reports" with the following changes:
* Increased compatibility to mcast-v1-tvlv nodes by
registering a v1 tvlv container and handler, too
(note: PATCH 2/4 needs to still unregister the handler
if the node is bridged bc. it can't "trust" v1 nodes)
* Removed skb_set_network_header() call
(extra patch pending for review for maint)
* Compared to patchset v9 this substitution makes things
compilable again for kernels < 2.6.35
- PATCH 2/4:
* Moved enum introduction of BATADV_DBG_MCAST to PATCH 3/4,
not needed in PATCH 2/4 yet
* Adjusted compat code to new compat layout
* Adjustments to batadv_mcast_mla_tvlv_update() to fit now
preceding PATCH 1/4
* bat_priv->mcast.bridged flag already introduced here
(instead of in PATCH 3/4) because we need it for the new
mcast-v1-tvlv handling
---
Interim Changlog of
"batman-adv: Always flood IGMP/MLD reports"
v1:
* Removed query snooping and state
* Squashed all three patches into one
* Renamed "batadv_mcast_tvlv_ogm_handler_v1()" to *_v2()
* Added explicit icmpv6.h include
* Rebased on top of master
-----
Interim Interim Changelog of
"batman-adv: Unicasting multicast reports to querier-node only" v6:
* compat: copied copyright headers from original upstream c files
* compat: unified ordering in compat c files:
-> copyright header, then includes, then kernel specific functions
v5:
* Removed RFC tag: Needed exports got merged to net-next and are going to be available with Linux 4.2
* Redid compat solution - now fully backwards compatible down to 2.6.33
v4:
* excluded bridge part from this patchset, they should
hopefully be added to net-next soon
* Added a compat solution (PATCH 3/3)
* Removed Kconfig-depends as by David's suggestion the needed parsing functions for MLD are going to be forced built-ins even if IPv6 is going to be built as a module
* Removed unused variable 'int ret' in batadv_mcast_is_report_ipv6()
* Adjusted to new folder structure
v3:
* Adding Kconfig-depends and #if's
(so basically adding similar dependancy constraints as the bridge code
has, except that there are no depends if batman-adv gets compiled without multicast optimizations)
-> the case of IPv6=M and batman-adv=y is still impossible if multicast
optimizations are enabled; but I don't see the practical demand for that either - people who use IPv6 as a module will probably also want to use batman-adv as a module
v2:
* various bugfixes (now runtime tested, too - should(tm) work)
* added netdev+bridge mailinglists
-----
---
Changes in v9:
- PATCH 1/4:
* fix: added compat code for pr_warn_once()
* compat fix for bridge export stubs: fixes compile error with kernels < 3.16 without bridge (snooping) support
- PATCH 2/4:
* perform updates of variables within bat_priv->mcast.querier_ipv{4,6} individually (there's a new, third member in 4/4 which shouldn't be overriden)
* PATCH 4/4: NEW
Changes in v8 (thanks to Simon's suggestions):
- PATCH 2/3:
* print shadowing status log of an appearing and shadowing querier, too (the bridge-querier-existence call has an additional 10s delay to ensure reports had their time to arrive -
the bridge-querier-port call doesn't have that)
- PATCH 3/3:
* changing debugfs output from "+" and "-" to "U/4/6" and "."
* fixing "no querier present" logic (introduced in [PATCHv7 3/3])
Changes in v7 (thanks to Simon's suggestions):
- PATCH 2/3:
* renaming old/new_querier to old/new_state
* slightly extended kerneldoc of batadv_mcast_querier_log()
* removing words "good" and "bad" from debug output
* simplified batadv_mcast_flags_log()
* assignment instead of memset in batadv_mcast_mla_tvlv_update() and batadv_softif_init_late()
* simple struct member assignments instead of one complex struct assigment
* removing unnecessary memcmp's
* substituting return statement for an if-block in batadv_mcast_querier_log() and batadv_mcast_bridge_log()
* print "Unsnoopables(U)-flag" instead of just "U-flag"
- PATCH 3/3:
* use bat_priv values instead of querying bridge ABI in batadv_mcast_flags_print_header()
Changes in v6:
* New PATCH 2/3 inserted, moving logging to separate patch
* More verbose logging added to PATCH 2/3:
Bridge and querier state changes are logged too
* upper case to lower case for kernel doc of batadv_mcast_flags_open (PATCH 2/3)
* Adding note to kernel doc of batadv_mcast_get_bridge about increased refcount (PATCH 1/3)
* Printing some lines about current bridge and querier state to debugfs too (PATCH 3/3)
Changes in v5 (PATCH 2/2 only):
* s/dat_cache/mcast_flags/ in kerneldoc (copy&paste error)
Changes in v4 (PATCH 2/2 only):
* initial {ad,e}dition of this patch
Changes in v3 (PATCH 1/2 only):
* Removed "RFC" tag in title again: The stubs and new export are upstream in net-next and therefore going to be included in 3.17
* Added some debug output:
* Two warning messages:
-> Old kernel version or no bridge IGMP/MLD snooping compiled
* New batman-adv log-level "mcast":
-> Logging mcast flag changes (a third debugging facility, a new table for debugfs for a global
mcast flag overview will be added in a separate patch later as discussed with Simon)
Changes in v2 (PATCH 1/2 only):
* fetching local (= on this same kernel) multicast listeners from the bridge instead of the bat0 interface if a bridge is present
- just like ip addresses and routes should be used from br0, the same goes for multicast listeners
* beautification of batadv_mcast_mla_br_addr_cpy(), now using already present functions from the kernel instead of own, hackish approach
* changed names of some goto-labels (not using "skip" anymore)
* using new, third bridge multicast export (because this export is not upstream yet, I've added the "RFC" in the title):
br_multicast_has_querier_anywhere()
* adding compat stubs for two bridge multicast exports, to make batman-adv compile- and usable even if a 3.16 kernel was compiled without bridge code - the stubs are supposed to be upstream in the bridge code in 3.17 (therefore just 'compat')
* updated kerneldocs for batadv_mcast_mla_bridge_get() and batadv_mcast_mla_softif_get()
* The two sentences in the commit message starting with "Queriers: ..." were slightly modified to include the third bridge multicast export
PATCH v13 1/4 batman-adv: Always flood IGMP/MLD reports
With this patch IGMP or MLD reports are always flooded. This is necessary for the upcoming bridge integration to function without multicast packet loss.
With the report handling so far bridges might miss interested multicast listeners, leading to wrongly excluding ports from multicast packet forwarding.
Currently we are treating IGMP/MLD reports, the messages bridges use to learn about interested multicast listeners, just as any other multicast
packet: We try to send them to nodes matching its multicast destination.
Unfortunately, the destination address of reports of the older IGMPv2/MLDv1 protocol families do not strictly adhere to their own
protocol: More precisely, the interested receiver, an IGMPv2 or MLDv1 querier, itself usually does not listen to the multicast destination address of any reports.
Therefore with this patch we are simply excluding IGMP/MLD reports from the multicast forwarding code path and keep flooding them. By that any bridge receives them and can properly learn about listeners.
To avoid compatibility issues with older nodes not yet implementing this report handling, we need to force them to flood reports: We do this by bumping the multicast TVLV version to 2, effectively disabling their multicast optimization.
--- Makefile | 4 + compat-include/linux/igmp.h | 13 ++ compat-include/linux/skbuff.h | 14 ++ compat-include/net/addrconf.h | 13 ++ compat-include/net/ip6_checksum.h | 18 +++ compat-include/net/ipv6.h | 17 +++ compat-sources/Makefile | 3 + compat-sources/net/core/skbuff.c | 214 +++++++++++++++++++++++++++++ compat-sources/net/ipv4/igmp.c | 241 +++++++++++++++++++++++++++++++++ compat-sources/net/ipv6/mcast_snoop.c | 216 +++++++++++++++++++++++++++++ net/batman-adv/multicast.c | 86 ++++++++++-- 11 files changed, 827 insertions(+), 12 deletions(-) create mode 100644 compat-include/linux/igmp.h create mode 100644 compat-include/net/addrconf.h create mode 100644 compat-include/net/ip6_checksum.h create mode 100644 compat-include/net/ipv6.h create mode 100644 compat-sources/Makefile create mode 100644 compat-sources/net/core/skbuff.c create mode 100644 compat-sources/net/ipv4/igmp.c create mode 100644 compat-sources/net/ipv6/mcast_snoop.c
Makefile +4 -0
@@ -52,6 +52,10 @@ ifneq ($(REVISION),) NOSTDINC_FLAGS += -DBATADV_SOURCE_VERSION=\"$(REVISION)\" endif +include $(PWD)/compat-sources/Makefile + +export batman-adv-y + BUILD_FLAGS := \ M=$(PWD)/net/batman-adv \ CONFIG_BATMAN_ADV=m \
compat-include/linux/igmp.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_IGMP_H_ +#define _NET_BATMAN_ADV_COMPAT_LINUX_IGMP_H_ + +#include <linux/version.h> +#include_next <linux/igmp.h> + +#if LINUX_VERSION_CODE <KERNEL_VERSION (4 ,2 ,0 ) + +int ip_mc_check_igmp (struct sk_buff *skb,struct sk_buff **skb_trimmed); + +#endif /* < KERNEL_VERSION(4, 2, 0) */ + +#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_IGMP_H_ */
compat-include/linux/skbuff.h +14 -0
@@ -89,6 +89,20 @@ static inline void skb_reset_mac_len(struct sk_buff *skb)#define pskb_copy_for_clone pskb_copy +__sum16 skb_checksum_simple_validate (struct sk_buff *skb); + +__sum16 +skb_checksum_validate (struct sk_buff *skb,int proto, +__wsum (*compute_pseudo)(struct sk_buff *skb,int proto)); +#endif /* < KERNEL_VERSION(3, 16, 0) */ +#if LINUX_VERSION_CODE <KERNEL_VERSION (4 ,2 ,0 ) + +struct sk_buff *skb_checksum_trimmed (struct sk_buff *skb, +unsigned int transport_len, +__sum16 (*skb_chkf)(struct sk_buff *skb)); + +#endif /* < KERNEL_VERSION(4, 2, 0) */ +#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_SKBUFF_H_ */
compat-include/net/addrconf.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef _NET_BATMAN_ADV_COMPAT_NET_ADDRCONF_H_ +#define _NET_BATMAN_ADV_COMPAT_NET_ADDRCONF_H_ + +#include <linux/version.h> +#include_next <net/addrconf.h> + +#if LINUX_VERSION_CODE <KERNEL_VERSION (4 ,2 ,0 ) + +int ipv6_mc_check_mld (struct sk_buff *skb,struct sk_buff **skb_trimmed); + +#endif /* < KERNEL_VERSION(4, 2, 0) */ + +#endif /* _NET_BATMAN_ADV_COMPAT_NET_ADDRCONF_H_ */
compat-include/net/ip6_checksum.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef _NET_BATMAN_ADV_COMPAT_NET_IP6_CHECKSUM_H_ +#define _NET_BATMAN_ADV_COMPAT_NET_IP6_CHECKSUM_H_ + +#include <linux/version.h> +#include_next <net/ip6_checksum.h> + +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,16 ,0 ) + +static inline __wsum ip6_compute_pseudo (struct sk_buff *skb,int proto) +{ +return ~csum_unfold (csum_ipv6_magic (&ipv6_hdr (skb)->saddr, + &ipv6_hdr (skb)->daddr, + skb->len, proto,0 )); +} + +#endif /* < KERNEL_VERSION(3, 16, 0) */ + +#endif /* _NET_BATMAN_ADV_COMPAT_NET_IP6_CHECKSUM_H_ */
compat-include/net/ipv6.h new file +17 -0
@@ -0,0 +1,17 @@ +#ifndef _NET_BATMAN_ADV_COMPAT_NET_IPV6_H_ +#define _NET_BATMAN_ADV_COMPAT_NET_IPV6_H_ + +#include <linux/version.h> +#include_next <net/ipv6.h> + +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,3 ,0 ) + +#define ipv6_skip_exthdr (skb, start, nexthdrp, frag_offp) \ + ({ \ + (void)frag_offp; \ + ipv6_skip_exthdr(skb, start, nexthdrp); \ + }) + +#endif /* < KERNEL_VERSION(3, 3, 0) */ + +#endif /* _NET_BATMAN_ADV_COMPAT_NET_IPV6_H_ */
compat-sources/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +batman-adv-y += ../../compat-sources/net/core/skbuff.o +batman-adv-y += ../../compat-sources/net/ipv4/igmp.o +batman-adv-y += ../../compat-sources/net/ipv6/mcast_snoop.o
compat-sources/net/core/skbuff.c new file +214 -0
214 lines not on this page · raw message
compat-sources/net/ipv4/igmp.c new file +241 -0
241 lines not on this page · raw message
compat-sources/net/ipv6/mcast_snoop.c new file +216 -0
216 lines not on this page · raw message
net/batman-adv/multicast.c +74 -12
174 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH v13 2/4 batman-adv: Add multicast optimization support for bridged setups
In reply to Linus LüssingWith this patch we are finally able to support multicast optimizations in bridged setups, too. So far, if a bridge was added on top of a soft-interface (e.g. bat0) the batman-adv multicast optimizations needed to be disabled to avoid packetloss.
Current Linux bridge implementations and API can now provide us with the so far missing information about interested but "remote" multicast receivers behind bridge ports.
The Linux bridge performs the detection of remote participants interested in multicast packets with its own and mature so called IGMP and MLD snooping code and stores that in its database. With the new API provided by the bridge batman-adv can now simply hook into this database.
We then reliably announce the gathered multicast listeners to other nodes through the batman-adv translation table.
Additionally, the Linux bridge provides us with the information about whether an IGMP/MLD querier exists. If there is none then we need to disable multicast optimizations as we cannot learn about multicast listeners on external, bridged-in host then.
--- compat-include/linux/etherdevice.h | 9 ++ compat-include/linux/if_bridge.h | 37 +++++++ compat-sources/Makefile | 1 + compat-sources/net/bridge/br_multicast.c | 33 ++++++ net/batman-adv/multicast.c | 173 ++++++++++++++++++++++++++---- net/batman-adv/types.h | 2 + 6 files changed, 237 insertions(+), 18 deletions(-) create mode 100644 compat-include/linux/if_bridge.h create mode 100644 compat-sources/net/bridge/br_multicast.c
compat-include/linux/etherdevice.h +9 -0
@@ -35,6 +35,15 @@ static inline void batadv_eth_hw_addr_random(struct net_device *dev)#endif /* < KERNEL_VERSION(3, 4, 0) */ +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,7 ,0 ) + +static inline void eth_zero_addr (u8 *addr) +{ +memset (addr,0x00 ,ETH_ALEN ); +} + +#endif /* < KERNEL_VERSION(3, 7, 0) */ +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,14 ,0 )#define ether_addr_equal_unaligned (_a, _b) (memcmp(_a, _b, ETH_ALEN) == 0)
compat-include/linux/if_bridge.h new file +37 -0
@@ -0,0 +1,37 @@ +#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_IF_BRIDGE_H_ +#define _NET_BATMAN_ADV_COMPAT_LINUX_IF_BRIDGE_H_ + +#include <linux/version.h> +#include_next <linux/if_bridge.h> + +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,16 ,0 ) + +int br_multicast_list_adjacent (struct net_device *dev, +struct list_head *br_ip_list); +bool br_multicast_has_querier_adjacent (struct net_device *dev,int proto); + +struct br_ip { +union { +__be32 ip4; +#if IS_ENABLED (CONFIG_IPV6 ) +struct in6_addr ip6; +#endif + } u; +__be16 proto; +__u16 vid; +}; + +struct br_ip_list { +struct list_head list; +struct br_ip addr; +}; + +#endif /* < KERNEL_VERSION(3, 16, 0) */ + +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,17 ,0 ) + +bool br_multicast_has_querier_anywhere (struct net_device *dev,int proto); + +#endif /* < KERNEL_VERSION(3, 17, 0) */ + +#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_IF_BRIDGE_H_ */
compat-sources/Makefile +1 -0
@@ -1,3 +1,4 @@ batman-adv-y += ../../compat-sources/net/core/skbuff.o batman-adv-y += ../../compat-sources/net/ipv4/igmp.o batman-adv-y += ../../compat-sources/net/ipv6/mcast_snoop.o +batman-adv-y += ../../compat-sources/net/bridge/br_multicast.o
compat-sources/net/bridge/br_multicast.c new file +33 -0
@@ -0,0 +1,33 @@ +#include <linux/if_bridge.h> +#include <linux/printk.h> + +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,16 ,0 ) || \ +LINUX_VERSION_CODE ==KERNEL_VERSION (3 ,16 ,0 ) && \ + (!IS_ENABLED (CONFIG_BRIDGE ) || \ + !IS_ENABLED (CONFIG_BRIDGE_IGMP_SNOOPING )) + +int br_multicast_list_adjacent (struct net_device *dev, +struct list_head *br_ip_list) +{ +return 0 ; +} + +bool br_multicast_has_querier_adjacent (struct net_device *dev,int proto) +{ +return false; +} + +#endif /* < KERNEL_VERSION(3, 16, 0) || +* !IS_ENABLED(CONFIG_BRIDGE) || +* !IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) */ + +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,17 ,0 ) + +bool br_multicast_has_querier_anywhere (struct net_device *dev,int proto) +{ +pr_warn_once ("Old kernel detected (< 3.17) - multicast optimizations disabled\n" ); + +return false; +} + +#endif /* < KERNEL_VERSION(3, 17, 0) */
net/batman-adv/multicast.c +155 -18
246 lines not on this page · raw message
net/batman-adv/types.h +2 -0
@@ -751,6 +751,7 @@ struct batadv_priv_dat {* @want_all_ipv6_list: a list of orig_nodes wanting all IPv6 multicast traffic * @flags: the flags we have last sent in our mcast tvlv * @enabled: whether the multicast tvlv is currently enabled +* @bridged: whether the soft interface has a bridge on top * @num_disabled: number of nodes that have no mcast tvlv * @num_want_all_unsnoopables: number of nodes wanting unsnoopable IP traffic * @num_want_all_ipv4: counter for items in want_all_ipv4_list
@@ -765,6 +766,7 @@ struct batadv_priv_mcast {struct hlist_head want_all_ipv6_list;u8 flags;bool enabled; +bool bridged;atomic_t num_disabled;atomic_t num_want_all_unsnoopables;atomic_t num_want_all_ipv4;
Signature · 1 line
1.7.10.4
PATCH v13 3/4 batman-adv: Adding logging of mcast flag changes
In reply to Linus LüssingWith this patch changes relevant to a node's own multicast flags are printed to the 'mcast' log level.
--- net/batman-adv/main.h | 4 +- net/batman-adv/multicast.c | 146 +++++++++++++++++++++++++++++++++++++-- net/batman-adv/soft-interface.c | 4 ++ net/batman-adv/types.h | 15 ++++ 4 files changed, 162 insertions(+), 7 deletions(-)
net/batman-adv/main.h +3 -1
@@ -227,6 +227,7 @@ __be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr);* @BATADV_DBG_BLA: bridge loop avoidance messages * @BATADV_DBG_DAT: ARP snooping and DAT related messages * @BATADV_DBG_NC: network coding related messages +* @BATADV_DBG_MCAST: multicast related messages * @BATADV_DBG_ALL: the union of all the above log levels */ enum batadv_dbg_level {
@@ -236,7 +237,8 @@ enum batadv_dbg_level {BATADV_DBG_BLA =BIT (3 ),BATADV_DBG_DAT =BIT (4 ),BATADV_DBG_NC =BIT (5 ), - BATADV_DBG_ALL = 63, +BATADV_DBG_MCAST =BIT (6 ), + BATADV_DBG_ALL = 127, };#ifdef CONFIG_BATMAN_ADV_DEBUG
net/batman-adv/multicast.c +140 -6
182 lines not on this page · raw message
net/batman-adv/soft-interface.c +4 -0
@@ -791,6 +791,10 @@ static int batadv_softif_init_late(struct net_device *dev)atomic_set (&bat_priv->distributed_arp_table,1 );#endif #ifdef CONFIG_BATMAN_ADV_MCAST + bat_priv->mcast.querier_ipv4.exists = false; + bat_priv->mcast.querier_ipv4.shadowing = false; + bat_priv->mcast.querier_ipv6.exists = false; + bat_priv->mcast.querier_ipv6.shadowing = false; bat_priv->mcast.flags =BATADV_NO_FLAGS ;atomic_set (&bat_priv->multicast_mode,1 );atomic_set (&bat_priv->mcast.num_disabled,0 );
net/batman-adv/types.h +15 -0
@@ -743,12 +743,25 @@ struct batadv_priv_dat {#ifdef CONFIG_BATMAN_ADV_MCAST /** +* struct batadv_mcast_querier_state - IGMP/MLD querier state when bridged +* @exists: whether a querier exists in the mesh +* @shadowing: if a querier exists, whether it is potentially shadowing +* multicast listeners (i.e. querier is behind our own bridge segment) +*/ +struct batadv_mcast_querier_state { +bool exists; +bool shadowing; +}; + +/** * struct batadv_priv_mcast - per mesh interface mcast data * @mla_list: list of multicast addresses we are currently announcing via TT * @want_all_unsnoopables_list: a list of orig_nodes wanting all unsnoopable * multicast traffic * @want_all_ipv4_list: a list of orig_nodes wanting all IPv4 multicast traffic * @want_all_ipv6_list: a list of orig_nodes wanting all IPv6 multicast traffic +* @querier_ipv4: the current state of an IGMP querier in the mesh +* @querier_ipv6: the current state of an MLD querier in the mesh * @flags: the flags we have last sent in our mcast tvlv * @enabled: whether the multicast tvlv is currently enabled * @bridged: whether the soft interface has a bridge on top
@@ -764,6 +777,8 @@ struct batadv_priv_mcast {struct hlist_head want_all_unsnoopables_list;struct hlist_head want_all_ipv4_list;struct hlist_head want_all_ipv6_list; +struct batadv_mcast_querier_state querier_ipv4; +struct batadv_mcast_querier_state querier_ipv6;u8 flags;bool enabled;bool bridged;
Signature · 1 line
1.7.10.4
PATCH v13 4/4 batman-adv: Add debugfs table for mcast flags
In reply to Linus LüssingThis patch adds a debugfs table with originators and their according multicast flags to help users figure out why multicast optimizations might be enabled or disabled for them.
--- net/batman-adv/debugfs.c | 21 +++++++++ net/batman-adv/multicast.c | 101 ++++++++++++++++++++++++++++++++++++++++++++ net/batman-adv/multicast.h | 2 + 3 files changed, 124 insertions(+)
net/batman-adv/debugfs.c +21 -0
@@ -48,6 +48,7 @@#include "distributed-arp-table.h" #include "gateway_client.h" #include "icmp_socket.h" +#include "multicast.h" #include "network-coding.h" #include "originator.h" #include "translation-table.h"
@@ -363,6 +364,20 @@ static int batadv_nc_nodes_open(struct inode *inode, struct file *file) }#endif +#ifdef CONFIG_BATMAN_ADV_MCAST +/** +* batadv_mcast_flags_open - prepare file handler for reads from mcast_flags +* @inode: inode which was opened +* @file: file handle to be initialized +*/ +static int batadv_mcast_flags_open (struct inode *inode,struct file *file) +{ +struct net_device *net_dev = (struct net_device *)inode->i_private; + +return single_open (file, batadv_mcast_flags_seq_print_text, net_dev); +} +#endif +#define BATADV_DEBUGINFO (_name, _mode, _open) \ struct batadv_debuginfo batadv_debuginfo_##_name = { \ .attr = { .name = __stringify(_name), \
@@ -404,6 +419,9 @@ static BATADV_DEBUGINFO(transtable_local, S_IRUGO,#ifdef CONFIG_BATMAN_ADV_NC static BATADV_DEBUGINFO(nc_nodes, S_IRUGO, batadv_nc_nodes_open);#endif +#ifdef CONFIG_BATMAN_ADV_MCAST +static BATADV_DEBUGINFO(mcast_flags, S_IRUGO, batadv_mcast_flags_open); +#endif static struct batadv_debuginfo *batadv_mesh_debuginfos[] = { &batadv_debuginfo_neighbors,
@@ -421,6 +439,9 @@ static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {#ifdef CONFIG_BATMAN_ADV_NC &batadv_debuginfo_nc_nodes,#endif +#ifdef CONFIG_BATMAN_ADV_MCAST + &batadv_debuginfo_mcast_flags, +#endif NULL, };
net/batman-adv/multicast.c +101 -0
113 lines not on this page · raw message
net/batman-adv/multicast.h +2 -0
@@ -46,6 +46,8 @@ batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,void batadv_mcast_init (struct batadv_priv *bat_priv); +int batadv_mcast_flags_seq_print_text (struct seq_file *seq,void *offset); +void batadv_mcast_free (struct batadv_priv *bat_priv);void batadv_mcast_purge_orig (struct batadv_orig_node *orig_node);
Signature · 1 line
1.7.10.4
Quoted 6 lines · Linus Lüssing
Changes in v13:
* Substituted a non-breaking space with a boring one
* Dropped compat code for kernels < 3.2
* Removed mcast tvlv container and handler support for v1 completely
* Rebase to current master branch
(automatic 3-way merge without issues)
The last changes in v13 are just compile and not runtime tested so far. Hopefully will do this within the next few days. But, ehm, should be minor anyways (..., which were the last words he mumbled before stepping on the deadly null pointer :P).
But I thought, it might be a good idea to mail them already in case Simon wants to do his testing in parallel this weekend :).
Regards, Linus
Hi,
Quoted 21 lines · On Tuesday 19 April 2016 04:10:35 Linus Lüssing wrote:
This patchset enables the usage of the batman-adv multicast optimizations for scenarios involving bridges on top of e.g. bat0, too.
The first one alters the forwarding behaviour for IGMP and MLD reports which is a prerequisite before enabling multicast optimizations in bridged setups. It also increases the MCAST TVLV version number to 2. More on the issue of insufficient report handling with the v1 MCAST TVLV can be found here:
http://www.open-mesh.org/projects/batman-adv/wiki/Multicast-optimizations-li
stener-reportsThe second patch finally enables the multicast optimizations for bridged setups.
Along come two more patches adding according debugging facilities to make it possible for the user to check why the multicast optimizations might not work ideally to give hints about what they might change about their topology.
Quoted 4 lines
This patchset can be found in the current linus/multicast-bridge branch.
Cheers, Linus
I've tested this patchset in my virtual environment with 6 nodes (based on OpenWRT), where 3 of them were meshed and another 3 were connected to each of the mesh nodes through a bridge. I've run the querier on various nodes, used the simple multicast listener [1] to create an IPv6 listener and verified that the querier detection and multicast forwarding was working as expected. There was a kernel bug which created problems with the querier detection (detected as enabled/disabled every 2 minutes or so), but Linus fixed that problem [2], and since the fix is targeted for stable I don't think it is an obstacle for us.
I've also checked the code briefly and didn't find any problems.
There is one last comment from Sven on v12 on the compat part which needs some attention, but other than that I think it is ready to merge.
Feel free to add
to the patches.
Thanks,
Simon
[1] https://github.com/T-X/sm-listener
[2] https://lkml.org/lkml/2016/5/3/780