Hi,
at the battlemesh we had plenty of time to discuss and test the tvlv
patchset. Therefore, a number of changes/fixes found their way into
v2 touching the tvlv API, network coding, unicast sending and gateway
announcements.
This looks like the final version which is going to be merged unless
objections are raised soon-ish.
Cheers,
Marek
This is the fourteenth revision of the basic multicast optimization patches.
Changes in v14 include:
* fixed compilation for CONFIG_BATMAN_ADV_MCAST=n (issue was introduced by v13)
* fixed potential null pointer exception (moved ethhdr assignment in
batadv_mcast_forw_mode() to after the check methods / pskb_may_pull()s)
* removed flag-list-"helper" functions
* removed methods which were performing both counting and orig_node retrieval
in batadv_mcast_forw_mode(), instead doing that in two logical, seperate
sections in batadv_mcast_forw_mode()
Cheers, Linus
Hi,
this is v2 of this series. I removed the hashtable patches for the moment. The
types.h patch is fixed to include linux headers only when compiling for the
kernel so that it can still be used in batctl.
Major changes (Patch 1-7):
- Compiling debugfs.c only when CONFIG_DEBUG_FS is selected. This reduces the
amount of unnecessary code that is executed. At the moment all calls to
debugfs functions will result in NOOPs. However there is some more code that
we simply don't need without DEBUG_FS.
- tvlv is separated from the large main.c file into its own tvlv.c. I don't
see a reason to have this set of functions for tvlv inside the main.c file.
Minor changes (Patch 8-26):
- Removing unnecessary return value variables
- Fixing some comments
- Reordering functions to increase readability
- Coding style fixes
- Declare boolean return types as bool
- Add missing includes
Best regards,
Markus
Markus Pargmann (26):
batman-adv: debugfs, avoid compiling for !DEBUG_FS
batman-adv: Separate logging header
batman-adv: iv_ogm, Reduce code duplication
batman-adv: iv_ogm, divide and round for ring buffer avg
batman-adv: init, Add some error handling
batman-adv: tvlv realloc, move error handling into if block
batman-adv: split tvlv into a seperate file
batman-adv: Makefile, Sort alphabetically
batman-adv: iv_ogm_iface_enable, direct return values
batman-adv: iv_ogm_aggr_packet, bool return value
batman-adv: iv_ogm_send_to_if, declare char* as const
batman-adv: iv_ogm_can_aggregate, code readability
batman-adv: iv_ogm_orig_update, remove unnecessary brackets
batman-adv: iv_ogm_aggregate_new, simplify error handling
batman-adv: iv_ogm_queue_add, Simplify expressions
batman-adv: iv_ogm_orig_update, style, add missin brackets
batman-adv: iv_ogm, Fix dup_status comment
batman-adv: iv_ogm, fix coding style
batman-adv: iv_ogm, fix comment function name
batman-adv: types, Fix comment on bcast_own
batman-adv: main, Convert is_my_mac() to bool
batman-adv: main, batadv_compare_eth return bool
batman-adv: Remove unnecessary ret variable
batman-adv: Remove unnecessary ret variable in algo_register
batman-adv: packet.h, add some missing includes
batman-adv: types.h, add missing include
Makefile.kbuild | 5 +-
bat_iv_ogm.c | 239 +++++++++---------
bitarray.c | 1 +
bridge_loop_avoidance.c | 1 +
debugfs.c | 9 +-
debugfs.h | 39 +++
distributed-arp-table.c | 2 +
gateway_client.c | 1 +
gateway_common.c | 2 +
hard-interface.c | 1 +
icmp_socket.c | 1 +
log.h | 82 +++++++
main.c | 626 +++---------------------------------------------
main.h | 101 +-------
multicast.c | 1 +
network-coding.c | 2 +
originator.c | 1 +
packet.h | 5 +
routing.c | 2 +
send.c | 1 +
sysfs.c | 1 +
translation-table.c | 2 +
tvlv.c | 592 +++++++++++++++++++++++++++++++++++++++++++++
tvlv.h | 62 +++++
types.h | 8 +-
25 files changed, 967 insertions(+), 820 deletions(-)
create mode 100644 log.h
create mode 100644 tvlv.c
create mode 100644 tvlv.h
--
2.1.3
Hello folks,
there appears to be some misconfiguration in our network. A gateway is
blocking unknown ip-addresses:
[658047.514011] FORWARD DROPPEDIN=bat0 OUT=backbone
MAC=3a:81:5b:64:fa:32:08:fc:88:9b:8a:60:08:00:45:00:00:4f:6c:b1:40:00:3f:06:b8:8e:0a:a6
SRC=10.166.28.69 DST=173.194.65.188 LEN=79 TOS=0x00 PREC=0x00 TTL=63
ID=27825 DF PROTO=TCP SPT=45173 DPT=5228 WINDOW=9131 RES=0x00 ACK PSH
URGP=0
[658047.519455] FORWARD DROPPEDIN=bat0 OUT=backbone
MAC=3a:81:5b:64:fa:32:08:fc:88:9b:8a:60:08:00:45:00:00:34:6c:b2:40:00:3f:06:b8:a8:0a:a6
SRC=10.166.28.69 DST=173.194.65.188 LEN=52 TOS=0x00 PREC=0x00 TTL=63
ID=27826 DF PROTO=TCP SPT=45173 DPT=5228 WINDOW=9131 RES=0x00 ACK FIN
URGP=0
I'm somewhat confused by the mac-address here - it's very long.
Can I somehow derive, which originator or client is propagating or using
this address?
Greetz, Jan
When first checking if a received packet is truncated, the size of the
alfred_tlv structure is ignored, thus allowing packets that are
truncated by 4 bytes or less to pass the check unnoticed.
Even the check itself might access memory after the packet if its size
was only 2 bytes or less.
Signed-off-by: Jan-Philipp Litza <janphilipp(a)litza.de>
---
recv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/recv.c b/recv.c
index 90db0b3..870485f 100644
--- a/recv.c
+++ b/recv.c
@@ -402,7 +402,8 @@ int recv_alfred_packet(struct globals *globals, struct interface *interface)
return -1;
/* drop truncated packets */
- if (length < ((int)ntohs(packet->length)))
+ if (length < (int)sizeof(*packet) ||
+ length < (int)(ntohs(packet->length) + sizeof(*packet)))
return -1;
/* drop incompatible packet */
--
2.1.0
Hi,
this series contains some major cleanup patches (at the beginning of the
series) and some minor cleanups at the end of the series. The behavior of
batman should not be influenced by this series as these patches are only
transformations to make the code more readable and maintainable. If it does
influence behavior something is wrong with this series. The series was tested
on ARM SoC with mwifiex driver.
Major changes (Patch 1-12):
- Compiling debugfs.c only when CONFIG_DEBUG_FS is selected. This reduces the
amount of unnecessary code that is executed. At the moment all calls to
debugfs functions will result in NOOPs. However there is some more code that
we simply don't need without DEBUG_FS.
- tvlv is separated from the large main.c file into its own tvlv.c. I don't
see a reason to have this set of functions for tvlv inside the main.c file.
- The hashtable implementation now has accessor functions to avoid direct
access on the private hashtable structure. This should improve the hashtable
interface and create proper encapsulation.
Minor changes (Patch 13-31):
- Removing unnecessary return value variables
- Fixing some comments
- Reordering functions to increase readability
- Coding style fixes
- Declare boolean return types as bool
- Add missing includes
Best Regards,
Markus
Markus Pargmann (31):
batman-adv: debugfs, avoid compiling for !DEBUG_FS
batman-adv: Separate logging header
batman-adv: iv_ogm, Reduce code duplication
batman-adv: iv_ogm, divide and round for ring buffer avg
batman-adv: init, Add some error handling
batman-adv: tvlv realloc, move error handling into if block
batman-adv: split tvlv into a seperate file
batman-adv: hash, remove function implementations from header
batman-adv: hash, Add helper functions
batman-adv: hash, replace direct hash structure accesses
batman-adv: hash, make struct hashtable private
batman-adv: hash, add used linux headers
batman-adv: Makefile, Sort alphabetically
batman-adv: iv_ogm_iface_enable, direct return values
batman-adv: iv_ogm_aggr_packet, bool return value
batman-adv: iv_ogm_send_to_if, declare char* as const
batman-adv: iv_ogm_can_aggregate, code readability
batman-adv: iv_ogm_orig_update, remove unnecessary brackets
batman-adv: iv_ogm_aggregate_new, simplify error handling
batman-adv: iv_ogm_queue_add, Simplify expressions
batman-adv: iv_ogm_orig_update, style, add missin brackets
batman-adv: iv_ogm, Fix dup_status comment
batman-adv: iv_ogm, fix coding style
batman-adv: iv_ogm, fix comment function name
batman-adv: types, Fix comment on bcast_own
batman-adv: main, Convert is_my_mac() to bool
batman-adv: main, batadv_compare_eth return bool
batman-adv: Remove unnecessary ret variable
batman-adv: Remove unnecessary ret variable in algo_register
batman-adv: packet.h, add some missing includes
batman-adv: types.h, add missing include
Makefile.kbuild | 5 +-
bat_iv_ogm.c | 247 +++++++++----------
bitarray.c | 1 +
bridge_loop_avoidance.c | 58 +++--
debugfs.c | 9 +-
debugfs.h | 39 +++
distributed-arp-table.c | 28 ++-
gateway_client.c | 1 +
gateway_common.c | 2 +
hard-interface.c | 1 +
hash.c | 163 +++++++++++++
hash.h | 164 ++-----------
icmp_socket.c | 1 +
log.h | 82 +++++++
main.c | 626 +++---------------------------------------------
main.h | 101 +-------
multicast.c | 1 +
network-coding.c | 38 +--
originator.c | 29 +--
originator.h | 4 +-
packet.h | 3 +
routing.c | 2 +
send.c | 1 +
sysfs.c | 1 +
translation-table.c | 90 ++++---
tvlv.c | 592 +++++++++++++++++++++++++++++++++++++++++++++
tvlv.h | 62 +++++
types.h | 8 +-
28 files changed, 1266 insertions(+), 1093 deletions(-)
create mode 100644 log.h
create mode 100644 tvlv.c
create mode 100644 tvlv.h
--
2.1.3
The fragmentation code was replaced in 9b3eab61754d74a93c9840c296013fe3b4a1b606
("batman-adv: Receive fragmented packets and merge") by an implementation which
handles the queueing+merging of fragments based on their size and the
total_size of the non-fragmented packet. This total_size is announced by each
fragment. The new implementation doesn't check if the the total_size
information of the packets inside one chain is consistent.
This is consistency check is recommended to allow using any of the packets in
the queue to decide whether all fragments of a packet are received or not.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
This is only compile tested
v3.
- withdrawing from inclusion in maint
- remove wrong example from the commit message
v2:
- proposed for maint
- changed commit message slightly
---
fragmentation.c | 7 +++++--
types.h | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/fragmentation.c b/fragmentation.c
index 5251aa1..6e4c957 100644
--- a/fragmentation.c
+++ b/fragmentation.c
@@ -161,6 +161,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
hlist_add_head(&frag_entry_new->list, &chain->head);
chain->size = skb->len - hdr_size;
chain->timestamp = jiffies;
+ chain->total_size = ntohs(frag_packet->total_size);
ret = true;
goto out;
}
@@ -195,9 +196,11 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
out:
if (chain->size > batadv_frag_size_limit() ||
- ntohs(frag_packet->total_size) > batadv_frag_size_limit()) {
+ chain->total_size != ntohs(frag_packet->total_size) ||
+ chain->total_size > batadv_frag_size_limit()) {
/* Clear chain if total size of either the list or the packet
- * exceeds the maximum size of one merged packet.
+ * exceeds the maximum size of one merged packet. Don't allow
+ * packets to have different total_size.
*/
batadv_frag_clear_chain(&chain->head);
chain->size = 0;
diff --git a/types.h b/types.h
index 462a70c..c4d7d24 100644
--- a/types.h
+++ b/types.h
@@ -132,6 +132,7 @@ struct batadv_orig_ifinfo {
* @timestamp: time (jiffie) of last received fragment
* @seqno: sequence number of the fragments in the list
* @size: accumulated size of packets in list
+ * @total_size: expected size of the assembled packet
*/
struct batadv_frag_table_entry {
struct hlist_head head;
@@ -139,6 +140,7 @@ struct batadv_frag_table_entry {
unsigned long timestamp;
uint16_t seqno;
uint16_t size;
+ uint16_t total_size;
};
/**
--
2.1.3
Hello David,
this is a batch of patches intended for net-next.
In this patchset you have mostly cleanups and small corrections to issues
reported by checkpatch.
One notable change is the addition of the DEBUG_FS dependency to the
BATMAN_ADV_DEBUG symbol by Markus Pargmann. We add this dependency because all
the information provided by the DEBUG feature is accessible only through
debugfs.
Please pull or let me know of any problem!
Thanks a lot,
Antonio
The following changes since commit 44d84d7272e5848878a96029b8a8b6e86854f146:
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (2015-01-06 22:29:20 -0500)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem
for you to fetch changes up to 9535395640edb23ba5cec2abb026c4ee51899722:
batman-adv: Kconfig, Add missing DEBUG_FS dependency (2015-01-07 22:17:11 +0100)
----------------------------------------------------------------
Included changes:
- remove useless return in void functions
- remove unused member 'primary_iface' from 'struct orig_node'
- improve existing kernel doc
- fix several checkpatch complaints
- ensure socket's control block is cleared for received skbs
- add missing DEBUG_FS dependency to BATMAN_ADV_DEBUG symbol
----------------------------------------------------------------
Antonio Quartulli (7):
batman-adv: avoid useless return in void functions
batman-adv: checkpatch - else is not generally useful after a break or return
batman-adv: checkpatch - No space is necessary after a cast
batman-adv: checkpatch - Please use a blank line after declarations
batman-adv: checkpatch - Please don't use multiple blank lines
batman-adv: checkpatch - remove unnecessary parentheses
batman-adv: fix misspelled words
Markus Pargmann (1):
batman-adv: Kconfig, Add missing DEBUG_FS dependency
Martin Hundebøll (5):
batman-adv: kernel doc fixes for bat_iv_ogm.c
batman-adv: kernel doc fixes for bridge_loop_avoidance.c
batman-adv: kernel doc fix for distributed-arp-table.h
batman-adv: kernel doc fixes for main.{c, h}
batman-adv: clear control block of received socket buffers
Simon Wunderlich (2):
batman-adv: remove obsolete variable primary_iface from orig_node
batman-adv: Start new development cycle
net/batman-adv/Kconfig | 1 +
net/batman-adv/bat_iv_ogm.c | 15 +++++++--------
net/batman-adv/bitarray.c | 1 -
net/batman-adv/bitarray.h | 3 +--
net/batman-adv/bridge_loop_avoidance.c | 17 +++++++----------
net/batman-adv/debugfs.c | 2 +-
net/batman-adv/distributed-arp-table.c | 1 +
net/batman-adv/distributed-arp-table.h | 4 +---
net/batman-adv/fragmentation.c | 1 -
net/batman-adv/fragmentation.h | 3 +--
net/batman-adv/gateway_client.c | 1 +
net/batman-adv/main.c | 10 ++++++----
net/batman-adv/main.h | 15 +++++++--------
net/batman-adv/multicast.h | 3 ---
net/batman-adv/network-coding.c | 3 +--
net/batman-adv/originator.c | 1 -
net/batman-adv/originator.h | 1 -
net/batman-adv/packet.h | 5 +++--
net/batman-adv/routing.c | 3 +--
net/batman-adv/soft-interface.c | 1 -
net/batman-adv/sysfs.c | 1 -
net/batman-adv/translation-table.c | 8 +++-----
net/batman-adv/types.h | 4 +---
23 files changed, 43 insertions(+), 61 deletions(-)