batman-adv: explain the weird TTL for ICMP packets

Message ID 1319989246-3670-1-git-send-email-siwu@hrz.tu-chemnitz.de (mailing list archive)
State Rejected, archived
Headers

Commit Message

Simon Wunderlich Oct. 30, 2011, 3:40 p.m. UTC
  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(-)
  

Comments

Sven Eckelmann Oct. 30, 2011, 3:57 p.m. UTC | #1
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
  

Patch

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);