From 0afefdaa3716c20ceeac359dcaffa377eab1a2be Mon Sep 17 00:00:00 2001 From: q66 Date: Tue, 17 Dec 2019 15:01:45 +0100 Subject: [PATCH] batctl14: musl build fix --- srcpkgs/batctl14/patches/musl.patch | 94 +++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 srcpkgs/batctl14/patches/musl.patch diff --git a/srcpkgs/batctl14/patches/musl.patch b/srcpkgs/batctl14/patches/musl.patch new file mode 100644 index 0000000000..caca064950 --- /dev/null +++ b/srcpkgs/batctl14/patches/musl.patch @@ -0,0 +1,94 @@ +Use POSIX instead of Linux fields. Glibc has both, musl only has POSIX. + +--- ioctl.c ++++ ioctl.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + #include + #include + #include +--- ping.c ++++ ping.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + #include "main.h" + #include "ping.h" +--- tcpdump.c ++++ tcpdump.c +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + + #include "main.h" + #include "tcpdump.h" +@@ -230,7 +231,7 @@ static void dump_ip(unsigned char *packet_buff, ssize_t buff_len, int time_print + printf("%s: ICMP ", inet_ntoa(*(struct in_addr *)&iphdr->daddr)); + printf("%s udp port %hu unreachable, length %zu\n", + inet_ntoa(*(struct in_addr *)&tmp_iphdr->daddr), +- ntohs(tmp_udphdr->dest), (size_t)buff_len - (iphdr->ihl * 4)); ++ ntohs(tmp_udphdr->uh_dport), (size_t)buff_len - (iphdr->ihl * 4)); + break; + default: + printf("%s: ICMP unreachable %hhu, length %zu\n", +@@ -261,25 +262,25 @@ static void dump_ip(unsigned char *packet_buff, ssize_t buff_len, int time_print + break; + case IPPROTO_TCP: + tcphdr = (struct tcphdr *)(packet_buff + (iphdr->ihl * 4)); +- tcp_header_len = tcphdr->doff * 4; ++ tcp_header_len = tcphdr->th_off * 4; + LEN_CHECK((size_t)buff_len - (iphdr->ihl * 4), + (size_t)tcp_header_len, "TCP"); + +- printf("IP %s.%i > ", inet_ntoa(*(struct in_addr *)&iphdr->saddr), ntohs(tcphdr->source)); ++ printf("IP %s.%i > ", inet_ntoa(*(struct in_addr *)&iphdr->saddr), ntohs(tcphdr->th_sport)); + printf("%s.%i: TCP, flags [%c%c%c%c%c%c], length %zu\n", +- inet_ntoa(*(struct in_addr *)&iphdr->daddr), ntohs(tcphdr->dest), +- (tcphdr->fin ? 'F' : '.'), (tcphdr->syn ? 'S' : '.'), +- (tcphdr->rst ? 'R' : '.'), (tcphdr->psh ? 'P' : '.'), +- (tcphdr->ack ? 'A' : '.'), (tcphdr->urg ? 'U' : '.'), ++ inet_ntoa(*(struct in_addr *)&iphdr->daddr), ntohs(tcphdr->th_dport), ++ (tcphdr->th_flags & TH_FIN ? 'F' : '.'), (tcphdr->th_flags & TH_SYN ? 'S' : '.'), ++ (tcphdr->th_flags & TH_RST ? 'R' : '.'), (tcphdr->th_flags & TH_PUSH ? 'P' : '.'), ++ (tcphdr->th_flags & TH_ACK ? 'A' : '.'), (tcphdr->th_flags & TH_URG ? 'U' : '.'), + (size_t)buff_len - (iphdr->ihl * 4) - tcp_header_len); + break; + case IPPROTO_UDP: + LEN_CHECK((size_t)buff_len - (iphdr->ihl * 4), sizeof(struct udphdr), "UDP"); + + udphdr = (struct udphdr *)(packet_buff + (iphdr->ihl * 4)); +- printf("IP %s.%i > ", inet_ntoa(*(struct in_addr *)&iphdr->saddr), ntohs(udphdr->source)); ++ printf("IP %s.%i > ", inet_ntoa(*(struct in_addr *)&iphdr->saddr), ntohs(udphdr->uh_sport)); + +- switch (ntohs(udphdr->dest)) { ++ switch (ntohs(udphdr->uh_dport)) { + case 67: + LEN_CHECK((size_t)buff_len - (iphdr->ihl * 4) - sizeof(struct udphdr), (size_t) 44, "DHCP"); + printf("%s.67: BOOTP/DHCP, Request from %s, length %zu\n", +@@ -294,7 +295,7 @@ static void dump_ip(unsigned char *packet_buff, ssize_t buff_len, int time_print + break; + default: + printf("%s.%i: UDP, length %zu\n", +- inet_ntoa(*(struct in_addr *)&iphdr->daddr), ntohs(udphdr->dest), ++ inet_ntoa(*(struct in_addr *)&iphdr->daddr), ntohs(udphdr->uh_dport), + (size_t)buff_len - (iphdr->ihl * 4) - sizeof(struct udphdr)); + break; + } +--- traceroute.c ++++ traceroute.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + #include "main.h" + #include "traceroute.h"