The netlink dump functionality transfers a large number of entries from the
kernel to userspace. It is rather likely that the transfer has to
interrupted and later continued. During that time, it can happen that
either new entries are added or removed. The userspace could than either
receive some entries multiple times or miss entries.
Commit 670dc2833d14 ("netlink: advertise incomplete dumps") introduced a
mechanism to inform userspace about this problem. Userspace can then decide
whether it is necessary or not to retry dumping the information again.
The netlink dump functions have to be switched to exclusive locks to avoid
changes while the current message is prepared. And an external generation
sequence counter is introduced which tracks all modifications of the
list/hash.
There some netlink dump commands which were not yet modified. These
datastructures use subentries (or entries for multiple main object)
which makes mapping to a generation sequence counter more problematic:
* originator
* neighbor list (multiple interfaces make it harder)
* global translation table
Also the batadv_algo stuff was ignored because it doesn't even have locks
and is not supposed to be modified at runtime.
Kind regards,
Sven
Sven Eckelmann (9):
batman-adv: Add compat for genl_dump_check_consistent
batman-adv: Add inconsistent gateway netlink dump detection
batman-adv: Add inconsistent hardif netlink dump detection
batman-adv: Store modification counter via hash helpers
batman-adv: Add inconsistent backbone netlink dump detection
batman-adv: Add inconsistent claim netlink dump detection
batman-adv: Add inconsistent dat netlink dump detection
batman-adv: Add inconsistent local TT netlink dump detection
batman-adv: Add inconsistent multicast netlink dump detection
compat-include/net/genetlink.h | 45 ++++++++++++++
net/batman-adv/bat_iv_ogm.c | 24 +++++---
net/batman-adv/bat_v.c | 26 +++++---
net/batman-adv/bridge_loop_avoidance.c | 82 +++++++++++++++-----------
net/batman-adv/distributed-arp-table.c | 42 +++++++------
net/batman-adv/gateway_client.c | 3 +
net/batman-adv/hard-interface.c | 3 +
net/batman-adv/hash.c | 2 +
net/batman-adv/hash.h | 6 ++
net/batman-adv/main.c | 3 +
net/batman-adv/main.h | 1 +
net/batman-adv/multicast.c | 51 ++++++++--------
net/batman-adv/netlink.c | 24 ++++----
net/batman-adv/translation-table.c | 41 +++++++------
net/batman-adv/types.h | 5 +-
15 files changed, 233 insertions(+), 125 deletions(-)
create mode 100644 compat-include/net/genetlink.h
--
2.19.1
Hello guys,
I setup a testbed like this. (BBN = backbone node)
Switch ---------->BBN1 --------------->MP1
|
------->BBN2---------------->MP2
MP1 and MP2 may select BBN1 or BBN2 as gateway.
On both MP1 and MP2, I enable Alfred and batadv-vis as follows:
alfred -i br0 -4 224.0.0.1 -m &
batadv-vis -i bat0 -s
when I run batadv-vis again on MP1, I can't get the info from MP2.
If I ping the ip address of MP2 from MP1, MP1 will get MP2's mac address by arp.
And then I run batadv-vis again, I can get the data from MP2 now.
Is there any configure or method to get MP2's info without ping test?
Thanks,
Gary
The incoming packet address is checked for a match against the local
interface addresses to avoid processing its own packets. The IPv4
implementation used the same code but only initialized 4 of the 16 bytes of
the address in the recv function. The interface initialization code in
netsock_set_interfaces set all unused bytes to zero but recv_alfred_packet
was modified to use 12 random bytes from the stack.
Both functions must work the same way and first set the address bytes to
zero and overwrite the actual used bytes with the address bytes. Otherwise,
the result of netsock_set_interfaces for own packets is random in the IPv4
implementation.
Fixes: c7da798113a2 ("alfred: IPv4 multicast distribution support.")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
Cc: Jonathan Haws <jhaws(a)sdl.usu.edu>
---
recv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/recv.c b/recv.c
index 59d759c..5ff4bb5 100644
--- a/recv.c
+++ b/recv.c
@@ -416,6 +416,7 @@ int recv_alfred_packet(struct globals *globals, struct interface *interface,
packet = (struct alfred_tlv *)buf;
+ memset(&alfred_source, 0, sizeof(alfred_source));
if (globals->ipv4mode) {
memcpy(&alfred_source, &source4.sin_addr, sizeof(source4.sin_addr));
} else {
--
2.19.1
Gary,
Interesting. Looking at that code I would think it wouldn't work any different than the original because retries is set to 1, so the first entrance into the first while will reduce that to 0 causing you to never enter that second loop. That should result in the same behavior as if the second loop wasn't even there.
If the second ioctl fails, the request still went out to the other device, so will populate the arp cache for the next sync. That's how it worked in my setup.
Can you give more details on what is not working?
FYI, l'm going to be in the Grand Canyon the next few days and likely won't be able to respond.
Thanks!
Sent from my Verizon, Samsung Galaxy smartphone
-------- Original message --------
From: gary <guohuizou2000(a)sina.com>
Date: 10/25/18 3:06 AM (GMT-07:00)
To: 'Sven Eckelmann' <sven(a)narfation.org>, Jonathan Haws <jhaws(a)sdl.usu.edu>
Cc: b.a.t.m.a.n(a)lists.open-mesh.org
Subject: RE: [B.A.T.M.A.N.] alfred and batadv-vis issue
Hi Sven and Jon,
The patch does NOT work for me.
I review the code again and find the issue. The following code may make my
testbed work.
--- a/util.c
+++ b/util.c
@@ -122,14 +122,14 @@ int ipv4_arp_request(struct interface *interface,
const alfred_addr *addr,
arpreq.arp_dev[sizeof(arpreq.arp_dev) - 1] = '\0';
if (ioctl(interface->netsock, SIOCGARP, &arpreq) < 0)
- return -1;
-
- while (retries-- && !(arpreq.arp_flags & ATF_COM)) {
- ipv4_request_mac_resolve(addr);
- usleep(200000);
-
- if (ioctl(interface->netsock, SIOCGARP, &arpreq) < 0)
- return -1;
+ {
+ while (retries-- && !(arpreq.arp_flags & ATF_COM)) {
+ ipv4_request_mac_resolve(addr);
+ usleep(200000);
+
+ if (ioctl(interface->netsock, SIOCGARP, &arpreq) <
0)
+ return -1;
+ }
}
Regards,
Gary
-----Original Message-----
From: Sven Eckelmann <sven(a)narfation.org>
Sent: 2018年10月25日 14:15
To: Jonathan Haws <jhaws(a)sdl.usu.edu>
Cc: guohuizou2000(a)sina.com; b.a.t.m.a.n(a)lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] alfred and batadv-vis issue
On Mittwoch, 24. Oktober 2018 18:39:43 CEST Jonathan Haws wrote:
[...]
> I just submitted a patch that pulls the request_mac_resolve() routine
> from batctl, modifies it appropriately, and uses it when MAC
> resolution isn't from the cache.
>
> I've tested this with my VM setup here and it works properly (after I
> verified that the nodes were not sharing messages first).
>
> Gary - can you try the patch with your setup and make sure it solves
> the problem in your setup as well?
The patch can be found at https://patchwork.open-mesh.org/patch/17552/ (or
directly on the mailing list)
Please reply via mail with a line
Tested-by: FirstName LastName <guohuizou2000(a)sina.com>
when you've successfully tested it (FirstName and LastName have to be
replaced with your actual name).
Kind regards,
Sven
All, thank you for the replies yesterday. Would you be able to offer
some more insight into updating the 2 packages? I have had some
successes, but not all the beagle bones have
recognized the new version of batman-adv when I run batctl -v.
The general method I've been using is the script here
https://gist.github.com/marvin/186a609d1e88f7426747 with version 2016.4.
The starting version on the Beagle Bones is batctl debian-2012.1.0-1 >
[batman-adv 2012.5.0] as mentioned previously.
After running this script and doing a
$ modprobe batman-adv
followed by
$ batctl -v
I get $ batctl 2016.4 [batman-adv 2012.5.0].
I have also attempted to uninstall batctl and batman-adv with
$ apt-get --purge remove batctl
and
$ apt-get --purge remove batman-adv
and reinstall using the script, but that hasn't worked across all devices.
The laptop I have is running Debian 9.5 with batctl debian-2016.5-1
[batman-adv 2016.4] and the Beagles are running Debian 7.9. I would
like to avoid reimaging the Beagles at this point in time.
Please pardon my lack of knowledge on the topic, as I'm still
relatively new to Linux and have been learning a great deal in the
past few months.
I greatly appreciate your help on the topic.
Regards,
Corey
Hello,
I'm currently working on a project that uses BATMAN for a mesh network
across multiple Beagle Bone Blacks which are running a Debian version
7.9 at the moment. They also are running batctl debian-2012.1.0-1
[batman-adv 2012.5.0]. I would like to connect a laptop to the
existing network either using Debian or Ubuntu, however I have run
into issues with compatibility. I configured everything identically
with the laptop and I believe I'm connected to the network, but I
cannot see any other devices on the network. Is it advisable to
upgrade the version of batctl on the 'bone or downgrade the version on
debian or Ubuntu so that the versions align? Or is there something
else I am missing in my efforts?
My process for configuring the BBB and the laptop follow this
construct, using appropriate hardware names when required. I have it
all in a script that runs on startup so it differs a little from the
lines below. Each node has it's own assigned IP address as well.
modprobe batman-adv
batctl if add eth0
ifup wlan0
ifconfig wlan0
ifconfig wlan0 down
ifconfig wlan0 mtu 1532
iwconfig wlan0 mode ad-hoc essid reynoldsplus ap CA:FE:C0:DE:F0:0D channel 11
batctl if add wlan0
ifconfig wlan0 up
ifconfig bat0 up
ifconfig bat0 10.200.8.1
route add default gw 10.0.99.1
echo bat0 > /sys/class/net/eth0/batman_adv/mesh_iface
echo 1 > /proc/sys/net/ipv4/ip_forward
Thank you.
Corey
Hi,
the batctl command already has support to get (previously debugfs) tables
via netlink. It does this while still being able to fall back to the old
debugfs tables on kernels which don't support the new generic netlink
family.
Something similar should be done in the future for the settings which
are currently part of sysfs. But we can already see that the current
integration of netlink in batctl only done in a single file - netlink.c
But this file is already starting to be so big that working with it
is rather cumbersome.
So as first steps:
* restructure command registration
* move commands in separate files (which should store their actual implementation)
* add a new helper command to receive multicast group messages from the kernel
More things will follow in the future.
Kind regards,
Sven
Sven Eckelmann (38):
batctl: Drop unused define SOCKET_PATH_FMT
batctl: Use common code organization for statistics
batctl: Drop legacy vis_* related warning messages
batctl: Move loglevel command to separate file
batctl: Move log command to separate file
batctl: Move gw_mode command to separate file
batctl: Move routing_algo command to separate file
batctl: Rename tp_meter to throughputmeter
batctl: Introduce datastructure for subcommands
batctl: Add per command flags
batctl: Use command structure for remaining subcommands
batctl: Use getopt to parse main options
batctl: Store usage line next to command
batctl: Prepare command infrastructure for shared functions
batctl: Add type to command to structure usage output
batctl: Convert debug table to command infrastructure
batctl: Convert sysfs settings to command infrastructure
batctl: Move backbonetable debug table to own file
batctl: Move claimtable debug table to own file
batctl: Move dat_cache debug table to own file
batctl: Move gateways debug table to own file
batctl: Move mcast_flags debug table to own file
batctl: Move nc_nodes debug table to own file
batctl: Move neighbors debug table to own file
batctl: Move originators debug table to own file
batctl: Move transglobal debug table to own file
batctl: Move translocal debug table to own file
batctl: Move aggregation setting to own file
batctl: Move bonding setting to own file
batctl: Move bridge_loop_avoidance setting to own file
batctl: Move distributed_arp_table setting to own file
batctl: Move fragmentation setting to own file
batctl: Move isolation_mark setting to own file
batctl: Move multicast_mode setting to own file
batctl: Move network_coding setting to own file
batctl: Move orig_interval setting to own file
batctl: Use external netlink socket for debug tables
batctl: Add command to monitor for netlink events
Makefile | 42 +-
translate.h => aggregation.c | 15 +-
ping.h => ap_isolation.c | 15 +-
backbonetable.c | 125 ++++
bisect_iv.c | 6 +-
bisect_iv.h | 4 -
traceroute.h => bonding.c | 15 +-
bridge_loop_avoidance.c | 33 +
claimtable.c | 130 ++++
dat_cache.c | 146 ++++
debug.c | 203 +-----
debug.h | 37 +-
distributed_arp_table.c | 33 +
event.c | 246 +++++++
fragmentation.c | 33 +
functions.c | 18 +-
gateways.c | 174 +++++
gw_mode.c | 171 +++++
interface.c | 23 +-
ioctl.h | 28 -
isolation_mark.c | 35 +
log.c | 73 ++
loglevel.c | 147 ++++
main.c | 274 ++++----
main.h | 65 +-
man/batctl.8 | 4 +
mcast_flags.c | 179 +++++
multicast_mode.c | 33 +
interface.h => nc_nodes.c | 14 +-
neighbors.c | 141 ++++
netlink.c | 1138 +++----------------------------
netlink.h | 49 +-
network_coding.c | 33 +
originators.c | 226 ++++++
ping.c | 10 +-
routing_algo.c | 130 ++++
ioctl.c => statistics.c | 10 +-
sys.c | 432 +-----------
sys.h | 39 +-
tcpdump.c | 5 +-
tcpdump.h | 2 -
tp_meter.c => throughputmeter.c | 10 +-
tp_meter.h | 28 -
traceroute.c | 10 +-
transglobal.c | 160 +++++
translate.c | 8 +-
translocal.c | 156 +++++
47 files changed, 2895 insertions(+), 2013 deletions(-)
rename translate.h => aggregation.c (67%)
rename ping.h => ap_isolation.c (67%)
create mode 100644 backbonetable.c
rename traceroute.h => bonding.c (68%)
create mode 100644 bridge_loop_avoidance.c
create mode 100644 claimtable.c
create mode 100644 dat_cache.c
create mode 100644 distributed_arp_table.c
create mode 100644 event.c
create mode 100644 fragmentation.c
create mode 100644 gateways.c
create mode 100644 gw_mode.c
delete mode 100644 ioctl.h
create mode 100644 isolation_mark.c
create mode 100644 log.c
create mode 100644 loglevel.c
create mode 100644 mcast_flags.c
create mode 100644 multicast_mode.c
rename interface.h => nc_nodes.c (73%)
create mode 100644 neighbors.c
create mode 100644 network_coding.c
create mode 100644 originators.c
create mode 100644 routing_algo.c
rename ioctl.c => statistics.c (90%)
rename tp_meter.c => throughputmeter.c (97%)
delete mode 100644 tp_meter.h
create mode 100644 transglobal.c
create mode 100644 translocal.c
--
2.19.1
Hi,
the current master branch already contains support to store debug messages
to the tracing buffer and to inform users about the deprecation of the
debugfs functionality.
This patchset is now cleaning it up a little bit more and allows to the
tracing infrastructure completely without BATMAN_ADV_DEBUGFS.
Kind regards,
Sven
Sven Eckelmann (5):
batman-adv: Drop unused lockdep include
batman-adv: Add includes for deprecation warning
batman-adv: Improve includes for trace functionality
batman-adv: Allow to use BATMAN_ADV_DEBUG without BATMAN_ADV_DEBUGFS
batman-adv: Fix description for BATMAN_ADV_DEBUG
compat.h | 5 ----
net/batman-adv/Kconfig | 7 +++--
net/batman-adv/bat_iv_ogm.c | 1 -
net/batman-adv/debugfs.c | 2 ++
net/batman-adv/log.c | 60 ++++++++++++++++++++-----------------
net/batman-adv/trace.c | 2 --
net/batman-adv/trace.h | 6 ++++
7 files changed, 45 insertions(+), 38 deletions(-)
--
2.19.1