[B.A.T.M.A.N.] pull request [net]: batman-adv 2013-12-28
by Antonio Quartulli
Hello David,
this is our "fixed" pull request intended for net/linux-3.13.
Here you have the same patches as before except for the netfilter patch that is
now using nf_reset() (as you suggested) and for a new patch that fixes the
access to the vlan_hdr in the rx path while reading the VID.
Short summary:
Patches from 1 to 5 take care of reshaping the packet layout a little bit to
make sure that all the structures we use for sending messages have size multiple
of 4 (or 2 when pack(2) is used).
This solves the problem raised by Russel King about the static checks in
batman-adv failing when compiling the module on the ARM architecture.
Patch 6 is adding the nf_reset() (as you suggested) after having removed the
batman-adv encapsulation header from a packet. This patch fixes the behaviour of
netfilter in case the skb enters two bridges during its life: once with the
batman-adv header and once without.
==> Please, enqueue this patch (number 6) for stable.
Patch 7 fixes a wrong access to the inner vlan_eth header when trying to read
the VID in the rx path.
Please pull or let me know of any problem.
Thank you,
Antonio
The following changes since commit 6a9eadccff2926e392173a989042f14c867cffbf:
ipv6: release dst properly in ipip6_tunnel_xmit (2013-12-27 13:14:40 -0500)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batman-adv-fix-for-davem
for you to fetch changes up to 2b1e2cb3594df80446dc33bb8e12230da11f38ff:
batman-adv: fix vlan header access (2013-12-28 14:48:40 +0100)
----------------------------------------------------------------
Included changes:
- reset netfilter-bridge state when removing the batman-adv
header from an incoming packet. This prevents netfilter
bridge from being fooled when the same packet enters a
bridge twice (or more): the first time within the
batman-adv header and the second time without.
- adjust the packet layout to prevent any architecture from
adding padding bytes. All the structs sent over the wire
now have size multiple of 4bytes (unless pack(2) is used).
- fix access to the inner vlan_eth header when reading the
VID in the rx path.
----------------------------------------------------------------
Antonio Quartulli (4):
batman-adv: fix size of batadv_icmp_header
batman-adv: fix alignment for batadv_tvlv_tt_change
batman-adv: clean nf state when removing protocol header
batman-adv: fix vlan header access
Simon Wunderlich (3):
batman-adv: fix alignment for batadv_coded_packet
batman-adv: fix header alignment by unrolling batadv_header
batman-adv: fix size of batadv_bla_claim_dst
net/batman-adv/bat_iv_ogm.c | 36 +++++-----
net/batman-adv/distributed-arp-table.c | 6 +-
net/batman-adv/fragmentation.c | 8 +--
net/batman-adv/icmp_socket.c | 6 +-
net/batman-adv/main.c | 16 ++---
net/batman-adv/network-coding.c | 22 +++---
net/batman-adv/packet.h | 124 +++++++++++++++++++++++++--------
net/batman-adv/routing.c | 30 ++++----
net/batman-adv/send.c | 10 +--
net/batman-adv/soft-interface.c | 18 +++--
net/batman-adv/translation-table.c | 6 +-
11 files changed, 177 insertions(+), 105 deletions(-)
8 years, 5 months
[B.A.T.M.A.N.] Using bat-adv for Wireless Video Streaming
by Kartic Bhargav
Hello,
I am currently working on Wireless Video streaming over a mesh network
of Raspberry Pi nodes.
I have set up the bat-adv mesh network and am able to ping each node.
I am working on the Video forwarding from one node to another now and
am facing problems here as I am unsure as to how to proceed. I have a
Microsoft LifeCam Camera attached to one of my Nodes and have to hop
the captured video packets to the next series of nodes.
I'm relatively new to bat-adv and some of its advanced functions.
Since we are dealing with ipv6 connectivity here, the eth0 is down and
as expected am unable to connect to the existing ipv4 LAN Network at
my Lab. So I'm not able to use the conventional Video streaming / Port
listening & forwarding tools. (like Netcat etc.)
Is there any specific tool/way by which I can achieve my 'Video
Forwarding' objective via bat-adv commands like batctl etc.? How
exactly do you make use of the connectivity between nodes? Any such
applications that are supported to forward Video Packets?
Any leads/insights would be very much helpful.
Thanks a lot.
Kartic Bhargav
8 years, 5 months
[B.A.T.M.A.N.] [PATCH] batman-adv: fix compat sparse errors for BUILD_BUG_ON in <= 2.6.39
by Simon Wunderlich
Signed-off-by: Simon Wunderlich <sw(a)simonwunderlich.de>
---
compat.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/compat.h b/compat.h
index a1c8396..92f88ee 100644
--- a/compat.h
+++ b/compat.h
@@ -207,6 +207,13 @@ static inline void skb_reset_mac_len(struct sk_buff *skb)
skb->mac_len = skb->network_header - skb->mac_header;
}
+#undef BUILD_BUG_ON
+#ifdef __CHECKER__
+#define BUILD_BUG_ON(condition) (0)
+#else /* __CHECKER__ */
+#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
+#endif /* __CHECKER__ */
+
#endif /* < KERNEL_VERSION(3, 0, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
--
1.7.10.4
8 years, 5 months
[B.A.T.M.A.N.] [PATCHv2] batman-adv: fix NULL pointer deref in batadv_find_best_neighbor
by Simon Wunderlich
If there is no best neighbor, don't dereference the NULL pointer. Try to
acquire the neighbor node right in the loop instead. There also was a
logic bug, finding the worst instead of the best neighbor.
Introduced by 9bb33b8d88e318c4879d37d06ad28e3e018b9036 ("batman-adv:
split tq information in neigh_node struct")
Signed-off-by: Simon Wunderlich <sw(a)simonwunderlich.de>
---
originator.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/originator.c b/originator.c
index 2243003..4a5d027 100644
--- a/originator.c
+++ b/originator.c
@@ -783,14 +783,19 @@ batadv_find_best_neighbor(struct batadv_priv *bat_priv,
struct batadv_algo_ops *bao = bat_priv->bat_algo_ops;
rcu_read_lock();
- hlist_for_each_entry_rcu(neigh, &orig_node->neigh_list, list)
- if (!best ||
- (bao->bat_neigh_cmp(neigh, if_outgoing,
- best, if_outgoing) <= 0))
- best = neigh;
+ hlist_for_each_entry_rcu(neigh, &orig_node->neigh_list, list) {
+ if (best && (bao->bat_neigh_cmp(neigh, if_outgoing,
+ best, if_outgoing) <= 0))
+ continue;
- if (!atomic_inc_not_zero(&best->refcount))
- best = NULL;
+ if (!atomic_inc_not_zero(&neigh->refcount))
+ continue;
+
+ if (best)
+ batadv_neigh_node_free_ref(best);
+
+ best = neigh;
+ }
rcu_read_unlock();
return best;
--
1.7.10.4
8 years, 5 months
[B.A.T.M.A.N.] [PATCH next] batman-adv: fix vlan header access
by Antonio Quartulli
When batadv_get_vid() is invoked in interface_rx() the
batman-adv header has already been removed, therefore
the header_len argument has to be 0.
Introduced by 580d7919f19e4f73ccd79e82a532af2bdc638042
("batman-adv: add the VLAN ID attribute to the TT entry")
Signed-off-by: Antonio Quartulli <antonio(a)meshcoding.com>
---
soft-interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/soft-interface.c b/soft-interface.c
index 74f4630..2a09294 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -346,7 +346,7 @@ void batadv_interface_rx(struct net_device *soft_iface,
skb_pull_rcsum(skb, hdr_size);
skb_reset_mac_header(skb);
- vid = batadv_get_vid(skb, hdr_size);
+ vid = batadv_get_vid(skb, 0);
ethhdr = eth_hdr(skb);
switch (ntohs(ethhdr->h_proto)) {
--
1.8.5.2
8 years, 5 months
[B.A.T.M.A.N.] [PATCH v3.5 06/19] batman-adv: use batadv_compare_eth for concise
by Ding Tianhong
It is better to use batadv_compate_eth instead of memcpy for
concise style.
Cc: Marek Lindner <mareklindner(a)neomailbox.ch>
Cc: Simon Wunderlich <sw(a)simonwunderlich.de>
Cc: Antonio Quartulli <antonio(a)meshcoding.com>
Cc: "David S. Miller" <davem(a)davemloft.net>
Cc: b.a.t.m.a.n(a)lists.open-mesh.org
Cc: netdev(a)vger.kernel.org
Cc: linux-kernel(a)vger.kernel.org
Signed-off-by: Tan Xiaojun <tanxiaojun(a)huawei.com>
Signed-off-by: Ding Tianhong <dingtianhong(a)huawei.com>
Acked-by: Antonio Quartulli <antonio(a)meshcoding.com>
---
net/batman-adv/originator.c | 2 +-
net/batman-adv/translation-table.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 8ab1434..803ab4b 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -41,7 +41,7 @@ int batadv_compare_orig(const struct hlist_node *node, const void *data2)
const void *data1 = container_of(node, struct batadv_orig_node,
hash_entry);
- return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
+ return batadv_compare_eth(data1, data2);
}
/**
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 4add57d..06506e6 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -51,7 +51,7 @@ static int batadv_compare_tt(const struct hlist_node *node, const void *data2)
const void *data1 = container_of(node, struct batadv_tt_common_entry,
hash_entry);
- return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
+ return batadv_compare_eth(data1, data2);
}
/**
--
1.8.0
8 years, 6 months
[B.A.T.M.A.N.] [PATCH] batman-adv: add build checks for packet sizes
by Simon Wunderlich
With unrolling the batadv_header into the respective structures, the
offsetof checks are now useless. Instead, add build checks for all
packet types which go over the wire to avoid problems with wrong sizes
or compatibility issues on some architectures which don't use every day.
Signed-off-by: Simon Wunderlich <sw(a)simonwunderlich.de>
---
main.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/main.c b/main.c
index 945e441..ad6aeed 100644
--- a/main.c
+++ b/main.c
@@ -419,13 +419,23 @@ static void batadv_recv_handler_init(void)
for (i = BATADV_UNICAST_MIN; i <= BATADV_UNICAST_MAX; i++)
batadv_rx_handler[i] = batadv_recv_unhandled_unicast_packet;
- /* compile time checks for struct member offsets */
- BUILD_BUG_ON(offsetof(struct batadv_unicast_4addr_packet, src) != 10);
- BUILD_BUG_ON(offsetof(struct batadv_unicast_packet, dest) != 4);
- BUILD_BUG_ON(offsetof(struct batadv_unicast_tvlv_packet, dst) != 4);
- BUILD_BUG_ON(offsetof(struct batadv_frag_packet, dest) != 4);
- BUILD_BUG_ON(offsetof(struct batadv_icmp_packet, dst) != 4);
- BUILD_BUG_ON(offsetof(struct batadv_icmp_packet_rr, dst) != 4);
+ /* compile time checks for sizes */
+ BUILD_BUG_ON(sizeof(struct batadv_bla_claim_dst) != 6);
+ BUILD_BUG_ON(sizeof(struct batadv_ogm_packet) != 24);
+ BUILD_BUG_ON(sizeof(struct batadv_icmp_header) != 20);
+ BUILD_BUG_ON(sizeof(struct batadv_icmp_packet) != 20);
+ BUILD_BUG_ON(sizeof(struct batadv_icmp_packet_rr) != 116);
+ BUILD_BUG_ON(sizeof(struct batadv_unicast_packet) != 10);
+ BUILD_BUG_ON(sizeof(struct batadv_unicast_4addr_packet) != 18);
+ BUILD_BUG_ON(sizeof(struct batadv_frag_packet) != 20);
+ BUILD_BUG_ON(sizeof(struct batadv_bcast_packet) != 14);
+ BUILD_BUG_ON(sizeof(struct batadv_coded_packet) != 46);
+ BUILD_BUG_ON(sizeof(struct batadv_unicast_tvlv_packet) != 20);
+ BUILD_BUG_ON(sizeof(struct batadv_tvlv_hdr) != 4);
+ BUILD_BUG_ON(sizeof(struct batadv_tvlv_gateway_data) != 8);
+ BUILD_BUG_ON(sizeof(struct batadv_tvlv_tt_vlan_data) != 8);
+ BUILD_BUG_ON(sizeof(struct batadv_tvlv_tt_change) != 12);
+ BUILD_BUG_ON(sizeof(struct batadv_tvlv_roam_adv) != 8);
/* broadcast packet */
batadv_rx_handler[BATADV_BCAST] = batadv_recv_bcast_packet;
--
1.7.10.4
8 years, 6 months
[B.A.T.M.A.N.] [PATCH] batman-adv: fix NULL pointer deref in batadv_find_best_neighbor
by Simon Wunderlich
If there is no best neighbor, don't dereference the NULL pointer.
Introduced by 9bb33b8d88e318c4879d37d06ad28e3e018b9036 ("batman-adv:
split tq information in neigh_node struct")
Signed-off-by: Simon Wunderlich <sw(a)simonwunderlich.de>
---
originator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/originator.c b/originator.c
index 2243003..9fcde58 100644
--- a/originator.c
+++ b/originator.c
@@ -789,7 +789,7 @@ batadv_find_best_neighbor(struct batadv_priv *bat_priv,
best, if_outgoing) <= 0))
best = neigh;
- if (!atomic_inc_not_zero(&best->refcount))
+ if (best && !atomic_inc_not_zero(&best->refcount))
best = NULL;
rcu_read_unlock();
--
1.7.10.4
8 years, 6 months
[B.A.T.M.A.N.] [PATCH v3 06/19] batman-adv: use batadv_compare_eth for concise
by Ding Tianhong
It is better to use batadv_compate_eth instead of memcpy for
concise style.
Cc: Marek Lindner <mareklindner(a)neomailbox.ch>
Cc: Simon Wunderlich <sw(a)simonwunderlich.de>
Cc: Antonio Quartulli <antonio(a)meshcoding.com>
Cc: "David S. Miller" <davem(a)davemloft.net>
Cc: b.a.t.m.a.n(a)lists.open-mesh.org
Cc: netdev(a)vger.kernel.org
Cc: linux-kernel(a)vger.kernel.org
Signed-off-by: Tan Xiaojun <tanxiaojun(a)huawei.com>
Signed-off-by: Ding Tianhong <dingtianhong(a)huawei.com>
Acked-by: Antonio Quartulli <antonio(a)meshcoding.com>
---
net/batman-adv/originator.c | 2 +-
net/batman-adv/translation-table.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 8ab1434..803ab4b 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -41,7 +41,7 @@ int batadv_compare_orig(const struct hlist_node *node, const void *data2)
const void *data1 = container_of(node, struct batadv_orig_node,
hash_entry);
- return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
+ return batadv_compare_eth(data1, data2);
}
/**
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 4add57d..06506e6 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -51,7 +51,7 @@ static int batadv_compare_tt(const struct hlist_node *node, const void *data2)
const void *data1 = container_of(node, struct batadv_tt_common_entry,
hash_entry);
- return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
+ return batadv_compare_eth(data1, data2);
}
/**
--
1.8.0
8 years, 6 months
[B.A.T.M.A.N.] [PATCH v2 07/20] batman-adv: use batadv_compare_eth for concise
by Ding Tianhong
It is better to use batadv_compate_eth instead of memcpy for
concise style.
Cc: Marek Lindner <mareklindner(a)neomailbox.ch>
Cc: Simon Wunderlich <sw(a)simonwunderlich.de>
Cc: Antonio Quartulli <antonio(a)meshcoding.com>
Cc: "David S. Miller" <davem(a)davemloft.net>
Cc: b.a.t.m.a.n(a)lists.open-mesh.org
Cc: netdev(a)vger.kernel.org
Cc: linux-kernel(a)vger.kernel.org
Signed-off-by: Tan Xiaojun <tanxiaojun(a)huawei.com>
Signed-off-by: Ding Tianhong <dingtianhong(a)huawei.com>
---
net/batman-adv/originator.c | 2 +-
net/batman-adv/translation-table.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 8ab1434..803ab4b 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -41,7 +41,7 @@ int batadv_compare_orig(const struct hlist_node *node, const void *data2)
const void *data1 = container_of(node, struct batadv_orig_node,
hash_entry);
- return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
+ return batadv_compare_eth(data1, data2);
}
/**
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 4add57d..06506e6 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -51,7 +51,7 @@ static int batadv_compare_tt(const struct hlist_node *node, const void *data2)
const void *data1 = container_of(node, struct batadv_tt_common_entry,
hash_entry);
- return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
+ return batadv_compare_eth(data1, data2);
}
/**
--
1.8.0
8 years, 6 months