Multicast optimizations for bridges
Subsystems (2)
v14 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 v14:
* replaced compat-sources/net/bridge/br_multicast.c with "static inline [foo]" and #defines in compat-include/linux/if_bridge.h
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 v14 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
@@ -60,6 +60,20 @@#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
Re: [B.A.T.M.A.N.] [PATCHv14 1/4] batman-adv: Always flood IGMP/MLD reports
compat-sources/Makefile line 3
Quoted 6 lines · On Thursday, May 05, 2016 17:07:02 Linus Lüssing wrote:
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
Please only compile the multicast compat code when multicast is compiled into the module.
Cheers,
Marek
PATCH v14 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 | 65 ++++++++++++++ net/batman-adv/multicast.c | 173 ++++++++++++++++++++++++++++++++---- net/batman-adv/types.h | 2 + 4 files changed, 231 insertions(+), 18 deletions(-) create mode 100644 compat-include/linux/if_bridge.h
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 +65 -0
65 lines not on this page · raw message
net/batman-adv/multicast.c +155 -18
246 lines not on this page · raw message
net/batman-adv/types.h +2 -0
@@ -757,6 +757,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
@@ -771,6 +772,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 v14 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
@@ -231,6 +231,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 {
@@ -240,7 +241,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
@@ -808,6 +808,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
@@ -749,12 +749,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
@@ -770,6 +783,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
Re: [B.A.T.M.A.N.] [PATCHv14 3/4] batman-adv: Adding logging of mcast flag changes
Quoted 12 lines · On Thursday, May 05, 2016 17:07:04 Linus Lüssing wrote:
(quoted diff) +2
-0+ querier4.exists = br_multicast_has_querier_anywhere(dev, ETH_P_IP); + querier4.shadowing = br_multicast_has_querier_adjacent(dev,
ETH_P_IP); +
+ querier6.exists = br_multicast_has_querier_anywhere(dev,ETH_P_IPV6); + querier6.shadowing =br_multicast_has_querier_adjacent(dev, ETH_P_IPV6); +mcast_data.flags |= BATADV_MCAST_WANT_ALL_UNSNOOPABLES; /* 1) If no querier exists at all, then multicast listeners on(quoted diff) +0
-0@@ -369,17 +494,26 @@ static bool batadv_mcast_mla_tvlv_update(struct
batadv_priv*bat_priv) * In both cases, we will signalize other batman nodes that * we need all multicast traffic of the according protocol. */
net/batman-adv/multicast.c static bool batadv_mcast_mla_tvlv_update(struct batadv_priv *bat_priv) · line 501
Quoted 9 lines
net/batman-adv/multicast.c +2
-4-if (!br_multicast_has_querier_anywhere (dev,ETH_P_IP ) || -br_multicast_has_querier_adjacent (dev,ETH_P_IP )) +if (!querier4.exists || querier4.shadowing) mcast_data.flags |=BATADV_MCAST_WANT_ALL_IPV4 ; -if (!br_multicast_has_querier_anywhere (dev,ETH_P_IPV6 ) || -br_multicast_has_querier_adjacent (dev,ETH_P_IPV6 )) +if (!querier6.exists || querier6.shadowing) mcast_data.flags |=BATADV_MCAST_WANT_ALL_IPV6 ;
Please move these variable assignments into your previous patch that introduces this section.
Thanks,
Marek
PATCH v14 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 = { \
@@ -407,6 +422,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,
@@ -424,6 +442,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
Re: [B.A.T.M.A.N.] [PATCHv14 4/4] batman-adv: Add debugfs table for mcast flags
Quoted 11 lines · On T hursday, May 05, 2016 17:07:05 Linus Lüssing wrote:
net/batman-adv/multicast.c +10
-0+ flags = orig_node->mcast_flags; + +if (!(orig_node->capabilities & +BATADV_ORIG_CAPA_HAS_MCAST )) { +seq_printf (seq,"%pM -\n" , orig_node->orig); +continue ; + } + + seq_printf(seq, "%pM [%c%c%c]\n", orig_node->orig, + (flags &
BATADV_MCAST_WANT_ALL_UNSNOOPABLES?
net/batman-adv/multicast.c void batadv_mcast_init(struct batadv_priv *bat_priv) · line 1221
Quoted 5 lines
net/batman-adv/multicast.c +5
-0+ 'U' : '.'), + (flags &BATADV_MCAST_WANT_ALL_IPV4 ? +'4' :'.' ), + (flags &BATADV_MCAST_WANT_ALL_IPV6 ? + '6' : '.'));
Little nitpick: Can you please move the flags assignment closer to where it is used.
Thanks!
Marek
Sven Eckelmann
maintainerQuoted 2 lines · On Thursday 05 May 2016 17:07:01 Linus Lüssing wrote:
This patchset can be found in the current linus/multicast-bridge branch.
Please check the attached results of the daily build test scripts.
Kind regards,
Sven
Quoted 5 lines · Sven Eckelmann
Quoted 2 lines · On Thursday 05 May 2016 17:07:01 Linus Lüssing wrote:
This patchset can be found in the current linus/multicast-bridge branch.
Please check the attached results of the daily build test scripts.
Thanks Sven!
Just wanted to note that there seem to be some false positives in there.
"[net/batman-adv/multicast.c:1181]: (style) The function 'batadv_mcast_flags_seq_print_text' is never used." -> used in debugfs.c
Also the header suggestions seem a bit unreliable to me, the following removals are false positives, I think:
* header removals in compat-sources/*
-> breaks compiling
* linux/icmp6.h in multicast.c
-> icmp6_hdr()
* linux/ipv6.h in multicast.c
-> ipv6_hdr()
* net/addrconf.h in multicast.c
-> ipv6_mc_check_mld()
-> ipv6_addr_is_ll_all_nodes()
* net/ip.h in multicast.c
-> ip_eth_mc_map()
* net/ipv6.h in multicast.c
-> IPV6_ADDR_MC_SCOPE
-> IPV6_ADDR_SCOPE_LINKLOCAL
Moving the following includes upwards seems unnecessary:
* linux/if_bridge.h in multicast.c
* linux/igmp.h in multicast.c
The following removals seem correct \o/:
* linux/in6.h in multicast.c
* net/mld.h in multicast.c
Additionally, the following include seems to be missing but wasn't caught by the scripts:
* net/if_inet6.h in multicast.c
-> ipv6_eth_mc_map()
Let me know whether this seems about right. Or whether I am missing #includes in my->head :).
Regards, Linus
PS: I also do not understand the sparse complaints regarding ip_eth_mc_map(). The according include is currently there, seems to compile fine.
Quoted 8 lines · Linus Lüssing
Quoted 5 lines · Sven Eckelmann
Quoted 2 lines · On Thursday 05 May 2016 17:07:01 Linus Lüssing wrote:
This patchset can be found in the current linus/multicast-bridge branch.
Please check the attached results of the daily build test scripts.
Thanks Sven!
Two more questions:
I can ignore return type warnings of sparse for the copy & pasted compat stuff, right?
Can I ignore the namespace checks mentioned in the end of the log? If not, how are they usually resolved for such external functions?
Regards, Linus
Quoted 6 lines · Linus Lüssing
Quoted 5 lines · Sven Eckelmann
Quoted 2 lines · On Thursday 05 May 2016 17:07:01 Linus Lüssing wrote:
This patchset can be found in the current linus/multicast-bridge branch.
Please check the attached results of the daily build test scripts.
Is it possible for the scripts to tell why it wants an include for linux/kernel.h? Currently can't find any function multicast.c might want from it.
Sven Eckelmann
maintainerQuoted 5 lines · On Tuesday 10 May 2016 02:03:11 Linus Lüssing wrote:
Quoted 4 lines · Sven Eckelmann
Quoted 2 lines · On Thursday 05 May 2016 17:07:01 Linus Lüssing wrote:
This patchset can be found in the current linus/multicast-bridge branch.
Quoted 8 lines
Quoted 1 line
Please check the attached results of the daily build test scripts.
Thanks Sven!
Just wanted to note that there seem to be some false positives in there.
"[
net/batman-adv/multicast.c:1181]: (style) The function
'batadv_mcast_flags_seq_print_text' is never used."
Quoted 1 line
-> used in
debugfs.c
Yes, cppcheck has some problems from time to time with it. I can whitelist this function.
Quoted 1 line
Also the header suggestions seem a bit unreliable to me,
I have do disagree here. Usually the person using the script or the person reading the result it unreliable.
For example I forgot to remove the compat-sources changes from the results. It is expected that it doesn't get the headers right here because it builds against 4.5 and the changes in it are not for 4.5. So it will not find code and thus think that it requires no headers.
Quoted 4 lines
the following removals are false positives, I think:
* header removals in compat-sources/*
-> breaks compiling
See above
Quoted 5 lines
*
linux/icmp6.hinmulticast.c
->icmp6_hdr()
*linux/ipv6.hinmulticast.c
->ipv6_hdr()
Quoted 8 lines
*
net/addrconf.hinmulticast.c
->ipv6_mc_check_mld()
->ipv6_addr_is_ll_all_nodes()
*net/ip.hinmulticast.c
->ip_eth_mc_map()
*net/ipv6.hinmulticast.c
->IPV6_ADDR_MC_SCOPE
->IPV6_ADDR_SCOPE_LINKLOCAL
Problem seems to be that your sources don't build at the moment. So most likely you are missing some dependencies like CONFIG_INET (and maybe even more).
The whole thing cannot work when your stuff doesn't build against the headers prepared in build_test. I didn't see that you've added something to Kconfig and thus I haven't rebuild my headers.
Quoted 3 lines
Moving the following includes upwards seems unnecessary:
*linux/if_bridge.hinmulticast.c
*linux/igmp.hinmulticast.c
This seems to be a side effect of how the script works. Moving is not the important part here but just what else is added/removed. But this can be false positives because the stuff doesn't build at the moment (even against 4.5)
[...]
Quoted 3 lines
PS: I also do not understand the sparse complaints regarding
ip_eth_mc_map(). The according include is currently there, seems to compile fine.
See above
Quoted 2 lines
I can ignore return type warnings of sparse for the copy & pasted compat stuff, right?
No, it will be causing build reports every day. Actually, we wanted no build reports when there is no problem (didn't happen since a long time because we never were able to submit all patches to net-next.git/net.git)
Quoted 2 lines
Can I ignore the namespace checks mentioned in the end of the log? If not, how are they usually resolved for such external functions?
There are usually no external functions. You've introduced them :)
But this is most likely an artifact because you're stuff doesn't compile at the moment.
Quoted 3 lines
Is it possible for the scripts to tell why it wants an include for
linux/kernel.h? Currently can't find any functionmulticast.cmight want from it.
I can run it (you can also with the stuff explained some days ago to Antonio
[1] + checking the "test" file).
It seems to be sprintf
Kind regards,
Sven
[1] https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2016-May/015203.html
Sven Eckelmann
maintainerQuoted 14 lines · On Tuesday 10 May 2016 09:43:00 Sven Eckelmann wrote:
Quoted 5 lines
*
linux/icmp6.hinmulticast.c
->icmp6_hdr()
*linux/ipv6.hinmulticast.c
->ipv6_hdr()Quoted 8 lines
*
net/addrconf.hinmulticast.c
->ipv6_mc_check_mld()
->ipv6_addr_is_ll_all_nodes()
*net/ip.hinmulticast.c
->ip_eth_mc_map()
*net/ipv6.hinmulticast.c
->IPV6_ADDR_MC_SCOPE
->IPV6_ADDR_SCOPE_LINKLOCAL
Quoted 3 lines
Problem seems to be that your sources don't build at the moment. So most likely you are missing some dependencies like
CONFIG_INET(and maybe even more).
I haven't checked all the included symbols (you should) but could it be that BRIDGE + IPv6 is also a missing dependency? At least there are some parts
* { 0x18fb237a, __VMLINUX_SYMBOL_STR(netdev_master_upper_dev_get_rcu) },
* { 0x65e57e43, __VMLINUX_SYMBOL_STR(br_multicast_list_adjacent) },
* { 0x671d7cb3, __VMLINUX_SYMBOL_STR(ip_mc_check_igmp) },
* { 0x10cfbe4f, __VMLINUX_SYMBOL_STR(br_multicast_has_querier_anywhere) },
* { 0x1d18dce9, __VMLINUX_SYMBOL_STR(br_multicast_has_querier_adjacent) },
* { 0xaf8ed45, __VMLINUX_SYMBOL_STR(ipv6_mc_check_mld) },
You can find all used symbols of a build module in net/batman-adv/batman-adv.mod.c
Kind regards,
Sven