batman-adv; branch, master, updated. v2011.3.0-39-g00ca20e
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit 00ca20ef24617946e37bf69ca0a374f86ea56e6b
Author: Simon Wunderlich <simon.wunderlich(a)s2003.tu-chemnitz.de>
Date: Sun Oct 30 16:22:43 2011 +0100
batman-adv: Fix range check for expected packets
The check for new packets in the future used a wrong binary operator,
which makes the check expression always true and accepting too many
packets.
Reported-by: Thomas Jarosch <thomas.jarosch(a)intra2net.com>
Signed-off-by: Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
diff --git a/bitarray.c b/bitarray.c
index 0be9ff3..9bc63b2 100644
--- a/bitarray.c
+++ b/bitarray.c
@@ -155,7 +155,7 @@ int bit_get_packet(void *priv, unsigned long *seq_bits,
/* sequence number is much newer, probably missed a lot of packets */
if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE)
- || (seq_num_diff < EXPECTED_SEQNO_RANGE)) {
+ && (seq_num_diff < EXPECTED_SEQNO_RANGE)) {
bat_dbg(DBG_BATMAN, bat_priv,
"We missed a lot of packets (%i) !\n",
seq_num_diff - 1);
--
batman-adv
11 years, 3 months
linux integration; branch, merge/master, updated. v3.1-rc1-1116-g71c7948
by postmaster@open-mesh.org
The following commit has been merged in the merge/master branch:
commit 71c7948eafcd10f55a34a92abc7af2a743c1e7d1
Merge: 5a441b8f246a72a818dbd5790433f9d179ac7681 474f9178314dc440d3be1df8e1af0f222ad7aff1
Author: Marek Lindner <lindner_marek(a)yahoo.de>
Date: Tue Oct 25 14:17:11 2011 +0200
Merge remote-tracking branch 'origin/standalone/next' into merge/master
Conflicts:
net/batman-adv/compat.c
net/batman-adv/compat.h
diff --combined net/batman-adv/translation-table.c
index 873fb3d,c7aafc7..c7aafc7
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@@ -137,10 -137,22 +137,22 @@@ static void tt_local_entry_free_ref(str
kfree_rcu(tt_local_entry, rcu);
}
+ static void tt_global_entry_free_rcu(struct rcu_head *rcu)
+ {
+ struct tt_global_entry *tt_global_entry;
+
+ tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
+
+ if (tt_global_entry->orig_node)
+ orig_node_free_ref(tt_global_entry->orig_node);
+
+ kfree(tt_global_entry);
+ }
+
static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
{
if (atomic_dec_and_test(&tt_global_entry->refcount))
- kfree_rcu(tt_global_entry, rcu);
+ call_rcu(&tt_global_entry->rcu, tt_global_entry_free_rcu);
}
static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
@@@ -710,6 -722,9 +722,9 @@@ void tt_global_del_orig(struct bat_pri
struct hlist_head *head;
spinlock_t *list_lock; /* protects write access to the hash lists */
+ if (!hash)
+ return;
+
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
list_lock = &hash->list_locks[i];
diff --combined net/batman-adv/types.h
index 1ae3557,ab8d0fe..ab8d0fe
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@@ -224,22 -224,22 +224,22 @@@ struct socket_packet
struct tt_local_entry {
uint8_t addr[ETH_ALEN];
+ struct hlist_node hash_entry;
unsigned long last_seen;
uint16_t flags;
atomic_t refcount;
struct rcu_head rcu;
- struct hlist_node hash_entry;
};
struct tt_global_entry {
uint8_t addr[ETH_ALEN];
+ struct hlist_node hash_entry; /* entry in the global table */
struct orig_node *orig_node;
uint8_t ttvn;
uint16_t flags; /* only TT_GLOBAL_ROAM is used */
unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */
atomic_t refcount;
struct rcu_head rcu;
- struct hlist_node hash_entry; /* entry in the global table */
};
struct tt_change_node {
--
linux integration
11 years, 3 months
batman-adv; branch, maint, updated. v2011.3.1-3-g32d1ad6
by postmaster@open-mesh.org
The following commit has been merged in the maint branch:
commit 32d1ad673cf104d05368129884c4ff3bcb2c7941
Author: Antonio Quartulli <ordex(a)autistici.org>
Date: Sat Oct 22 00:55:39 2011 +0200
batman-adv: unify hash_entry field position in tt_local/global_entry
Function tt_response_fill_table() actually uses a tt_local_entry pointer to
iterate either over the local or the global table entries (it depends on the
what hash table is passed as argument). To iterate over such entries the
hlist_for_each_entry_rcu() macro has to access their "hash_entry" field which
MUST be at the same position in both the tt_global/local_entry structures.
Reported-by: Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
diff --git a/types.h b/types.h
index 25bd1db..51a0db7 100644
--- a/types.h
+++ b/types.h
@@ -223,22 +223,22 @@ struct socket_packet {
struct tt_local_entry {
uint8_t addr[ETH_ALEN];
+ struct hlist_node hash_entry;
unsigned long last_seen;
uint16_t flags;
atomic_t refcount;
struct rcu_head rcu;
- struct hlist_node hash_entry;
};
struct tt_global_entry {
uint8_t addr[ETH_ALEN];
+ struct hlist_node hash_entry; /* entry in the global table */
struct orig_node *orig_node;
uint8_t ttvn;
uint16_t flags; /* only TT_GLOBAL_ROAM is used */
unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */
atomic_t refcount;
struct rcu_head rcu;
- struct hlist_node hash_entry; /* entry in the global table */
};
struct tt_change_node {
--
batman-adv
11 years, 3 months
batman-adv; branch, maint, updated. v2011.3.1-3-g32d1ad6
by postmaster@open-mesh.org
The following commit has been merged in the maint branch:
commit ee9f128534108be4eafd2ecb410ea89e1f063e8b
Author: Simon Wunderlich <simon.wunderlich(a)s2003.tu-chemnitz.de>
Date: Wed Oct 19 11:02:25 2011 +0200
batman-adv: remove references for global tt entries
struct tt_global_entry holds a reference to an orig_node which must be
decremented before deallocating the structure.
Signed-off-by: Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
Tested-by: Alexey Fisher <bug-track(a)fisher-privat.net>
diff --git a/compat.c b/compat.c
index 88ceb40..1793904 100644
--- a/compat.c
+++ b/compat.c
@@ -36,12 +36,4 @@ void free_rcu_tt_local_entry(struct rcu_head *rcu)
kfree(tt_local_entry);
}
-void free_rcu_tt_global_entry(struct rcu_head *rcu)
-{
- struct tt_global_entry *tt_global_entry;
-
- tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
- kfree(tt_global_entry);
-}
-
#endif /* < KERNEL_VERSION(3, 0, 0) */
diff --git a/compat.h b/compat.h
index 829b0fb..aad9310 100644
--- a/compat.h
+++ b/compat.h
@@ -61,7 +61,6 @@ void free_rcu_gw_node(struct rcu_head *rcu);
void free_rcu_neigh_node(struct rcu_head *rcu);
void free_rcu_softif_neigh(struct rcu_head *rcu);
void free_rcu_tt_local_entry(struct rcu_head *rcu);
-void free_rcu_tt_global_entry(struct rcu_head *rcu);
#endif /* < KERNEL_VERSION(3, 0, 0) */
diff --git a/translation-table.c b/translation-table.c
index ef1acfd..ca537ed 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -137,10 +137,22 @@ static void tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry)
kfree_rcu(tt_local_entry, rcu);
}
+static void tt_global_entry_free_rcu(struct rcu_head *rcu)
+{
+ struct tt_global_entry *tt_global_entry;
+
+ tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
+
+ if (tt_global_entry->orig_node)
+ orig_node_free_ref(tt_global_entry->orig_node);
+
+ kfree(tt_global_entry);
+}
+
static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
{
if (atomic_dec_and_test(&tt_global_entry->refcount))
- kfree_rcu(tt_global_entry, rcu);
+ call_rcu(&tt_global_entry->rcu, tt_global_entry_free_rcu);
}
static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
--
batman-adv
11 years, 3 months
batman-adv; branch, maint, updated. v2011.3.1-3-g32d1ad6
by postmaster@open-mesh.org
The following commit has been merged in the maint branch:
commit 24ccf55154d49d78660a28f383664e938f9e97f2
Author: Simon Wunderlich <simon.wunderlich(a)s2003.tu-chemnitz.de>
Date: Wed Oct 19 10:28:26 2011 +0200
batman-adv: add sanity check when removing global tts
After removing the batman-adv module, the hash may be already gone
when tt_global_del_orig() tries to clean the hash. This patch adds
a sanity check to avoid this.
Signed-off-by: Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
Tested-by: Alexey Fisher <bug-track(a)fisher-privat.net>
diff --git a/translation-table.c b/translation-table.c
index ca537ed..d58fd8b 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -698,6 +698,9 @@ void tt_global_del_orig(struct bat_priv *bat_priv,
struct hlist_head *head;
spinlock_t *list_lock; /* protects write access to the hash lists */
+ if (!hash)
+ return;
+
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
list_lock = &hash->list_locks[i];
--
batman-adv
11 years, 3 months
batctl; branch, master, updated. v2011.3.0-9-g9031e43
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit b6faa0d4a6024e34d76aa6fdbd03d3fd480f154e
Author: Marek Lindner <lindner_marek(a)yahoo.de>
Date: Fri Aug 19 00:35:55 2011 +0200
batctl: rename all instances of batman_packet to batman_ogm_packet
The follow-up routing code changes are going to introduce additional
routing packet types which make this distinction necessary.
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
diff --git a/packet.h b/packet.h
index b76b4be..8a0ce69 100644
--- a/packet.h
+++ b/packet.h
@@ -25,14 +25,14 @@
#define ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */
enum bat_packettype {
- BAT_PACKET = 0x01,
- BAT_ICMP = 0x02,
- BAT_UNICAST = 0x03,
- BAT_BCAST = 0x04,
- BAT_VIS = 0x05,
+ BAT_OGM = 0x01,
+ BAT_ICMP = 0x02,
+ BAT_UNICAST = 0x03,
+ BAT_BCAST = 0x04,
+ BAT_VIS = 0x05,
BAT_UNICAST_FRAG = 0x06,
- BAT_TT_QUERY = 0x07,
- BAT_ROAM_ADV = 0x08
+ BAT_TT_QUERY = 0x07,
+ BAT_ROAM_ADV = 0x08
};
/* this file is included by batctl which needs these defines */
@@ -89,7 +89,7 @@ enum tt_client_flags {
TT_CLIENT_PENDING = 1 << 10
};
-struct batman_packet {
+struct batman_ogm_packet {
uint8_t packet_type;
uint8_t version; /* batman version field */
uint8_t ttl;
@@ -104,7 +104,7 @@ struct batman_packet {
uint16_t tt_crc;
} __packed;
-#define BAT_PACKET_LEN sizeof(struct batman_packet)
+#define BATMAN_OGM_LEN sizeof(struct batman_ogm_packet)
struct icmp_packet {
uint8_t packet_type;
diff --git a/tcpdump.c b/tcpdump.c
index 0e69431..977bedc 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -318,27 +318,27 @@ static void dump_batman_roam(unsigned char *packet_buff, ssize_t buff_len, int r
static void dump_batman_ogm(unsigned char *packet_buff, ssize_t buff_len, int read_opt, int time_printed)
{
struct ether_header *ether_header;
- struct batman_packet *batman_packet;
+ struct batman_ogm_packet *batman_ogm_packet;
- LEN_CHECK((size_t)buff_len - sizeof(struct ether_header), sizeof(struct batman_packet), "BAT OGM");
+ LEN_CHECK((size_t)buff_len - sizeof(struct ether_header), sizeof(struct batman_ogm_packet), "BAT OGM");
ether_header = (struct ether_header *)packet_buff;
- batman_packet = (struct batman_packet *)(packet_buff + sizeof(struct ether_header));
+ batman_ogm_packet = (struct batman_ogm_packet *)(packet_buff + sizeof(struct ether_header));
if (!time_printed)
print_time();
printf("BAT %s: ",
- get_name_by_macaddr((struct ether_addr *)batman_packet->orig, read_opt));
+ get_name_by_macaddr((struct ether_addr *)batman_ogm_packet->orig, read_opt));
printf("OGM via neigh %s, seq %u, tq %3d, ttvn %d, ttcrc %d, ttl %2d, v %d, flags [%c%c%c%c], length %zu\n",
get_name_by_macaddr((struct ether_addr *)ether_header->ether_shost, read_opt),
- ntohl(batman_packet->seqno), batman_packet->tq, batman_packet->ttvn,
- ntohl(batman_packet->tt_crc), batman_packet->ttl, batman_packet->version,
- (batman_packet->flags & DIRECTLINK ? 'D' : '.'),
- (batman_packet->flags & VIS_SERVER ? 'V' : '.'),
- (batman_packet->flags & PRIMARIES_FIRST_HOP ? 'F' : '.'),
- (batman_packet->gw_flags ? 'G' : '.'),
+ ntohl(batman_ogm_packet->seqno), batman_ogm_packet->tq, batman_ogm_packet->ttvn,
+ ntohl(batman_ogm_packet->tt_crc), batman_ogm_packet->ttl, batman_ogm_packet->version,
+ (batman_ogm_packet->flags & DIRECTLINK ? 'D' : '.'),
+ (batman_ogm_packet->flags & VIS_SERVER ? 'V' : '.'),
+ (batman_ogm_packet->flags & PRIMARIES_FIRST_HOP ? 'F' : '.'),
+ (batman_ogm_packet->gw_flags ? 'G' : '.'),
(size_t)buff_len - sizeof(struct ether_header));
}
@@ -469,7 +469,7 @@ static void dump_batman_frag(unsigned char *packet_buff, ssize_t buff_len, int r
static void parse_eth_hdr(unsigned char *packet_buff, ssize_t buff_len, int read_opt, int time_printed)
{
- struct batman_packet *batman_packet;
+ struct batman_ogm_packet *batman_ogm_packet;
struct ether_header *eth_hdr;
eth_hdr = (struct ether_header *)packet_buff;
@@ -488,10 +488,10 @@ static void parse_eth_hdr(unsigned char *packet_buff, ssize_t buff_len, int read
dump_vlan(packet_buff, buff_len, read_opt, time_printed);
break;
case ETH_P_BATMAN:
- batman_packet = (struct batman_packet *)(packet_buff + ETH_HLEN);
+ batman_ogm_packet = (struct batman_ogm_packet *)(packet_buff + ETH_HLEN);
- switch (batman_packet->packet_type) {
- case BAT_PACKET:
+ switch (batman_ogm_packet->packet_type) {
+ case BAT_OGM:
if (dump_level & DUMP_TYPE_BATOGM)
dump_batman_ogm(packet_buff, buff_len, read_opt, time_printed);
break;
@@ -524,7 +524,7 @@ static void parse_eth_hdr(unsigned char *packet_buff, ssize_t buff_len, int read
dump_batman_roam(packet_buff, buff_len, read_opt, time_printed);
break;
default:
- printf("Warning - packet contains unknown batman packet type: 0x%02x\n", batman_packet->packet_type);
+ printf("Warning - packet contains unknown batman packet type: 0x%02x\n", batman_ogm_packet->packet_type);
break;
}
--
batctl
11 years, 3 months
batctl; branch, master, updated. v2011.3.0-9-g9031e43
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit e4ac9b72dd7a36d587fb91186b6979d94265f234
Merge: b6faa0d4a6024e34d76aa6fdbd03d3fd480f154e 0a284c579e26edc603f46f71684ee66f8bfc0a68
Author: Marek Lindner <lindner_marek(a)yahoo.de>
Date: Mon Oct 24 14:18:29 2011 +0200
Merge branch 'next' of git+ssh://batman-git/batctl into next
--
batctl
11 years, 3 months
batctl; branch, master, updated. v2011.3.0-9-g9031e43
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit 9031e43c3d40a1771d6969c44e06ba4229ee6522
Author: Antonio Quartull <ordex(a)autistici.org>
Date: Wed Oct 19 14:34:42 2011 +0200
batctl: correct ttcrc print format in the tcpdump output
The OGM ttcrc field is an unsigned short int, therefore it has to be printed
using %hu and has to be converted from network to host order using ntohs
Signed-off-by: Antonio Quartull <ordex(a)autistici.org>
diff --git a/tcpdump.c b/tcpdump.c
index 977bedc..7dd289e 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -331,10 +331,10 @@ static void dump_batman_ogm(unsigned char *packet_buff, ssize_t buff_len, int re
printf("BAT %s: ",
get_name_by_macaddr((struct ether_addr *)batman_ogm_packet->orig, read_opt));
- printf("OGM via neigh %s, seq %u, tq %3d, ttvn %d, ttcrc %d, ttl %2d, v %d, flags [%c%c%c%c], length %zu\n",
+ printf("OGM via neigh %s, seq %u, tq %3d, ttvn %d, ttcrc %hu, ttl %2d, v %d, flags [%c%c%c%c], length %zu\n",
get_name_by_macaddr((struct ether_addr *)ether_header->ether_shost, read_opt),
ntohl(batman_ogm_packet->seqno), batman_ogm_packet->tq, batman_ogm_packet->ttvn,
- ntohl(batman_ogm_packet->tt_crc), batman_ogm_packet->ttl, batman_ogm_packet->version,
+ ntohs(batman_ogm_packet->tt_crc), batman_ogm_packet->ttl, batman_ogm_packet->version,
(batman_ogm_packet->flags & DIRECTLINK ? 'D' : '.'),
(batman_ogm_packet->flags & VIS_SERVER ? 'V' : '.'),
(batman_ogm_packet->flags & PRIMARIES_FIRST_HOP ? 'F' : '.'),
--
batctl
11 years, 3 months
linux integration; annotated tag, v3.1, created. v3.1
by postmaster@open-mesh.org
The annotated tag, v3.1 has been created
at a732360658fc100add6ded23ac6c8013b50cef1f (tag)
tagging c3b92c8787367a8bb53d57d9789b558f1295cc96 (commit)
replaces v3.1-rc10
tagged by Linus Torvalds
on Mon Oct 24 09:10:51 2011 +0200
- Shortlog ------------------------------------------------------------
Linux v3.1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iQEcBAABAgAGBQJOpQ9/AAoJEHm+PkMAQRiGtVkH/jICsGwOyUaBEXl640YjCoem
lE5CQGOMGqFt1jZaVNkLnzKnb+G/XRadE5C5q9teMwgtB5owQMZu5vJdbrwcFB7u
8CttF+B5QjubgyJDuP4eztDTrtQkvq7v0SMzGiGWN2Q9vKldRgTimD3+vgBcW/fS
ixbfDeGkaaP+t952buSDvOz/RhHZM6rZZPrtRD1MiMHr45oB3caXVStja5jAAETZ
0V2byOu3fpniCGB/Puv+E6iWxRp7hwc0vIUG6x3ubqhMb8N2CjxBmlypii86Lt7m
oUmNqdKpMYONoy8Uythh6iMEUG5PK8ZJt1HOQ3tJ5y2Zz7PR/NAd/XSvbH2GW2g=
=SvzE
-----END PGP SIGNATURE-----
-----------------------------------------------------------------------
--
linux integration
11 years, 3 months
batman-adv; branch, master, updated. v2011.3.0-38-ge096f38
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit e096f3862a486fd1a1cf024baf7e0b9f93dec6b9
Author: Antonio Quartulli <ordex(a)autistici.org>
Date: Sun Oct 16 20:32:03 2011 +0200
batman-adv: check for tt_reponse packet real length
Before accessing the TT_RESPONSE packet payload, the node has to ensure that the
packet is long enough as it would expect to be.
Reported-by: Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
diff --git a/routing.c b/routing.c
index e0e7b7b..ef24a72 100644
--- a/routing.c
+++ b/routing.c
@@ -578,6 +578,7 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
{
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct tt_query_packet *tt_query;
+ uint16_t tt_len;
struct ethhdr *ethhdr;
/* drop packet if it has not necessary minimum size */
@@ -622,6 +623,14 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
if (skb_linearize(skb) < 0)
goto out;
+ tt_len = tt_query->tt_data * sizeof(struct tt_change);
+
+ /* Ensure we have all the claimed data */
+ if (unlikely(skb_headlen(skb) <
+ sizeof(struct tt_query_packet) +
+ tt_len))
+ goto out;
+
handle_tt_response(bat_priv, tt_query);
} else {
bat_dbg(DBG_TT, bat_priv,
--
batman-adv
11 years, 3 months