aports/main/sipp/musl-fixes.patch
Natanael Copa 2ca113961d main/sipp: build fix for musl
replace u_char and u_long with unsigned char/long
define _GNU_SOURCE for the gnu style udphdr fields
2014-03-26 07:41:46 +00:00

143 lines
4.3 KiB
Diff

diff --git a/auth.c b/auth.c
index 544e1a9..e1551ff 100644
--- a/auth.c
+++ b/auth.c
@@ -42,24 +42,24 @@ extern char *auth_uri;
/* AKA */
#define KLEN 16
-typedef u_char K[KLEN];
+typedef unsigned char K[KLEN];
#define RANDLEN 16
-typedef u_char RAND[RANDLEN];
+typedef unsigned char RAND[RANDLEN];
#define AUTNLEN 16
-typedef u_char AUTN[AUTNLEN];
+typedef unsigned char AUTN[AUTNLEN];
#define AKLEN 6
-typedef u_char AK[AKLEN];
+typedef unsigned char AK[AKLEN];
#define AMFLEN 2
-typedef u_char AMF[AMFLEN];
+typedef unsigned char AMF[AMFLEN];
#define MACLEN 8
-typedef u_char MAC[MACLEN];
+typedef unsigned char MAC[MACLEN];
#define CKLEN 16
-typedef u_char CK[CKLEN];
+typedef unsigned char CK[CKLEN];
#define IKLEN 16
-typedef u_char IK[IKLEN];
+typedef unsigned char IK[IKLEN];
#define SQNLEN 6
-typedef u_char SQN[SQNLEN];
+typedef unsigned char SQN[SQNLEN];
#define AUTSLEN 14
typedef char AUTS[AUTSLEN];
#define AUTS64LEN 29
@@ -69,7 +69,7 @@ typedef unsigned char RES[RESLEN+1];
#define RESHEXLEN 17
typedef char RESHEX[RESHEXLEN];
#define OPLEN 16
-typedef u_char OP[OPLEN];
+typedef unsigned char OP[OPLEN];
AMF amfstar="\0\0";
SQN sqn_he={0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/prepare_pcap.c b/prepare_pcap.c
index 07ccb26..d6dd102 100644
--- a/prepare_pcap.c
+++ b/prepare_pcap.c
@@ -15,6 +15,7 @@
*
* Author : Guillaume TEISSIER from FTR&D 02/02/2006
*/
+#define _GNU_SOURCE
#include <pcap.h>
#include <stdlib.h>
#include <netinet/in.h>
@@ -84,11 +85,11 @@ char errbuf[PCAP_ERRBUF_SIZE];
int prepare_pkts(char *file, pcap_pkts *pkts) {
pcap_t *pcap;
struct pcap_pkthdr *pkthdr = NULL;
- u_char *pktdata = NULL;
+ unsigned char *pktdata = NULL;
int n_pkts = 0;
- u_long max_length = 0;
+ unsigned long max_length = 0;
u_int16_t base = 0xffff;
- u_long pktlen;
+ unsigned long pktlen;
pcap_pkt *pkt_index;
ether_hdr *ethhdr;
struct iphdr *iphdr;
@@ -102,7 +103,7 @@ int prepare_pkts(char *file, pcap_pkts *pkts) {
ERROR("Can't open PCAP file '%s'", file);
#if HAVE_PCAP_NEXT_EX
- while (pcap_next_ex (pcap, &pkthdr, (const u_char **) &pktdata) == 1)
+ while (pcap_next_ex (pcap, &pkthdr, (const unsigned char **) &pktdata) == 1)
{
#else
#ifdef __HPUX
@@ -112,7 +113,7 @@ int prepare_pkts(char *file, pcap_pkts *pkts) {
#endif
if (!pkthdr)
ERROR("Can't allocate memory for pcap pkthdr");
- while ((pktdata = (u_char *) pcap_next (pcap, pkthdr)) != NULL)
+ while ((pktdata = (unsigned char *) pcap_next (pcap, pkthdr)) != NULL)
{
#endif
ethhdr = (ether_hdr *)pktdata;
@@ -124,7 +125,7 @@ int prepare_pkts(char *file, pcap_pkts *pkts) {
iphdr = (struct iphdr *)((char *)ethhdr + sizeof(*ethhdr));
if (iphdr && iphdr->version == 6) {
//ipv6
- pktlen = (u_long) pkthdr->len - sizeof(*ethhdr) - sizeof(*ip6hdr);
+ pktlen = (unsigned long) pkthdr->len - sizeof(*ethhdr) - sizeof(*ip6hdr);
ip6hdr = (ipv6_hdr *)(void *) iphdr;
if (ip6hdr->nxt_header != IPPROTO_UDP) {
fprintf(stderr, "prepare_pcap.c: Ignoring non UDP packet!\n");
@@ -139,13 +140,13 @@ int prepare_pkts(char *file, pcap_pkts *pkts) {
}
#if defined(__DARWIN) || defined(__CYGWIN) || defined(__FreeBSD__)
udphdr = (struct udphdr *)((char *)iphdr + (iphdr->ihl << 2) + 4);
- pktlen = (u_long)(ntohs(udphdr->uh_ulen));
+ pktlen = (unsigned long)(ntohs(udphdr->uh_ulen));
#elif defined ( __HPUX)
udphdr = (struct udphdr *)((char *)iphdr + (iphdr->ihl << 2));
- pktlen = (u_long) pkthdr->len - sizeof(*ethhdr) - sizeof(*iphdr);
+ pktlen = (unsigned long) pkthdr->len - sizeof(*ethhdr) - sizeof(*iphdr);
#else
udphdr = (struct udphdr *)((char *)iphdr + (iphdr->ihl << 2));
- pktlen = (u_long)(ntohs(udphdr->len));
+ pktlen = (unsigned long)(ntohs(udphdr->len));
#endif
}
if (pktlen > PCAP_MAXPACKET) {
diff --git a/prepare_pcap.h b/prepare_pcap.h
index ae90556..e89ab52 100644
--- a/prepare_pcap.h
+++ b/prepare_pcap.h
@@ -52,8 +52,8 @@ struct iphdr
typedef struct
{
- u_char *data;
- u_long pktlen;
+ unsigned char *data;
+ unsigned long pktlen;
struct timeval ts;
int partial_check;
} pcap_pkt;
@@ -63,7 +63,7 @@ typedef struct
{
char *file;
u_int16_t base;
- u_long max_length;
+ unsigned long max_length;
pcap_pkt *max;
pcap_pkt *pkts;
} pcap_pkts;