batman-adv: explain the weird TTL for ICMP packets
Commit Message
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
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
@@ -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);