Hi,
just looked through some ICMP code in icmp_socket.c and found a little bit weird TTL:
218 if (icmp_packet->version != COMPAT_VERSION) { 219 icmp_packet->msg_type = PARAMETER_PROBLEM; 220 icmp_packet->ttl = COMPAT_VERSION; 221 bat_socket_add_packet(socket_client, icmp_packet, packet_len); 222 goto free_skb; 223 }
It was introduced by dba95eb270ff9674326865a20d25921c69c04d6c. My guess is that TTL should be used.
Kind regards, Sven
Hi Sven,
although looking a little bit confusing, this seems to be correct. The TTL field is used to transport the kernel modules compat version when it differs from the one used in batctl.
Compare the batctl code (ping.c:284): switch (icmp_packet_in.msg_type) { [...] case PARAMETER_PROBLEM: printf("Error - the batman adv kernel module version (%d) differs from ours (%d)\n", icmp_packet_in.ttl, COMPAT_VERSION); printf("Please make sure to compatible versions!\n"); goto out; [...]
However, I guess an explaining comment in the kernel code would not be wrong ...
Cheers Simon
On Sun, Oct 30, 2011 at 02:31:55PM +0100, Sven Eckelmann wrote:
Hi,
just looked through some ICMP code in icmp_socket.c and found a little bit weird TTL:
218 if (icmp_packet->version != COMPAT_VERSION) { 219 icmp_packet->msg_type = PARAMETER_PROBLEM; 220 icmp_packet->ttl = COMPAT_VERSION; 221 bat_socket_add_packet(socket_client, icmp_packet, packet_len); 222 goto free_skb; 223 }
It was introduced by dba95eb270ff9674326865a20d25921c69c04d6c. My guess is that TTL should be used.
Kind regards, Sven
A comment may clear this up ...
Reported-by: Sven Eckelmann sven@narfation.org Signed-off-by: Simon Wunderlich siwu@hrz.tu-chemnitz.de --- icmp_socket.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/icmp_socket.c b/icmp_socket.c index ac3520e..7b832d2 100644 --- a/icmp_socket.c +++ b/icmp_socket.c @@ -216,6 +216,8 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, icmp_packet->uid = socket_client->index;
if (icmp_packet->version != COMPAT_VERSION) { + /* report the kernel modules COMPAT_VERSION through the ttl + * field if it differs from the version in the copied packet. */ icmp_packet->msg_type = PARAMETER_PROBLEM; icmp_packet->ttl = COMPAT_VERSION; bat_socket_add_packet(socket_client, icmp_packet, packet_len);
On Sunday 30 October 2011 16:40:46 Simon Wunderlich wrote:
A comment may clear this up ...
Reported-by: Sven Eckelmann sven@narfation.org Signed-off-by: Simon Wunderlich siwu@hrz.tu-chemnitz.de
NAcked-by: Sven Eckelmann sven@narfation.org
No, the problem is that there is a ttl field and a version field. There is no reason to use the ttl field for the version or the version field for the ttl. When we query the information from the kernel, why don't we use the correct stuff in the common header structure. And the ttl position wasn't stable... so it would create a random number anyway when mixing particular versions of batman-adv/batctl.
But yes, you are right that the TTL mentioned in my first post doesn't make sense either.
Kind regards, Sven
b.a.t.m.a.n@lists.open-mesh.org