diff options
author | p-wassi <p.wassi@gmx.at> | 2016-12-10 10:56:22 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-12-14 12:13:13 +0100 |
commit | 4297f4f9014f8b2596cdfc38fe086e8c0653ffba (patch) | |
tree | 90128ecfbbda52bad2dfca5a9b86afbf6def20c0 /package/libs/libpcap/patches/201-space_optimization.patch | |
parent | 28f6951600d0da31363e9b17dbad3f47097f4104 (diff) | |
download | upstream-4297f4f9014f8b2596cdfc38fe086e8c0653ffba.tar.gz upstream-4297f4f9014f8b2596cdfc38fe086e8c0653ffba.tar.bz2 upstream-4297f4f9014f8b2596cdfc38fe086e8c0653ffba.zip |
libs/libpcap: update to 1.8.1
Update libpcap to upstream release 1.8.1
Change the name from libpcap.so.1.3 to libpcap.so.1
Remove parts of patch 201 which moved code among src files.
Import patch 204 from Debian to update the USB path.
Signed-off-by: Paul Wassi <p.wassi@gmx.at>
Signed-off-by: Felix Fietkau <nbd@nbd.name> [fix parallel build bug]
Diffstat (limited to 'package/libs/libpcap/patches/201-space_optimization.patch')
-rw-r--r-- | package/libs/libpcap/patches/201-space_optimization.patch | 137 |
1 files changed, 2 insertions, 135 deletions
diff --git a/package/libs/libpcap/patches/201-space_optimization.patch b/package/libs/libpcap/patches/201-space_optimization.patch index f331a18357..b0a91bb0ef 100644 --- a/package/libs/libpcap/patches/201-space_optimization.patch +++ b/package/libs/libpcap/patches/201-space_optimization.patch @@ -1,140 +1,7 @@ ---- a/gencode.c -+++ b/gencode.c -@@ -543,20 +543,6 @@ pcap_compile_nopcap(int snaplen_arg, int - } - - /* -- * Clean up a "struct bpf_program" by freeing all the memory allocated -- * in it. -- */ --void --pcap_freecode(struct bpf_program *program) --{ -- program->bf_len = 0; -- if (program->bf_insns != NULL) { -- free((char *)program->bf_insns); -- program->bf_insns = NULL; -- } --} -- --/* - * Backpatch the blocks in 'list' to 'target'. The 'sense' field indicates - * which of the jt and jf fields has been resolved and which is a pointer - * back to another unresolved block (or nil). At least one of the fields ---- a/pcap.c -+++ b/pcap.c -@@ -1087,6 +1087,59 @@ static const u_char charmap[] = { - (u_char)'\374', (u_char)'\375', (u_char)'\376', (u_char)'\377', - }; - -+/* -+ * Clean up a "struct bpf_program" by freeing all the memory allocated -+ * in it. -+ */ -+void -+pcap_freecode(struct bpf_program *program) -+{ -+ program->bf_len = 0; -+ if (program->bf_insns != NULL) { -+ free((char *)program->bf_insns); -+ program->bf_insns = NULL; -+ } -+} -+ -+/* -+ * Make a copy of a BPF program and put it in the "fcode" member of -+ * a "pcap_t". -+ * -+ * If we fail to allocate memory for the copy, fill in the "errbuf" -+ * member of the "pcap_t" with an error message, and return -1; -+ * otherwise, return 0. -+ */ -+int -+install_bpf_program(pcap_t *p, struct bpf_program *fp) -+{ -+ size_t prog_size; -+ -+ /* -+ * Validate the program. -+ */ -+ if (!bpf_validate(fp->bf_insns, fp->bf_len)) { -+ snprintf(p->errbuf, sizeof(p->errbuf), -+ "BPF program is not valid"); -+ return (-1); -+ } -+ -+ /* -+ * Free up any already installed program. -+ */ -+ pcap_freecode(&p->fcode); -+ -+ prog_size = sizeof(*fp->bf_insns) * fp->bf_len; -+ p->fcode.bf_len = fp->bf_len; -+ p->fcode.bf_insns = (struct bpf_insn *)malloc(prog_size); -+ if (p->fcode.bf_insns == NULL) { -+ snprintf(p->errbuf, sizeof(p->errbuf), -+ "malloc: %s", pcap_strerror(errno)); -+ return (-1); -+ } -+ memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size); -+ return (0); -+} -+ - int - pcap_strcasecmp(const char *s1, const char *s2) - { ---- a/optimize.c -+++ b/optimize.c -@@ -2203,45 +2203,6 @@ icode_to_fcode(struct block *root, u_int - return fp; - } - --/* -- * Make a copy of a BPF program and put it in the "fcode" member of -- * a "pcap_t". -- * -- * If we fail to allocate memory for the copy, fill in the "errbuf" -- * member of the "pcap_t" with an error message, and return -1; -- * otherwise, return 0. -- */ --int --install_bpf_program(pcap_t *p, struct bpf_program *fp) --{ -- size_t prog_size; -- -- /* -- * Validate the program. -- */ -- if (!bpf_validate(fp->bf_insns, fp->bf_len)) { -- snprintf(p->errbuf, sizeof(p->errbuf), -- "BPF program is not valid"); -- return (-1); -- } -- -- /* -- * Free up any already installed program. -- */ -- pcap_freecode(&p->fcode); -- -- prog_size = sizeof(*fp->bf_insns) * fp->bf_len; -- p->fcode.bf_len = fp->bf_len; -- p->fcode.bf_insns = (struct bpf_insn *)malloc(prog_size); -- if (p->fcode.bf_insns == NULL) { -- snprintf(p->errbuf, sizeof(p->errbuf), -- "malloc: %s", pcap_strerror(errno)); -- return (-1); -- } -- memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size); -- return (0); --} -- - #ifdef BDEBUG - static void - dot_dump_node(struct block *block, struct bpf_program *prog, FILE *out) --- a/pcap-common.c +++ b/pcap-common.c -@@ -1372,14 +1372,23 @@ swap_pseudo_headers(int linktype, struct - switch (linktype) { +@@ -1447,14 +1447,23 @@ swap_pseudo_headers(int linktype, struct + break; case DLT_USB_LINUX: +#ifndef PCAP_SUPPORT_USB |