Hi Jakub, hi David,
here is a feature/cleanup pull request of batman-adv to go into net-next.
Please pull or let me know of any problem!
Thank you,
Simon
The following changes since commit 88603b6dc419445847923fcb7fe5080067a30f98:
Linux 6.2-rc2 (2023-01-01 13:53:16 -0800)
are available in the Git repository at:
git://git.open-mesh.org/linux-merge.git tags/batadv-next-pullrequest-20230127
for you to fetch changes up to 0c4061c0d0e2c381ffe4d8b7c62ea69ad8132071:
batman-adv: tvlv: prepare for tvlv enabled multicast packet type (2023-01-21 19:01:59 +0100)
----------------------------------------------------------------
This feature/cleanup patchset includes the following patches:
- bump version strings, by Simon Wunderlich
- drop prandom.h includes, by Sven Eckelmann
- fix mailing list address, by Sven Eckelmann
- multicast feature preparation, by Linus Lüssing (2 patches)
----------------------------------------------------------------
Linus Lüssing (2):
batman-adv: mcast: remove now redundant single ucast forwarding
batman-adv: tvlv: prepare for tvlv enabled multicast packet type
Simon Wunderlich (1):
batman-adv: Start new development cycle
Sven Eckelmann (2):
batman-adv: Drop prandom.h includes
batman-adv: Fix mailing list address
Documentation/networking/batman-adv.rst | 2 +-
include/uapi/linux/batadv_packet.h | 2 +
net/batman-adv/bat_iv_ogm.c | 1 -
net/batman-adv/bat_v_elp.c | 1 -
net/batman-adv/bat_v_ogm.c | 5 +-
net/batman-adv/distributed-arp-table.c | 2 +-
net/batman-adv/gateway_common.c | 2 +-
net/batman-adv/main.h | 2 +-
net/batman-adv/multicast.c | 251 ++------------------------------
net/batman-adv/multicast.h | 38 +----
net/batman-adv/network-coding.c | 4 +-
net/batman-adv/routing.c | 7 +-
net/batman-adv/soft-interface.c | 26 ++--
net/batman-adv/translation-table.c | 4 +-
net/batman-adv/tvlv.c | 71 ++++++---
net/batman-adv/tvlv.h | 9 +-
net/batman-adv/types.h | 6 +
17 files changed, 110 insertions(+), 323 deletions(-)
Hi,
The following patchset implements a stateless, TVLV capable batman-adv
multicast packet type.
The new batman-adv multicast packet type allows to contain several
originator destination MAC addresses within a TVLV. Routers on the way will
potentially split the batman-adv multicast packet and adjust its tracker
TVLV contents.
Routing decisions are still based on the selected BATMAN IV or BATMAN V
routing algorithm. So this new batman-adv multicast packet type retains
the same loop-free properties.
The purpose of this new packet type is to allow to forward an IP
multicast packet with less transmissions / overhead than the
multicast-via-multiple-unicasts approach. Or to reach a lot more
destinations (currently up to 196, depending on the payload size, see
Wiki documentation for details) than with the default multicast fanout
for the via-unicasts approach.
This will allow using applications like mDNS again in several Freifunk
communities. And with less transmissions will also make more bulky
multicast applications, like media streaming (to an assessable amount of
receivers) a lot more feasible.
This approach is way simpler than the original multicast (tracker) packet
approach we envisioned years ago. As it involves no maintenance of an
extra, state based multicast routing table. However the TVLV capability
should allow to extend things later, to split control and data plane a bit
more for instance, to further increase the number of destinations, to
further reduce overhead.
A compact overview can be found in the Wiki here, including limitations:
https://www.open-mesh.org/projects/batman-adv/wiki/Multicast-Packet-Type
Regards, Linus
___
Changelog v4:
* PATCH 4/5:
* add missing include for linux/types.h in multicast.h
* add missing kerneldoc for @bat_priv in batadv_mcast_forw_push_dest()
and batadv_mcast_forw_push_tvlvs()
* use sizeof_field(type, field) instead of sizeof(((type *)0)->field)
in batadv_mcast_forw_push_dest()
* PATCH 5/5:
* rename num_dests_remove to num_dests_reduce in
batadv_mcast_forw_shrink_align_offse() to fix kerneldocs and for
consistency
* fix typo in kerneldoc in batadv_mcast_forw_shrink_update_headers()
-> @num_dest_reduce -> @num_dests_reduce
* use sizeof_field(type, field) instead of sizeof(((type *)0)->field)
in batadv_mcast_forw_shrink_align_offset()
Changelog v3:
* PATCH 1/5:
* remove now obsolete includes
* PATCH 2/5:
* fix batadv_tvlv_handler_register() in network-coding.c
* add missing include for linux/skbuff.h
* move variable declarations out of the switch case
in batadv_tvlv_call_handler()
* PATCH 3/5:
* remove unnecessary include of multicast.h in routing.c
* add a few missing includes to multicast_forw.c
(linux/byteorder/generic.h, linux/errno.h, linux/gfp.h, linux/stddef.h
uapi/linux/batadv_packet.h, multicast.h)
* PATCH 4/5:
* add missing rcu_read_unlock() in error case before returning in
batadv_mcast_forw_push_dests_list()
* remove unnecessary include of soft-interface.h in multicast_forw.c
* add a few missing includes to multicast_forw.c
(linux/bug.h, linux/build_bug.h, linux/limits.h, linux/rculist.h,
linux/rcupdate.h, linux/string.h)
* make batadv_mcast_forw_mode_by_count() static
* fix return types in the declaration of
batadv_mcast_forw_packet_hdrlen() and batadv_mcast_forw_push()
in multicast.h
* fix typo in commit message: "that the are capable of"
-> "that the*y* are capable of"
* PATCH 5/5:
* make batadv_mcast_forw_shrink_pack_dests() adhere to 80 characters
per line for consistency
* add a "continue" statement after the jump label in
batadv_mcast_forw_shrink_pack_dests() to silence the sparse error
"error: label at end of compound statement"
Changelog v2:
* Add "[PATCH v2 0/5]" prefix to title of cover letter, so that
Patchwork can hopefully find it - no other changes
gpsd moved in commit 35fe48835da0 ("include/gps.h: Move fixsource_t into
gps.h, add into gps_data_t.") the function gpsd_source_spec + its data
structures from the private gpsdclient.h to the public API header gps.h.
But the actual API major or minor version was not increased in this
process.
It is therefore not easily possible to figure out whether the libgps API
will provide this functionality or not. To avoid a conflict during the
build, just rename fixsource_t and gpsd_source_spec.
Reported-by: Bjørn Forsman <bjorn.forsman(a)gmail.com>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
gpsd/alfred-gpsd.c | 11 +++++++----
gpsd/alfred-gpsd.h | 8 +++++---
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/gpsd/alfred-gpsd.c b/gpsd/alfred-gpsd.c
index 20b3d98..d0bd47c 100644
--- a/gpsd/alfred-gpsd.c
+++ b/gpsd/alfred-gpsd.c
@@ -217,8 +217,11 @@ static int gpsd_read_answer(struct globals *globals)
return 0;
}
-/* Standard parsing of a GPS data source spec. Taken from gpsdclient.c */
-static void gpsd_source_spec(const char *arg, struct fixsource_t *source)
+/* Standard parsing of a GPS data source spec. Taken from gpsdclient.c
+ * remove when gpsd 3.25 is minimum supported version
+ */
+static void alfred_gpsd_source_spec(const char *arg,
+ struct alfred_gpsd_fixsource_t *source)
{
/* the casts attempt to head off a -Wwrite-strings warning */
source->server = (char *)"localhost";
@@ -425,7 +428,7 @@ static struct globals *gpsd_init(int argc, char *argv[])
gpsd_parse_location(globals, optarg);
break;
case 'g':
- gpsd_source_spec(optarg, &globals->gpsdsource);
+ alfred_gpsd_source_spec(optarg, &globals->gpsdsource);
have_source = true;
break;
case 'u':
@@ -443,7 +446,7 @@ static struct globals *gpsd_init(int argc, char *argv[])
}
if (globals->source == SOURCE_GPSD && !have_source)
- gpsd_source_spec(NULL, &globals->gpsdsource);
+ alfred_gpsd_source_spec(NULL, &globals->gpsdsource);
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
perror("could not register SIGPIPE handler");
diff --git a/gpsd/alfred-gpsd.h b/gpsd/alfred-gpsd.h
index 38588ad..174ca14 100644
--- a/gpsd/alfred-gpsd.h
+++ b/gpsd/alfred-gpsd.h
@@ -60,8 +60,10 @@ struct gpsd_v1 {
#define GPSD_DATA_SIZE(gpsd_data) \
(sizeof(*gpsd_data) + (ntohl(gpsd_data->tpv_len)))
-/* struct taken from gpsdclient.h */
-struct fixsource_t
+/* struct taken from gpsdclient.h
+ * remove when gpsd 3.25 is minimum supported version
+ */
+struct alfred_gpsd_fixsource_t
{
char *spec; /* pointer to actual storage */
char *server;
@@ -84,7 +86,7 @@ struct globals {
int unix_sock;
const char *unix_path;
- struct fixsource_t gpsdsource;
+ struct alfred_gpsd_fixsource_t gpsdsource;
struct gps_data_t gpsdata;
char * tpv;
};
---
base-commit: 1ff43b3ea32b0f6cdea2440c4beaf001090370ff
change-id: 20230121-gpsd_3-25-34e854104d05
Best regards,
--
Sven Eckelmann <sven(a)narfation.org>
I'm looking for a way to collect link data between nodes. My
google-fu has failed me on how to get node-to-node data like latency
or throughput etc. Is there any model built in to batman-adv/alfred
to poll this data? I only really finding the batvis data which is
just returning metric.
I'm mostly wanting to see how traffic is flowing, where links are
being more heavily used especially if those are not shortest paths
(suggests I have something to fix) and to keep track of a sort of high
water mark to metric ratio. ie, this link has done 260Mbps with the
link metric <=1.2 in the last 48 hours and it's currently doing
105Mbps at 1.08 metric.
my current plan is to run scripts to find 1 hop neighbors and either
so an arp-scan or find IP and ping directly on a schedule and store
that in alfred or just push it up to my database but this is a little
brute-forcy considering batman-adv is doing some of this work to
create the route metric in the first place.
Any advice appreciated. Thanks.
It's tricky to avoid reusing an argument in a for-each like macro. This is
to silence the following warning:
CHECK: Macro argument reuse 'num_dests' - possible side-effects?
#789: FILE: net/batman-adv/multicast_forw.c:35:
+#define batadv_mcast_forw_tracker_for_each_dest(dest, num_dests) \
+ for (; num_dests; num_dests--, (dest) += ETH_ALEN)
CHECK: Macro argument reuse 'num_dests' - possible side-effects?
#792: FILE: net/batman-adv/multicast_forw.c:38:
+#define batadv_mcast_forw_tracker_for_each_dest_rev(dest, num_dests) \
+ for (; num_dests; num_dests--, (dest) -= ETH_ALEN)
Later, once < 5.18 is out of our compat range we can rely on C99 syntax
and use variable declarations inside a for loop, readd the check and
rewrite the macro to something like this:
#define batadv_mcast_forw_tracker_for_each_dest(dest, num_dests) \
for (typeof(num_dests) __batadv_forw_num_dests = num_dests; \
*__batadv_forw_num_dests; \
(*__batadv_forw_num_dests)--, (dest) += ETH_ALEN)
Signed-off-by: Linus Lüssing <linus.luessing(a)c0d3.blue>
---
checkstuff.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/checkstuff.sh b/checkstuff.sh
index 207652ce4fbe..be49709dcb3b 100755
--- a/checkstuff.sh
+++ b/checkstuff.sh
@@ -191,7 +191,7 @@ test_checkpatch()
continue
fi
- if [ "${fname}" = "log.h" ]; then
+ if [ "${fname}" = "log.h" -o "${fname}" = "multicast_forw.c" ]; then
cp_extra_params="${cp_extra_params} --ignore MACRO_ARG_REUSE"
fi
--
2.39.0
Hi,
The following patchset implements a stateless, TVLV capable batman-adv
multicast packet type.
The new batman-adv multicast packet type allows to contain several
originator destination MAC addresses within a TVLV. Routers on the way will
potentially split the batman-adv multicast packet and adjust its tracker
TVLV contents.
Routing decisions are still based on the selected BATMAN IV or BATMAN V
routing algorithm. So this new batman-adv multicast packet type retains
the same loop-free properties.
The purpose of this new packet type is to allow to forward an IP
multicast packet with less transmissions / overhead than the
multicast-via-multiple-unicasts approach. Or to reach a lot more
destinations (currently up to 196, depending on the payload size, see
Wiki documentation for details) than with the default multicast fanout
for the via-unicasts approach.
This will allow using applications like mDNS again in several Freifunk
communities. And with less transmissions will also make more bulky
multicast applications, like media streaming (to an assessable amount of
receivers) a lot more feasible.
This approach is way simpler than the original multicast (tracker) packet
approach we envisioned years ago. As it involves no maintenance of an
extra, state based multicast routing table. However the TVLV capability
should allow to extend things later, to split control and data plane a bit
more for instance, to further increase the number of destinations, to
further reduce overhead.
A compact overview can be found in the Wiki here, including limitations:
https://www.open-mesh.org/projects/batman-adv/wiki/Multicast-Packet-Type
Regards, Linus
___
Changelog v3:
* PATCH 1/5:
* remove now obsolete includes
* PATCH 2/5:
* fix batadv_tvlv_handler_register() in network-coding.c
* add missing include for linux/skbuff.h
* move variable declarations out of the switch case
in batadv_tvlv_call_handler()
* PATCH 3/5:
* remove unnecessary include of multicast.h in routing.c
* add a few missing includes to multicast_forw.c
(linux/byteorder/generic.h, linux/errno.h, linux/gfp.h, linux/stddef.h
uapi/linux/batadv_packet.h, multicast.h)
* PATCH 4/5:
* add missing rcu_read_unlock() in error case before returning in
batadv_mcast_forw_push_dests_list()
* remove unnecessary include of soft-interface.h in multicast_forw.c
* add a few missing includes to multicast_forw.c
(linux/bug.h, linux/build_bug.h, linux/limits.h, linux/rculist.h,
linux/rcupdate.h, linux/string.h)
* make batadv_mcast_forw_mode_by_count() static
* fix return types in the declaration of
batadv_mcast_forw_packet_hdrlen() and batadv_mcast_forw_push()
in multicast.h
* fix typo in commit message: "that the are capable of"
-> "that the*y* are capable of"
* PATCH 5/5:
* make batadv_mcast_forw_shrink_pack_dests() adhere to 80 characters
per line for consistency
* add a "continue" statement after the jump label in
batadv_mcast_forw_shrink_pack_dests() to silence the sparse error
"error: label at end of compound statement"
Changelog v2:
* Add "[PATCH v2 0/5]" prefix to title of cover letter, so that
Patchwork can hopefully find it - no other changes