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
|
Fix various socket header usages on MUSL.
Upstream-status: Cleanup needed
--- libparistraceroute-0.93.orig/libparistraceroute/protocols/ipv6.c
+++ libparistraceroute-0.93/libparistraceroute/protocols/ipv6.c
@@ -186,7 +186,7 @@
// If at least one byte of the src_ip is not null, we suppose
// that the src_ip has been set...
for (i = 0; i < 8 && !do_update_src_ip; i++) {
- if (iph->ip6_src.__in6_u.__u6_addr16[i] != 0) {
+ if (iph->ip6_src.__in6_union.__s6_addr16[i] != 0) {
do_update_src_ip = false;
break;
}
--- libparistraceroute-0.93.orig/libparistraceroute/protocols/tcp.c
+++ libparistraceroute-0.93/libparistraceroute/protocols/tcp.c
@@ -77,6 +77,7 @@
#define TCP_FIELD_OPTIONS "options" // if data offset > 5, padded at the end with 0 if necessary
// BSD/Linux abstraction
+#define __FAVOR_BSD
#ifdef __FAVOR_BSD
# define SRC_PORT th_sport
# define DST_PORT th_dport
@@ -308,10 +309,10 @@
memcpy(psh + size_ip, tcp_segment, size_tcp);
// Overrides the TCP checksum in psh with zeros
- memset(psh + size_ip + offsetof(struct tcphdr, check), 0, sizeof(uint16_t));
+ memset(psh + size_ip + offsetof(struct tcphdr, CHECKSUM), 0, sizeof(uint16_t));
// Compute the checksum
- tcp_header->check = csum((const uint16_t *) psh, size_psh);
+ tcp_header->CHECKSUM = csum((const uint16_t *) psh, size_psh);
free(psh);
return true;
}
--- libparistraceroute-0.93.orig/libparistraceroute/protocols/udp.c
+++ libparistraceroute-0.93/libparistraceroute/protocols/udp.c
@@ -32,6 +32,7 @@
// XXX UDP parsing missing
// BSD/Linux abstraction
+#define __FAVOR_BSD
#ifdef __FAVOR_BSD
# define SRC_PORT uh_sport
# define DST_PORT uh_dport
@@ -147,7 +148,7 @@
memset(psh + size_ip + offsetof(struct udphdr, CHECKSUM), 0, sizeof(uint16_t));
// Compute the checksum
- udp_header->check = csum((const uint16_t *) psh, size_psh);
+ udp_header->CHECKSUM = csum((const uint16_t *) psh, size_psh);
free(psh);
return true;
}
|