26 Mar, 2017
2 commits
-
This patch refactors the num_packets counter of a forw_packet in the
following three ways:1) Removed dual-use of forw_packet::num_packets:
-> now for aggregation purposes only
2) Using forw_packet::skb::cb::num_bcasts instead:
-> for easier access in aggregation code later
3) make access to num_bcasts private to batadv_forw_packet_*()Signed-off-by: Linus Lüssing
[sven@narfation.org: Change num_bcasts to unsigned]
Signed-off-by: Sven Eckelmann
Signed-off-by: Simon Wunderlich -
An skb is assigned to a forw_packet only once, shortly after the
forw_packet allocation.With this patch the assignment is moved into the this allocation
function.Signed-off-by: Linus Lüssing
Signed-off-by: Sven Eckelmann
Signed-off-by: Simon Wunderlich
26 Jan, 2017
1 commit
-
Signed-off-by: Sven Eckelmann
Signed-off-by: Simon Wunderlich
09 Nov, 2016
1 commit
-
In rare cases during shutdown the following general protection fault can
happen:general protection fault: 0000 [#1] SMP
Modules linked in: batman_adv(O-) [...]
CPU: 3 PID: 1714 Comm: rmmod Tainted: G O 4.6.0-rc6+ #1
[...]
Call Trace:
[] batadv_hardif_disable_interface+0x29a/0x3a6 [batman_adv]
[] batadv_softif_destroy_netlink+0x4b/0xa4 [batman_adv]
[] __rtnl_link_unregister+0x48/0x92
[] rtnl_link_unregister+0xc1/0xdb
[] ? bit_waitqueue+0x87/0x87
[] batadv_exit+0x1a/0xf48 [batman_adv]
[] SyS_delete_module+0x136/0x1b0
[] entry_SYSCALL_64_fastpath+0x18/0xa8
[] ? trace_hardirqs_off_caller+0x37/0xa6
Code: 89 f7 e8 21 bd 0d e1 4d 85 e4 75 0e 31 f6 48 c7 c7 50 d7 3b a0 e8 50 16 f2 e0 49 8b 9c 24 28 01 00 00 48 85 db 0f 84 b2 00 00 00 8b 03 4d 85 ed 48 89 45 c8 74 09 4c 39 ab f8 00 00 00 75 1c
RIP [] batadv_purge_outstanding_packets+0x1c8/0x291 [batman_adv]
RSP
---[ end trace 803b9bdc6a4a952b ]---
Kernel panic - not syncing: Fatal exception in interrupt
Kernel Offset: disabled
---[ end Kernel panic - not syncing: Fatal exception in interruptIt does not happen often, but may potentially happen when frequently
shutting down and reinitializing an interface. With some carefully
placed msleep()s/mdelay()s it can be reproduced easily.The issue is, that on interface removal, any still running worker thread
of a forwarding packet will race with the interface purging routine to
free a forwarding packet. Temporarily giving up a spin-lock to be able
to sleep in the purging routine is not safe.Furthermore, there is a potential general protection fault not just for
the purging side shown above, but also on the worker side: Temporarily
removing a forw_packet from the according forw_{bcast,bat}_list will make
it impossible for the purging routine to catch and cancel it.# How this patch tries to fix it:
With this patch we split the queue purging into three steps: Step 1),
removing forward packets from the queue of an interface and by that
claim it as our responsibility to free.Step 2), we are either lucky to cancel a pending worker before it starts
to run. Or if it is already running, we wait and let it do its thing,
except two things:Through the claiming in step 1) we prevent workers from a) re-arming
themselves. And b) prevent workers from freeing packets which we still
hold in the interface purging routine.Finally, step 3, we are sure that no forwarding packets are pending or
even running anymore on the interface to remove. We can then safely free
the claimed forwarding packets.Signed-off-by: Linus Lüssing
Signed-off-by: Sven Eckelmann
Signed-off-by: Simon Wunderlich
30 Oct, 2016
2 commits
-
kfree_skb assumes that an skb is dropped after an failure and notes that.
consume_skb should be used in non-failure situations. Such information is
important for dropmonitor netlink which tells how many packets were dropped
and where this drop happened.Signed-off-by: Sven Eckelmann
Signed-off-by: Simon Wunderlich -
With this patch, (re)broadcasting on a specific interfaces is avoided:
* No neighbor: There is no need to broadcast on an interface if there
is no node behind it.* Single neighbor is source: If there is just one neighbor on an
interface and if this neighbor is the one we actually got this
broadcast packet from, then we do not need to echo it back.* Single neighbor is originator: If there is just one neighbor on
an interface and if this neighbor is the originator of this
broadcast packet, then we do not need to echo it back.Goodies for BATMAN V:
("Upgrade your BATMAN IV network to V now to get these for free!")
Thanks to the split of OGMv1 into two packet types, OGMv2 and ELP
that is, we can now apply the same optimizations stated above to OGMv2
packets, too.Furthermore, with BATMAN V, rebroadcasts can be reduced in certain
multi interface cases, too, where BATMAN IV cannot. This is thanks to
the removal of the "secondary interface originator" concept in BATMAN V.Signed-off-by: Linus Lüssing
Signed-off-by: Sven Eckelmann
Signed-off-by: Simon Wunderlich
09 Aug, 2016
1 commit
-
This patch abstracts the forward packet creation into the new function
batadv_forw_packet_alloc().The queue counting and interface reference counters are now handled
internally within batadv_forw_packet_alloc() and its
batadv_forw_packet_free() counterpart. This should reduce the risk of
having reference/queue counting bugs again and should increase
code readibility.Signed-off-by: Linus Lüssing
Signed-off-by: Marek Lindner
Signed-off-by: Sven Eckelmann
Signed-off-by: Simon Wunderlich
30 Jun, 2016
1 commit
-
The ogm_emit and ogm_schedule API calls were rather tight to the
B.A.T.M.A.N. IV logic and therefore rather difficult to use
with other algorithm implementations.Remove such calls and move the surrounding logic into the
B.A.T.M.A.N. IV specific code.Signed-off-by: Antonio Quartulli
Signed-off-by: Marek Lindner
Signed-off-by: Sven Eckelmann
Signed-off-by: Simon Wunderlich
29 Feb, 2016
1 commit
-
To enable ELP to send probing packets over wireless links
only if needed, batman-adv must keep track of the last time
it sent a unicast packet towards every neighbour.For this purpose a 2 main changes are introduced:
1) a new member of the elp_neigh_node structure stores the
last time a unicast packet was sent towards this neighbour;
2) a wrapper function for sending unicast packets is
implemented. This function will simply update the member
describe din point 1) and then forward the packet to the
real sending routine.Point 2) implies that any code-path leading to a unicast
sending now has to use the new wrapper.Signed-off-by: Antonio Quartulli
Signed-off-by: Marek Lindner
02 Feb, 2016
2 commits
-
Signed-off-by: Sven Eckelmann
Signed-off-by: Marek Lindner
Signed-off-by: Antonio Quartulli -
Signed-off-by: Sven Eckelmann
Signed-off-by: Marek Lindner
Signed-off-by: Antonio Quartulli
25 Aug, 2015
2 commits
-
main.h is included in every file and is the only way to access types.h.
This makes forward declarations for all types defined in types.h
unnecessary.Signed-off-by: Sven Eckelmann
Signed-off-by: Marek Lindner
Signed-off-by: Antonio Quartulli -
(s|u)(8|16|32|64) are the preferred types in the kernel. The use of the
standard C99 types u?int(8|16|32|64)_t are objected by some people and even
checkpatch now warns about using them.Signed-off-by: Sven Eckelmann
Signed-off-by: Marek Lindner
Signed-off-by: Antonio Quartulli
07 Jun, 2015
1 commit
-
The header files could not be build indepdent from each other. This is
happened because headers didn't include the files for things they've used.
This was problematic because the success of a build depended on the
knowledge about the right order of local includes.Also source files were not including everything they've used explicitly.
Instead they required that transitive includes are always stable. This is
problematic because some transitive includes are not obvious, depend on
config settings and may not be stable in the future.The order for include blocks are:
* primary headers (main.h and the *.h file of a *.c file)
* global linux headers
* required local headers
* extra forward declarations for pointers in function/struct declarationsThe only exceptions are linux/bitops.h and linux/if_ether.h in packet.h.
This header file is shared with userspace applications like batctl and must
therefore build together with userspace applications. The header
linux/bitops.h is not part of the uapi headers and linux/if_ether.h
conflicts with the musl implementation of netinet/if_ether.h. The
maintainers rejected the use of __KERNEL__ preprocessor checks and thus
these two headers are only in main.h. All files using packet.h first have
to include main.h to work correctly.Reported-by: Markus Pargmann
Signed-off-by: Sven Eckelmann
Signed-off-by: Marek Lindner
29 May, 2015
1 commit
-
Signed-off-by: Sven Eckelmann
Signed-off-by: Marek Lindner
22 Mar, 2014
2 commits
-
With this patch a multicast packet is not always simply flooded anymore,
the behaviour for the following cases is changed to reduce
unnecessary overhead:If all nodes within the horizon of a certain node have signalized
multicast listener announcement capability then an IPv6 multicast packet
with a destination of IPv6 link-local scope (excluding ff02::1) coming
from the upstream of this node...* ...is dropped if there is no according multicast listener in the
translation table,
* ...is forwarded via unicast if there is a single node with interested
multicast listeners
* ...and otherwise still gets flooded.Signed-off-by: Linus Lüssing
Signed-off-by: Marek Lindner
Signed-off-by: Antonio Quartulli -
Some helper functions used along the TX path have now a new
"dst_hint" argument but the kerneldoc was missing.Signed-off-by: Antonio Quartulli
Signed-off-by: Marek Lindner
12 Jan, 2014
1 commit
-
Signed-off-by: Simon Wunderlich
Signed-off-by: Marek Lindner
Signed-off-by: Antonio Quartulli
09 Jan, 2014
2 commits
-
In different situations it is possible that the DHCP server
or client uses broadcast Ethernet frames to send messages
to each other. The GW component in batman-adv takes care of
using bat-unicast packets to bring broadcast DHCP
Discover/Requests to the "best" server.On the way back the DHCP server usually sends unicasts,
but upon client request it may decide to use broadcasts as
well.This patch improves the GW component so that it now snoops
and sends as unicast all the DHCP packets, no matter if they
were generated by a DHCP server or client.Signed-off-by: Antonio Quartulli
Signed-off-by: Marek Lindner -
As suggested by checkpatch, remove all the references to the
FSF address since the kernel already has one reference in
its documentation.In this way it is easier to update it in case of future
changes.Signed-off-by: Antonio Quartulli
Signed-off-by: Marek Lindner
19 Oct, 2013
2 commits
-
With this patch the functions batadv_send_skb_unicast() and
batadv_send_skb_unicast_4addr() are further refined into
batadv_send_skb_via_tt(), batadv_send_skb_via_tt_4addr() and
batadv_send_skb_via_gw(). This way we avoid any "guessing" about where to send
a packet in the unicast forwarding methods and let the callers decide.This is going to be useful for the upcoming multicast related patches in
particular.Further, the return values were polished a little to use the more
appropriate NET_XMIT_* defines.Signed-off-by: Linus Lüssing
Acked-by: Antonio Quartulli
Signed-off-by: Marek Lindner
Signed-off-by: Antonio Quartulli -
To make the translation table code VLAN-aware, each entry
must carry the VLAN ID which it belongs to. This patch adds
such attribute to the related TT structures.Signed-off-by: Antonio Quartulli
Signed-off-by: Marek Lindner
12 Oct, 2013
1 commit
-
Remove the existing fragmentation code before adding the new version
and delete unicast.{h,c}.batadv_unicast_send_skb() is moved to send.c and renamed to
batadv_send_skb_unicast().fragmentation entry in sysfs (bat_priv->fragmentation) is kept for use in
the new fragmentation code.BATADV_UNICAST_FRAG packet type is renamed to BATADV_FRAG for use in the
new fragmentation code.Signed-off-by: Martin Hundebøll
Signed-off-by: Marek Lindner
Signed-off-by: Antonio Quartulli
29 May, 2013
1 commit
-
The call to batadv_nc_skb_forward() fits better in
batadv_send_skb_to_orig(), as this is where the actual next hop is
looked up.To let the caller of batadv_send_skb_to_orig() know wether the skb is
transmitted, buffered or failed, the return value is changed from
boolean to int.Signed-off-by: Martin Hundebøll
Signed-off-by: Marek Lindner
Signed-off-by: Antonio Quartulli
19 Jan, 2013
1 commit
-
Signed-off-by: Antonio Quartulli
Signed-off-by: Marek Lindner
21 Nov, 2012
1 commit
-
By adding batadv_send_skb_to_orig() in send.c, we can remove duplicate
code that looks up the next hop and then calls batadv_send_skb_packet().Furthermore, this prepares the upcoming new implementation of
fragmentation, which requires the next hop to route packets.Please note that this doesn't entirely remove the next-hop lookup in
routing.c and unicast.c, since it is used by the current fragmentation
code.Also note that the next-hop info is removed from debug messages in
translation-table.c, since it is looked up elsewhere.Signed-off-by: Martin Hundebøll
Signed-off-by: Marek Lindner
Signed-off-by: Antonio Quartulli
02 Jul, 2012
1 commit
-
Reported-by: Martin Hundebøll
Signed-off-by: Sven Eckelmann
21 Jun, 2012
2 commits
-
batman-adv doesn't follow the style for multiline comments that David S. Miller
prefers. All comments should be reformatted to follow this consistent style to
make the code slightly more readable.Signed-off-by: Sven Eckelmann
-
batman-adv can be compiled as part of the kernel instead of an module. In that
case the linker will see all non-static symbols of batman-adv and all other
non-static symbols of the kernel. This could lead to symbol collisions. A
prefix for the batman-adv symbols that defines their private namespace avoids
such a problem.Reported-by: David Miller
Signed-off-by: Sven Eckelmann
17 Feb, 2012
1 commit
-
Signed-off-by: Sven Eckelmann
Signed-off-by: Marek Lindner
08 Sep, 2011
2 commits
-
In the process the batman iv OGM aggregation code could be merged
into the batman iv code base which makes the separate aggregation
files superfluous.Signed-off-by: Marek Lindner
-
The follow-up routing code changes are going to introduce additional
routing packet types which make this distinction necessary.Signed-off-by: Marek Lindner
05 Jul, 2011
1 commit
-
In order to make possible to use the broadcast list for delayed sendings
the "delay" parameter is now provided instead of using 1 as hardcoded
value.Signed-off-by: Antonio Quartulli
Signed-off-by: Marek Lindner
20 Jun, 2011
2 commits
-
The client announcement mechanism informs every mesh node in the network
of any connected non-mesh client, in order to find the path towards that
client from any given point in the mesh.The old implementation was based on the simple idea of appending a data
buffer to each OGM containing all the client MAC addresses the node is
serving. All other nodes can populate their global translation tables
(table which links client MAC addresses to node addresses) using this
MAC address buffer and linking it to the node's address contained in the
OGM. A node that wants to contact a client has to lookup the node the
client is connected to and its address in the global translation table.It is easy to understand that this implementation suffers from several
issues:
- big overhead (each and every OGM contains the entire list of
connected clients)
- high latencies for client route updates due to long OGM trip time and
OGM lossesThe new implementation addresses these issues by appending client
changes (new client joined or a client left) to the OGM instead of
filling it with all the client addresses each time. In this way nodes
can modify their global tables by means of "updates", thus reducing the
overhead within the OGMs.To keep the entire network in sync each node maintains a translation
table version number (ttvn) and a translation table checksum. These
values are spread with the OGM to allow all the network participants to
determine whether or not they need to update their translation table
information.When a translation table lookup is performed in order to send a packet
to a client attached to another node, the destination's ttvn is added to
the payload packet. Forwarding nodes can compare the packet's ttvn with
their destination's ttvn (this node could have a fresher information
than the source) and re-route the packet if necessary. This greatly
reduces the packet loss of clients roaming from one AP to the next.Signed-off-by: Antonio Quartulli
Signed-off-by: Marek Lindner
Signed-off-by: Sven Eckelmann -
char was used in different places to store information without really
using the characteristics of that data type or by ignoring the fact that
char has not a well defined signedness.Signed-off-by: Sven Eckelmann
30 May, 2011
1 commit
-
batman-adv uses pointers which are marked as const and should not
violate that type qualifier by passing it to functions which force a
cast to the non-const version.Signed-off-by: Sven Eckelmann
08 May, 2011
1 commit
-
To be coherent, all the functions/variables/constants have been renamed
to the TranslationTable styleSigned-off-by: Antonio Quartulli
Signed-off-by: Sven Eckelmann
05 Mar, 2011
1 commit
-
Signed-off-by: Marek Lindner
12 Feb, 2011
1 commit
-
types.h is included by main.h, which is included at the beginning of any
other c-file anyway. Therefore this commit removes those duplicate
inclussions.Signed-off-by: Linus Lüssing
Signed-off-by: Sven Eckelmann
31 Jan, 2011
1 commit
-
Signed-off-by: Sven Eckelmann