projects/aports·blob master · refs

56 lines · 2.0 KiB

1Fix various socket header usages on MUSL.
2
3Upstream-status: Cleanup needed
4--- libparistraceroute-0.93.orig/libparistraceroute/protocols/ipv6.c
5+++ libparistraceroute-0.93/libparistraceroute/protocols/ipv6.c
6@@ -186,7 +186,7 @@
7 // If at least one byte of the src_ip is not null, we suppose
8 // that the src_ip has been set...
9 for (i = 0; i < 8 && !do_update_src_ip; i++) {
10- if (iph->ip6_src.__in6_u.__u6_addr16[i] != 0) {
11+ if (iph->ip6_src.__in6_union.__s6_addr16[i] != 0) {
12 do_update_src_ip = false;
13 break;
14 }
15--- libparistraceroute-0.93.orig/libparistraceroute/protocols/tcp.c
16+++ libparistraceroute-0.93/libparistraceroute/protocols/tcp.c
17@@ -77,6 +77,7 @@
18 #define TCP_FIELD_OPTIONS "options" // if data offset > 5, padded at the end with 0 if necessary
19
20 // BSD/Linux abstraction
21+#define __FAVOR_BSD
22 #ifdef __FAVOR_BSD
23 # define SRC_PORT th_sport
24 # define DST_PORT th_dport
25@@ -308,10 +309,10 @@
26 memcpy(psh + size_ip, tcp_segment, size_tcp);
27
28 // Overrides the TCP checksum in psh with zeros
29- memset(psh + size_ip + offsetof(struct tcphdr, check), 0, sizeof(uint16_t));
30+ memset(psh + size_ip + offsetof(struct tcphdr, CHECKSUM), 0, sizeof(uint16_t));
31
32 // Compute the checksum
33- tcp_header->check = csum((const uint16_t *) psh, size_psh);
34+ tcp_header->CHECKSUM = csum((const uint16_t *) psh, size_psh);
35 free(psh);
36 return true;
37 }
38--- libparistraceroute-0.93.orig/libparistraceroute/protocols/udp.c
39+++ libparistraceroute-0.93/libparistraceroute/protocols/udp.c
40@@ -32,6 +32,7 @@
41 // XXX UDP parsing missing
42
43 // BSD/Linux abstraction
44+#define __FAVOR_BSD
45 #ifdef __FAVOR_BSD
46 # define SRC_PORT uh_sport
47 # define DST_PORT uh_dport
48@@ -147,7 +148,7 @@
49 memset(psh + size_ip + offsetof(struct udphdr, CHECKSUM), 0, sizeof(uint16_t));
50
51 // Compute the checksum
52- udp_header->check = csum((const uint16_t *) psh, size_psh);
53+ udp_header->CHECKSUM = csum((const uint16_t *) psh, size_psh);
54 free(psh);
55 return true;
56 }