summaryrefslogtreecommitdiff
path: root/debian/patches/72_traceroute_fix_setsockopt.patch
blob: 2f86a89cead39cd08297396bb8fc758c960bb57a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Description: Use integer arguments to setsockopt().
 GNU/kFreeBSD must pass an integer argument with IP_TTL
 in setsockopt(2). Thsi has no ill effect with GNU/Linux.
 .
 The change is backported from upstream git repository.
Author: Mats Erik Andersson <debian@gisladisker.se>
Forwarded: not-needed
Last-Update: 2011-01-18

--- inetutils-1.8/src/traceroute.c.orig
+++ inetutils-1.8/src/traceroute.c
@@ -67,7 +67,7 @@
   int icmpfd, udpfd;
   enum trace_type type;
   struct sockaddr_in to, from;
-  unsigned char ttl;
+  int ttl;
   struct timeval tsent;
 } trace_t;
 
@@ -314,7 +314,7 @@
 trace_init (trace_t * t, const struct sockaddr_in to,
 	    const enum trace_type type)
 {
-  const unsigned char *ttlp;
+  const int *ttlp;
   assert (t);
   ttlp = &t->ttl;
 
@@ -329,7 +329,7 @@
         error (EXIT_FAILURE, errno, "socket");
 
       if (setsockopt (t->udpfd, IPPROTO_IP, IP_TTL, ttlp,
-		      sizeof (t->ttl)) < 0)
+		      sizeof (*ttlp)) < 0)
         error (EXIT_FAILURE, errno, "setsockopt");
     }
 
@@ -343,7 +343,7 @@
             error (EXIT_FAILURE, errno, "socket");
 
 	  if (setsockopt (t->icmpfd, IPPROTO_IP, IP_TTL,
-			  ttlp, sizeof (t->ttl)) < 0)
+			  ttlp, sizeof (*ttlp)) < 0)
             error (EXIT_FAILURE, errno, "setsockopt");
 	}
       else
@@ -523,14 +523,14 @@
 trace_inc_ttl (trace_t * t)
 {
   int fd;
-  const unsigned char *ttlp;
+  const int *ttlp;
 
   assert (t);
 
   ttlp = &t->ttl;
   t->ttl++;
   fd = (t->type == TRACE_UDP ? t->udpfd : t->icmpfd);
-  if (setsockopt (fd, IPPROTO_IP, IP_TTL, ttlp, sizeof (t->ttl)) < 0)
+  if (setsockopt (fd, IPPROTO_IP, IP_TTL, ttlp, sizeof (*ttlp)) < 0)
     error (EXIT_FAILURE, errno, "setsockopt");
 }