From: Rosen Penev Date: Mon, 4 Jan 2021 02:55:59 +0000 (-0800) Subject: rtpengine: fix compilation with newer pcap X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=refs%2Fpull%2F605%2Fhead;p=feed%2Ftelephony.git rtpengine: fix compilation with newer pcap Backport upstream patch fixing this issue. Remove uClibc-ng patch as it's no longer in the tree. Refresh patches. Signed-off-by: Rosen Penev --- diff --git a/net/rtpengine/Makefile b/net/rtpengine/Makefile index 6323a28..356208d 100644 --- a/net/rtpengine/Makefile +++ b/net/rtpengine/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=rtpengine PKG_VERSION:=mr8.5.2.7 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/sipwise/rtpengine/tar.gz/$(PKG_VERSION)? diff --git a/net/rtpengine/patches/02-pcap.patch b/net/rtpengine/patches/02-pcap.patch new file mode 100644 index 0000000..5a27766 --- /dev/null +++ b/net/rtpengine/patches/02-pcap.patch @@ -0,0 +1,173 @@ +From 2a86d5da2ebf9777e7543a9ebe7c5b4c91f563b6 Mon Sep 17 00:00:00 2001 +From: Richard Fuchs +Date: Tue, 5 Jan 2021 11:47:12 -0500 +Subject: [PATCH] TT#14008 fix possible pcap namespace issue + +Change-Id: I8c759d74c8091dd302399c3e72939fa43688f655 +--- + daemon/recording.c | 48 +++++++++++++++++++++++----------------------- + 1 file changed, 24 insertions(+), 24 deletions(-) + +diff --git a/daemon/recording.c b/daemon/recording.c +index 62d26acf4..ad36e1901 100644 +--- a/daemon/recording.c ++++ b/daemon/recording.c +@@ -24,7 +24,7 @@ + + + +-struct pcap_format { ++struct rec_pcap_format { + int linktype; + int headerlen; + void (*header)(unsigned char *, struct packet_stream *); +@@ -40,8 +40,8 @@ static int append_meta_chunk(struct recording *recording, const char *buf, unsig + __attribute__((format(printf,4,5))); + + // pcap methods +-static int pcap_create_spool_dir(const char *dirpath); +-static void pcap_init(struct call *); ++static int rec_pcap_create_spool_dir(const char *dirpath); ++static void rec_pcap_init(struct call *); + static void sdp_after_pcap(struct recording *, GString *str, struct call_monologue *, enum call_opmode opmode); + static void dump_packet_pcap(struct media_packet *mp, const str *s); + static void finish_pcap(struct call *); +@@ -60,7 +60,7 @@ static void setup_stream_proc(struct packet_stream *); + static void setup_media_proc(struct call_media *); + static void kernel_info_proc(struct packet_stream *, struct rtpengine_target_info *); + +-static void pcap_eth_header(unsigned char *, struct packet_stream *); ++static void rec_pcap_eth_header(unsigned char *, struct packet_stream *); + + #define append_meta_chunk_str(r, str, f...) append_meta_chunk(r, (str)->s, (str)->len, f) + #define append_meta_chunk_s(r, str, f...) append_meta_chunk(r, (str), strlen(str), f) +@@ -71,8 +71,8 @@ static const struct recording_method methods[] = { + { + .name = "pcap", + .kernel_support = 0, +- .create_spool_dir = pcap_create_spool_dir, +- .init_struct = pcap_init, ++ .create_spool_dir = rec_pcap_create_spool_dir, ++ .init_struct = rec_pcap_init, + .sdp_after = sdp_after_pcap, + .dump_packet = dump_packet_pcap, + .finish = finish_pcap, +@@ -96,14 +96,14 @@ static const struct recording_method methods[] = { + }, + }; + +-static const struct pcap_format pcap_format_raw = { ++static const struct rec_pcap_format rec_pcap_format_raw = { + .linktype = DLT_RAW, + .headerlen = 0, + }; +-static const struct pcap_format pcap_format_eth = { ++static const struct rec_pcap_format rec_pcap_format_eth = { + .linktype = DLT_EN10MB, + .headerlen = 14, +- .header = pcap_eth_header, ++ .header = rec_pcap_eth_header, + }; + + +@@ -111,7 +111,7 @@ static const struct pcap_format pcap_format_eth = { + static char *spooldir = NULL; + + const struct recording_method *selected_recording_method; +-static const struct pcap_format *pcap_format; ++static const struct rec_pcap_format *rec_pcap_format; + + + +@@ -150,9 +150,9 @@ void recording_fs_init(const char *spoolpath, const char *method_str, const char + + found: + if(!strcmp("raw", format_str)) +- pcap_format = &pcap_format_raw; ++ rec_pcap_format = &rec_pcap_format_raw; + else if(!strcmp("eth", format_str)) +- pcap_format = &pcap_format_eth; ++ rec_pcap_format = &rec_pcap_format_eth; + else { + ilog(LOG_ERR, "Invalid value for recording format \"%s\".", format_str); + exit(-1); +@@ -207,7 +207,7 @@ static int check_main_spool_dir(const char *spoolpath) { + * + * Create the "metadata" and "pcaps" directories if they are not there. + */ +-static int pcap_create_spool_dir(const char *spoolpath) { ++static int rec_pcap_create_spool_dir(const char *spoolpath) { + int spool_good = TRUE; + + if (!check_main_spool_dir(spoolpath)) +@@ -360,7 +360,7 @@ void detect_setup_recording(struct call *call, const str *recordcall, str *metad + ilog(LOG_INFO, "\"record-call\" flag "STR_FORMAT" is invalid flag.", STR_FMT(recordcall)); + } + +-static void pcap_init(struct call *call) { ++static void rec_pcap_init(struct call *call) { + struct recording *recording = call->recording; + + // Wireshark starts at packet index 1, so we start there, too +@@ -441,7 +441,7 @@ static void sdp_after_pcap(struct recording *recording, GString *str, struct cal + * Writes metadata to metafile, closes file, and renames it to finished location. + * Returns non-zero for failure. + */ +-static int pcap_meta_finish_file(struct call *call) { ++static int rec_pcap_meta_finish_file(struct call *call) { + // This should usually be called from a place that has the call->master_lock + struct recording *recording = call->recording; + int return_code = 0; +@@ -522,7 +522,7 @@ static char *recording_setup_file(struct recording *recording) { + recording_path = file_path_str(recording->meta_prefix, "/pcaps/", ".pcap"); + recording->u.pcap.recording_path = recording_path; + +- recording->u.pcap.recording_pd = pcap_open_dead(pcap_format->linktype, 65535); ++ recording->u.pcap.recording_pd = pcap_open_dead(rec_pcap_format->linktype, 65535); + recording->u.pcap.recording_pdumper = pcap_dump_open(recording->u.pcap.recording_pd, recording_path); + if (recording->u.pcap.recording_pdumper == NULL) { + pcap_close(recording->u.pcap.recording_pd); +@@ -538,7 +538,7 @@ static char *recording_setup_file(struct recording *recording) { + /** + * Flushes PCAP file, closes the dumper and descriptors, and frees object memory. + */ +-static void pcap_recording_finish_file(struct recording *recording) { ++static void rec_pcap_recording_finish_file(struct recording *recording) { + if (recording->u.pcap.recording_pdumper != NULL) { + pcap_dump_flush(recording->u.pcap.recording_pdumper); + pcap_dump_close(recording->u.pcap.recording_pdumper); +@@ -565,7 +565,7 @@ static unsigned int fake_ip_header(unsigned char *out, struct media_packet *mp, + return hdr_len + inp->len; + } + +-static void pcap_eth_header(unsigned char *pkt, struct packet_stream *stream) { ++static void rec_pcap_eth_header(unsigned char *pkt, struct packet_stream *stream) { + memset(pkt, 0, 14); + uint16_t *hdr16 = (void *) pkt; + hdr16[6] = htons(stream->selected_sfd->socket.local.address.family->ethertype); +@@ -580,10 +580,10 @@ static void stream_pcap_dump(struct media_packet *mp, const str *s) { + if (!pdumper) + return; + +- unsigned char pkt[s->len + MAX_PACKET_HEADER_LEN + pcap_format->headerlen]; +- unsigned int pkt_len = fake_ip_header(pkt + pcap_format->headerlen, mp, s) + pcap_format->headerlen; +- if (pcap_format->header) +- pcap_format->header(pkt, mp->stream); ++ unsigned char pkt[s->len + MAX_PACKET_HEADER_LEN + rec_pcap_format->headerlen]; ++ unsigned int pkt_len = fake_ip_header(pkt + rec_pcap_format->headerlen, mp, s) + rec_pcap_format->headerlen; ++ if (rec_pcap_format->header) ++ rec_pcap_format->header(pkt, mp->stream); + + // Set up PCAP packet header + struct pcap_pkthdr header; +@@ -606,8 +606,8 @@ static void dump_packet_pcap(struct media_packet *mp, const str *s) { + } + + static void finish_pcap(struct call *call) { +- pcap_recording_finish_file(call->recording); +- pcap_meta_finish_file(call); ++ rec_pcap_recording_finish_file(call->recording); ++ rec_pcap_meta_finish_file(call); + } + + static void response_pcap(struct recording *recording, bencode_item_t *output) { diff --git a/net/rtpengine/patches/03-uclibc-getloadavg.patch b/net/rtpengine/patches/03-uclibc-getloadavg.patch deleted file mode 100644 index 9351de5..0000000 --- a/net/rtpengine/patches/03-uclibc-getloadavg.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- a/daemon/load.c -+++ b/daemon/load.c -@@ -14,6 +14,43 @@ int cpu_usage; // percent times 100 (0 - - - static long used_last, idle_last; - -+/* uclibc and dietlibc do not have this junk -ReneR */ -+#if defined (__UCLIBC__) || defined (__dietlibc__) -+static int getloadavg(double loadavg[], int nelem) { -+ int fd; -+ -+ fd = open ("/proc/loadavg", O_RDONLY); -+ if (fd < 0) -+ return -1; -+ else -+ { -+ char buf[65], *p; -+ ssize_t nread; -+ int i; -+ -+ nread = read (fd, buf, sizeof buf - 1); -+ close (fd); -+ if (nread <= 0) -+ return -1; -+ buf[nread - 1] = '\0'; -+ -+ if (nelem > 3) -+ nelem = 3; -+ p = buf; -+ for (i = 0; i < nelem; ++i) -+ { -+ char *endp; -+ loadavg[i] = strtod (p, &endp); -+ if (endp == p) -+ return -1; -+ p = endp; -+ } -+ -+ return i; -+ } -+} -+#endif -+ - void load_thread(void *dummy) { - while (!rtpe_shutdown) { - if (rtpe_config.load_limit) { diff --git a/net/rtpengine/patches/200-openssl-deprecated.patch b/net/rtpengine/patches/200-openssl-deprecated.patch index 428cd88..2755fb6 100644 --- a/net/rtpengine/patches/200-openssl-deprecated.patch +++ b/net/rtpengine/patches/200-openssl-deprecated.patch @@ -24,7 +24,7 @@ /* sign it */ --- a/lib/ssllib.c +++ b/lib/ssllib.c -@@ -35,10 +35,6 @@ static void make_OpenSSL_thread_safe(void) { +@@ -35,10 +35,6 @@ static void make_OpenSSL_thread_safe(voi CRYPTO_THREADID_set_callback(cb_openssl_threadid); CRYPTO_set_locking_callback(cb_openssl_lock); }