c6ce65d3d0
```sh git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" | while read template; do for p in ${template%/template}/patches/*; do sed -i ' \,^[+-][+-][+-] /dev/null,b /^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b s,^[*][*][*] ,&a/, /^--- /{ s,\(^--- \)\(./\)*,\1a/, s,[.-][Oo][Rr][Ii][Gg]\([ /]\),\1, s/[.-][Oo][Rr][Ii][Gg]$// s/[.]patched[.]\([^.]\)/.\1/ h } /^+++ -/{ g s/^--- a/+++ b/ b } s,\(^+++ \)\(./\)*,\1b/, ' "$p" done sed -i '/^patch_args=/d' $template done ```
94 lines
3.5 KiB
Diff
94 lines
3.5 KiB
Diff
Use POSIX instead of Linux fields. Glibc has both, musl only has POSIX.
|
|
|
|
--- a/ioctl.c
|
|
+++ b/ioctl.c
|
|
@@ -25,6 +25,7 @@
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
+#include <sys/types.h>
|
|
#include <sys/ioctl.h>
|
|
#include <sys/socket.h>
|
|
#include <linux/if.h>
|
|
--- a/ping.c
|
|
+++ b/ping.c
|
|
@@ -30,6 +30,7 @@
|
|
#include <fcntl.h>
|
|
#include <string.h>
|
|
#include <math.h>
|
|
+#include <linux/types.h>
|
|
|
|
#include "main.h"
|
|
#include "ping.h"
|
|
--- a/tcpdump.c
|
|
+++ b/tcpdump.c
|
|
@@ -36,6 +36,7 @@
|
|
#include <netinet/udp.h>
|
|
#include <netinet/ip_icmp.h>
|
|
#include <netinet/if_ether.h>
|
|
+#include <linux/types.h>
|
|
|
|
#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;
|
|
}
|
|
--- a/traceroute.c
|
|
+++ b/traceroute.c
|
|
@@ -28,6 +28,7 @@
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#include <string.h>
|
|
+#include <linux/types.h>
|
|
|
|
#include "main.h"
|
|
#include "traceroute.h"
|