Signed-off-by: Ian Leonard <antonlacon@gmail.com> Conflicts: devel/patch/Makefile multimedia/minidlna/Makefilelilik-openwrt-22.03
@ -0,0 +1,110 @@ | |||
# | |||
# Copyright (C) 2006-2008 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=cyrus-sasl | |||
PKG_VERSION:=2.1.26 | |||
PKG_RELEASE:=2 | |||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | |||
PKG_SOURCE_URL:=ftp://ftp.cyrusimap.org/cyrus-sasl/ | |||
PKG_MD5SUM:=a7f4e5e559a0e37b3ffc438c9456e425 | |||
PKG_LICENSE:=BSD-4c BSD | |||
PKG_LICENSE_FILES:=COPYING cmulocal/COPYING saslauthd/COPYING | |||
PKG_FIXUP:=autoreconf | |||
PKG_MACRO_PATHS:=cmulocal config ../cmulocal ../config | |||
PKG_AUTOMAKE_PATHS:=. saslauthd sasldb | |||
PKG_REMOVE_FILES:=aclocal.m4 saslauthd/aclocal.m4 config/libtool.m4 | |||
include $(INCLUDE_DIR)/package.mk | |||
define Package/libsasl2 | |||
SECTION:=libs | |||
CATEGORY:=Libraries | |||
TITLE:=A general purpose authentication library | |||
URL:=http://asg.web.cmu.edu/sasl/ | |||
DEPENDS:=libopenssl | |||
endef | |||
TARGET_CFLAGS += $(FPIC) | |||
CONFIGURE_ARGS += \ | |||
--enable-shared \ | |||
--enable-static \ | |||
--disable-sample \ | |||
--enable-staticdlopen \ | |||
--disable-java \ | |||
--disable-alwaystrue \ | |||
--disable-checkapop \ | |||
--enable-cram \ | |||
--enable-digest \ | |||
--without-auth-sasldb \ | |||
--disable-otp \ | |||
--disable-srp \ | |||
--disable-srp-setpass \ | |||
--disable-krb4 \ | |||
--disable-gssapi \ | |||
--disable-gss_mutexes \ | |||
--enable-plain \ | |||
--enable-anon \ | |||
--disable-login \ | |||
--disable-ntlm \ | |||
--disable-sql \ | |||
--disable-ldapdb \ | |||
--without-dblib \ | |||
--without-gdbm \ | |||
--with-devrandom="/dev/urandom" \ | |||
--without-pam \ | |||
--without-saslauthd \ | |||
--without-authdaemond \ | |||
--without-pwcheck \ | |||
--with-ipctype=unix \ | |||
--with-openssl="$(STAGING_DIR)/usr" \ | |||
--without-des \ | |||
--without-opie \ | |||
--without-ldap \ | |||
--without-mysql \ | |||
--without-pgsql \ | |||
--without-sqlite \ | |||
--without-rc4 \ | |||
--without-dmalloc \ | |||
--without-sfio \ | |||
--disable-sample | |||
define Build/Compile | |||
$(MAKE) -C $(PKG_BUILD_DIR)/include \ | |||
CC="$(HOSTCC)" \ | |||
LINK="$(HOSTCC) -o makemd5 -lc" \ | |||
CFLAGS="" \ | |||
CPPFLAGS="" \ | |||
makemd5 | |||
$(MAKE) -C $(PKG_BUILD_DIR) \ | |||
DESTDIR="$(PKG_INSTALL_DIR)" \ | |||
all install | |||
endef | |||
define Build/InstallDev | |||
$(INSTALL_DIR) $(1)/usr/include/ | |||
$(CP) $(PKG_INSTALL_DIR)/usr/include/sasl $(1)/usr/include/ | |||
$(INSTALL_DIR) $(1)/usr/lib/ | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsasl2.{a,so*} $(1)/usr/lib/ | |||
ln -sf libsasl2.a $(1)/usr/lib/libsasl.a | |||
ln -sf libsasl2.so $(1)/usr/lib/libsasl.so | |||
$(INSTALL_DIR) $(1)/usr/lib/sasl2 | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/sasl2/lib*.{a,so*} $(1)/usr/lib/sasl2/ | |||
endef | |||
define Package/libsasl2/install | |||
$(INSTALL_DIR) $(1)/usr/lib/ | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsasl2.so.* $(1)/usr/lib/ | |||
$(INSTALL_DIR) $(1)/usr/lib/sasl2 | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/sasl2/lib*.so.* $(1)/usr/lib/sasl2/ | |||
endef | |||
$(eval $(call BuildPackage,libsasl2)) |
@ -1,28 +0,0 @@ | |||
diff --git a/lib/accelerated/x86/x86-common.h b/lib/accelerated/x86/x86-common.h | |||
index 03fc8de..647c7d6 100644 | |||
--- a/lib/accelerated/x86/x86-common.h | |||
+++ b/lib/accelerated/x86/x86-common.h | |||
@@ -29,11 +29,13 @@ extern unsigned int _gnutls_x86_cpuid_s[4]; | |||
void gnutls_cpuid(unsigned int func, unsigned int *ax, unsigned int *bx, | |||
unsigned int *cx, unsigned int *dx); | |||
-#ifdef ASM_X86_32 | |||
+# ifdef ASM_X86_32 | |||
unsigned int gnutls_have_cpuid(void); | |||
-#else | |||
-#define gnutls_have_cpuid() 1 | |||
-#endif /* ASM_X86_32 */ | |||
+# else | |||
+# define gnutls_have_cpuid() 1 | |||
+# endif /* ASM_X86_32 */ | |||
+ | |||
+#endif | |||
#define NN_HASH(name, update_func, digest_func, NAME) { \ | |||
#name, \ | |||
@@ -44,5 +46,3 @@ unsigned int gnutls_have_cpuid(void); | |||
(nettle_hash_update_func *) update_func, \ | |||
(nettle_hash_digest_func *) digest_func \ | |||
} | |||
- | |||
-#endif |
@ -1,98 +0,0 @@ | |||
# | |||
# Copyright (C) 2006-2014 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=gsm | |||
PKG_VERSION:=1.0.13 | |||
PKG_RELEASE:=1 | |||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | |||
PKG_SOURCE_URL:=http://user.cs.tu-berlin.de/~jutta/gsm/ | |||
PKG_MD5SUM:=c1ba392ce61dc4aff1c29ea4e92f6df4 | |||
PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net> | |||
PKG_LICENSE:=FREE | |||
PKG_LICENSE_FILES:=COPYRIGHT | |||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-1.0-pl13 | |||
include $(INCLUDE_DIR)/package.mk | |||
define Package/gsm/Default | |||
TITLE:=GSM transcoding | |||
URL:=http://user.cs.tu-berlin.de/~jutta/toast.html | |||
endef | |||
define Package/gsm/description/Default | |||
An implementation of the European GSM 06.10 provisional standard | |||
for full-rate speech transcoding, prI-ETS 300 036, which uses | |||
RPE/LTP (residual pulse excitation/long term prediction) coding | |||
at 13 kbit/s. | |||
endef | |||
define Package/libgsm | |||
$(call Package/gsm/Default) | |||
SECTION:=libs | |||
CATEGORY:=Libraries | |||
TITLE+= library | |||
endef | |||
define Package/libgsm/description | |||
$(call Package/gsm/description/Default) | |||
This package contains a shared GSM transcoding library, used by other | |||
programs. | |||
endef | |||
define Package/gsm-utils | |||
$(call Package/gsm/Default) | |||
SECTION:=utils | |||
CATEGORY:=Utilities | |||
DEPENDS:=+libgsm | |||
TITLE+= utilities | |||
endef | |||
define Package/gsm-utils/description | |||
$(call Package/gsm/description/Default) | |||
This package contains GSM transcoding utilities. | |||
endef | |||
define Build/Configure | |||
endef | |||
TARGET_CFLAGS += $(FPIC) | |||
define Build/Compile | |||
$(MAKE) -C $(PKG_BUILD_DIR) \ | |||
$(TARGET_CONFIGURE_OPTS) \ | |||
LD="$(TARGET_CC)" \ | |||
COPTS="$(TARGET_CFLAGS)" \ | |||
INSTALL_ROOT="$(PKG_INSTALL_DIR)" \ | |||
all install | |||
endef | |||
define Package/libgsm/install | |||
$(INSTALL_DIR) $(1)/usr/lib | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgsm.so.* $(1)/usr/lib/ | |||
endef | |||
define Package/gsm-utils/install | |||
$(INSTALL_DIR) $(1)/usr/bin | |||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/toast $(1)/usr/bin/ | |||
(cd $(1)/usr/bin; ln -sf toast untoast; ln -sf toast tcat) | |||
endef | |||
define Build/InstallDev | |||
$(INSTALL_DIR) $(1)/usr/include/gsm | |||
$(CP) $(PKG_INSTALL_DIR)/usr/include/gsm.h $(1)/usr/include/gsm/ | |||
$(INSTALL_DIR) $(1)/usr/lib | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgsm.{a,so*} $(1)/usr/lib/ | |||
endef | |||
$(eval $(call BuildPackage,libgsm)) | |||
$(eval $(call BuildPackage,gsm-utils)) |
@ -1,428 +0,0 @@ | |||
--- a/Makefile | |||
+++ b/Makefile | |||
@@ -8,10 +8,12 @@ SASR = -DSASR | |||
######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1) | |||
# MULHACK = -DUSE_FLOAT_MUL | |||
+MULHACK = | |||
######### Define this if your host multiplies floats faster than integers, | |||
######### e.g. on a SPARCstation. | |||
# FAST = -DFAST | |||
+FAST = | |||
######### Define together with USE_FLOAT_MUL to enable the GSM library's | |||
######### approximation option for incorrect, but good-enough results. | |||
@@ -22,8 +24,8 @@ LTP_CUT = | |||
######### both integer and floating point multiplications. | |||
######### This flag is still in the experimental stage. | |||
-WAV49 = -DWAV49 | |||
-# WAV49 = | |||
+# WAV49 = -DWAV49 | |||
+WAV49 = | |||
######### Define to enable the GSM library's option to pack GSM frames | |||
######### in the style used by the WAV #49 format. If you want to write | |||
######### a tool that produces .WAV files which contain GSM-encoded data, | |||
@@ -44,7 +46,8 @@ WAV49 = -DWAV49 | |||
# CCFLAGS = -c -O | |||
CC = gcc -ansi -pedantic | |||
-CCFLAGS = -c -O2 -DNeedFunctionPrototypes=1 | |||
+COPTS = -O2 | |||
+CCFLAGS = -c $(COPTS) -DNeedFunctionPrototypes=1 | |||
LD = $(CC) | |||
@@ -78,10 +81,10 @@ INSTALL_ROOT = | |||
# Leave GSM_INSTALL_ROOT empty to not install the GSM library outside of | |||
# this directory. | |||
-GSM_INSTALL_ROOT = $(INSTALL_ROOT) | |||
+GSM_INSTALL_ROOT = $(INSTALL_ROOT)/usr | |||
GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib | |||
-GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc | |||
-GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3 | |||
+GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/include | |||
+GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/share/man/man3 | |||
# Where do you want to install the toast binaries and their manpage? | |||
@@ -89,14 +92,14 @@ GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/ma | |||
# Leave TOAST_INSTALL_ROOT empty to not install the toast binaries outside | |||
# of this directory. | |||
-TOAST_INSTALL_ROOT = $(INSTALL_ROOT) | |||
+TOAST_INSTALL_ROOT = $(INSTALL_ROOT)/usr | |||
TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin | |||
-TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1 | |||
+TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/share/man/man1 | |||
# Other tools | |||
SHELL = /bin/sh | |||
-LN = ln | |||
+LN = ln -s | |||
BASENAME = basename | |||
AR = ar | |||
ARFLAGS = cr | |||
@@ -126,7 +129,7 @@ INC = $(ROOT)/inc | |||
# Flags | |||
-# DEBUG = -DNDEBUG | |||
+DEBUG = -DNDEBUG | |||
######### Remove -DNDEBUG to enable assertions. | |||
CFLAGS = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \ | |||
@@ -140,6 +143,7 @@ LFLAGS = $(LDFLAGS) $(LDINC) | |||
# Targets | |||
LIBGSM = $(LIB)/libgsm.a | |||
+LIBGSMSO= $(LIB)/libgsm.so | |||
TOAST = $(BIN)/toast | |||
UNTOAST = $(BIN)/untoast | |||
@@ -258,6 +262,9 @@ STUFF = ChangeLog \ | |||
GSM_INSTALL_TARGETS = \ | |||
$(GSM_INSTALL_LIB)/libgsm.a \ | |||
+ $(GSM_INSTALL_LIB)/libgsm.so \ | |||
+ $(GSM_INSTALL_LIB)/libgsm.so.1 \ | |||
+ $(GSM_INSTALL_LIB)/libgsm.so.1.0.10 \ | |||
$(GSM_INSTALL_INC)/gsm.h \ | |||
$(GSM_INSTALL_MAN)/gsm.3 \ | |||
$(GSM_INSTALL_MAN)/gsm_explode.3 \ | |||
@@ -279,7 +286,7 @@ TOAST_INSTALL_TARGETS = \ | |||
# Target rules | |||
-all: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST) | |||
+all: $(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST) | |||
@-echo $(ROOT): Done. | |||
tst: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result | |||
@@ -299,6 +306,11 @@ install: toastinstall gsminstall | |||
# The basic API: libgsm | |||
+$(LIBGSMSO): $(LIB) $(GSM_OBJECTS) | |||
+ $(LD) -o $@.1.0.10 -shared -Xlinker -soname -Xlinker libgsm.so.1 $(GSM_OBJECTS) -lc | |||
+ ln -fs libgsm.so.1.0.10 lib/libgsm.so.1 | |||
+ ln -fs libgsm.so.1.0.10 lib/libgsm.so | |||
+ | |||
$(LIBGSM): $(LIB) $(GSM_OBJECTS) | |||
-rm $(RMFLAGS) $(LIBGSM) | |||
$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS) | |||
@@ -308,15 +320,15 @@ $(LIBGSM): $(LIB) $(GSM_OBJECTS) | |||
# Toast, Untoast and Tcat -- the compress-like frontends to gsm. | |||
$(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM) | |||
- $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB) | |||
+ $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSMSO) $(LDLIB) | |||
$(UNTOAST): $(BIN) $(TOAST) | |||
-rm $(RMFLAGS) $(UNTOAST) | |||
- $(LN) $(TOAST) $(UNTOAST) | |||
+ $(LN) toast $(UNTOAST) | |||
$(TCAT): $(BIN) $(TOAST) | |||
-rm $(RMFLAGS) $(TCAT) | |||
- $(LN) $(TOAST) $(TCAT) | |||
+ $(LN) toast $(TCAT) | |||
# The local bin and lib directories | |||
@@ -351,53 +363,66 @@ toastuninstall: | |||
fi | |||
$(TOAST_INSTALL_BIN)/toast: $(TOAST) | |||
- -rm $@ | |||
- cp $(TOAST) $@ | |||
+ mkdir -p $(TOAST_INSTALL_BIN) | |||
+ cp -f $(TOAST) $@ | |||
chmod 755 $@ | |||
$(TOAST_INSTALL_BIN)/untoast: $(TOAST_INSTALL_BIN)/toast | |||
- -rm $@ | |||
- ln $? $@ | |||
+ mkdir -p $(TOAST_INSTALL_BIN) | |||
+ ln -sf $? $@ | |||
$(TOAST_INSTALL_BIN)/tcat: $(TOAST_INSTALL_BIN)/toast | |||
- -rm $@ | |||
- ln $? $@ | |||
+ mkdir -p $(TOAST_INSTALL_BIN) | |||
+ ln -sf $? $@ | |||
$(TOAST_INSTALL_MAN)/toast.1: $(MAN)/toast.1 | |||
- -rm $@ | |||
- cp $? $@ | |||
+ mkdir -p $(TOAST_INSTALL_MAN) | |||
+ cp -f $? $@ | |||
chmod 444 $@ | |||
$(GSM_INSTALL_MAN)/gsm.3: $(MAN)/gsm.3 | |||
- -rm $@ | |||
- cp $? $@ | |||
+ mkdir -p $(GSM_INSTALL_MAN) | |||
+ cp -f $? $@ | |||
chmod 444 $@ | |||
$(GSM_INSTALL_MAN)/gsm_option.3: $(MAN)/gsm_option.3 | |||
- -rm $@ | |||
- cp $? $@ | |||
+ mkdir -p $(GSM_INSTALL_MAN) | |||
+ cp -f $? $@ | |||
chmod 444 $@ | |||
$(GSM_INSTALL_MAN)/gsm_explode.3: $(MAN)/gsm_explode.3 | |||
- -rm $@ | |||
- cp $? $@ | |||
+ mkdir -p $(GSM_INSTALL_MAN) | |||
+ cp -f $? $@ | |||
chmod 444 $@ | |||
$(GSM_INSTALL_MAN)/gsm_print.3: $(MAN)/gsm_print.3 | |||
- -rm $@ | |||
- cp $? $@ | |||
+ mkdir -p $(GSM_INSTALL_MAN) | |||
+ cp -f $? $@ | |||
chmod 444 $@ | |||
$(GSM_INSTALL_INC)/gsm.h: $(INC)/gsm.h | |||
- -rm $@ | |||
- cp $? $@ | |||
+ mkdir -p $(GSM_INSTALL_INC) | |||
+ cp -f $? $@ | |||
chmod 444 $@ | |||
$(GSM_INSTALL_LIB)/libgsm.a: $(LIBGSM) | |||
- -rm $@ | |||
- cp $? $@ | |||
+ mkdir -p $(GSM_INSTALL_LIB) | |||
+ cp -f $? $@ | |||
chmod 444 $@ | |||
+$(GSM_INSTALL_LIB)/libgsm.so: $(LIBGSMSO) | |||
+ mkdir -p $(GSM_INSTALL_LIB) | |||
+ cp -f $? $@ | |||
+ | |||
+$(GSM_INSTALL_LIB)/libgsm.so.1: $(LIBGSMSO) | |||
+ mkdir -p $(GSM_INSTALL_LIB) | |||
+ cp -f $? $@ | |||
+ | |||
+$(GSM_INSTALL_LIB)/libgsm.so.1.0.10: $(LIBGSMSO) | |||
+ mkdir -p $(GSM_INSTALL_LIB) | |||
+ cp -f $? $@ | |||
+ chmod 755 $@ | |||
+ | |||
# Distribution | |||
@@ -426,7 +451,9 @@ semi-clean: | |||
clean: semi-clean | |||
-rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add \ | |||
- $(TOAST) $(TCAT) $(UNTOAST) \ | |||
+ $(LIBGSMSO) $(LIB)/libgsm.so.1.0.10 \ | |||
+ $(LIB)libgsm.so.1 \ | |||
+ $(TOAST) $(TCAT) $(UNTOAST) \ | |||
$(ROOT)/gsm-1.0.tar.Z | |||
--- a/inc/config.h | |||
+++ b/inc/config.h | |||
@@ -9,8 +9,8 @@ | |||
#ifndef CONFIG_H | |||
#define CONFIG_H | |||
-/*efine SIGHANDLER_T int /* signal handlers are void */ | |||
-/*efine HAS_SYSV_SIGNAL 1 /* sigs not blocked/reset? */ | |||
+/*efine SIGHANDLER_T int *//* signal handlers are void */ | |||
+/*efine HAS_SYSV_SIGNAL 1 *//* sigs not blocked/reset? */ | |||
#define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */ | |||
#define HAS_LIMITS_H 1 /* /usr/include/limits.h */ | |||
@@ -22,16 +22,16 @@ | |||
#define HAS_CHMOD 1 /* chmod syscall */ | |||
#define HAS_FCHOWN 1 /* fchown syscall */ | |||
#define HAS_CHOWN 1 /* chown syscall */ | |||
-/*efine HAS__FSETMODE 1 /* _fsetmode -- set file mode */ | |||
+/*efine HAS__FSETMODE 1 *//* _fsetmode -- set file mode */ | |||
#define HAS_STRING_H 1 /* /usr/include/string.h */ | |||
-/*efine HAS_STRINGS_H 1 /* /usr/include/strings.h */ | |||
+/*efine HAS_STRINGS_H 1 *//* /usr/include/strings.h */ | |||
#define HAS_UNISTD_H 1 /* /usr/include/unistd.h */ | |||
#define HAS_UTIME 1 /* POSIX utime(path, times) */ | |||
-/*efine HAS_UTIMES 1 /* use utimes() syscall instead */ | |||
+/*efine HAS_UTIMES 1 *//* use utimes() syscall instead */ | |||
#define HAS_UTIME_H 1 /* UTIME header file */ | |||
#define HAS_UTIMBUF 1 /* struct utimbuf */ | |||
-/*efine HAS_UTIMEUSEC 1 /* microseconds in utimbuf? */ | |||
+/*efine HAS_UTIMEUSEC 1 *//* microseconds in utimbuf? */ | |||
#endif /* CONFIG_H */ | |||
--- a/inc/gsm.h | |||
+++ b/inc/gsm.h | |||
@@ -54,6 +54,10 @@ typedef gsm_byte gsm_frame[33]; /* 33 | |||
#define GSM_OPT_FRAME_INDEX 5 | |||
#define GSM_OPT_FRAME_CHAIN 6 | |||
+#ifdef __cplusplus | |||
+extern "C" { | |||
+#endif | |||
+ | |||
extern gsm gsm_create GSM_P((void)); | |||
extern void gsm_destroy GSM_P((gsm)); | |||
@@ -66,6 +70,10 @@ extern int gsm_decode GSM_P((gsm, gsm_ | |||
extern int gsm_explode GSM_P((gsm, gsm_byte *, gsm_signal *)); | |||
extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte *)); | |||
+#ifdef __cplusplus | |||
+} | |||
+#endif | |||
+ | |||
#undef GSM_P | |||
#endif /* GSM_H */ | |||
--- a/inc/toast.h | |||
+++ b/inc/toast.h | |||
@@ -16,11 +16,12 @@ | |||
#include <stdio.h> | |||
#include <ctype.h> | |||
+#include <pthread.h> | |||
#include <signal.h> | |||
#include <errno.h> | |||
-#ifndef HAS_ERRNO_DECL | |||
- extern int errno; | |||
+#ifndef errno | |||
+ extern int errno; | |||
#endif | |||
#ifdef HAS_LIMITS_H | |||
@@ -37,6 +38,10 @@ | |||
# endif | |||
#endif | |||
+#ifdef HAS_STDIO_H | |||
+# include <stdio.h> | |||
+#endif | |||
+ | |||
#include "gsm.h" | |||
#ifndef S_ISREG | |||
--- a/src/code.c | |||
+++ b/src/code.c | |||
@@ -9,8 +9,8 @@ | |||
#include "config.h" | |||
-#ifdef HAS_STDLIB_H | |||
-#include <stdlib.h> | |||
+#ifdef HAS_STRING_H | |||
+#include <string.h> | |||
#else | |||
# include "proto.h" | |||
extern char * memcpy P((char *, char *, int)); | |||
--- a/src/debug.c | |||
+++ b/src/debug.c | |||
@@ -49,7 +49,7 @@ void gsm_debug_longwords P4( (name, from | |||
fprintf( stderr, "%s [%d .. %d]: ", name, from, to ); | |||
while (from <= to) { | |||
- fprintf(stderr, "%d ", ptr[ from ] ); | |||
+ fprintf(stderr, "%ld ", ptr[ from ] ); | |||
from++; | |||
if (nprinted++ >= 7) { | |||
nprinted = 0; | |||
@@ -63,14 +63,14 @@ void gsm_debug_longword P2( (name, valu | |||
char * name, | |||
longword value ) | |||
{ | |||
- fprintf(stderr, "%s: %d\n", name, (long)value ); | |||
+ fprintf(stderr, "%s: %ld\n", name, (long)value ); | |||
} | |||
void gsm_debug_word P2( (name, value), | |||
char * name, | |||
word value ) | |||
{ | |||
- fprintf(stderr, "%s: %d\n", name, (long)value); | |||
+ fprintf(stderr, "%s: %ld\n", name, (long)value); | |||
} | |||
#endif | |||
--- a/src/toast.c | |||
+++ b/src/toast.c | |||
@@ -251,8 +251,8 @@ static char * emalloc P1((len), size_t l | |||
{ | |||
char * s; | |||
if (!(s = malloc(len))) { | |||
- fprintf(stderr, "%s: failed to malloc %d bytes -- abort\n", | |||
- progname, len); | |||
+ fprintf(stderr, "%s: failed to malloc %ld bytes -- abort\n", | |||
+ progname, (long) len); | |||
onintr(); | |||
exit(1); | |||
} | |||
@@ -270,7 +270,7 @@ static char* normalname P3((name, want, | |||
maxlen = strlen(name) + 1 + strlen(want) + strlen(cut); | |||
p = strcpy(emalloc(maxlen), name); | |||
- if (s = suffix(p, cut)) strcpy(s, want); | |||
+ if ((s = suffix(p, cut))) strcpy(s, want); | |||
else if (*want && !suffix(p, want)) strcat(p, want); | |||
return p; | |||
@@ -386,7 +386,7 @@ static void update_times P0() | |||
ut[0] = instat.st_atime; | |||
ut[1] = instat.st_mtime; | |||
- (void) utime(outname, ut); | |||
+ (void) utime(outname, (struct utimbuf *)ut); | |||
#endif /* UTIMBUF */ | |||
} | |||
@@ -416,7 +416,7 @@ static int okay_as_input P3((name,f,st), | |||
} | |||
if (st->st_nlink > 1 && !f_cat && !f_precious) { | |||
fprintf(stderr, | |||
- "%s: \"%s\" has %s other link%s -- unchanged.\n", | |||
+ "%s: \"%s\" has %d other link%s -- unchanged.\n", | |||
progname,name,st->st_nlink - 1,"s" + (st->st_nlink<=2)); | |||
return 0; | |||
} | |||
@@ -585,8 +585,8 @@ static int process_decode P0() | |||
if (cc != sizeof(s)) { | |||
if (cc >= 0) fprintf(stderr, | |||
- "%s: incomplete frame (%d byte%s missing) from %s\n", | |||
- progname, sizeof(s) - cc, | |||
+ "%s: incomplete frame (%ld byte%s missing) from %s\n", | |||
+ progname, (long) sizeof(s) - cc, | |||
"s" + (sizeof(s) - cc == 1), | |||
inname ? inname : "stdin" ); | |||
gsm_destroy(r); | |||
@@ -624,8 +624,6 @@ static int process_decode P0() | |||
static int process P1((name), char * name) | |||
{ | |||
- int step = 0; | |||
- | |||
out = (FILE *)0; | |||
in = (FILE *)0; | |||
@@ -779,7 +777,6 @@ int main P2((ac, av), int ac, char **av) | |||
case 'h': help(); exit(0); | |||
default: | |||
- usage: | |||
fprintf(stderr, | |||
"Usage: %s [-fcpdhvuaslFC] [files...] (-h for help)\n", | |||
progname); |
@ -1,11 +0,0 @@ | |||
--- a/makefile.cfg | |||
+++ b/makefile.cfg | |||
@@ -168,7 +168,7 @@ libjpeg.a: @A2K_DEPS@ $(LIBOBJECTS) | |||
# with libtool: | |||
libjpeg.la: @A2K_DEPS@ $(LIBOBJECTS) | |||
- $(LIBTOOL) --mode=link $(CC) -o libjpeg.la $(LIBOBJECTS) \ | |||
+ $(LIBTOOL) --mode=link "$(CC)" -o libjpeg.la $(LIBOBJECTS) \ | |||
-rpath $(libdir) -version-info $(JPEG_LIB_VERSION) | |||
# sample programs: |
@ -1,15 +0,0 @@ | |||
--- a/jdmarker.c | |||
+++ b/jdmarker.c | |||
@@ -342,6 +342,12 @@ get_sos (j_decompress_ptr cinfo) | |||
TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc, | |||
compptr->dc_tbl_no, compptr->ac_tbl_no); | |||
+ | |||
+ /* This CSi (cc) should differ from the previous CSi */ | |||
+ for (ci = 0; ci < i; ci++) { | |||
+ if (cinfo->cur_comp_info[ci] == compptr) | |||
+ ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc); | |||
+ } | |||
} | |||
/* Collect the additional scan parameters Ss, Se, Ah/Al. */ |
@ -0,0 +1,75 @@ | |||
# | |||
# Copyright (C) 2014 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=libsoup | |||
PKG_VERSION:=2.44.2 | |||
PKG_RELEASE:=1 | |||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz | |||
PKG_SOURCE_URL:=@GNOME/$(PKG_NAME)/2.44 | |||
PKG_MD5SUM:=92aa3667357157e8f3489bcca287f2fa | |||
PKG_LICENSE:=GPL-2.0 | |||
PKG_LICENSE_FILE:=COPYING | |||
PKG_FIXUP:=autoreconf | |||
PKG_INSTALL:=1 | |||
include $(INCLUDE_DIR)/package.mk | |||
include $(INCLUDE_DIR)/nls.mk | |||
TARGET_LDFLAGS+=\ | |||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib $(if $(ICONV_FULL),-liconv) | |||
define Package/libsoup | |||
SECTION:=libs | |||
CATEGORY:=Libraries | |||
TITLE:=libsoup | |||
URL:=http://live.gnome.org/LibSoup | |||
MAINTAINER:=W. Michael Petullo <mike@flyn.org> | |||
DEPENDS:=+glib2 +libxml2 +libgnutls +libsqlite3 $(ICONV_DEPENDS) $(INTL_DEPENDS) | |||
endef | |||
define Build/Configure | |||
$(call Build/Configure/Default, \ | |||
--enable-ssl \ | |||
--disable-glibtest \ | |||
--without-apache-httpd \ | |||
--without-gnome \ | |||
) | |||
endef | |||
define package/libsoup/decription | |||
Libsoup is an HTTP library implementation in C | |||
endef | |||
define Build/InstallDev | |||
$(INSTALL_DIR) $(1)/usr/{lib/pkgconfig,include/libsoup-2.4/libsoup} | |||
$(CP) \ | |||
$(PKG_INSTALL_DIR)/usr/lib/libsoup-2.4.{so*,la,a} \ | |||
$(1)/usr/lib/ | |||
$(INSTALL_DATA) \ | |||
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \ | |||
$(1)/usr/lib/pkgconfig/ | |||
$(INSTALL_DATA) \ | |||
$(PKG_INSTALL_DIR)/usr/include/libsoup-2.4/libsoup/*.h \ | |||
$(1)/usr/include/libsoup-2.4/libsoup/ | |||
endef | |||
define Package/libsoup/install | |||
$(INSTALL_DIR) $(1)/usr/lib | |||
$(CP) \ | |||
$(PKG_INSTALL_DIR)/usr/lib/libsoup-2.4.so* \ | |||
$(1)/usr/lib/ | |||
endef | |||
$(eval $(call BuildPackage,libsoup)) |
@ -0,0 +1,150 @@ | |||
# | |||
# Copyright (C) 2006-2012 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=openldap | |||
PKG_VERSION:=2.4.39 | |||
PKG_RELEASE:=1 | |||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz | |||
PKG_SOURCE_URL:=ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/ \ | |||
ftp://sunsite.cnlab-switch.ch/mirror/OpenLDAP/openldap-release/ \ | |||
ftp://ftp.nl.uu.net/pub/unix/db/openldap/openldap-release/ \ | |||
ftp://ftp.plig.org/pub/OpenLDAP/openldap-release/ | |||
PKG_MD5SUM:=b0d5ee4b252c841dec6b332d679cf943 | |||
PKG_FIXUP:=autoreconf | |||
include $(INCLUDE_DIR)/package.mk | |||
define Package/openldap/Default | |||
TITLE:=LDAP implementation | |||
URL:=http://www.openldap.org/ | |||
MAINTAINER:=W. Michael Petullo <mike@flyn.org> | |||
endef | |||
define Package/openldap/Default/description | |||
OpenLDAP Software is an open source implementation of the | |||
Lightweight Directory Access Protocol (LDAP). | |||
endef | |||
define Package/libopenldap | |||
$(call Package/openldap/Default) | |||
SECTION:=libs | |||
CATEGORY:=Libraries | |||
DEPENDS:=+libopenssl +libsasl2 +libpthread | |||
TITLE+= (libraries) | |||
endef | |||
define Package/libopenldap/description | |||
$(call Package/openldap/Default/description) | |||
This package contains the shared LDAP client libraries, needed by other programs. | |||
endef | |||
define Package/libopenldap/conffiles | |||
/etc/openldap/ldap.conf | |||
endef | |||
define Package/openldap-utils | |||
$(call Package/openldap/Default) | |||
SECTION:=utils | |||
CATEGORY:=Utilities | |||
DEPENDS:=+libopenldap | |||
TITLE+= (utilities) | |||
endef | |||
define Package/openldap-utils/description | |||
$(call Package/openldap/Default/description) | |||
This package contains client programs required to access LDAP servers. | |||
endef | |||
define Package/openldap-server | |||
$(call Package/openldap/Default) | |||
SECTION:=net | |||
CATEGORY:=Network | |||
DEPENDS:=+libopenldap +libuuid | |||
TITLE+= (server) | |||
endef | |||
define Package/openldap-server/description | |||
$(call Package/openldap/Default/description) | |||
This package contains server programs required to provide LDAP services. | |||
endef | |||
define Package/openldap-server/conffiles | |||
/etc/openldap/slapd.conf | |||
endef | |||
TARGET_CFLAGS += $(FPIC) -lpthread | |||
CONFIGURE_ARGS += \ | |||
--enable-shared \ | |||
--enable-static \ | |||
--disable-debug \ | |||
--enable-dynamic \ | |||
--enable-syslog \ | |||
--disable-local \ | |||
--disable-slurpd \ | |||
--with-cyrus-sasl \ | |||
--without-fetch \ | |||
--with-threads \ | |||
--with-tls \ | |||
--with-yielding_select="yes" \ | |||
--without-cyrus-sasl \ | |||
--without-threads \ | |||
--without-tls \ | |||
--enable-null \ | |||
--disable-bdb \ | |||
--disable-hdb \ | |||
--disable-monitor \ | |||
--disable-relay | |||
define Build/Compile | |||
$(MAKE) -C $(PKG_BUILD_DIR) \ | |||
DESTDIR="$(PKG_INSTALL_DIR)" \ | |||
HOSTCC="$(HOSTCC)" \ | |||
depend all install | |||
endef | |||
define Build/InstallDev | |||
$(INSTALL_DIR) $(1)/usr/include | |||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/{lber,ldap}*.h $(1)/usr/include/ | |||
$(INSTALL_DIR) $(1)/usr/lib/ | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{lber,ldap}*.{a,so*} $(1)/usr/lib/ | |||
endef | |||
define Package/libopenldap/install | |||
$(INSTALL_DIR) $(1)/etc/openldap | |||
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/openldap/ldap.conf $(1)/etc/openldap/ | |||
$(INSTALL_DIR) $(1)/usr/lib | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{lber,ldap}*.so.* $(1)/usr/lib/ | |||
endef | |||
define Package/openldap-utils/install | |||
$(INSTALL_DIR) $(1)/usr/bin | |||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/ldap* $(1)/usr/bin/ | |||
endef | |||
define Package/openldap-server/install | |||
$(INSTALL_DIR) $(1)/etc/init.d | |||
$(INSTALL_BIN) ./files/ldap.init $(1)/etc/init.d/ldap | |||
$(INSTALL_DIR) $(1)/etc/openldap/schema | |||
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/openldap/schema/* $(1)/etc/openldap/schema/ | |||
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/openldap/slapd.conf $(1)/etc/openldap/ | |||
$(INSTALL_DIR) $(1)/usr/sbin | |||
# XXX: OpenLDAP installs slapd into libexecdir, not sbindir: | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/slapd $(1)/usr/sbin/ | |||
# XXX: switch default backend to ldif, since bdb is disabled | |||
$(SED) 's|^\(database\)\([ \t]\+\)bdb|\1\2ldif|g' \ | |||
-e 's|^\(index\)|#\1|g' \ | |||
$(1)/etc/openldap/slapd.conf | |||
endef | |||
$(eval $(call BuildPackage,libopenldap)) | |||
$(eval $(call BuildPackage,openldap-utils)) | |||
$(eval $(call BuildPackage,openldap-server)) |
@ -0,0 +1,19 @@ | |||
#!/bin/sh /etc/rc.common | |||
# Copyright (C) 2009-2011 OpenWrt.org | |||
START=60 | |||
SERVICE_USE_PID=1 | |||
start() { | |||
mkdir -m 0755 -p /var/openldap-data | |||
service_start /usr/sbin/slapd | |||
} | |||
stop() { | |||
service_stop /usr/sbin/slapd | |||
} | |||
reload() { | |||
service_reload /usr/sbin/slapd | |||
} |
@ -0,0 +1,323 @@ | |||
--- /dev/null | |||
+++ b/Makefile.am | |||
@@ -0,0 +1 @@ | |||
+SUBDIRS = include libraries clients servers tests doc | |||
--- a/libraries/Makefile.in | |||
+++ b/libraries/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SUBDIRS= \ | |||
liblutil \ | |||
liblber \ | |||
--- a/libraries/liblber/Makefile.in | |||
+++ b/libraries/liblber/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
LIBRARY = liblber.la | |||
NT_SRCS = nt_err.c | |||
--- a/libraries/libldap/Makefile.in | |||
+++ b/libraries/libldap/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
LIBRARY = libldap.la | |||
PROGRAMS = apitest dntest ftest ltest urltest | |||
--- a/libraries/libldap_r/Makefile.in | |||
+++ b/libraries/libldap_r/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
LIBRARY = libldap_r.la | |||
PROGRAMS = apitest ltest | |||
--- a/libraries/liblunicode/Makefile.in | |||
+++ b/libraries/liblunicode/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
LIBRARY = liblunicode.a | |||
XXDIR = $(srcdir)/ucdata/ | |||
--- a/libraries/liblutil/Makefile.in | |||
+++ b/libraries/liblutil/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
LIBRARY = liblutil.a | |||
PROGRAM = testavl | |||
--- a/libraries/librewrite/Makefile.in | |||
+++ b/libraries/librewrite/Makefile.in | |||
@@ -16,6 +16,8 @@ | |||
## Copyright 2000-2001 Pierangelo Masarati <ando@sys-net.it> | |||
## | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = config.c context.c info.c ldapmap.c map.c params.c rule.c \ | |||
session.c subst.c var.c xmap.c \ | |||
parse.c rewrite.c | |||
--- a/clients/tools/Makefile.in | |||
+++ b/clients/tools/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = ldapsearch.c ldapmodify.c ldapdelete.c ldapmodrdn.c \ | |||
ldappasswd.c ldapwhoami.c ldapcompare.c \ | |||
ldapexop.c ldapurl.c common.c | |||
--- a/servers/slapd/Makefile.in | |||
+++ b/servers/slapd/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SLAPTOOLS=slapadd slapcat slapdn slapindex slappasswd slaptest slapauth slapacl slapschema | |||
PROGRAMS=slapd $(SLAPTOOLS) | |||
XPROGRAMS=sslapd libbackends.a .backend liboverlays.a | |||
--- a/servers/slapd/overlays/Makefile.in | |||
+++ b/servers/slapd/overlays/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = overlays.c \ | |||
accesslog.c \ | |||
auditlog.c \ | |||
--- a/tests/progs/Makefile.in | |||
+++ b/tests/progs/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
PROGRAMS = slapd-tester slapd-search slapd-read slapd-addel slapd-modrdn \ | |||
slapd-modify slapd-bind slapd-mtread ldif-filter | |||
--- a/servers/slapd/back-bdb/Makefile.in | |||
+++ b/servers/slapd/back-bdb/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = init.c tools.c config.c \ | |||
add.c bind.c compare.c delete.c modify.c modrdn.c search.c \ | |||
extended.c referral.c operational.c \ | |||
--- a/servers/slapd/back-dnssrv/Makefile.in | |||
+++ b/servers/slapd/back-dnssrv/Makefile.in | |||
@@ -18,6 +18,8 @@ | |||
# The DNSSRV backend was written by Kurt D. Zeilenga. | |||
# | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = init.c bind.c search.c config.c referral.c | |||
OBJS = init.lo bind.lo search.lo config.lo referral.lo | |||
--- a/servers/slapd/back-hdb/Makefile.in | |||
+++ b/servers/slapd/back-hdb/Makefile.in | |||
@@ -15,6 +15,8 @@ | |||
# | |||
## Copyright 2003 Howard Chu @ Symas Corp. See master COPYRIGHT file for terms. | |||
+SHELL = @SHELL@ | |||
+ | |||
XXDIR = $(srcdir)/../back-bdb | |||
XXSRCS = init.c tools.c config.c \ | |||
--- a/servers/slapd/back-ldap/Makefile.in | |||
+++ b/servers/slapd/back-ldap/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = init.c config.c search.c bind.c unbind.c add.c compare.c \ | |||
delete.c modify.c modrdn.c extended.c chain.c \ | |||
distproc.c monitor.c pbind.c | |||
--- a/servers/slapd/back-ldif/Makefile.in | |||
+++ b/servers/slapd/back-ldif/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = ldif.c | |||
OBJS = ldif.lo | |||
--- a/servers/slapd/back-mdb/Makefile.in | |||
+++ b/servers/slapd/back-mdb/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = init.c tools.c config.c \ | |||
add.c bind.c compare.c delete.c modify.c modrdn.c search.c \ | |||
extended.c operational.c \ | |||
--- a/servers/slapd/back-meta/Makefile.in | |||
+++ b/servers/slapd/back-meta/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = init.c config.c search.c bind.c unbind.c add.c compare.c \ | |||
delete.c modify.c modrdn.c suffixmassage.c map.c \ | |||
conn.c candidates.c dncache.c | |||
--- a/servers/slapd/back-monitor/Makefile.in | |||
+++ b/servers/slapd/back-monitor/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = init.c search.c compare.c modify.c bind.c \ | |||
operational.c \ | |||
cache.c entry.c \ | |||
--- a/servers/slapd/back-ndb/Makefile.in | |||
+++ b/servers/slapd/back-ndb/Makefile.in | |||
@@ -17,6 +17,8 @@ | |||
## This work was initially developed by Howard Chu for inclusion | |||
## in OpenLDAP Software. This work was sponsored by MySQL. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = init.cpp tools.cpp config.cpp ndbio.cpp \ | |||
add.cpp bind.cpp compare.cpp delete.cpp modify.cpp modrdn.cpp search.cpp | |||
--- a/servers/slapd/back-null/Makefile.in | |||
+++ b/servers/slapd/back-null/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = null.c | |||
OBJS = null.lo | |||
--- a/servers/slapd/back-passwd/Makefile.in | |||
+++ b/servers/slapd/back-passwd/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = search.c config.c init.c | |||
OBJS = search.lo config.lo init.lo | |||
--- a/servers/slapd/back-perl/Makefile.in | |||
+++ b/servers/slapd/back-perl/Makefile.in | |||
@@ -14,6 +14,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = init.c search.c close.c config.c bind.c compare.c \ | |||
modify.c add.c modrdn.c delete.c | |||
OBJS = init.lo search.lo close.lo config.lo bind.lo compare.lo \ | |||
--- a/servers/slapd/back-relay/Makefile.in | |||
+++ b/servers/slapd/back-relay/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = init.c op.c | |||
OBJS = init.lo op.lo | |||
--- a/servers/slapd/back-shell/Makefile.in | |||
+++ b/servers/slapd/back-shell/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = init.c config.c fork.c search.c bind.c unbind.c add.c \ | |||
delete.c modify.c modrdn.c compare.c result.c | |||
OBJS = init.lo config.lo fork.lo search.lo bind.lo unbind.lo add.lo \ | |||
--- a/servers/slapd/back-sock/Makefile.in | |||
+++ b/servers/slapd/back-sock/Makefile.in | |||
@@ -17,6 +17,8 @@ | |||
## This work was initially developed by Brian Candler for inclusion | |||
## in OpenLDAP Software. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = init.c config.c opensock.c search.c bind.c unbind.c add.c \ | |||
delete.c modify.c modrdn.c compare.c result.c | |||
OBJS = init.lo config.lo opensock.lo search.lo bind.lo unbind.lo add.lo \ | |||
--- a/servers/slapd/back-sql/Makefile.in | |||
+++ b/servers/slapd/back-sql/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
SRCS = init.c config.c search.c bind.c compare.c operational.c \ | |||
entry-id.c schema-map.c sql-wrap.c modify.c util.c \ | |||
add.c delete.c modrdn.c api.c | |||
--- a/servers/slapd/shell-backends/Makefile.in | |||
+++ b/servers/slapd/shell-backends/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
PROGRAMS = passwd-shell | |||
SRCS = passwd-shell.c shellutil.c | |||
--- a/servers/slapd/slapi/Makefile.in | |||
+++ b/servers/slapd/slapi/Makefile.in | |||
@@ -14,6 +14,8 @@ | |||
## top-level directory of the distribution or, alternatively, at | |||
## <http://www.OpenLDAP.org/license.html>. | |||
+SHELL = @SHELL@ | |||
+ | |||
LIBRARY = libslapi.la | |||
#all-common: $(LIBRARY) $(PROGRAMS) |
@ -0,0 +1,26 @@ | |||
--- /dev/null | |||
+++ b/servers/slapd/schema/autofs.schema | |||
@@ -0,0 +1,23 @@ | |||
+attributetype ( 1.3.6.1.1.1.1.31 NAME 'automountMapName' | |||
+ DESC 'Automount map name' | |||
+ EQUALITY caseExactMatch | |||
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) | |||
+ | |||
+attributetype ( 1.3.6.1.1.1.1.32 NAME 'automountKey' | |||
+ DESC 'Automount key value' | |||
+ EQUALITY caseExactMatch | |||
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) | |||
+ | |||
+attributetype ( 1.3.6.1.1.1.1.33 NAME 'automountInformation' | |||
+ DESC 'Automount information' | |||
+ EQUALITY caseExactMatch | |||
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) | |||
+ | |||
+objectclass ( 1.3.6.1.1.1.2.16 NAME 'automountMap' SUP top STRUCTURAL | |||
+ MUST ( automountMapName ) | |||
+ MAY ( description ) ) | |||
+ | |||
+objectclass ( 1.3.6.1.1.1.2.17 NAME 'automount' SUP top STRUCTURAL | |||
+ DESC 'Automount' | |||
+ MUST ( automountKey $ automountInformation ) | |||
+ MAY description ) |
@ -0,0 +1,22 @@ | |||
--- a/clients/tools/Makefile.in | |||
+++ b/clients/tools/Makefile.in | |||
@@ -122,7 +122,7 @@ install-local: FORCE | |||
-$(MKDIR) $(DESTDIR)$(bindir) | |||
@( \ | |||
for prg in $(PROGRAMS); do \ | |||
- $(LTINSTALL) $(INSTALLFLAGS) $(STRIP) -m 755 $$prg$(EXEEXT) \ | |||
+ $(LTINSTALL) $(INSTALLFLAGS) -m 755 $$prg$(EXEEXT) \ | |||
$(DESTDIR)$(bindir); \ | |||
done \ | |||
) | |||
--- a/servers/slapd/Makefile.in | |||
+++ b/servers/slapd/Makefile.in | |||
@@ -380,7 +380,7 @@ install-local-srv: install-slapd install | |||
install-slapd: FORCE | |||
-$(MKDIR) $(DESTDIR)$(libexecdir) | |||
-$(MKDIR) $(DESTDIR)$(localstatedir)/run | |||
- $(LTINSTALL) $(INSTALLFLAGS) $(STRIP) -m 755 \ | |||
+ $(LTINSTALL) $(INSTALLFLAGS) -m 755 \ | |||
slapd$(EXEEXT) $(DESTDIR)$(libexecdir) | |||
@for i in $(SUBDIRS); do \ | |||
if test -d $$i && test -f $$i/Makefile ; then \ |
@ -0,0 +1,31 @@ | |||
Index: tiff-4.0.3/tools/ppm2tiff.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/tools/ppm2tiff.c 2013-06-23 10:36:50.779629492 -0400 | |||
+++ tiff-4.0.3/tools/ppm2tiff.c 2013-06-23 10:36:50.775629494 -0400 | |||
@@ -89,6 +89,7 @@ | |||
int c; | |||
extern int optind; | |||
extern char* optarg; | |||
+ tmsize_t scanline_size; | |||
if (argc < 2) { | |||
fprintf(stderr, "%s: Too few arguments\n", argv[0]); | |||
@@ -237,8 +238,16 @@ | |||
} | |||
if (TIFFScanlineSize(out) > linebytes) | |||
buf = (unsigned char *)_TIFFmalloc(linebytes); | |||
- else | |||
- buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out)); | |||
+ else { | |||
+ scanline_size = TIFFScanlineSize(out); | |||
+ if (scanline_size != 0) | |||
+ buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out)); | |||
+ else { | |||
+ fprintf(stderr, "%s: scanline size overflow\n",infile); | |||
+ (void) TIFFClose(out); | |||
+ exit(-2); | |||
+ } | |||
+ } | |||
if (resolution > 0) { | |||
TIFFSetField(out, TIFFTAG_XRESOLUTION, resolution); | |||
TIFFSetField(out, TIFFTAG_YRESOLUTION, resolution); |
@ -0,0 +1,146 @@ | |||
Index: tiff-4.0.3/tools/tiff2pdf.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/tools/tiff2pdf.c 2013-06-23 10:36:50.979629486 -0400 | |||
+++ tiff-4.0.3/tools/tiff2pdf.c 2013-06-23 10:36:50.975629486 -0400 | |||
@@ -3341,33 +3341,56 @@ | |||
uint32 height){ | |||
tsize_t i=0; | |||
- uint16 ri =0; | |||
- uint16 v_samp=1; | |||
- uint16 h_samp=1; | |||
- int j=0; | |||
- | |||
- i++; | |||
- | |||
- while(i<(*striplength)){ | |||
+ | |||
+ while (i < *striplength) { | |||
+ tsize_t datalen; | |||
+ uint16 ri; | |||
+ uint16 v_samp; | |||
+ uint16 h_samp; | |||
+ int j; | |||
+ int ncomp; | |||
+ | |||
+ /* marker header: one or more FFs */ | |||
+ if (strip[i] != 0xff) | |||
+ return(0); | |||
+ i++; | |||
+ while (i < *striplength && strip[i] == 0xff) | |||
+ i++; | |||
+ if (i >= *striplength) | |||
+ return(0); | |||
+ /* SOI is the only pre-SOS marker without a length word */ | |||
+ if (strip[i] == 0xd8) | |||
+ datalen = 0; | |||
+ else { | |||
+ if ((*striplength - i) <= 2) | |||
+ return(0); | |||
+ datalen = (strip[i+1] << 8) | strip[i+2]; | |||
+ if (datalen < 2 || datalen >= (*striplength - i)) | |||
+ return(0); | |||
+ } | |||
switch( strip[i] ){ | |||
- case 0xd8: | |||
- /* SOI - start of image */ | |||
+ case 0xd8: /* SOI - start of image */ | |||
_TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), 2); | |||
*bufferoffset+=2; | |||
- i+=2; | |||
break; | |||
- case 0xc0: | |||
- case 0xc1: | |||
- case 0xc3: | |||
- case 0xc9: | |||
- case 0xca: | |||
+ case 0xc0: /* SOF0 */ | |||
+ case 0xc1: /* SOF1 */ | |||
+ case 0xc3: /* SOF3 */ | |||
+ case 0xc9: /* SOF9 */ | |||
+ case 0xca: /* SOF10 */ | |||
if(no==0){ | |||
- _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), strip[i+2]+2); | |||
- for(j=0;j<buffer[*bufferoffset+9];j++){ | |||
- if( (buffer[*bufferoffset+11+(2*j)]>>4) > h_samp) | |||
- h_samp = (buffer[*bufferoffset+11+(2*j)]>>4); | |||
- if( (buffer[*bufferoffset+11+(2*j)] & 0x0f) > v_samp) | |||
- v_samp = (buffer[*bufferoffset+11+(2*j)] & 0x0f); | |||
+ _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), datalen+2); | |||
+ ncomp = buffer[*bufferoffset+9]; | |||
+ if (ncomp < 1 || ncomp > 4) | |||
+ return(0); | |||
+ v_samp=1; | |||
+ h_samp=1; | |||
+ for(j=0;j<ncomp;j++){ | |||
+ uint16 samp = buffer[*bufferoffset+11+(3*j)]; | |||
+ if( (samp>>4) > h_samp) | |||
+ h_samp = (samp>>4); | |||
+ if( (samp & 0x0f) > v_samp) | |||
+ v_samp = (samp & 0x0f); | |||
} | |||
v_samp*=8; | |||
h_samp*=8; | |||
@@ -3381,45 +3404,43 @@ | |||
(unsigned char) ((height>>8) & 0xff); | |||
buffer[*bufferoffset+6]= | |||
(unsigned char) (height & 0xff); | |||
- *bufferoffset+=strip[i+2]+2; | |||
- i+=strip[i+2]+2; | |||
- | |||
+ *bufferoffset+=datalen+2; | |||
+ /* insert a DRI marker */ | |||
buffer[(*bufferoffset)++]=0xff; | |||
buffer[(*bufferoffset)++]=0xdd; | |||
buffer[(*bufferoffset)++]=0x00; | |||
buffer[(*bufferoffset)++]=0x04; | |||
buffer[(*bufferoffset)++]=(ri >> 8) & 0xff; | |||
buffer[(*bufferoffset)++]= ri & 0xff; | |||
- } else { | |||
- i+=strip[i+2]+2; | |||
} | |||
break; | |||
- case 0xc4: | |||
- case 0xdb: | |||
- _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), strip[i+2]+2); | |||
- *bufferoffset+=strip[i+2]+2; | |||
- i+=strip[i+2]+2; | |||
+ case 0xc4: /* DHT */ | |||
+ case 0xdb: /* DQT */ | |||
+ _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), datalen+2); | |||
+ *bufferoffset+=datalen+2; | |||
break; | |||
- case 0xda: | |||
+ case 0xda: /* SOS */ | |||
if(no==0){ | |||
- _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), strip[i+2]+2); | |||
- *bufferoffset+=strip[i+2]+2; | |||
- i+=strip[i+2]+2; | |||
+ _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), datalen+2); | |||
+ *bufferoffset+=datalen+2; | |||
} else { | |||
buffer[(*bufferoffset)++]=0xff; | |||
buffer[(*bufferoffset)++]= | |||
(unsigned char)(0xd0 | ((no-1)%8)); | |||
- i+=strip[i+2]+2; | |||
} | |||
- _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), (*striplength)-i-1); | |||
- *bufferoffset+=(*striplength)-i-1; | |||
+ i += datalen + 1; | |||
+ /* copy remainder of strip */ | |||
+ _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i]), *striplength - i); | |||
+ *bufferoffset+= *striplength - i; | |||
return(1); | |||
default: | |||
- i+=strip[i+2]+2; | |||
+ /* ignore any other marker */ | |||
+ break; | |||
} | |||
+ i += datalen + 1; | |||
} | |||
- | |||
+ /* failed to find SOS marker */ | |||
return(0); | |||
} | |||
#endif |
@ -0,0 +1,768 @@ | |||
Index: tiff-4.0.3/contrib/dbs/xtiff/xtiff.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/contrib/dbs/xtiff/xtiff.c 2013-06-23 10:36:51.163629483 -0400 | |||
+++ tiff-4.0.3/contrib/dbs/xtiff/xtiff.c 2013-06-23 10:36:51.147629484 -0400 | |||
@@ -512,9 +512,9 @@ | |||
Arg args[1]; | |||
if (tfMultiPage) | |||
- sprintf(buffer, "%s - page %d", fileName, tfDirectory); | |||
+ snprintf(buffer, sizeof(buffer), "%s - page %d", fileName, tfDirectory); | |||
else | |||
- strcpy(buffer, fileName); | |||
+ snprintf(buffer, sizeof(buffer), "%s", fileName); | |||
XtSetArg(args[0], XtNlabel, buffer); | |||
XtSetValues(labelWidget, args, 1); | |||
} | |||
Index: tiff-4.0.3/libtiff/tif_dirinfo.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/libtiff/tif_dirinfo.c 2013-06-23 10:36:51.163629483 -0400 | |||
+++ tiff-4.0.3/libtiff/tif_dirinfo.c 2013-06-23 10:36:51.147629484 -0400 | |||
@@ -711,7 +711,7 @@ | |||
* note that this name is a special sign to TIFFClose() and | |||
* _TIFFSetupFields() to free the field | |||
*/ | |||
- sprintf(fld->field_name, "Tag %d", (int) tag); | |||
+ snprintf(fld->field_name, 32, "Tag %d", (int) tag); | |||
return fld; | |||
} | |||
Index: tiff-4.0.3/libtiff/tif_codec.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/libtiff/tif_codec.c 2013-06-23 10:36:51.163629483 -0400 | |||
+++ tiff-4.0.3/libtiff/tif_codec.c 2013-06-23 10:36:51.151629482 -0400 | |||
@@ -108,7 +108,8 @@ | |||
const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression); | |||
char compression_code[20]; | |||
- sprintf( compression_code, "%d", tif->tif_dir.td_compression ); | |||
+ snprintf(compression_code, sizeof(compression_code), "%d", | |||
+ tif->tif_dir.td_compression ); | |||
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, | |||
"%s compression support is not configured", | |||
c ? c->name : compression_code ); | |||
Index: tiff-4.0.3/tools/tiffdither.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/tools/tiffdither.c 2013-06-23 10:36:51.163629483 -0400 | |||
+++ tiff-4.0.3/tools/tiffdither.c 2013-06-23 10:36:51.151629482 -0400 | |||
@@ -260,7 +260,7 @@ | |||
TIFFSetField(out, TIFFTAG_FILLORDER, fillorder); | |||
else | |||
CopyField(TIFFTAG_FILLORDER, shortv); | |||
- sprintf(thing, "Dithered B&W version of %s", argv[optind]); | |||
+ snprintf(thing, sizeof(thing), "Dithered B&W version of %s", argv[optind]); | |||
TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, thing); | |||
CopyField(TIFFTAG_PHOTOMETRIC, shortv); | |||
CopyField(TIFFTAG_ORIENTATION, shortv); | |||
Index: tiff-4.0.3/tools/rgb2ycbcr.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/tools/rgb2ycbcr.c 2013-06-23 10:36:51.163629483 -0400 | |||
+++ tiff-4.0.3/tools/rgb2ycbcr.c 2013-06-23 10:36:51.151629482 -0400 | |||
@@ -332,7 +332,8 @@ | |||
TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); | |||
{ char buf[2048]; | |||
char *cp = strrchr(TIFFFileName(in), '/'); | |||
- sprintf(buf, "YCbCr conversion of %s", cp ? cp+1 : TIFFFileName(in)); | |||
+ snprintf(buf, sizeof(buf), "YCbCr conversion of %s", | |||
+ cp ? cp+1 : TIFFFileName(in)); | |||
TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, buf); | |||
} | |||
TIFFSetField(out, TIFFTAG_SOFTWARE, TIFFGetVersion()); | |||
Index: tiff-4.0.3/tools/tiff2pdf.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/tools/tiff2pdf.c 2013-06-23 10:36:51.163629483 -0400 | |||
+++ tiff-4.0.3/tools/tiff2pdf.c 2013-06-23 10:36:51.151629482 -0400 | |||
@@ -3630,7 +3630,9 @@ | |||
char buffer[16]; | |||
int buflen=0; | |||
- buflen=sprintf(buffer, "%%PDF-%u.%u ", t2p->pdf_majorversion&0xff, t2p->pdf_minorversion&0xff); | |||
+ buflen = snprintf(buffer, sizeof(buffer), "%%PDF-%u.%u ", | |||
+ t2p->pdf_majorversion&0xff, | |||
+ t2p->pdf_minorversion&0xff); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t)"\n%\342\343\317\323\n", 7); | |||
@@ -3644,10 +3646,10 @@ | |||
tsize_t t2p_write_pdf_obj_start(uint32 number, TIFF* output){ | |||
tsize_t written=0; | |||
- char buffer[16]; | |||
+ char buffer[32]; | |||
int buflen=0; | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)number); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)number); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen ); | |||
written += t2pWriteFile(output, (tdata_t) " 0 obj\n", 7); | |||
@@ -3686,13 +3688,13 @@ | |||
written += t2pWriteFile(output, (tdata_t) "/", 1); | |||
for (i=0;i<namelen;i++){ | |||
if ( ((unsigned char)name[i]) < 0x21){ | |||
- sprintf(buffer, "#%.2X", name[i]); | |||
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); | |||
buffer[sizeof(buffer) - 1] = '\0'; | |||
written += t2pWriteFile(output, (tdata_t) buffer, 3); | |||
nextchar=1; | |||
} | |||
if ( ((unsigned char)name[i]) > 0x7E){ | |||
- sprintf(buffer, "#%.2X", name[i]); | |||
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); | |||
buffer[sizeof(buffer) - 1] = '\0'; | |||
written += t2pWriteFile(output, (tdata_t) buffer, 3); | |||
nextchar=1; | |||
@@ -3700,57 +3702,57 @@ | |||
if (nextchar==0){ | |||
switch (name[i]){ | |||
case 0x23: | |||
- sprintf(buffer, "#%.2X", name[i]); | |||
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); | |||
buffer[sizeof(buffer) - 1] = '\0'; | |||
written += t2pWriteFile(output, (tdata_t) buffer, 3); | |||
break; | |||
case 0x25: | |||
- sprintf(buffer, "#%.2X", name[i]); | |||
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); | |||
buffer[sizeof(buffer) - 1] = '\0'; | |||
written += t2pWriteFile(output, (tdata_t) buffer, 3); | |||
break; | |||
case 0x28: | |||
- sprintf(buffer, "#%.2X", name[i]); | |||
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); | |||
buffer[sizeof(buffer) - 1] = '\0'; | |||
written += t2pWriteFile(output, (tdata_t) buffer, 3); | |||
break; | |||
case 0x29: | |||
- sprintf(buffer, "#%.2X", name[i]); | |||
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); | |||
buffer[sizeof(buffer) - 1] = '\0'; | |||
written += t2pWriteFile(output, (tdata_t) buffer, 3); | |||
break; | |||
case 0x2F: | |||
- sprintf(buffer, "#%.2X", name[i]); | |||
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); | |||
buffer[sizeof(buffer) - 1] = '\0'; | |||
written += t2pWriteFile(output, (tdata_t) buffer, 3); | |||
break; | |||
case 0x3C: | |||
- sprintf(buffer, "#%.2X", name[i]); | |||
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); | |||
buffer[sizeof(buffer) - 1] = '\0'; | |||
written += t2pWriteFile(output, (tdata_t) buffer, 3); | |||
break; | |||
case 0x3E: | |||
- sprintf(buffer, "#%.2X", name[i]); | |||
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); | |||
buffer[sizeof(buffer) - 1] = '\0'; | |||
written += t2pWriteFile(output, (tdata_t) buffer, 3); | |||
break; | |||
case 0x5B: | |||
- sprintf(buffer, "#%.2X", name[i]); | |||
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); | |||
buffer[sizeof(buffer) - 1] = '\0'; | |||
written += t2pWriteFile(output, (tdata_t) buffer, 3); | |||
break; | |||
case 0x5D: | |||
- sprintf(buffer, "#%.2X", name[i]); | |||
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); | |||
buffer[sizeof(buffer) - 1] = '\0'; | |||
written += t2pWriteFile(output, (tdata_t) buffer, 3); | |||
break; | |||
case 0x7B: | |||
- sprintf(buffer, "#%.2X", name[i]); | |||
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); | |||
buffer[sizeof(buffer) - 1] = '\0'; | |||
written += t2pWriteFile(output, (tdata_t) buffer, 3); | |||
break; | |||
case 0x7D: | |||
- sprintf(buffer, "#%.2X", name[i]); | |||
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); | |||
buffer[sizeof(buffer) - 1] = '\0'; | |||
written += t2pWriteFile(output, (tdata_t) buffer, 3); | |||
break; | |||
@@ -3865,14 +3867,14 @@ | |||
tsize_t t2p_write_pdf_stream_dict(tsize_t len, uint32 number, TIFF* output){ | |||
tsize_t written=0; | |||
- char buffer[16]; | |||
+ char buffer[32]; | |||
int buflen=0; | |||
written += t2pWriteFile(output, (tdata_t) "/Length ", 8); | |||
if(len!=0){ | |||
written += t2p_write_pdf_stream_length(len, output); | |||
} else { | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)number); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)number); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6); | |||
} | |||
@@ -3913,10 +3915,10 @@ | |||
tsize_t t2p_write_pdf_stream_length(tsize_t len, TIFF* output){ | |||
tsize_t written=0; | |||
- char buffer[16]; | |||
+ char buffer[32]; | |||
int buflen=0; | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)len); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)len); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) "\n", 1); | |||
@@ -3930,7 +3932,7 @@ | |||
tsize_t t2p_write_pdf_catalog(T2P* t2p, TIFF* output) | |||
{ | |||
tsize_t written = 0; | |||
- char buffer[16]; | |||
+ char buffer[32]; | |||
int buflen = 0; | |||
written += t2pWriteFile(output, | |||
@@ -3969,7 +3971,6 @@ | |||
written += t2p_write_pdf_string(t2p->pdf_datetime, output); | |||
} | |||
written += t2pWriteFile(output, (tdata_t) "\n/Producer ", 11); | |||
- _TIFFmemset((tdata_t)buffer, 0x00, sizeof(buffer)); | |||
snprintf(buffer, sizeof(buffer), "libtiff / tiff2pdf - %d", TIFFLIB_VERSION); | |||
written += t2p_write_pdf_string(buffer, output); | |||
written += t2pWriteFile(output, (tdata_t) "\n", 1); | |||
@@ -4110,7 +4111,7 @@ | |||
{ | |||
tsize_t written=0; | |||
tdir_t i=0; | |||
- char buffer[16]; | |||
+ char buffer[32]; | |||
int buflen=0; | |||
int page=0; | |||
@@ -4118,7 +4119,7 @@ | |||
(tdata_t) "<< \n/Type /Pages \n/Kids [ ", 26); | |||
page = t2p->pdf_pages+1; | |||
for (i=0;i<t2p->tiff_pagecount;i++){ | |||
- buflen=sprintf(buffer, "%d", page); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%d", page); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5); | |||
if ( ((i+1)%8)==0 ) { | |||
@@ -4133,8 +4134,7 @@ | |||
} | |||
} | |||
written += t2pWriteFile(output, (tdata_t) "] \n/Count ", 10); | |||
- _TIFFmemset(buffer, 0x00, 16); | |||
- buflen=sprintf(buffer, "%d", t2p->tiff_pagecount); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%d", t2p->tiff_pagecount); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " \n>> \n", 6); | |||
@@ -4149,28 +4149,28 @@ | |||
unsigned int i=0; | |||
tsize_t written=0; | |||
- char buffer[16]; | |||
+ char buffer[256]; | |||
int buflen=0; | |||
written += t2pWriteFile(output, (tdata_t) "<<\n/Type /Page \n/Parent ", 24); | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_pages); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_pages); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6); | |||
written += t2pWriteFile(output, (tdata_t) "/MediaBox [", 11); | |||
- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.x1); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.x1); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " ", 1); | |||
- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.y1); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.y1); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " ", 1); | |||
- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.x2); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.x2); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " ", 1); | |||
- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.y2); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.y2); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) "] \n", 3); | |||
written += t2pWriteFile(output, (tdata_t) "/Contents ", 10); | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)(object + 1)); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(object + 1)); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6); | |||
written += t2pWriteFile(output, (tdata_t) "/Resources << \n", 15); | |||
@@ -4178,15 +4178,13 @@ | |||
written += t2pWriteFile(output, (tdata_t) "/XObject <<\n", 12); | |||
for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount;i++){ | |||
written += t2pWriteFile(output, (tdata_t) "/Im", 3); | |||
- buflen = sprintf(buffer, "%u", t2p->pdf_page+1); | |||
+ buflen = snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) "_", 1); | |||
- buflen = sprintf(buffer, "%u", i+1); | |||
+ buflen = snprintf(buffer, sizeof(buffer), "%u", i+1); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " ", 1); | |||
- buflen = sprintf( | |||
- buffer, | |||
- "%lu", | |||
+ buflen = snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra)); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5); | |||
@@ -4198,12 +4196,10 @@ | |||
} else { | |||
written += t2pWriteFile(output, (tdata_t) "/XObject <<\n", 12); | |||
written += t2pWriteFile(output, (tdata_t) "/Im", 3); | |||
- buflen = sprintf(buffer, "%u", t2p->pdf_page+1); | |||
+ buflen = snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " ", 1); | |||
- buflen = sprintf( | |||
- buffer, | |||
- "%lu", | |||
+ buflen = snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra)); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5); | |||
@@ -4212,9 +4208,7 @@ | |||
if(t2p->tiff_transferfunctioncount != 0) { | |||
written += t2pWriteFile(output, (tdata_t) "/ExtGState <<", 13); | |||
t2pWriteFile(output, (tdata_t) "/GS1 ", 5); | |||
- buflen = sprintf( | |||
- buffer, | |||
- "%lu", | |||
+ buflen = snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)(object + 3)); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5); | |||
@@ -4587,7 +4581,7 @@ | |||
if(t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount>0){ | |||
for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount; i++){ | |||
box=t2p->tiff_tiles[t2p->pdf_page].tiles_tiles[i].tile_box; | |||
- buflen=sprintf(buffer, | |||
+ buflen=snprintf(buffer, sizeof(buffer), | |||
"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d_%ld Do Q\n", | |||
t2p->tiff_transferfunctioncount?"/GS1 gs ":"", | |||
box.mat[0], | |||
@@ -4602,7 +4596,7 @@ | |||
} | |||
} else { | |||
box=t2p->pdf_imagebox; | |||
- buflen=sprintf(buffer, | |||
+ buflen=snprintf(buffer, sizeof(buffer), | |||
"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d Do Q\n", | |||
t2p->tiff_transferfunctioncount?"/GS1 gs ":"", | |||
box.mat[0], | |||
@@ -4627,59 +4621,48 @@ | |||
TIFF* output){ | |||
tsize_t written=0; | |||
- char buffer[16]; | |||
+ char buffer[32]; | |||
int buflen=0; | |||
written += t2p_write_pdf_stream_dict(0, t2p->pdf_xrefcount+1, output); | |||
written += t2pWriteFile(output, | |||
(tdata_t) "/Type /XObject \n/Subtype /Image \n/Name /Im", | |||
42); | |||
- buflen=sprintf(buffer, "%u", t2p->pdf_page+1); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
if(tile != 0){ | |||
written += t2pWriteFile(output, (tdata_t) "_", 1); | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)tile); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)tile); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
} | |||
written += t2pWriteFile(output, (tdata_t) "\n/Width ", 8); | |||
- _TIFFmemset((tdata_t)buffer, 0x00, 16); | |||
if(tile==0){ | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->tiff_width); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->tiff_width); | |||
} else { | |||
if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){ | |||
- buflen=sprintf( | |||
- buffer, | |||
- "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth); | |||
} else { | |||
- buflen=sprintf( | |||
- buffer, | |||
- "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth); | |||
} | |||
} | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) "\n/Height ", 9); | |||
- _TIFFmemset((tdata_t)buffer, 0x00, 16); | |||
if(tile==0){ | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->tiff_length); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->tiff_length); | |||
} else { | |||
if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){ | |||
- buflen=sprintf( | |||
- buffer, | |||
- "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength); | |||
} else { | |||
- buflen=sprintf( | |||
- buffer, | |||
- "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength); | |||
} | |||
} | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) "\n/BitsPerComponent ", 19); | |||
- _TIFFmemset((tdata_t)buffer, 0x00, 16); | |||
- buflen=sprintf(buffer, "%u", t2p->tiff_bitspersample); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_bitspersample); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) "\n/ColorSpace ", 13); | |||
written += t2p_write_pdf_xobject_cs(t2p, output); | |||
@@ -4723,11 +4706,10 @@ | |||
t2p->pdf_colorspace ^= T2P_CS_PALETTE; | |||
written += t2p_write_pdf_xobject_cs(t2p, output); | |||
t2p->pdf_colorspace |= T2P_CS_PALETTE; | |||
- buflen=sprintf(buffer, "%u", (0x0001 << t2p->tiff_bitspersample)-1 ); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%u", (0x0001 << t2p->tiff_bitspersample)-1 ); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " ", 1); | |||
- _TIFFmemset(buffer, 0x00, 16); | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_palettecs ); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_palettecs ); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R ]\n", 7); | |||
return(written); | |||
@@ -4761,10 +4743,10 @@ | |||
X_W /= Y_W; | |||
Z_W /= Y_W; | |||
Y_W = 1.0F; | |||
- buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) "/Range ", 7); | |||
- buflen=sprintf(buffer, "[%d %d %d %d] \n", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "[%d %d %d %d] \n", | |||
t2p->pdf_labrange[0], | |||
t2p->pdf_labrange[1], | |||
t2p->pdf_labrange[2], | |||
@@ -4780,26 +4762,26 @@ | |||
tsize_t t2p_write_pdf_transfer(T2P* t2p, TIFF* output){ | |||
tsize_t written=0; | |||
- char buffer[16]; | |||
+ char buffer[32]; | |||
int buflen=0; | |||
written += t2pWriteFile(output, (tdata_t) "<< /Type /ExtGState \n/TR ", 25); | |||
if(t2p->tiff_transferfunctioncount == 1){ | |||
- buflen=sprintf(buffer, "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)(t2p->pdf_xrefcount + 1)); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5); | |||
} else { | |||
written += t2pWriteFile(output, (tdata_t) "[ ", 2); | |||
- buflen=sprintf(buffer, "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)(t2p->pdf_xrefcount + 1)); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5); | |||
- buflen=sprintf(buffer, "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)(t2p->pdf_xrefcount + 2)); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5); | |||
- buflen=sprintf(buffer, "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)(t2p->pdf_xrefcount + 3)); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5); | |||
@@ -4821,7 +4803,7 @@ | |||
written += t2pWriteFile(output, (tdata_t) "/FunctionType 0 \n", 17); | |||
written += t2pWriteFile(output, (tdata_t) "/Domain [0.0 1.0] \n", 19); | |||
written += t2pWriteFile(output, (tdata_t) "/Range [0.0 1.0] \n", 18); | |||
- buflen=sprintf(buffer, "/Size [%u] \n", (1<<t2p->tiff_bitspersample)); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "/Size [%u] \n", (1<<t2p->tiff_bitspersample)); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) "/BitsPerSample 16 \n", 19); | |||
written += t2p_write_pdf_stream_dict(((tsize_t)1)<<(t2p->tiff_bitspersample+1), 0, output); | |||
@@ -4848,7 +4830,7 @@ | |||
tsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){ | |||
tsize_t written=0; | |||
- char buffer[128]; | |||
+ char buffer[256]; | |||
int buflen=0; | |||
float X_W=0.0; | |||
@@ -4916,16 +4898,16 @@ | |||
written += t2pWriteFile(output, (tdata_t) "<< \n", 4); | |||
if(t2p->pdf_colorspace & T2P_CS_CALGRAY){ | |||
written += t2pWriteFile(output, (tdata_t) "/WhitePoint ", 12); | |||
- buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) "/Gamma 2.2 \n", 12); | |||
} | |||
if(t2p->pdf_colorspace & T2P_CS_CALRGB){ | |||
written += t2pWriteFile(output, (tdata_t) "/WhitePoint ", 12); | |||
- buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) "/Matrix ", 8); | |||
- buflen=sprintf(buffer, "[%.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f] \n", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f] \n", | |||
X_R, Y_R, Z_R, | |||
X_G, Y_G, Z_G, | |||
X_B, Y_B, Z_B); | |||
@@ -4944,11 +4926,11 @@ | |||
tsize_t t2p_write_pdf_xobject_icccs(T2P* t2p, TIFF* output){ | |||
tsize_t written=0; | |||
- char buffer[16]; | |||
+ char buffer[32]; | |||
int buflen=0; | |||
written += t2pWriteFile(output, (tdata_t) "[/ICCBased ", 11); | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_icccs); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_icccs); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R] \n", 7); | |||
@@ -4958,11 +4940,11 @@ | |||
tsize_t t2p_write_pdf_xobject_icccs_dict(T2P* t2p, TIFF* output){ | |||
tsize_t written=0; | |||
- char buffer[16]; | |||
+ char buffer[32]; | |||
int buflen=0; | |||
written += t2pWriteFile(output, (tdata_t) "/N ", 3); | |||
- buflen=sprintf(buffer, "%u \n", t2p->tiff_samplesperpixel); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%u \n", t2p->tiff_samplesperpixel); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) "/Alternate ", 11); | |||
t2p->pdf_colorspace ^= T2P_CS_ICCBASED; | |||
@@ -5027,7 +5009,7 @@ | |||
tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output){ | |||
tsize_t written=0; | |||
- char buffer[16]; | |||
+ char buffer[32]; | |||
int buflen=0; | |||
if(t2p->pdf_compression==T2P_COMPRESS_NONE){ | |||
@@ -5042,41 +5024,33 @@ | |||
written += t2pWriteFile(output, (tdata_t) "<< /K -1 ", 9); | |||
if(tile==0){ | |||
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9); | |||
- buflen=sprintf(buffer, "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)t2p->tiff_width); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7); | |||
- buflen=sprintf(buffer, "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)t2p->tiff_length); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
} else { | |||
if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){ | |||
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9); | |||
- buflen=sprintf( | |||
- buffer, | |||
- "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
} else { | |||
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9); | |||
- buflen=sprintf( | |||
- buffer, | |||
- "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
} | |||
if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){ | |||
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7); | |||
- buflen=sprintf( | |||
- buffer, | |||
- "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
} else { | |||
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7); | |||
- buflen=sprintf( | |||
- buffer, | |||
- "%lu", | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
} | |||
@@ -5103,21 +5077,17 @@ | |||
if(t2p->pdf_compressionquality%100){ | |||
written += t2pWriteFile(output, (tdata_t) "/DecodeParms ", 13); | |||
written += t2pWriteFile(output, (tdata_t) "<< /Predictor ", 14); | |||
- _TIFFmemset(buffer, 0x00, 16); | |||
- buflen=sprintf(buffer, "%u", t2p->pdf_compressionquality%100); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_compressionquality%100); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " /Columns ", 10); | |||
- _TIFFmemset(buffer, 0x00, 16); | |||
- buflen = sprintf(buffer, "%lu", | |||
+ buflen = snprintf(buffer, sizeof(buffer), "%lu", | |||
(unsigned long)t2p->tiff_width); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " /Colors ", 9); | |||
- _TIFFmemset(buffer, 0x00, 16); | |||
- buflen=sprintf(buffer, "%u", t2p->tiff_samplesperpixel); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_samplesperpixel); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " /BitsPerComponent ", 19); | |||
- _TIFFmemset(buffer, 0x00, 16); | |||
- buflen=sprintf(buffer, "%u", t2p->tiff_bitspersample); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_bitspersample); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) ">>\n", 3); | |||
} | |||
@@ -5137,16 +5107,16 @@ | |||
tsize_t t2p_write_pdf_xreftable(T2P* t2p, TIFF* output){ | |||
tsize_t written=0; | |||
- char buffer[21]; | |||
+ char buffer[64]; | |||
int buflen=0; | |||
uint32 i=0; | |||
written += t2pWriteFile(output, (tdata_t) "xref\n0 ", 7); | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)(t2p->pdf_xrefcount + 1)); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(t2p->pdf_xrefcount + 1)); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
written += t2pWriteFile(output, (tdata_t) " \n0000000000 65535 f \n", 22); | |||
for (i=0;i<t2p->pdf_xrefcount;i++){ | |||
- sprintf(buffer, "%.10lu 00000 n \n", | |||
+ snprintf(buffer, sizeof(buffer), "%.10lu 00000 n \n", | |||
(unsigned long)t2p->pdf_xrefoffsets[i]); | |||
written += t2pWriteFile(output, (tdata_t) buffer, 20); | |||
} | |||
@@ -5170,17 +5140,14 @@ | |||
snprintf(t2p->pdf_fileid + i, 9, "%.8X", rand()); | |||
written += t2pWriteFile(output, (tdata_t) "trailer\n<<\n/Size ", 17); | |||
- buflen = sprintf(buffer, "%lu", (unsigned long)(t2p->pdf_xrefcount+1)); | |||
+ buflen = snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(t2p->pdf_xrefcount+1)); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
- _TIFFmemset(buffer, 0x00, 32); | |||
written += t2pWriteFile(output, (tdata_t) "\n/Root ", 7); | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_catalog); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_catalog); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
- _TIFFmemset(buffer, 0x00, 32); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R \n/Info ", 12); | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_info); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_info); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
- _TIFFmemset(buffer, 0x00, 32); | |||
written += t2pWriteFile(output, (tdata_t) " 0 R \n/ID[<", 11); | |||
written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid, | |||
sizeof(t2p->pdf_fileid) - 1); | |||
@@ -5188,9 +5155,8 @@ | |||
written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid, | |||
sizeof(t2p->pdf_fileid) - 1); | |||
written += t2pWriteFile(output, (tdata_t) ">]\n>>\nstartxref\n", 16); | |||
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_startxref); | |||
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_startxref); | |||
written += t2pWriteFile(output, (tdata_t) buffer, buflen); | |||
- _TIFFmemset(buffer, 0x00, 32); | |||
written += t2pWriteFile(output, (tdata_t) "\n%%EOF\n", 7); | |||
return(written); | |||
Index: tiff-4.0.3/tools/tiff2ps.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/tools/tiff2ps.c 2013-06-23 10:36:51.163629483 -0400 | |||
+++ tiff-4.0.3/tools/tiff2ps.c 2013-06-23 10:36:51.155629481 -0400 | |||
@@ -1781,8 +1781,8 @@ | |||
imageOp = "imagemask"; | |||
(void)strcpy(im_x, "0"); | |||
- (void)sprintf(im_y, "%lu", (long) h); | |||
- (void)sprintf(im_h, "%lu", (long) h); | |||
+ (void)snprintf(im_y, sizeof(im_y), "%lu", (long) h); | |||
+ (void)snprintf(im_h, sizeof(im_h), "%lu", (long) h); | |||
tile_width = w; | |||
tile_height = h; | |||
if (TIFFIsTiled(tif)) { | |||
@@ -1803,7 +1803,7 @@ | |||
} | |||
if (tile_height < h) { | |||
fputs("/im_y 0 def\n", fd); | |||
- (void)sprintf(im_y, "%lu im_y sub", (unsigned long) h); | |||
+ (void)snprintf(im_y, sizeof(im_y), "%lu im_y sub", (unsigned long) h); | |||
} | |||
} else { | |||
repeat_count = tf_numberstrips; | |||
@@ -1815,7 +1815,7 @@ | |||
fprintf(fd, "/im_h %lu def\n", | |||
(unsigned long) tile_height); | |||
(void)strcpy(im_h, "im_h"); | |||
- (void)sprintf(im_y, "%lu im_y sub", (unsigned long) h); | |||
+ (void)snprintf(im_y, sizeof(im_y), "%lu im_y sub", (unsigned long) h); | |||
} | |||
} | |||
Index: tiff-4.0.3/tools/tiffcrop.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/tools/tiffcrop.c 2013-06-23 10:36:51.163629483 -0400 | |||
+++ tiff-4.0.3/tools/tiffcrop.c 2013-06-23 10:36:51.159629481 -0400 | |||
@@ -2077,7 +2077,7 @@ | |||
return 1; | |||
} | |||
- sprintf (filenum, "-%03d%s", findex, export_ext); | |||
+ snprintf(filenum, sizeof(filenum), "-%03d%s", findex, export_ext); | |||
filenum[14] = '\0'; | |||
strncat (exportname, filenum, 15); | |||
} | |||
@@ -2230,8 +2230,8 @@ | |||
/* dump.infilename is guaranteed to be NUL termimated and have 20 bytes | |||
fewer than PATH_MAX */ | |||
- memset (temp_filename, '\0', PATH_MAX + 1); | |||
- sprintf (temp_filename, "%s-read-%03d.%s", dump.infilename, dump_images, | |||
+ snprintf(temp_filename, sizeof(temp_filename), "%s-read-%03d.%s", | |||
+ dump.infilename, dump_images, | |||
(dump.format == DUMP_TEXT) ? "txt" : "raw"); | |||
if ((dump.infile = fopen(temp_filename, dump.mode)) == NULL) | |||
{ | |||
@@ -2249,8 +2249,8 @@ | |||
/* dump.outfilename is guaranteed to be NUL termimated and have 20 bytes | |||
fewer than PATH_MAX */ | |||
- memset (temp_filename, '\0', PATH_MAX + 1); | |||
- sprintf (temp_filename, "%s-write-%03d.%s", dump.outfilename, dump_images, | |||
+ snprintf(temp_filename, sizeof(temp_filename), "%s-write-%03d.%s", | |||
+ dump.outfilename, dump_images, | |||
(dump.format == DUMP_TEXT) ? "txt" : "raw"); | |||
if ((dump.outfile = fopen(temp_filename, dump.mode)) == NULL) | |||
{ | |||
Index: tiff-4.0.3/tools/tiff2bw.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/tools/tiff2bw.c 2013-06-23 10:36:51.163629483 -0400 | |||
+++ tiff-4.0.3/tools/tiff2bw.c 2013-06-23 10:36:51.159629481 -0400 | |||
@@ -205,7 +205,7 @@ | |||
} | |||
} | |||
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK); | |||
- sprintf(thing, "B&W version of %s", argv[optind]); | |||
+ snprintf(thing, sizeof(thing), "B&W version of %s", argv[optind]); | |||
TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, thing); | |||
TIFFSetField(out, TIFFTAG_SOFTWARE, "tiff2bw"); | |||
outbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out)); |
@ -0,0 +1,17 @@ | |||
Description: Buffer overflow in gif2tiff | |||
Bug: http://bugzilla.maptools.org/show_bug.cgi?id=2450 | |||
Bug-Debian: http://bugs.debian.org/719303 | |||
Index: tiff-4.0.3/tools/gif2tiff.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/tools/gif2tiff.c 2013-08-22 11:46:11.960846910 -0400 | |||
+++ tiff-4.0.3/tools/gif2tiff.c 2013-08-22 11:46:11.956846910 -0400 | |||
@@ -333,6 +333,8 @@ | |||
int status = 1; | |||
datasize = getc(infile); | |||
+ if (datasize > 12) | |||
+ return 0; | |||
clear = 1 << datasize; | |||
eoi = clear + 1; | |||
avail = clear + 2; |
@ -0,0 +1,18 @@ | |||
Description: use after free in tiff2pdf | |||
Bug: http://bugzilla.maptools.org/show_bug.cgi?id=2449 | |||
Bug-Debian: http://bugs.debian.org/719303 | |||
Index: tiff-4.0.3/tools/tiff2pdf.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/tools/tiff2pdf.c 2013-08-22 11:46:37.292847242 -0400 | |||
+++ tiff-4.0.3/tools/tiff2pdf.c 2013-08-22 11:46:37.292847242 -0400 | |||
@@ -2461,7 +2461,8 @@ | |||
(unsigned long) t2p->tiff_datasize, | |||
TIFFFileName(input)); | |||
t2p->t2p_error = T2P_ERR_ERROR; | |||
- _TIFFfree(buffer); | |||
+ _TIFFfree(buffer); | |||
+ return(0); | |||
} else { | |||
buffer=samplebuffer; | |||
t2p->tiff_datasize *= t2p->tiff_samplesperpixel; |
@ -0,0 +1,18 @@ | |||
Description: OOB write in gif2tiff | |||
Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=996468 | |||
Index: tiff-4.0.3/tools/gif2tiff.c | |||
=================================================================== | |||
--- tiff-4.0.3.orig/tools/gif2tiff.c 2013-08-24 11:17:13.546447901 -0400 | |||
+++ tiff-4.0.3/tools/gif2tiff.c 2013-08-24 11:17:13.546447901 -0400 | |||
@@ -400,6 +400,10 @@ | |||
} | |||
if (oldcode == -1) { | |||
+ if (code >= clear) { | |||
+ fprintf(stderr, "bad input: code=%d is larger than clear=%d\n",code, clear); | |||
+ return 0; | |||
+ } | |||
*(*fill)++ = suffix[code]; | |||
firstchar = oldcode = code; | |||
return 1; |
@ -0,0 +1,37 @@ | |||
Index: tiff/tools/gif2tiff.c | |||
=================================================================== | |||
--- tiff.orig/tools/gif2tiff.c | |||
+++ tiff/tools/gif2tiff.c | |||
@@ -280,6 +280,10 @@ readgifimage(char* mode) | |||
fprintf(stderr, "no colormap present for image\n"); | |||
return (0); | |||
} | |||
+ if (width == 0 || height == 0) { | |||
+ fprintf(stderr, "Invalid value of width or height\n"); | |||
+ return(0); | |||
+ } | |||
if ((raster = (unsigned char*) _TIFFmalloc(width*height+EXTRAFUDGE)) == NULL) { | |||
fprintf(stderr, "not enough memory for image\n"); | |||
return (0); | |||
@@ -404,6 +408,10 @@ process(register int code, unsigned char | |||
fprintf(stderr, "bad input: code=%d is larger than clear=%d\n",code, clear); | |||
return 0; | |||
} | |||
+ if (*fill >= raster + width*height) { | |||
+ fprintf(stderr, "raster full before eoi code\n"); | |||
+ return 0; | |||
+ } | |||
*(*fill)++ = suffix[code]; | |||
firstchar = oldcode = code; | |||
return 1; | |||
@@ -434,6 +442,10 @@ process(register int code, unsigned char | |||
} | |||
oldcode = incode; | |||
do { | |||
+ if (*fill >= raster + width*height) { | |||
+ fprintf(stderr, "raster full before eoi code\n"); | |||
+ return 0; | |||
+ } | |||
*(*fill)++ = *--stackp; | |||
} while (stackp > stack); | |||
return 1; |
@ -0,0 +1,81 @@ | |||
# | |||
# Copyright (C) 2010-2012 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=vips | |||
PKG_VERSION:=7.38.5 | |||
PKG_RELEASE:=1 | |||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | |||
PKG_SOURCE_URL:=http://www.vips.ecs.soton.ac.uk/supported/7.38/ | |||
PKG_MD5SUM:=768d1c0f50c5b2794bcab68383af33ee | |||
PKG_FIXUP:=autoreconf | |||
include $(INCLUDE_DIR)/package.mk | |||
include $(INCLUDE_DIR)/nls.mk | |||
PKG_INSTALL=1 | |||
define Package/vips | |||
$(call Package/vips/Default) | |||
SECTION:=multimedia | |||
CATEGORY:=Multimedia | |||
TITLE:=An image manipulation library | |||
URL:=http://www.vips.ecs.soton.ac.uk/ | |||
MAINTAINER:=W. Michael Petullo <mike@flyn.org> | |||
DEPENDS:=+glib2 +libexif +libjpeg +libpng +libxml2 $(INTL_DEPENDS) | |||
endef | |||
TARGET_LDFLAGS+= \ | |||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib | |||
CONFIGURE_ARGS += \ | |||
--disable-cxx \ | |||
--disable-threads \ | |||
--without-cfitsio \ | |||
--without-fftw \ | |||
--without-lcms \ | |||
--without-magick \ | |||
--without-matio \ | |||
--without-OpenEXR \ | |||
--without-orc \ | |||
--without-pangoft2 \ | |||
--without-python \ | |||
--without-tiff \ | |||
--without-v4l \ | |||
--without-x \ | |||
--without-zip \ | |||
--with-jpeg \ | |||
--with-libexif \ | |||
--with-png \ | |||
define Build/InstallDev | |||
$(INSTALL_DIR) $(1)/usr/include/vips | |||
$(CP) \ | |||
$(PKG_INSTALL_DIR)/usr/include/* \ | |||
$(1)/usr/include/ | |||
$(INSTALL_DIR) $(1)/usr/lib/ | |||
$(CP) \ | |||
$(PKG_INSTALL_DIR)/usr/lib/*.so* \ | |||
$(1)/usr/lib/ | |||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig/ | |||
$(INSTALL_DATA) \ | |||
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \ | |||
$(1)/usr/lib/pkgconfig/ | |||
endef | |||
define Package/vips/install | |||
$(INSTALL_DIR) $(1)/usr/lib/ | |||
$(CP) \ | |||
$(PKG_INSTALL_DIR)/usr/lib/*.so* \ | |||
$(1)/usr/lib/ | |||
endef | |||
$(eval $(call BuildPackage,vips)) |
@ -0,0 +1,238 @@ | |||
# | |||
# Copyright (C) 2011-2014 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=gst1-plugins-bad | |||
PKG_VERSION:=1.2.3 | |||
PKG_RELEASE:=2 | |||
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org> | |||
PKG_LICENSE:=LGPLv2 GPLv2 | |||
PKG_LICENSE_FILE:=COPYING.LIB COPYING | |||
PKG_BUILD_DIR:=$(BUILD_DIR)/gst-plugins-bad-$(PKG_VERSION) | |||
PKG_SOURCE:=gst-plugins-bad-$(PKG_VERSION).tar.xz | |||
PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-plugins-bad/ | |||
PKG_MD5SUM:=cfd6f303c8df2740b27cc63b945decef | |||
PKG_BUILD_DEPENDS:= gstreamer1 gst1-plugins-base liboil | |||
PKG_FIXUP:=autoreconf | |||
PKG_INSTALL:=1 | |||
include $(INCLUDE_DIR)/package.mk | |||
include $(INCLUDE_DIR)/nls.mk | |||
define Package/gstreamer1/Default | |||
CATEGORY:=Multimedia | |||
SECTION:=multimedia | |||
TITLE:=GStreamer | |||
URL:=http://gstreamer.freedesktop.org/ | |||
DEPENDS:= $(ICONV_DEPENDS) | |||
endef | |||
define Package/gstreamer1/description/Default | |||
GStreamer open source multimedia framework | |||
endef | |||
define Package/gst1-plugins-bad | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= plugins collection (bad) | |||
DEPENDS+= $(GST_DEPENDS) | |||
endef | |||
define Package/gts1-plugins-bad/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This meta package contains only dependencies to the other plugins from | |||
the bad plugins collection. | |||
endef | |||
GST_VERSION:=1.0 | |||
CONFIGURE_ARGS += \ | |||
--disable-debug \ | |||
--disable-examples \ | |||
--disable-nls \ | |||
\ | |||
--disable-directsound \ | |||
--disable-directdraw \ | |||
--disable-osx_video \ | |||
--disable-quicktime \ | |||
--disable-vcd \ | |||
--disable-alsa \ | |||
--disable-assrender \ | |||
--disable-amrwb \ | |||
--disable-apexsink \ | |||
--disable-bz2 \ | |||
--disable-cdaudio \ | |||
--disable-celt \ | |||
--disable-cog \ | |||
--disable-dc1394 \ | |||
--disable-directfb \ | |||
--disable-dirac \ | |||
--disable-dts \ | |||
--disable-divx \ | |||
--disable-resindvd \ | |||
--disable-metadata \ | |||
--disable-faac \ | |||
--disable-faad \ | |||
--disable-fbdev \ | |||
--disable-flite \ | |||
--disable-gsm \ | |||
--disable-jack \ | |||
--disable-jp2k \ | |||
--disable-kate \ | |||
--disable-ladspa \ | |||
--disable-lv2 \ | |||
--disable-modplug \ | |||
--disable-mimic \ | |||
--disable-libmms \ | |||
--disable-mpeg2enc \ | |||
--disable-mplex \ | |||
--disable-musepack \ | |||
--disable-musicbrainz \ | |||
--disable-mythtv \ | |||
--disable-nas \ | |||
--disable-neon \ | |||
--disable-ofa \ | |||
--disable-rsvg \ | |||
--disable-timidity \ | |||
--disable-wildmidi \ | |||
--disable-sdl \ | |||
--disable-sdltest \ | |||
--disable-sndfile \ | |||
--disable-soundtouch \ | |||
--disable-spc \ | |||
--disable-gme \ | |||
--disable-swfdec \ | |||
--disable-theoradec \ | |||
--disable-xvid \ | |||
--disable-dvb \ | |||
--disable-wininet \ | |||
--disable-acm \ | |||
--disable-vdpau \ | |||
--disable-schro \ | |||
--disable-zbar \ | |||
--disable-vp8 \ | |||
\ | |||
--without-libiconv-prefix \ | |||
--without-libintl-prefix \ | |||
--without-x \ | |||
TARGET_CFLAGS+= -std=gnu99 | |||
EXTRA_LDFLAGS+= \ | |||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \ | |||
$(if $(ICONV_FULL),-liconv) \ | |||
define Package/gst1-plugins-ugly/install | |||
/bin/true | |||
endef | |||
# 1: short name | |||
# 2: description | |||
# 3: dependencies on other gstreamer libraries (short name) | |||
# 4: dependencies on other packages | |||
define GstBuildLibrary | |||
GST_DEPENDS += +libgst1$(1) | |||
define Package/libgst1$(1) | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= $(2) library (base) | |||
DEPENDS+= +libgstreamer1 $$(foreach p,$(3),+libgst1$$(p)) $(4) | |||
endef | |||
define Package/libgst1$(1)/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This package contains the GStreamer $(2) library. | |||
endef | |||
define Package/libgst1$(1)/install | |||
$(INSTALL_DIR) $$(1)/usr/lib | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/libgst$(1)-$(GST_VERSION).so.* \ | |||
$$(1)/usr/lib/ \ | |||
) | |||
endef | |||
$$(eval $$(call BuildPackage,libgst1$(1))) | |||
endef | |||
$(eval $(call GstBuildLibrary,photography,photography,,)) | |||
$(eval $(call GstBuildLibrary,basecamerabinsrc,basecamerabinsrc,app,)) | |||
# 1: short name | |||
# 2: description | |||
# 3: dependencies on other gstreamer libraries (short name) | |||
# 4: dependencies on other gstreamer plugins (short name) | |||
# 5: dependencies on other packages | |||
define GstBuildPlugin | |||
GST_DEPENDS += +gst1-mod-$(1) | |||
define Package/gst1-mod-$(1) | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= $(2) plugin (bad) | |||
DEPENDS+= +libgstreamer1 $$(foreach p,$(3),+libgst1$$(p)) $$(foreach p,$(4),+gst1-mod-$$(p)) $(5) | |||
endef | |||
define Package/gst1-mod-$(1)/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This package contains the GStreamer $(2) plugin. | |||
endef | |||
define Package/gst1-mod-$(1)/install | |||
$(INSTALL_DIR) $$(1)/usr/lib/gstreamer-$(GST_VERSION) | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/gstreamer-$(GST_VERSION)/libgst$(1).so* \ | |||
$$(1)/usr/lib/gstreamer-$(GST_VERSION)/ \ | |||
) | |||
endef | |||
$$(eval $$(call BuildPackage,gst1-mod-$(1))) | |||
endef | |||
$(eval $(call GstBuildPlugin,adpcmdec,adpcm decoding support,audio,,)) | |||
$(eval $(call GstBuildPlugin,adpcmenc,adpcm encoding support,audio,,)) | |||
$(eval $(call GstBuildPlugin,aiff,aiff support,audio tag,,)) | |||
$(eval $(call GstBuildPlugin,asfmux,asf muxing support,rtp,,)) | |||
$(eval $(call GstBuildPlugin,autoconvert,autoconvert support,,,)) | |||
$(eval $(call GstBuildPlugin,bayer,bayer support,video,,)) | |||
$(eval $(call GstBuildPlugin,camerabin2,camerabin support,basecamerabinsrc photography tag pbutils app,,)) | |||
$(eval $(call GstBuildPlugin,dataurisrc,dataurisrc support,,,)) | |||
$(eval $(call GstBuildPlugin,debugutilsbad,debugutils support,video,,)) | |||
$(eval $(call GstBuildPlugin,dvdspu,dvdspu support,video,,)) | |||
$(eval $(call GstBuildPlugin,festival,festival support,audio,,)) | |||
$(eval $(call GstBuildPlugin,frei0r,frei0r support,controller video,,)) | |||
$(eval $(call GstBuildPlugin,id3tag,id3tag support,tag,,)) | |||
$(eval $(call GstBuildPlugin,jpegformat,jpegformat support,tag,,)) | |||
$(eval $(call GstBuildPlugin,liveadder,liveadder support,audio,,)) | |||
$(eval $(call GstBuildPlugin,mpegpsdemux,mpegpsdemux support,pbutils tag,,)) | |||
$(eval $(call GstBuildPlugin,mpegpsmux,mpegpsmux support,,,)) | |||
#$(eval $(call GstBuildPlugin,mpegtsdemux,mpegtsdemux support,mpegts pbutils tag,,)) | |||
#$(eval $(call GstBuildPlugin,mpegtsmux,mpegtsmux support,video,,)) | |||
$(eval $(call GstBuildPlugin,mxf,mxf support,audio video,,)) | |||
$(eval $(call GstBuildPlugin,pcapparse,pcapparse support,,,)) | |||
$(eval $(call GstBuildPlugin,pnm,pnm support,video,,)) | |||
$(eval $(call GstBuildPlugin,rawparse,rawparse support,audio video,,)) | |||
$(eval $(call GstBuildPlugin,rfbsrc,librfb support,video,,)) | |||
$(eval $(call GstBuildPlugin,sdpelem,sdp support,rtp sdp,,)) | |||
$(eval $(call GstBuildPlugin,segmentclip,segmentclip support,audio,,)) | |||
$(eval $(call GstBuildPlugin,siren,siren support,audio rtp,,)) | |||
$(eval $(call GstBuildPlugin,speed,speed support,audio,,)) | |||
$(eval $(call GstBuildPlugin,subenc,subenc support,controller,,)) | |||
$(eval $(call BuildPackage,gst1-plugins-bad)) |
@ -0,0 +1,45 @@ | |||
diff -u --recursive gst-plugins-bad-1.0.7-vanilla/configure.ac gst-plugins-bad-1.0.7/configure.ac | |||
--- gst-plugins-bad-1.0.7-vanilla/configure.ac 2013-06-01 19:44:32.199308073 -0500 | |||
+++ gst-plugins-bad-1.0.7/configure.ac 2013-06-01 19:45:27.754119344 -0500 | |||
@@ -2373,7 +2373,6 @@ | |||
ext/timidity/Makefile | |||
ext/xvid/Makefile | |||
ext/zbar/Makefile | |||
-po/Makefile.in | |||
docs/Makefile | |||
docs/plugins/Makefile | |||
docs/libs/Makefile | |||
diff -u --recursive gst-plugins-bad-1.0.7-vanilla/Makefile.am gst-plugins-bad-1.0.7/Makefile.am | |||
--- gst-plugins-bad-1.0.7-vanilla/Makefile.am 2013-06-01 19:44:32.165309412 -0500 | |||
+++ gst-plugins-bad-1.0.7/Makefile.am 2013-06-01 19:45:39.016675625 -0500 | |||
@@ -2,11 +2,11 @@ | |||
SUBDIRS = \ | |||
gst-libs gst sys ext pkgconfig \ | |||
- m4 common docs tests po tools | |||
+ m4 common docs tests tools | |||
DIST_SUBDIRS = \ | |||
gst gst-libs sys ext pkgconfig \ | |||
- m4 common docs tests po tools | |||
+ m4 common docs tests tools | |||
# include before EXTRA_DIST for win32 assignment | |||
include $(top_srcdir)/common/win32.mak | |||
diff -u --recursive gst-plugins-bad-1.0.7-vanilla/Makefile.in gst-plugins-bad-1.0.7/Makefile.in | |||
--- gst-plugins-bad-1.0.7-vanilla/Makefile.in 2013-06-01 19:44:32.217307364 -0500 | |||
+++ gst-plugins-bad-1.0.7/Makefile.in 2013-06-01 19:45:44.624454691 -0500 | |||
@@ -636,11 +636,11 @@ | |||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc | |||
SUBDIRS = \ | |||
gst-libs gst sys ext pkgconfig \ | |||
- m4 common docs tests po tools | |||
+ m4 common docs tests tools | |||
DIST_SUBDIRS = \ | |||
gst gst-libs sys ext pkgconfig \ | |||
- m4 common docs tests po tools | |||
+ m4 common docs tests tools | |||
# the MANIFEST contains all win32 related files that should be disted |
@ -0,0 +1,242 @@ | |||
# | |||
# Copyright (C) 2008-2014 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=gst1-plugins-base | |||
PKG_VERSION:=1.2.3 | |||
PKG_RELEASE:=1 | |||
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org> | |||
PKG_LICENSE:=LGPLv2 GPLv2 | |||
PKG_LICENSE_FILE:=COPYING.LIB COPYING | |||
PKG_BUILD_DIR:=$(BUILD_DIR)/gst-plugins-base-$(PKG_VERSION) | |||
PKG_SOURCE:=gst-plugins-base-$(PKG_VERSION).tar.xz | |||
PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-plugins-base/ | |||
PKG_MD5SUM:=17aeabfbcd232526f50c9bee375f1b97 | |||
PKG_BUILD_DEPENDS:= gstreamer1 liboil | |||
PKG_CONFIG_DEPENDS:= \ | |||
CONFIG_PACKAGE_gst1-mod-alsa \ | |||
CONFIG_PACKAGE_gst1-mod-app \ | |||
CONFIG_PACKAGE_gst1-mod-audioconvert \ | |||
CONFIG_PACKAGE_gst1-mod-audiorate \ | |||
CONFIG_PACKAGE_gst1-mod-audioresample \ | |||
CONFIG_PACKAGE_gst1-mod-audiotestsrc \ | |||
CONFIG_PACKAGE_gst1-mod-gio \ | |||
CONFIG_PACKAGE_gst1-mod-ogg \ | |||
CONFIG_PACKAGE_gst1-mod-tcp \ | |||
CONFIG_PACKAGE_gst1-mod-theora \ | |||
CONFIG_PACKAGE_gst1-mod-videotestsrc \ | |||
CONFIG_PACKAGE_gst1-mod-volume \ | |||
CONFIG_PACKAGE_gst1-mod-vorbis \ | |||
PKG_FIXUP:=autoreconf | |||
PKG_INSTALL:=1 | |||
include $(INCLUDE_DIR)/package.mk | |||
include $(INCLUDE_DIR)/nls.mk | |||
define Package/gstreamer1/Default | |||
CATEGORY:=Multimedia | |||
SECTION:=multimedia | |||
TITLE:=GStreamer | |||
URL:=http://gstreamer.freedesktop.org/ | |||
DEPENDS:= $(ICONV_DEPENDS) | |||
endef | |||
define Package/gstreamer1/description/Default | |||
GStreamer open source multimedia framework | |||
endef | |||
define Package/gst1-plugins-base | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= plugins collection (base) | |||
DEPENDS+= $(GST_DEPENDS) | |||
endef | |||
define Package/gts1-plugins-base/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This meta package contains only dependencies to the other libraries and | |||
plugins from the base plugins collection. | |||
endef | |||
GST_COND_SELECT = $(patsubst %,$(if $(CONFIG_PACKAGE_gst1-mod-$(1)),--enable,--disable)-%,$(1)) | |||
GST_VERSION:=1.0 | |||
CONFIGURE_ARGS += \ | |||
--disable-debug \ | |||
--disable-examples \ | |||
\ | |||
$(call GST_COND_SELECT,alsa) \ | |||
--disable-alsa-test \ | |||
$(call GST_COND_SELECT,app) \ | |||
$(call GST_COND_SELECT,audioconvert) \ | |||
$(call GST_COND_SELECT,audiorate) \ | |||
$(call GST_COND_SELECT,audioresample) \ | |||
$(call GST_COND_SELECT,audiotestsrc) \ | |||
--disable-cdparanoia \ | |||
--disable-ffmpegcolorspace \ | |||
--disable-freetypetest \ | |||
$(call GST_COND_SELECT,gio) \ | |||
--disable-gnome_vfs \ | |||
--disable-gst_v4l \ | |||
--disable-libvisual \ | |||
$(call GST_COND_SELECT,ogg) \ | |||
--disable-oggtest \ | |||
--disable-pango \ | |||
--disable-subparse \ | |||
$(call GST_COND_SELECT,tcp) \ | |||
$(call GST_COND_SELECT,theora) \ | |||
--disable-videorate \ | |||
--disable-videoscale \ | |||
$(call GST_COND_SELECT,videotestsrc) \ | |||
$(call GST_COND_SELECT,volume) \ | |||
$(call GST_COND_SELECT,vorbis) \ | |||
--disable-vorbistest \ | |||
--disable-x \ | |||
--disable-xshm \ | |||
--disable-xvideo \ | |||
\ | |||
--without-libiconv-prefix \ | |||
--without-libintl-prefix \ | |||
--without-x \ | |||
\ | |||
--with-audioresample-format=int \ | |||
EXTRA_LDFLAGS+= \ | |||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \ | |||
$(if $(ICONV_FULL),-liconv) \ | |||
define Build/InstallDev | |||
$(INSTALL_DIR) $(1)/usr/include/gstreamer-$(GST_VERSION) | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/include/gstreamer-$(GST_VERSION)/* \ | |||
$(1)/usr/include/gstreamer-$(GST_VERSION)/ \ | |||
) | |||
$(INSTALL_DIR) $(1)/usr/lib | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/libgst*-$(GST_VERSION).{la,so*} \ | |||
$(1)/usr/lib/ \ | |||
) | |||
$(INSTALL_DIR) $(1)/usr/lib/gstreamer-$(GST_VERSION) | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/gstreamer-$(GST_VERSION)/libgst*.{la,so} \ | |||
$(1)/usr/lib/gstreamer-$(GST_VERSION)/ \ | |||
) | |||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/pkgconfig/gstreamer*-$(GST_VERSION).pc \ | |||
$(1)/usr/lib/pkgconfig/ \ | |||
) | |||
endef | |||
define Package/gst1-plugins-base/install | |||
/bin/true | |||
endef | |||
# 1: short name | |||
# 2: description | |||
# 3: dependencies on other gstreamer libraries (short name) | |||
# 4: dependencies on other packages | |||
define GstBuildLibrary | |||
GST_DEPENDS += +libgst1$(1) | |||
define Package/libgst1$(1) | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= $(2) library (base) | |||
DEPENDS+= +libgstreamer1 $$(foreach p,$(3),+libgst1$$(p)) $(4) | |||
endef | |||
define Package/libgst1$(1)/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This package contains the GStreamer $(2) library. | |||
endef | |||
define Package/libgst1$(1)/install | |||
$(INSTALL_DIR) $$(1)/usr/lib | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/libgst$(1)-$(GST_VERSION).so.* \ | |||
$$(1)/usr/lib/ \ | |||
) | |||
endef | |||
$$(eval $$(call BuildPackage,libgst1$(1))) | |||
endef | |||
$(eval $(call GstBuildLibrary,app,app,,)) | |||
$(eval $(call GstBuildLibrary,audio,audio,tag,)) | |||
$(eval $(call GstBuildLibrary,fft,FFT,,)) | |||
$(eval $(call GstBuildLibrary,pbutils,utils,audio tag video,)) | |||
$(eval $(call GstBuildLibrary,riff,RIFF media,audio tag,,)) | |||
$(eval $(call GstBuildLibrary,rtp,RTP,,)) | |||
$(eval $(call GstBuildLibrary,rtsp,RTSP,,)) | |||
$(eval $(call GstBuildLibrary,sdp,SDP,,)) | |||
$(eval $(call GstBuildLibrary,tag,tag support,,)) | |||
$(eval $(call GstBuildLibrary,video,video,,)) | |||
# 1: short name | |||
# 2: description | |||
# 3: dependencies on other gstreamer libraries (short name) | |||
# 4: dependencies on other gstreamer plugins (short name) | |||
# 5: dependencies on other packages | |||
define GstBuildPlugin | |||
GST_DEPENDS += +gst1-mod-$(1) | |||
define Package/gst1-mod-$(1) | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= $(2) plugin (base) | |||
DEPENDS+= +libgstreamer1 $$(foreach p,$(3),+libgst1$$(p)) $$(foreach p,$(4),+gst1-mod-$$(p)) $(5) | |||
endef | |||
define Package/gst1-mod-$(1)/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This package contains the GStreamer $(2) plugin. | |||
endef | |||
define Package/gst1-mod-$(1)/install | |||
$(INSTALL_DIR) $$(1)/usr/lib/gstreamer-$(GST_VERSION) | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/gstreamer-$(GST_VERSION)/libgst$(1).so* \ | |||
$$(1)/usr/lib/gstreamer-$(GST_VERSION)/ \ | |||
) | |||
endef | |||
$$(eval $$(call BuildPackage,gst1-mod-$(1))) | |||
endef | |||
$(eval $(call GstBuildPlugin,alsa,ALSA,audio tag,,+alsa-lib)) | |||
$(eval $(call GstBuildPlugin,app,app,app,,)) | |||
$(eval $(call GstBuildPlugin,audioconvert,audio format conversion,audio,,)) | |||
$(eval $(call GstBuildPlugin,audiorate,audio rate adjusting,audio tag,,)) | |||
$(eval $(call GstBuildPlugin,audioresample,audio resampling,audio tag,,)) | |||
$(eval $(call GstBuildPlugin,audiotestsrc,audio test,audio tag controller,,)) | |||
$(eval $(call GstBuildPlugin,playback,media decoder (v2),pbutils,,)) | |||
$(eval $(call GstBuildPlugin,gio,GIO,,,)) | |||
$(eval $(call GstBuildPlugin,ogg,Ogg,riff tag pbutils video,,+libogg)) | |||
$(eval $(call GstBuildPlugin,tcp,TCP,,,)) | |||
$(eval $(call GstBuildPlugin,theora,Theora,tag video,,+libogg +libtheora)) | |||
$(eval $(call GstBuildPlugin,typefindfunctions,'typefind' functions,audio pbutils tag video,,)) | |||
$(eval $(call GstBuildPlugin,videotestsrc,video test,video,,+liboil)) | |||
$(eval $(call GstBuildPlugin,volume,volume,audio controller,,+liboil)) | |||
$(eval $(call GstBuildPlugin,vorbis,Vorbis,audio tag,ogg,+libvorbis)) | |||
$(eval $(call BuildPackage,gst1-plugins-base)) |
@ -0,0 +1,36 @@ | |||
diff -u --recursive gst-plugins-base-1.0.7-vanilla/Makefile.am gst-plugins-base-1.0.7/Makefile.am | |||
--- gst-plugins-base-1.0.7-vanilla/Makefile.am 2013-06-01 22:38:30.495678685 -0500 | |||
+++ gst-plugins-base-1.0.7/Makefile.am 2013-06-01 22:39:04.374335121 -0500 | |||
@@ -12,14 +12,12 @@ | |||
gst sys $(SUBDIRS_EXT) \ | |||
tools \ | |||
tests \ | |||
- docs \ | |||
po \ | |||
common \ | |||
m4 | |||
DIST_SUBDIRS = \ | |||
pkgconfig \ | |||
- docs \ | |||
gst-libs \ | |||
gst sys ext \ | |||
tools \ | |||
diff -u --recursive gst-plugins-base-1.0.7-vanilla/Makefile.in gst-plugins-base-1.0.7/Makefile.in | |||
--- gst-plugins-base-1.0.7-vanilla/Makefile.in 2013-06-01 22:38:30.527677416 -0500 | |||
+++ gst-plugins-base-1.0.7/Makefile.in 2013-06-01 22:38:59.110543873 -0500 | |||
@@ -493,14 +493,12 @@ | |||
gst sys $(SUBDIRS_EXT) \ | |||
tools \ | |||
tests \ | |||
- docs \ | |||
po \ | |||
common \ | |||
m4 | |||
DIST_SUBDIRS = \ | |||
pkgconfig \ | |||
- docs \ | |||
gst-libs \ | |||
gst sys ext \ | |||
tools \ |
@ -0,0 +1,38 @@ | |||
diff -u --recursive gst-plugins-base-1.0.7-vanilla/Makefile.am gst-plugins-base-1.0.7/Makefile.am | |||
--- gst-plugins-base-1.0.7-vanilla/Makefile.am 2013-06-01 19:49:37.986260708 -0500 | |||
+++ gst-plugins-base-1.0.7/Makefile.am 2013-06-01 19:49:54.998590479 -0500 | |||
@@ -11,7 +11,6 @@ | |||
gst-libs \ | |||
gst sys $(SUBDIRS_EXT) \ | |||
tools \ | |||
- tests \ | |||
po \ | |||
common \ | |||
m4 | |||
@@ -21,7 +20,6 @@ | |||
gst-libs \ | |||
gst sys ext \ | |||
tools \ | |||
- tests \ | |||
po \ | |||
common \ | |||
m4 | |||
diff -u --recursive gst-plugins-base-1.0.7-vanilla/Makefile.in gst-plugins-base-1.0.7/Makefile.in | |||
--- gst-plugins-base-1.0.7-vanilla/Makefile.in 2013-06-01 19:49:37.987260668 -0500 | |||
+++ gst-plugins-base-1.0.7/Makefile.in 2013-06-01 19:49:58.374457466 -0500 | |||
@@ -492,7 +492,6 @@ | |||
gst-libs \ | |||
gst sys $(SUBDIRS_EXT) \ | |||
tools \ | |||
- tests \ | |||
po \ | |||
common \ | |||
m4 | |||
@@ -502,7 +501,6 @@ | |||
gst-libs \ | |||
gst sys ext \ | |||
tools \ | |||
- tests \ | |||
po \ | |||
common \ | |||
m4 |
@ -0,0 +1,49 @@ | |||
diff -u --recursive gst-plugins-base-1.0.7-vanilla/configure.ac gst-plugins-base-1.0.7/configure.ac | |||
--- gst-plugins-base-1.0.7-vanilla/configure.ac 2013-06-01 19:48:21.931257133 -0500 | |||
+++ gst-plugins-base-1.0.7/configure.ac 2013-06-01 19:51:30.371829534 -0500 | |||
@@ -923,7 +923,6 @@ | |||
docs/libs/Makefile | |||
docs/plugins/Makefile | |||
docs/version.entities | |||
-po/Makefile.in | |||
common/Makefile | |||
common/m4/Makefile | |||
m4/Makefile | |||
diff -u --recursive gst-plugins-base-1.0.7-vanilla/Makefile.am gst-plugins-base-1.0.7/Makefile.am | |||
--- gst-plugins-base-1.0.7-vanilla/Makefile.am 2013-06-01 19:50:30.232202309 -0500 | |||
+++ gst-plugins-base-1.0.7/Makefile.am 2013-06-01 19:50:58.973069965 -0500 | |||
@@ -11,7 +11,6 @@ | |||
gst-libs \ | |||
gst sys $(SUBDIRS_EXT) \ | |||
tools \ | |||
- po \ | |||
common \ | |||
m4 | |||
@@ -20,7 +19,6 @@ | |||
gst-libs \ | |||
gst sys ext \ | |||
tools \ | |||
- po \ | |||
common \ | |||
m4 | |||
diff -u --recursive gst-plugins-base-1.0.7-vanilla/Makefile.in gst-plugins-base-1.0.7/Makefile.in | |||
--- gst-plugins-base-1.0.7-vanilla/Makefile.in 2013-06-01 19:50:30.233202273 -0500 | |||
+++ gst-plugins-base-1.0.7/Makefile.in 2013-06-01 19:51:22.796130711 -0500 | |||
@@ -492,7 +492,6 @@ | |||
gst-libs \ | |||
gst sys $(SUBDIRS_EXT) \ | |||
tools \ | |||
- po \ | |||
common \ | |||
m4 | |||
@@ -501,7 +500,6 @@ | |||
gst-libs \ | |||
gst sys ext \ | |||
tools \ | |||
- po \ | |||
common \ | |||
m4 | |||
@ -0,0 +1,202 @@ | |||
## Copyright (C) 2009-2014 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=gst1-plugins-good | |||
PKG_VERSION:=1.2.3 | |||
PKG_RELEASE:=1 | |||
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org> | |||
PKG_LICENSE:=LGPLv2 | |||
PKG_LICENSE_FILE:=COPYING | |||
PKG_BUILD_DIR:=$(BUILD_DIR)/gst-plugins-good-$(PKG_VERSION) | |||
PKG_SOURCE:=gst-plugins-good-$(PKG_VERSION).tar.xz | |||
PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-plugins-good/ | |||
PKG_MD5SUM:=1a1f96bc27ad446e559474299160a9a8 | |||
PKG_BUILD_DEPENDS:= gstreamer1 gst1-plugins-base liboil | |||
PKG_FIXUP:=autoreconf | |||
PKG_INSTALL:=1 | |||
include $(INCLUDE_DIR)/package.mk | |||
include $(INCLUDE_DIR)/nls.mk | |||
define Package/gstreamer1/Default | |||
CATEGORY:=Multimedia | |||
SECTION:=multimedia | |||
TITLE:=GStreamer | |||
URL:=http://gstreamer.freedesktop.org/ | |||
DEPENDS:= $(ICONV_DEPENDS) | |||
endef | |||
define Package/gstreamer1/description/Default | |||
GStreamer open source multimedia framework | |||
endef | |||
define Package/gst1-plugins-good | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= plugins collection (good) | |||
DEPENDS+= $(GST_DEPENDS) | |||
endef | |||
define Package/gts-plugins-good/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This meta package contains only dependencies to the other plugins from | |||
the good plugins collection. | |||
endef | |||
GST_VERSION:=1.0 | |||
CONFIGURE_ARGS += \ | |||
--disable-debug \ | |||
--disable-examples \ | |||
\ | |||
--disable-aalib \ | |||
--disable-annodex \ | |||
--disable-bz2 \ | |||
--disable-cairo \ | |||
--disable-directsound \ | |||
--disable-dv1394 \ | |||
--disable-esd \ | |||
--disable-gconf \ | |||
--disable-gconftool \ | |||
--disable-gdk_pixbuf \ | |||
--disable-gst_v4l2 \ | |||
--disable-hal \ | |||
--disable-libcaca \ | |||
--disable-libdv \ | |||
--disable-osx_audio \ | |||
--disable-osx_video \ | |||
--disable-pulse \ | |||
--disable-qtdemux \ | |||
--disable-rtspmanager \ | |||
--disable-shout2 \ | |||
--disable-sunaudio \ | |||
--disable-wavpack \ | |||
--disable-x \ | |||
--disable-xshm \ | |||
--disable-xvideo \ | |||
--disable-y4m \ | |||
--disable-zlib \ | |||
\ | |||
--without-libiconv-prefix \ | |||
--without-libintl-prefix \ | |||
--without-x \ | |||
EXTRA_LDFLAGS+= \ | |||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \ | |||
$(if $(ICONV_FULL),-liconv) \ | |||
define Package/gst1-plugins-good/install | |||
/bin/true | |||
endef | |||
# 1: short name | |||
# 2: description | |||
# 3: dependencies on other gstreamer libraries (short name) | |||
# 4: dependencies on other gstreamer plugins (short name) | |||
# 5: dependencies on other packages | |||
define GstBuildPlugin | |||
GST_DEPENDS += +gst1-mod-$(1) | |||
define Package/gst1-mod-$(1) | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= $(2) plugin (good) | |||
DEPENDS+= +libgstreamer1 $$(foreach p,$(3),+libgst1$$(p)) $$(foreach p,$(4),+gst1-mod-$$(p)) $(5) | |||
endef | |||
define Package/gst1-mod-$(1)/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This package contains the GStreamer $(2) plugin. | |||
endef | |||
define Package/gst1-mod-$(1)/install | |||
$(INSTALL_DIR) $$(1)/usr/lib/gstreamer-$(GST_VERSION) | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/gstreamer-$(GST_VERSION)/libgst$(1).so* \ | |||
$$(1)/usr/lib/gstreamer-$(GST_VERSION)/ \ | |||
) | |||
endef | |||
$$(eval $$(call BuildPackage,gst1-mod-$(1))) | |||
endef | |||
#$(eval $(call GstBuildPlugin,1394,IEEE 1394 support,,,)) | |||
$(eval $(call GstBuildPlugin,alaw,alaw codec,audio,,)) | |||
$(eval $(call GstBuildPlugin,alpha,alpha support,video,,)) | |||
$(eval $(call GstBuildPlugin,alphacolor,alphacolor support,video,,)) | |||
$(eval $(call GstBuildPlugin,apetag,apetag support,audio pbutils tag video,,)) | |||
$(eval $(call GstBuildPlugin,audiofx,audio effects,audio fft controller,,)) | |||
$(eval $(call GstBuildPlugin,audioparsers,audioparsers,audio tag pbutils,,)) | |||
$(eval $(call GstBuildPlugin,auparse,auparse,audio tag pbutils,,)) | |||
$(eval $(call GstBuildPlugin,autodetect,format auto-detection,,,)) | |||
$(eval $(call GstBuildPlugin,avi,avi support,audio riff tag video,,)) | |||
$(eval $(call GstBuildPlugin,cutter,audio cutter,audio,,)) | |||
$(eval $(call GstBuildPlugin,debug,debugging,,,)) | |||
$(eval $(call GstBuildPlugin,deinterlace,deinterlace support,video,,)) | |||
$(eval $(call GstBuildPlugin,dtmf,dtmf support,rtp,,)) | |||
#$(eval $(call GstBuildPlugin,dv,dv support,audio tag video,,)) | |||
$(eval $(call GstBuildPlugin,effectv,effectvsupport,video,,)) | |||
$(eval $(call GstBuildPlugin,equalizer,audio equalizer,audio controller,,)) | |||
$(eval $(call GstBuildPlugin,flac,FLAC codec,audio pbutils tag,,+libflac)) | |||
$(eval $(call GstBuildPlugin,flv,flv codec,audio pbutils tag video,,)) | |||
$(eval $(call GstBuildPlugin,flxdec,flx codec,,,)) | |||
#$(eval $(call GstBuildPlugin,gdkpixbuf,gdkpixbuf support,video,,)) | |||
$(eval $(call GstBuildPlugin,goom2k1,goom support,,,)) | |||
$(eval $(call GstBuildPlugin,goom,goom support,,,)) | |||
$(eval $(call GstBuildPlugin,icydemux,icy demuxer,audio tag,,)) | |||
$(eval $(call GstBuildPlugin,id3demux,ID3v1/v2 demuxer,pbutils tag,,)) | |||
$(eval $(call GstBuildPlugin,imagefreeze,imagefreeze support,,,)) | |||
$(eval $(call GstBuildPlugin,interleave,audio interleave,audio,,)) | |||
$(eval $(call GstBuildPlugin,isomp4,isomp4 support,audio pbutils riff rtp tag video,,)) | |||
#$(eval $(call GstBuildPlugin,jack,jack support,audio,,)) | |||
$(eval $(call GstBuildPlugin,jpeg,jpeg support,video,,+libjpeg)) | |||
$(eval $(call GstBuildPlugin,level,audio level,audio,,)) | |||
$(eval $(call GstBuildPlugin,matroska,matroska support,audio pbutils riff tag video,,)) | |||
$(eval $(call GstBuildPlugin,mulaw,mulaw support,audio,,)) | |||
$(eval $(call GstBuildPlugin,multifile,multiple files access,video,,)) | |||
$(eval $(call GstBuildPlugin,multipart,multipart stream handling,,,)) | |||
$(eval $(call GstBuildPlugin,navigationtest,navigationtest support,video,,)) | |||
$(eval $(call GstBuildPlugin,oss4audio,OSS 4 audio support,audio tag,,)) | |||
$(eval $(call GstBuildPlugin,ossaudio,OSS audio support,audio,,)) | |||
$(eval $(call GstBuildPlugin,png,png support,video,,+libpng)) | |||
#$(eval $(call GstBuildPlugin,pulse,pulse support,audio pbutils tag video,,)) | |||
$(eval $(call GstBuildPlugin,replaygain,volume normalization,pbutils,,)) | |||
$(eval $(call GstBuildPlugin,rtpmanager,RTP manager,audio net rtp tag pbutils video,,)) | |||
$(eval $(call GstBuildPlugin,rtp,RTP,audio rtp tag pbutils video,,)) | |||
$(eval $(call GstBuildPlugin,rtsp,RTSP,net rtp rtsp sdp,,)) | |||
$(eval $(call GstBuildPlugin,shapewipe,shapewipe support,video,,)) | |||
#$(eval $(call GstBuildPlugin,shout2,shout2 support,,,)) | |||
$(eval $(call GstBuildPlugin,smpte,smpte support,video,,)) | |||
$(eval $(call GstBuildPlugin,souphttpsrc,soup input,audio tag,,+libsoup)) | |||
$(eval $(call GstBuildPlugin,spectrum,spectrum data output,audio fft,,)) | |||
#$(eval $(call GstBuildPlugin,speex,speex support,audio tag,,)) | |||
#$(eval $(call GstBuildPlugin,sty4menc,sty4menc support,video,,)) | |||
#$(eval $(call GstBuildPlugin,taglib,taglib support,tag,,)) | |||
$(eval $(call GstBuildPlugin,udp,UDP,net,,)) | |||
#$(eval $(call GstBuildPlugin,video4linux2,video4linux2 support,video,,)) | |||
$(eval $(call GstBuildPlugin,videobox,videobox support,video,,)) | |||
$(eval $(call GstBuildPlugin,videocrop,videocrop support,video,,)) | |||
$(eval $(call GstBuildPlugin,videofilter,videofilter support,video,,)) | |||
$(eval $(call GstBuildPlugin,videomixer,videomixer support,video,,)) | |||
#$(eval $(call GstBuildPlugin,vpx,vpx support,tag video,,)) | |||
$(eval $(call GstBuildPlugin,wavenc,Wav encoder,riff,,)) | |||
#$(eval $(call GstBuildPlugin,wavpack,Wav packer,audio riff tag,,)) | |||
$(eval $(call GstBuildPlugin,wavparse,Wav parser,audio riff tag,,)) | |||
#$(eval $(call GstBuildPlugin,ximagesrc,ximagesrc support,video,,)) | |||
$(eval $(call BuildPackage,gst1-plugins-good)) |
@ -0,0 +1,22 @@ | |||
diff -u --recursive gst-plugins-good-1.0.7-vanilla/Makefile.am gst-plugins-good-1.0.7/Makefile.am | |||
--- gst-plugins-good-1.0.7-vanilla/Makefile.am 2013-06-01 19:54:57.652601127 -0500 | |||
+++ gst-plugins-good-1.0.7/Makefile.am 2013-06-01 19:55:15.281902215 -0500 | |||
@@ -3,7 +3,6 @@ | |||
ALWAYS_SUBDIRS = \ | |||
gst sys ext \ | |||
tests \ | |||
- docs \ | |||
po \ | |||
common \ | |||
m4 \ | |||
diff -u --recursive gst-plugins-good-1.0.7-vanilla/Makefile.in gst-plugins-good-1.0.7/Makefile.in | |||
--- gst-plugins-good-1.0.7-vanilla/Makefile.in 2013-06-01 19:54:57.692599541 -0500 | |||
+++ gst-plugins-good-1.0.7/Makefile.in 2013-06-01 19:55:23.025595255 -0500 | |||
@@ -523,7 +523,6 @@ | |||
ALWAYS_SUBDIRS = \ | |||
gst sys ext \ | |||
tests \ | |||
- docs \ | |||
po \ | |||
common \ | |||
m4 \ |
@ -0,0 +1,22 @@ | |||
diff -u --recursive gst-plugins-good-1.0.7-vanilla/Makefile.am gst-plugins-good-1.0.7/Makefile.am | |||
--- gst-plugins-good-1.0.7-vanilla/Makefile.am 2013-06-01 19:56:00.995090476 -0500 | |||
+++ gst-plugins-good-1.0.7/Makefile.am 2013-06-01 19:56:12.911618318 -0500 | |||
@@ -2,7 +2,6 @@ | |||
ALWAYS_SUBDIRS = \ | |||
gst sys ext \ | |||
- tests \ | |||
po \ | |||
common \ | |||
m4 \ | |||
diff -u --recursive gst-plugins-good-1.0.7-vanilla/Makefile.in gst-plugins-good-1.0.7/Makefile.in | |||
--- gst-plugins-good-1.0.7-vanilla/Makefile.in 2013-06-01 19:56:00.995090476 -0500 | |||
+++ gst-plugins-good-1.0.7/Makefile.in 2013-06-01 19:56:16.655469989 -0500 | |||
@@ -522,7 +522,6 @@ | |||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc | |||
ALWAYS_SUBDIRS = \ | |||
gst sys ext \ | |||
- tests \ | |||
po \ | |||
common \ | |||
m4 \ |
@ -0,0 +1,33 @@ | |||
diff -u --recursive gst-plugins-good-1.0.7-vanilla/configure.ac gst-plugins-good-1.0.7/configure.ac | |||
--- gst-plugins-good-1.0.7-vanilla/configure.ac 2013-06-01 19:56:23.004218467 -0500 | |||
+++ gst-plugins-good-1.0.7/configure.ac 2013-06-01 19:56:52.919033496 -0500 | |||
@@ -1157,7 +1157,6 @@ | |||
sys/v4l2/Makefile | |||
sys/waveform/Makefile | |||
sys/ximage/Makefile | |||
-po/Makefile.in | |||
tests/Makefile | |||
tests/check/Makefile | |||
tests/examples/Makefile | |||
diff -u --recursive gst-plugins-good-1.0.7-vanilla/Makefile.am gst-plugins-good-1.0.7/Makefile.am | |||
--- gst-plugins-good-1.0.7-vanilla/Makefile.am 2013-06-01 19:56:23.043216922 -0500 | |||
+++ gst-plugins-good-1.0.7/Makefile.am 2013-06-01 19:56:43.671399777 -0500 | |||
@@ -2,7 +2,6 @@ | |||
ALWAYS_SUBDIRS = \ | |||
gst sys ext \ | |||
- po \ | |||
common \ | |||
m4 \ | |||
pkgconfig | |||
diff -u --recursive gst-plugins-good-1.0.7-vanilla/Makefile.in gst-plugins-good-1.0.7/Makefile.in | |||
--- gst-plugins-good-1.0.7-vanilla/Makefile.in 2013-06-01 19:56:23.043216922 -0500 | |||
+++ gst-plugins-good-1.0.7/Makefile.in 2013-06-01 19:56:47.703240080 -0500 | |||
@@ -522,7 +522,6 @@ | |||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc | |||
ALWAYS_SUBDIRS = \ | |||
gst sys ext \ | |||
- po \ | |||
common \ | |||
m4 \ | |||
pkgconfig |
@ -0,0 +1,142 @@ | |||
# | |||
# Copyright (C) 2009-2014 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=gst1-plugins-ugly | |||
PKG_VERSION:=1.2.3 | |||
PKG_RELEASE:=1 | |||
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org> | |||
PKG_LICENSE:=LGPLv2 | |||
PKG_LICENSE_FILE:=COPYING | |||
PKG_BUILD_DIR:=$(BUILD_DIR)/gst-plugins-ugly-$(PKG_VERSION) | |||
PKG_SOURCE:=gst-plugins-ugly-$(PKG_VERSION).tar.xz | |||
PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-plugins-ugly/ | |||
PKG_MD5SUM:=7ae60e2f759f58f32af5fcdc3c9193c4 | |||
PKG_BUILD_DEPENDS:= gstreamer1 gst1-plugins-base liboil | |||
PKG_CONFIG_DEPENDS:= \ | |||
CONFIG_PACKAGE_gst1-mod-asf \ | |||
CONFIG_PACKAGE_gst1-mod-lame \ | |||
CONFIG_PACKAGE_gst1-mod-mad \ | |||
CONFIG_PACKAGE_gst1-mod-mpeg2dec \ | |||
PKG_FIXUP:=autoreconf | |||
PKG_INSTALL:=1 | |||
include $(INCLUDE_DIR)/package.mk | |||
include $(INCLUDE_DIR)/nls.mk | |||
define Package/gstreamer1/Default | |||
CATEGORY:=Multimedia | |||
SECTION:=multimedia | |||
TITLE:=GStreamer | |||
URL:=http://gstreamer.freedesktop.org/ | |||
DEPENDS:= $(ICONV_DEPENDS) | |||
endef | |||
define Package/gstreamer1/description/Default | |||
GStreamer open source multimedia framework | |||
endef | |||
define Package/gst1-plugins-ugly | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= plugins collection (ugly) | |||
DEPENDS+= $(GST_DEPENDS) | |||
endef | |||
define Package/gts-plugins-ugly/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This meta package contains only dependencies to the other plugins from | |||
the ugly plugins collection. | |||
endef | |||
GST_COND_SELECT = $(patsubst %,$(if $(CONFIG_PACKAGE_gst1-mod-$(1)),--enable,--disable)-%,$(1)) | |||
GST_VERSION:=1.0 | |||
CONFIGURE_ARGS += \ | |||
--disable-debug \ | |||
--disable-examples \ | |||
\ | |||
--disable-a52dec \ | |||
--disable-amrnb \ | |||
--disable-amrwb \ | |||
$(call GST_COND_SELECT,asf) \ | |||
--disable-cdio \ | |||
--disable-dvdlpcmdec \ | |||
--disable-dvdread \ | |||
--disable-dvdsub \ | |||
--disable-iec958 \ | |||
$(call GST_COND_SELECT,lame) \ | |||
$(call GST_COND_SELECT,mad) \ | |||
$(call GST_COND_SELECT,mpeg2dec) \ | |||
--disable-mpegaudioparse \ | |||
--disable-mpegstream \ | |||
--disable-realmedia \ | |||
--disable-sidplay \ | |||
--disable-synaesthesia \ | |||
--disable-twolame \ | |||
--disable-x264 \ | |||
\ | |||
--without-libiconv-prefix \ | |||
--without-libintl-prefix \ | |||
EXTRA_LDFLAGS+= \ | |||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \ | |||
$(if $(ICONV_FULL),-liconv) \ | |||
define Package/gst1-plugins-ugly/install | |||
/bin/true | |||
endef | |||
# 1: short name | |||
# 2: description | |||
# 3: dependencies on other gstreamer libraries (short name) | |||
# 4: dependencies on other gstreamer plugins (short name) | |||
# 5: dependencies on other packages | |||
define GstBuildPlugin | |||
GST_DEPENDS += +gst1-mod-$(1) | |||
define Package/gst1-mod-$(1) | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= $(2) plugin (ugly) | |||
DEPENDS+= +libgstreamer1 $$(foreach p,$(3),+libgst1$$(p)) $$(foreach p,$(4),+gst1-mod-$$(p)) $(5) | |||
endef | |||
define Package/gst1-mod-$(1)/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This package contains the GStreamer $(2) plugin. | |||
endef | |||
define Package/gst1-mod-$(1)/install | |||
$(INSTALL_DIR) $$(1)/usr/lib/gstreamer-$(GST_VERSION) | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/gstreamer-$(GST_VERSION)/libgst$(1).so* \ | |||
$$(1)/usr/lib/gstreamer-$(GST_VERSION)/ \ | |||
) | |||
endef | |||
$$(eval $$(call BuildPackage,gst1-mod-$(1))) | |||
endef | |||
$(eval $(call GstBuildPlugin,asf,ASF demuxer,audio riff rtp rtsp sdp tag,,)) | |||
$(eval $(call GstBuildPlugin,lame,MP3 encoder (using LAME),audio,,+lame-lib)) | |||
$(eval $(call GstBuildPlugin,mad,MP3 decoder (using MAD),audio tag,,+libid3tag +libmad)) | |||
$(eval $(call GstBuildPlugin,mpeg2dec,MPEG decoder,video,,+libmpeg2)) | |||
$(eval $(call BuildPackage,gst1-plugins-ugly)) |
@ -0,0 +1,24 @@ | |||
diff -u --recursive gst-plugins-ugly-1.0.7-vanilla/Makefile.am gst-plugins-ugly-1.0.7/Makefile.am | |||
--- gst-plugins-ugly-1.0.7-vanilla/Makefile.am 2013-06-01 19:58:12.400886469 -0500 | |||
+++ gst-plugins-ugly-1.0.7/Makefile.am 2013-06-01 19:58:33.306059047 -0500 | |||
@@ -1,7 +1,7 @@ | |||
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc | |||
SUBDIRS = \ | |||
- gst-libs gst ext docs m4 tests common pkgconfig po | |||
+ gst-libs gst ext m4 tests common pkgconfig po | |||
# include before EXTRA_DIST for win32 assignment | |||
include $(top_srcdir)/common/win32.mak | |||
diff -u --recursive gst-plugins-ugly-1.0.7-vanilla/Makefile.in gst-plugins-ugly-1.0.7/Makefile.in | |||
--- gst-plugins-ugly-1.0.7-vanilla/Makefile.in 2013-06-01 19:58:12.412885994 -0500 | |||
+++ gst-plugins-ugly-1.0.7/Makefile.in 2013-06-01 19:58:39.810801615 -0500 | |||
@@ -453,7 +453,7 @@ | |||
top_srcdir = @top_srcdir@ | |||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc | |||
SUBDIRS = \ | |||
- gst-libs gst ext docs m4 tests common pkgconfig po | |||
+ gst-libs gst ext m4 tests common pkgconfig po | |||
# the MANIFEST contains all win32 related files that should be disted |
@ -0,0 +1,24 @@ | |||
diff -u --recursive gst-plugins-ugly-1.0.7-vanilla/Makefile.am gst-plugins-ugly-1.0.7/Makefile.am | |||
--- gst-plugins-ugly-1.0.7-vanilla/Makefile.am 2013-06-01 19:59:16.988330482 -0500 | |||
+++ gst-plugins-ugly-1.0.7/Makefile.am 2013-06-01 19:59:28.455876771 -0500 | |||
@@ -1,7 +1,7 @@ | |||
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc | |||
SUBDIRS = \ | |||
- gst-libs gst ext m4 tests common pkgconfig po | |||
+ gst-libs gst ext m4 common pkgconfig po | |||
# include before EXTRA_DIST for win32 assignment | |||
include $(top_srcdir)/common/win32.mak | |||
diff -u --recursive gst-plugins-ugly-1.0.7-vanilla/Makefile.in gst-plugins-ugly-1.0.7/Makefile.in | |||
--- gst-plugins-ugly-1.0.7-vanilla/Makefile.in 2013-06-01 19:59:16.988330482 -0500 | |||
+++ gst-plugins-ugly-1.0.7/Makefile.in 2013-06-01 19:59:39.840426385 -0500 | |||
@@ -453,7 +453,7 @@ | |||
top_srcdir = @top_srcdir@ | |||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc | |||
SUBDIRS = \ | |||
- gst-libs gst ext m4 tests common pkgconfig po | |||
+ gst-libs gst ext m4 common pkgconfig po | |||
# the MANIFEST contains all win32 related files that should be disted |
@ -0,0 +1,35 @@ | |||
diff -u --recursive gst-plugins-ugly-1.0.7-vanilla/configure.ac gst-plugins-ugly-1.0.7/configure.ac | |||
--- gst-plugins-ugly-1.0.7-vanilla/configure.ac 2013-06-01 19:59:46.199174835 -0500 | |||
+++ gst-plugins-ugly-1.0.7/configure.ac 2013-06-01 20:00:29.709453831 -0500 | |||
@@ -479,7 +479,6 @@ | |||
tests/Makefile | |||
tests/check/Makefile | |||
m4/Makefile | |||
-po/Makefile.in | |||
pkgconfig/Makefile | |||
pkgconfig/gstreamer-plugins-ugly-uninstalled.pc | |||
gst-plugins-ugly.spec | |||
diff -u --recursive gst-plugins-ugly-1.0.7-vanilla/Makefile.am gst-plugins-ugly-1.0.7/Makefile.am | |||
--- gst-plugins-ugly-1.0.7-vanilla/Makefile.am 2013-06-01 19:59:46.210174399 -0500 | |||
+++ gst-plugins-ugly-1.0.7/Makefile.am 2013-06-01 20:00:11.351179921 -0500 | |||
@@ -1,7 +1,7 @@ | |||
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc | |||
SUBDIRS = \ | |||
- gst-libs gst ext m4 common pkgconfig po | |||
+ gst-libs gst ext m4 common pkgconfig | |||
# include before EXTRA_DIST for win32 assignment | |||
include $(top_srcdir)/common/win32.mak | |||
diff -u --recursive gst-plugins-ugly-1.0.7-vanilla/Makefile.in gst-plugins-ugly-1.0.7/Makefile.in | |||
--- gst-plugins-ugly-1.0.7-vanilla/Makefile.in 2013-06-01 19:59:46.210174399 -0500 | |||
+++ gst-plugins-ugly-1.0.7/Makefile.in 2013-06-01 20:00:20.222829049 -0500 | |||
@@ -453,7 +453,7 @@ | |||
top_srcdir = @top_srcdir@ | |||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc | |||
SUBDIRS = \ | |||
- gst-libs gst ext m4 common pkgconfig po | |||
+ gst-libs gst ext m4 common pkgconfig | |||
# the MANIFEST contains all win32 related files that should be disted |
@ -0,0 +1,195 @@ | |||
# | |||
# Copyright (C) 2008-2014 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=gstreamer1 | |||
PKG_VERSION:=1.2.3 | |||
PKG_RELEASE:=1 | |||
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org> | |||
PKG_LICENSE:=LGPLv2 | |||
PKG_LICENSE_FILE:=COPYING | |||
PKG_BUILD_DIR:=$(BUILD_DIR)/gstreamer-$(PKG_VERSION) | |||
PKG_SOURCE:=gstreamer-$(PKG_VERSION).tar.xz | |||
PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gstreamer/ | |||
PKG_MD5SUM:=8155b9c7574ccaa361cc504e8e0e72dc | |||
PKG_FIXUP:=autoreconf | |||
PKG_REMOVE_FILES:=autogen.sh aclocal.m4 | |||
PKG_INSTALL:=1 | |||
include $(INCLUDE_DIR)/package.mk | |||
include $(INCLUDE_DIR)/nls.mk | |||
define Package/gstreamer1/Default | |||
CATEGORY:=Multimedia | |||
SECTION:=multimedia | |||
TITLE:=GStreamer | |||
URL:=http://gstreamer.freedesktop.org/ | |||
DEPENDS:= $(ICONV_DEPENDS) $(INTL_DEPENDS) | |||
endef | |||
define Package/gstreamer1/description/Default | |||
GStreamer open source multimedia framework | |||
endef | |||
define Package/gstreamer1 | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= framework | |||
DEPENDS+= +libgstreamer1 \ | |||
+libgst1check \ | |||
+libgst1controller \ | |||
+libgst1net | |||
endef | |||
define Package/gstreamer1/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This meta package contains only dependencies on the other GStreamer | |||
componenents. | |||
endef | |||
define Package/gstreamer1-utils | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= utilities | |||
DEPENDS+= +libgstreamer1 | |||
endef | |||
define Package/gstreamer1-utils/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This package contains the GStreamer utilities. | |||
endef | |||
define Package/libgstreamer1 | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= library (core) | |||
DEPENDS+= +glib2 +libpthread +libxml2 | |||
endef | |||
define Package/libgstreamer1/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This package contains the GStreamer core library. | |||
endef | |||
GST_VERSION:=1.0 | |||
CONFIGURE_ARGS += \ | |||
--enable-static \ | |||
--disable-examples \ | |||
--disable-tests \ | |||
--disable-valgrind \ | |||
--without-libiconv-prefix \ | |||
--without-libintl-prefix \ | |||
--without-x \ | |||
EXTRA_LDFLAGS+= \ | |||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \ | |||
$(if $(ICONV_FULL),-liconv) | |||
define Build/InstallDev | |||
$(INSTALL_DIR) $(1)/usr/include/gstreamer-$(GST_VERSION) | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/include/gstreamer-$(GST_VERSION)/* \ | |||
$(1)/usr/include/gstreamer-$(GST_VERSION)/ \ | |||
) | |||
$(INSTALL_DIR) $(1)/usr/lib | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/libgst*-$(GST_VERSION).{a,la,so*} \ | |||
$(1)/usr/lib/ \ | |||
) | |||
$(INSTALL_DIR) $(1)/usr/lib/gstreamer-$(GST_VERSION) | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/gstreamer-$(GST_VERSION)/libgst*.{la,so} \ | |||
$(1)/usr/lib/gstreamer-$(GST_VERSION)/ \ | |||
) | |||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/pkgconfig/gstreamer*-$(GST_VERSION).pc \ | |||
$(1)/usr/lib/pkgconfig/ \ | |||
) | |||
$(INSTALL_DIR) $(2)/share/aclocal | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/share/aclocal/* \ | |||
$(2)/share/aclocal/ \ | |||
) | |||
endef | |||
define Package/gstreamer1/install | |||
/bin/true | |||
endef | |||
define Package/gstreamer1-utils/install | |||
$(INSTALL_DIR) $(1)/usr/bin | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/bin/gst-launch* \ | |||
./usr/bin/gst-inspect* \ | |||
./usr/bin/gst-typefind* \ | |||
$(1)/usr/bin/ \ | |||
) | |||
endef | |||
define Package/libgstreamer1/install | |||
$(INSTALL_DIR) $(1)/usr/lib | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/libgstbase-$(GST_VERSION).so.* \ | |||
./usr/lib/libgstreamer-$(GST_VERSION).so.* \ | |||
$(1)/usr/lib/ \ | |||
) | |||
$(INSTALL_DIR) $(1)/usr/lib/gstreamer-$(GST_VERSION) | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/gstreamer-$(GST_VERSION)/libgst*.so \ | |||
$(1)/usr/lib/gstreamer-$(GST_VERSION)/ \ | |||
) | |||
endef | |||
# 1: short name | |||
# 2: description | |||
# 3: dependencies on other gstreamer libraries (short name) | |||
# 4: dependencies on other packages | |||
define GstBuildLibrary | |||
define Package/libgst1$(1) | |||
$(call Package/gstreamer1/Default) | |||
TITLE+= $(2) library (core) | |||
DEPENDS+= +libgstreamer1 $$(foreach p,$(3),+libgst1$$(p)) $(4) | |||
endef | |||
define Package/libgst1$(1)/description | |||
$(call Package/gstreamer1/description/Default) | |||
. | |||
This package contains the GStreamer $(2) library. | |||
endef | |||
define Package/libgst1$(1)/install | |||
$(INSTALL_DIR) $$(1)/usr/lib | |||
( cd $(PKG_INSTALL_DIR); $(CP) \ | |||
./usr/lib/libgst$(1)-$(GST_VERSION).so.* \ | |||
$$(1)/usr/lib/ \ | |||
) | |||
endef | |||
$$(eval $$(call BuildPackage,libgst1$(1))) | |||
endef | |||
$(eval $(call GstBuildLibrary,check,check unit testing)) | |||
$(eval $(call GstBuildLibrary,controller,dynamic parameter control)) | |||
$(eval $(call GstBuildLibrary,net,network classes)) | |||
$(eval $(call BuildPackage,libgstreamer1)) | |||
$(eval $(call BuildPackage,gstreamer1)) | |||
$(eval $(call BuildPackage,gstreamer1-utils)) |
@ -0,0 +1,37 @@ | |||
diff -u --recursive gstreamer-1.0.7-vanilla/Makefile.am gstreamer-1.0.7/Makefile.am | |||
--- gstreamer-1.0.7-vanilla/Makefile.am 2013-06-01 18:47:44.498057069 -0500 | |||
+++ gstreamer-1.0.7/Makefile.am 2013-06-01 19:01:41.634143861 -0500 | |||
@@ -8,7 +8,6 @@ | |||
SUBDIRS = pkgconfig \ | |||
gst libs plugins tests \ | |||
- docs \ | |||
po \ | |||
m4 \ | |||
common | |||
@@ -20,7 +19,6 @@ | |||
# These are all the possible subdirs | |||
DIST_SUBDIRS = pkgconfig \ | |||
gst libs plugins tools tests \ | |||
- docs \ | |||
po \ | |||
m4 \ | |||
common | |||
diff -u --recursive gstreamer-1.0.7-vanilla/Makefile.in gstreamer-1.0.7/Makefile.in | |||
--- gstreamer-1.0.7-vanilla/Makefile.in 2013-06-01 18:47:44.533056863 -0500 | |||
+++ gstreamer-1.0.7/Makefile.in 2013-06-01 19:02:04.529246907 -0500 | |||
@@ -508,13 +508,12 @@ | |||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-docbook | |||
aclocaldir = $(datadir)/aclocal | |||
aclocal_DATA = gst-element-check-@GST_API_VERSION@.m4 | |||
-SUBDIRS = pkgconfig gst libs plugins tests docs po m4 common \ | |||
+SUBDIRS = pkgconfig gst libs plugins tests po m4 common \ | |||
$(am__append_1) | |||
# These are all the possible subdirs | |||
DIST_SUBDIRS = pkgconfig \ | |||
gst libs plugins tools tests \ | |||
- docs \ | |||
po \ | |||
m4 \ | |||
common |
@ -0,0 +1,39 @@ | |||
diff -u --recursive gstreamer-1.0.7-vanilla/Makefile.am gstreamer-1.0.7/Makefile.am | |||
--- gstreamer-1.0.7-vanilla/Makefile.am 2013-06-01 19:22:31.546496381 -0500 | |||
+++ gstreamer-1.0.7/Makefile.am 2013-06-01 19:20:38.141070908 -0500 | |||
@@ -7,7 +7,7 @@ | |||
aclocal_DATA = gst-element-check-@GST_API_VERSION@.m4 | |||
SUBDIRS = pkgconfig \ | |||
- gst libs plugins tests \ | |||
+ gst libs plugins \ | |||
po \ | |||
m4 \ | |||
common | |||
@@ -18,7 +18,7 @@ | |||
# These are all the possible subdirs | |||
DIST_SUBDIRS = pkgconfig \ | |||
- gst libs plugins tools tests \ | |||
+ gst libs plugins tools \ | |||
po \ | |||
m4 \ | |||
common | |||
diff -u --recursive gstreamer-1.0.7-vanilla/Makefile.in gstreamer-1.0.7/Makefile.in | |||
--- gstreamer-1.0.7-vanilla/Makefile.in 2013-06-01 19:22:31.547496342 -0500 | |||
+++ gstreamer-1.0.7/Makefile.in 2013-06-01 19:20:48.948632307 -0500 | |||
@@ -508,12 +508,12 @@ | |||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-docbook | |||
aclocaldir = $(datadir)/aclocal | |||
aclocal_DATA = gst-element-check-@GST_API_VERSION@.m4 | |||
-SUBDIRS = pkgconfig gst libs plugins tests po m4 common \ | |||
+SUBDIRS = pkgconfig gst libs plugins po m4 common \ | |||
$(am__append_1) | |||
# These are all the possible subdirs | |||
DIST_SUBDIRS = pkgconfig \ | |||
- gst libs plugins tools tests \ | |||
+ gst libs plugins tools \ | |||
po \ | |||
m4 \ | |||
common |
@ -0,0 +1,48 @@ | |||
diff -u --recursive gstreamer-1.0.7-vanilla/configure.ac gstreamer-1.0.7/configure.ac | |||
--- gstreamer-1.0.7-vanilla/configure.ac 2013-06-01 18:47:44.506057110 -0500 | |||
+++ gstreamer-1.0.7/configure.ac 2013-06-01 19:24:05.035756124 -0500 | |||
@@ -769,7 +769,6 @@ | |||
libs/gst/net/Makefile | |||
plugins/Makefile | |||
plugins/elements/Makefile | |||
-po/Makefile.in | |||
tests/Makefile | |||
tests/benchmarks/Makefile | |||
tests/check/Makefile | |||
diff -u --recursive gstreamer-1.0.7-vanilla/Makefile.am gstreamer-1.0.7/Makefile.am | |||
--- gstreamer-1.0.7-vanilla/Makefile.am 2013-06-01 19:23:08.361020919 -0500 | |||
+++ gstreamer-1.0.7/Makefile.am 2013-06-01 19:24:15.036357308 -0500 | |||
@@ -8,7 +8,6 @@ | |||
SUBDIRS = pkgconfig \ | |||
gst libs plugins \ | |||
- po \ | |||
m4 \ | |||
common | |||
@@ -19,7 +18,6 @@ | |||
# These are all the possible subdirs | |||
DIST_SUBDIRS = pkgconfig \ | |||
gst libs plugins tools \ | |||
- po \ | |||
m4 \ | |||
common | |||
diff -u --recursive gstreamer-1.0.7-vanilla/Makefile.in gstreamer-1.0.7/Makefile.in | |||
--- gstreamer-1.0.7-vanilla/Makefile.in 2013-06-01 19:23:08.362020867 -0500 | |||
+++ gstreamer-1.0.7/Makefile.in 2013-06-01 19:24:27.907844191 -0500 | |||
@@ -508,13 +508,12 @@ | |||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-docbook | |||
aclocaldir = $(datadir)/aclocal | |||
aclocal_DATA = gst-element-check-@GST_API_VERSION@.m4 | |||
-SUBDIRS = pkgconfig gst libs plugins po m4 common \ | |||
+SUBDIRS = pkgconfig gst libs plugins m4 common \ | |||
$(am__append_1) | |||
# These are all the possible subdirs | |||
DIST_SUBDIRS = pkgconfig \ | |||
gst libs plugins tools \ | |||
- po \ | |||
m4 \ | |||
common | |||
@ -0,0 +1,12 @@ | |||
--- a/upnphttp.c | |||
+++ b/upnphttp.c | |||
@@ -1259,7 +1259,7 @@ | |||
int try_sendfile = 1; | |||
#endif | |||
- while( offset < end_offset ) | |||
+ while( offset <= end_offset ) | |||
{ | |||
#if HAVE_SENDFILE | |||
if( try_sendfile ) | |||
@ -0,0 +1,63 @@ | |||
# | |||
# Copyright (C) 2014 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=dhcpcd | |||
PKG_VERSION:=6.4.3 | |||
PKG_RELEASE:=1 | |||
PKG_SOURCE_URL:=ftp://roy.marples.name/pub/dhcpcd \ | |||
http://roy.marples.name/downloads/dhcpcd | |||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 | |||
PKG_MD5SUM:=b22005c131e7108ecf598b6a4ac091eb | |||
PKG_LICENSE:=BSD-2c | |||
PKG_LICENSE_FILES:= | |||
PKG_MAINTAINER:=Roy Marples <roy@marples.name> | |||
PKG_BUILD_PARALLEL:=1 | |||
PKG_INSTALL:=1 | |||
include $(INCLUDE_DIR)/package.mk | |||
define Package/dhcpcd | |||
SECTION:=net | |||
CATEGORY:=Network | |||
TITLE:=DHCPv4/IPv4LL/IPv6RS/DHCPv6 quad stack client | |||
URL:=http://roy.marples.name/projects/dhcpcd | |||
endef | |||
define Package/dhcpcd/description | |||
DHCPv4, IPv6RS and DHCPv6 client with IPv4LL support | |||
dhcpcd is a one stop network management daemon which includes | |||
* RFC compliant DHCPv4 and DHCPv6 clients | |||
* DHCPv6 Prefix Delegation support | |||
* IPv4LL (aka ZeroConf) support | |||
* ARP address conflict resolution | |||
* Link carrier detection | |||
* Wireless SSID profiles | |||
* ARP ping profiles | |||
endef | |||
CONFIGURE_ARGS+= --prefix=/ --sbindir=/sbin \ | |||
--libexecdir=/lib/dhcpcd --dbdir=/var/dhcpcd | |||
define Package/dhcpcd/install | |||
$(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/dhcpcd/dhcpcd-hooks | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/dhcpcd $(1)/sbin/ | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/dhcpcd/dhcpcd-run-hooks \ | |||
$(1)/lib/dhcpcd/ | |||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/lib/dhcpcd/dhcpcd-hooks/* \ | |||
$(1)/lib/dhcpcd/dhcpcd-hooks/ | |||
$(INSTALL_DIR) $(1)/etc/init.d | |||
$(INSTALL_BIN) ./files/dhcpcd.init $(1)/etc/init.d/dhcpcd | |||
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/dhcpcd.conf $(1)/etc/dhcpcd.conf | |||
endef | |||
$(eval $(call BuildPackage,dhcpcd)) |
@ -0,0 +1,24 @@ | |||
#!/bin/sh /etc/rc.common | |||
# | |||
# Copyright (C) 2014 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
START=30 | |||
STOP=85 | |||
USE_PROCD=1 | |||
start_service() | |||
{ | |||
procd_open_instance | |||
procd_set_param command /sbin/dhcpcd -B | |||
procd_set_param respawn | |||
procd_close_instance | |||
} | |||
reload_service() | |||
{ | |||
/sbin/dhcpcd -n | |||
} |
@ -1,166 +0,0 @@ | |||
--- a/Makefile.am | |||
+++ b/Makefile.am | |||
@@ -13,7 +13,7 @@ ethtool_SOURCES += \ | |||
fec_8xx.c ibm_emac.c ixgb.c ixgbe.c natsemi.c \ | |||
pcnet32.c realtek.c tg3.c marvell.c vioc.c \ | |||
smsc911x.c at76c50x-usb.c sfc.c stmmac.c \ | |||
- sfpid.c sfpdiag.c ixgbevf.c | |||
+ sfpid.c sfpdiag.c ixgbevf.c ixp4xx.c | |||
endif | |||
TESTS = test-cmdline test-features | |||
--- a/ethtool.c | |||
+++ b/ethtool.c | |||
@@ -894,6 +894,7 @@ static const struct { | |||
{ "ixgb", ixgb_dump_regs }, | |||
{ "ixgbe", ixgbe_dump_regs }, | |||
{ "ixgbevf", ixgbevf_dump_regs }, | |||
+ { "ixp4xx", ixp4xx_dump_regs }, | |||
{ "natsemi", natsemi_dump_regs }, | |||
{ "e100", e100_dump_regs }, | |||
{ "amd8111e", amd8111e_dump_regs }, | |||
--- a/internal.h | |||
+++ b/internal.h | |||
@@ -243,6 +243,9 @@ int st_gmac_dump_regs(struct ethtool_drv | |||
/* Et131x ethernet controller */ | |||
int et131x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); | |||
+/* Intel IXP4xx internal MAC */ | |||
+int ixp4xx_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); | |||
+ | |||
/* Rx flow classification */ | |||
int rxclass_parse_ruleopts(struct cmd_context *ctx, | |||
struct ethtool_rx_flow_spec *fsp); | |||
--- /dev/null | |||
+++ b/ixp4xx.c | |||
@@ -0,0 +1,130 @@ | |||
+/* | |||
+ * Copyright (c) 2006 Christian Hohnstaed <chohnstaedt@innominate.com> | |||
+ * This file is released under the GPLv2 | |||
+ */ | |||
+ | |||
+#include <stdio.h> | |||
+#include "internal.h" | |||
+ | |||
+#ifndef BIT | |||
+#define BIT(x) (1<<x) | |||
+#endif | |||
+ | |||
+#define TX_CNTRL1_TX_EN BIT(0) | |||
+#define TX_CNTRL1_DUPLEX BIT(1) | |||
+#define TX_CNTRL1_RETRY BIT(2) | |||
+#define TX_CNTRL1_PAD_EN BIT(3) | |||
+#define TX_CNTRL1_FCS_EN BIT(4) | |||
+#define TX_CNTRL1_2DEFER BIT(5) | |||
+#define TX_CNTRL1_RMII BIT(6) | |||
+ | |||
+/* TX Control Register 2 */ | |||
+#define TX_CNTRL2_RETRIES_MASK 0xf | |||
+ | |||
+/* RX Control Register 1 */ | |||
+#define RX_CNTRL1_RX_EN BIT(0) | |||
+#define RX_CNTRL1_PADSTRIP_EN BIT(1) | |||
+#define RX_CNTRL1_CRC_EN BIT(2) | |||
+#define RX_CNTRL1_PAUSE_EN BIT(3) | |||
+#define RX_CNTRL1_LOOP_EN BIT(4) | |||
+#define RX_CNTRL1_ADDR_FLTR_EN BIT(5) | |||
+#define RX_CNTRL1_RX_RUNT_EN BIT(6) | |||
+#define RX_CNTRL1_BCAST_DIS BIT(7) | |||
+ | |||
+/* Core Control Register */ | |||
+#define CORE_RESET BIT(0) | |||
+#define CORE_RX_FIFO_FLUSH BIT(1) | |||
+#define CORE_TX_FIFO_FLUSH BIT(2) | |||
+#define CORE_SEND_JAM BIT(3) | |||
+#define CORE_MDC_EN BIT(4) | |||
+ | |||
+#define MAC "%02x:%02x:%02x:%02x:%02x:%02x" | |||
+#define MAC_DATA(d) (d)[0], (d)[1], (d)[2], (d)[3], (d)[4], (d)[5] | |||
+ | |||
+int ixp4xx_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs) | |||
+{ | |||
+ u8 *data = regs->data; | |||
+ | |||
+ fprintf(stdout, | |||
+ "TXctrl: 0x%02x:0x%02x\n" | |||
+ " Enable: %s\n" | |||
+ " Duplex: %s\n" | |||
+ " Retry: %s (%d)\n" | |||
+ " Padding: %s\n" | |||
+ " Frame check: %s\n" | |||
+ " TX deferral: %s\n" | |||
+ " Connection: %s\n" | |||
+ "\n", | |||
+ data[0], data[1], | |||
+ data[0] & TX_CNTRL1_TX_EN ? "yes" : "no", | |||
+ data[0] & TX_CNTRL1_DUPLEX ? "half" : "full", | |||
+ data[0] & TX_CNTRL1_RETRY ? "enabled" : "disabled", | |||
+ data[1] & TX_CNTRL2_RETRIES_MASK, | |||
+ data[0] & TX_CNTRL1_PAD_EN ? "enabled" : "disabled", | |||
+ data[0] & TX_CNTRL1_FCS_EN ? "enabled" : "disabled", | |||
+ data[0] & TX_CNTRL1_2DEFER ? "two-part" : "one-part", | |||
+ data[0] & TX_CNTRL1_RMII ? "RMII" : "Full MII" | |||
+ ); | |||
+ | |||
+ fprintf(stdout, | |||
+ "RXctrl: 0x%02x\n" | |||
+ " Enable: %s\n" | |||
+ " Pad strip: %s\n" | |||
+ " CRC check: %s\n" | |||
+ " Pause: %s\n" | |||
+ " Loop: %s\n" | |||
+ " Promiscous: %s\n" | |||
+ " Runt frames: %s\n" | |||
+ " Broadcast: %s\n" | |||
+ "\n", | |||
+ data[2], | |||
+ data[2] & RX_CNTRL1_RX_EN ? "yes" : "no", | |||
+ data[2] & RX_CNTRL1_PADSTRIP_EN ? "enabled" : "disabled", | |||
+ data[2] & RX_CNTRL1_CRC_EN ? "enabled" : "disabled", | |||
+ data[2] & RX_CNTRL1_PAUSE_EN ? "enabled" : "disabled", | |||
+ data[2] & RX_CNTRL1_LOOP_EN ? "enabled" : "disabled", | |||
+ data[2] & RX_CNTRL1_ADDR_FLTR_EN ? "disabled" : "enabled", | |||
+ data[2] & RX_CNTRL1_RX_RUNT_EN ? "forward" : "discard", | |||
+ data[2] & RX_CNTRL1_BCAST_DIS ? "disabled" : "enabled" | |||
+ ); | |||
+ fprintf(stdout, | |||
+ "Core control: 0x%02x\n" | |||
+ " Core state: %s\n" | |||
+ " RX fifo: %s\n" | |||
+ " TX fifo: %s\n" | |||
+ " Send jam: %s\n" | |||
+ " MDC clock %s\n" | |||
+ "\n", | |||
+ data[32], | |||
+ data[32] & CORE_RESET ? "reset" : "normal operation", | |||
+ data[32] & CORE_RX_FIFO_FLUSH ? "flush" : "ok", | |||
+ data[32] & CORE_TX_FIFO_FLUSH ? "flush" : "ok", | |||
+ data[32] & CORE_SEND_JAM ? "yes" : "no", | |||
+ data[32] & CORE_MDC_EN ? "output" : "input" | |||
+ ); | |||
+ fprintf(stdout, | |||
+ "MAC addresses: \n" | |||
+ " Multicast mask: " MAC "\n" | |||
+ " Multicast address: " MAC "\n" | |||
+ " Unicast address: " MAC "\n" | |||
+ "\n", | |||
+ MAC_DATA(data+13), MAC_DATA(data+19), MAC_DATA(data+26) | |||
+ ); | |||
+ fprintf(stdout, | |||
+ "Random seed: 0x%02x\n" | |||
+ "Threshold empty: %3d\n" | |||
+ "Threshold full: %3d\n" | |||
+ "TX buffer size: %3d\n" | |||
+ "TX deferral: %3d\n" | |||
+ "RX deferral: %3d\n" | |||
+ "TX two deferral 1: %3d\n" | |||
+ "TX two deferral 2: %3d\n" | |||
+ "Slot time: %3d\n" | |||
+ "Internal clock: %3d\n" | |||
+ "\n", | |||
+ data[4], data[5], data[6], data[7], data[8], data[9], | |||
+ data[10], data[11], data[12], data[25] | |||
+ ); | |||
+ | |||
+ return 0; | |||
+} |
@ -0,0 +1,45 @@ | |||
# | |||
# Copyright (C) 2006 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=horst | |||
PKG_VERSION:=4.0 | |||
PKG_RELEASE:=1 | |||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-git.tar.gz | |||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) | |||
PKG_SOURCE_URL:=git://br1.einfach.org/horst | |||
PKG_SOURCE_PROTO:=git | |||
PKG_SOURCE_VERSION:=version-4.0 | |||
PKG_BUILD_PARALLEL:=1 | |||
include $(INCLUDE_DIR)/package.mk | |||
define Package/horst | |||
SECTION:=net | |||
CATEGORY:=Network | |||
SUBMENU:=wireless | |||
DEPENDS:=+libncurses | |||
MAINTAINER:=Bruno Randolf <br1@einfach.org> | |||
TITLE:=Highly Optimized 802.11 Radio Scanning Tool | |||
URL:=http://br1.einfach.org/tech/horst/ | |||
endef | |||
define Package/horst/description | |||
[horst] is a scanning and analysis tool for 802.11 wireless networks | |||
and especially IBSS (ad-hoc) mode and mesh networks (OLSR). | |||
endef | |||
define Package/horst/install | |||
$(INSTALL_DIR) $(1)/usr/sbin | |||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/horst $(1)/usr/sbin/ | |||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/horst.sh $(1)/usr/sbin/ | |||
endef | |||
$(eval $(call BuildPackage,horst)) |
@ -0,0 +1,40 @@ | |||
# | |||
# Copyright (C) 2006-2014 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=luci-app-mwan3 | |||
PKG_VERSION:=1.3 | |||
PKG_RELEASE:=1 | |||
PKG_MAINTAINER:=Aedan Renner <chipdankly@gmail.com> | |||
PKG_LICENSE:=GPLv2 | |||
include $(INCLUDE_DIR)/package.mk | |||
define Package/luci-app-mwan3 | |||
SECTION:=LuCI | |||
CATEGORY:=LuCI | |||
SUBMENU:=3. Applications | |||
TITLE:=LuCI support for the MWAN3 multiwan hotplug script | |||
DEPENDS:=+mwan3 | |||
PKGARCH:=all | |||
MAINTAINER:=Aedan Renner <chipdankly@gmail.com> | |||
endef | |||
define Package/luci-app-mwan3/description | |||
Hotplug script which makes configuration of multiple WAN interfaces simple and manageable | |||
With loadbalancing/failover support for up to 250 WAN interfaces, connection tracking and an easy to manage traffic ruleset | |||
endef | |||
define Build/Compile | |||
endef | |||
define Package/luci-app-mwan3/install | |||
$(CP) ./files/* $(1) | |||
endef | |||
$(eval $(call BuildPackage,luci-app-mwan3)) |
@ -0,0 +1,38 @@ | |||
#!/bin/sh | |||
# to enable this script uncomment the case loop at the bottom | |||
# to report MWAN3 status on interface up/down events modify the lines in the send_reportdata function | |||
send_alert() | |||
{ | |||
# $1 stores the mwan3 status information | |||
# insert your code here to send the contents of $1 | |||
echo "$1" | |||
} | |||
gather_event_info() | |||
{ | |||
# create event information message | |||
local EVENT_INFO="Interface [ "$INTERFACE" ($DEVICE) ] on router [ "$(uci get -p /var/state system.@system[0].hostname)" ] has triggered an [ "$ACTION" ] hotplug event on "$(date)"" | |||
# get current interface, policy and rule status | |||
local CURRENT_STATUS="$(mwan3 status)" | |||
# get last 50 mwan3 systemlog messages | |||
local MWAN3_LOG="$(echo -e "Last 50 MWAN3 systemlog entries. Newest entries sorted at the top:\n$(logread | grep mwan3 | tail -n 50 | sed 'x;1!H;$!d;x')")" | |||
# pass event info to send_alert function | |||
send_alert "$(echo -e "$EVENT_INFO\n\n$CURRENT_STATUS\n\n$MWAN3_LOG")" | |||
} | |||
#case "$ACTION" in | |||
# ifup) | |||
# gather_event_info | |||
# ;; | |||
# | |||
# ifdown) | |||
# gather_event_info | |||
# ;; | |||
#esac | |||
exit 0 |
@ -0,0 +1,14 @@ | |||
#!/bin/sh | |||
# delete existing mwan3 ucitrack entry and add new entry | |||
uci -q batch <<-EOF >/dev/null | |||
del ucitrack.@mwan3[-1] | |||
add ucitrack mwan3 | |||
set ucitrack.@mwan3[-1].exec="/etc/init.d/mwan3 restart" | |||
commit ucitrack | |||
EOF | |||
# make controller file addition take effect without system restart | |||
rm -rf /tmp/luci-indexcache /tmp/luci-modulecache | |||
exit 0 |
@ -0,0 +1,355 @@ | |||
module("luci.controller.mwan3", package.seeall) | |||
sys = require "luci.sys" | |||
ut = require "luci.util" | |||
function index() | |||
if not nixio.fs.access("/etc/config/mwan3") then | |||
return | |||
end | |||
entry({"admin", "network", "mwan3"}, | |||
alias("admin", "network", "mwan3", "overview"), | |||
_("Load Balancing"), 600) | |||
entry({"admin", "network", "mwan3", "overview"}, | |||
alias("admin", "network", "mwan3", "overview", "over_iface"), | |||
_("Overview"), 10) | |||
entry({"admin", "network", "mwan3", "overview", "over_iface"}, | |||
template("mwan3/mwan3_over_interface")) | |||
entry({"admin", "network", "mwan3", "overview", "iface_status"}, | |||
call("mwan3_iface_status")) | |||
entry({"admin", "network", "mwan3", "overview", "over_detail"}, | |||
template("mwan3/mwan3_over_detail")) | |||
entry({"admin", "network", "mwan3", "overview", "detail_status"}, | |||
call("mwan3_detail_status")) | |||
entry({"admin", "network", "mwan3", "configuration"}, | |||
alias("admin", "network", "mwan3", "configuration", "interface"), | |||
_("Configuration"), 20) | |||
entry({"admin", "network", "mwan3", "configuration", "interface"}, | |||
arcombine(cbi("mwan3/mwan3_interface"), cbi("mwan3/mwan3_interfaceconfig")), | |||
_("Interfaces"), 10).leaf = true | |||
entry({"admin", "network", "mwan3", "configuration", "member"}, | |||
arcombine(cbi("mwan3/mwan3_member"), cbi("mwan3/mwan3_memberconfig")), | |||
_("Members"), 20).leaf = true | |||
entry({"admin", "network", "mwan3", "configuration", "policy"}, | |||
arcombine(cbi("mwan3/mwan3_policy"), cbi("mwan3/mwan3_policyconfig")), | |||
_("Policies"), 30).leaf = true | |||
entry({"admin", "network", "mwan3", "configuration", "rule"}, | |||
arcombine(cbi("mwan3/mwan3_rule"), cbi("mwan3/mwan3_ruleconfig")), | |||
_("Rules"), 40).leaf = true | |||
entry({"admin", "network", "mwan3", "advanced"}, | |||
alias("admin", "network", "mwan3", "advanced", "hotplug"), | |||
_("Advanced"), 100) | |||
entry({"admin", "network", "mwan3", "advanced", "hotplug"}, | |||
form("mwan3/mwan3_adv_hotplug")) | |||
entry({"admin", "network", "mwan3", "advanced", "mwan3"}, | |||
form("mwan3/mwan3_adv_mwan3")) | |||
entry({"admin", "network", "mwan3", "advanced", "network"}, | |||
form("mwan3/mwan3_adv_network")) | |||
entry({"admin", "network", "mwan3", "advanced", "diag"}, | |||
template("mwan3/mwan3_adv_diagnostics")) | |||
entry({"admin", "network", "mwan3", "advanced", "diag_display"}, | |||
call("mwan3_diag_data"), nil).leaf = true | |||
entry({"admin", "network", "mwan3", "advanced", "tshoot"}, | |||
template("mwan3/mwan3_adv_troubleshoot")) | |||
entry({"admin", "network", "mwan3", "advanced", "tshoot_display"}, | |||
call("mwan3_tshoot_data")) | |||
end | |||
function mwan3_get_iface_status(rulenum, ifname) | |||
if ut.trim(sys.exec("uci get -p /var/state mwan3." .. ifname .. ".enabled")) == "1" then | |||
if ut.trim(sys.exec("ip route list table " .. rulenum)) ~= "" then | |||
if ut.trim(sys.exec("uci get -p /var/state mwan3." .. ifname .. ".track_ip")) ~= "" then | |||
return "on" | |||
else | |||
return "nm" | |||
end | |||
else | |||
return "off" | |||
end | |||
else | |||
return "ne" | |||
end | |||
end | |||
function mwan3_get_iface() | |||
local rulenum, str = 0, "" | |||
uci.cursor():foreach("mwan3", "interface", | |||
function (section) | |||
rulenum = rulenum+1 | |||
str = str .. section[".name"] .. "[" .. mwan3_get_iface_status(rulenum, section[".name"]) .. "]" | |||
end | |||
) | |||
return str | |||
end | |||
function mwan3_iface_status() | |||
local ntm = require "luci.model.network".init() | |||
local rv = { } | |||
-- overview status | |||
local statstr = mwan3_get_iface() | |||
if statstr ~= "" then | |||
rv.wans = { } | |||
wansid = {} | |||
for wanname, ifstat in string.gfind(statstr, "([^%[]+)%[([^%]]+)%]") do | |||
local wanifname = ut.trim(sys.exec("uci get -p /var/state network." .. wanname .. ".ifname")) | |||
if wanifname == "" then | |||
wanifname = "X" | |||
end | |||
local wanlink = ntm:get_interface(wanifname) | |||
wanlink = wanlink and wanlink:get_network() | |||
wanlink = wanlink and wanlink:adminlink() or "#" | |||
wansid[wanname] = #rv.wans + 1 | |||
rv.wans[wansid[wanname]] = { name = wanname, link = wanlink, ifname = wanifname, status = ifstat } | |||
end | |||
end | |||
-- overview status log | |||
local mwlg = ut.trim(sys.exec("logread | grep mwan3 | tail -n 50 | sed 'x;1!H;$!d;x'")) | |||
if mwlg ~= "" then | |||
rv.mwan3log = { } | |||
mwlog = {} | |||
mwlog[mwlg] = #rv.mwan3log + 1 | |||
rv.mwan3log[mwlog[mwlg]] = { mwanlog = mwlg } | |||
end | |||
luci.http.prepare_content("application/json") | |||
luci.http.write_json(rv) | |||
end | |||
function mwan3_detail_status() | |||
local rv = { } | |||
-- detailed mwan3 status | |||
local dst = ut.trim(sys.exec("mwan3 status")) | |||
if dst ~= "" then | |||
rv.mwan3dst = { } | |||
dstat = {} | |||
dstat[dst] = #rv.mwan3dst + 1 | |||
rv.mwan3dst[dstat[dst]] = { detailstat = dst } | |||
end | |||
luci.http.prepare_content("application/json") | |||
luci.http.write_json(rv) | |||
end | |||
function mwan3_diag_data(iface, tool, alt) | |||
function get_ifnum() | |||
local num = 0 | |||
uci.cursor():foreach("mwan3", "interface", | |||
function (section) | |||
num = num+1 | |||
if section[".name"] == iface then | |||
ifnum = num | |||
end | |||
end | |||
) | |||
end | |||
local rv = { } | |||
local res = "" | |||
if tool == "service" then | |||
os.execute("mwan3 " .. alt) | |||
if alt == "restart" then | |||
res = "MWAN3 restarted" | |||
elseif alt == "stop" then | |||
res = "MWAN3 stopped" | |||
else | |||
res = "MWAN3 started" | |||
end | |||
else | |||
local ifdev = ut.trim(sys.exec("uci get -p /var/state network." .. iface .. ".ifname")) | |||
if ifdev ~= "" then | |||
if tool == "ping" then | |||
local gateway = ut.trim(sys.exec("route -n | awk -F' ' '{ if ($8 == \"" .. ifdev .. "\" && $1 == \"0.0.0.0\") print $2 }'")) | |||
if gateway ~= "" then | |||
if alt == "gateway" then | |||
local cmd = "ping -c 3 -W 2 -I " .. ifdev .. " " .. gateway | |||
res = cmd .. "\n\n" .. sys.exec(cmd) | |||
else | |||
local str = ut.trim(sys.exec("uci get -p /var/state mwan3." .. iface .. ".track_ip")) | |||
if str ~= "" then | |||
for z in str:gmatch("[^ ]+") do | |||
local cmd = "ping -c 3 -W 2 -I " .. ifdev .. " " .. z | |||
res = res .. cmd .. "\n\n" .. sys.exec(cmd) .. "\n\n" | |||
end | |||
else | |||
res = "No tracking IP addresses configured on " .. iface | |||
end | |||
end | |||
else | |||
res = "No default gateway for " .. iface .. " found. Default route does not exist or is configured incorrectly" | |||
end | |||
elseif tool == "rulechk" then | |||
get_ifnum() | |||
local rule1 = sys.exec("ip rule | grep $(echo $((" .. ifnum .. " + 1000)))") | |||
local rule2 = sys.exec("ip rule | grep $(echo $((" .. ifnum .. " + 2000)))") | |||
if rule1 ~= "" and rule2 ~= "" then | |||
res = "All required interface IP rules found:\n\n" .. rule1 .. rule2 | |||
elseif rule1 ~= "" or rule2 ~= "" then | |||
res = "Missing 1 of the 2 required interface IP rules\n\n\nRules found:\n\n" .. rule1 .. rule2 | |||
else | |||
res = "Missing both of the required interface IP rules" | |||
end | |||
elseif tool == "routechk" then | |||
get_ifnum() | |||
local table = sys.exec("ip route list table " .. ifnum) | |||
if table ~= "" then | |||
res = "Interface routing table " .. ifnum .. " was found:\n\n" .. table | |||
else | |||
res = "Missing required interface routing table " .. ifnum | |||
end | |||
elseif tool == "hotplug" then | |||
if alt == "ifup" then | |||
os.execute("mwan3 ifup " .. iface) | |||
res = "Hotplug ifup sent to interface " .. iface .. "..." | |||
else | |||
os.execute("mwan3 ifdown " .. iface) | |||
res = "Hotplug ifdown sent to interface " .. iface .. "..." | |||
end | |||
end | |||
else | |||
res = "Unable to perform diagnostic tests on " .. iface .. ". There is no physical or virtual device associated with this interface" | |||
end | |||
end | |||
if res ~= "" then | |||
res = ut.trim(res) | |||
rv.diagres = { } | |||
dres = {} | |||
dres[res] = #rv.diagres + 1 | |||
rv.diagres[dres[res]] = { diagresult = res } | |||
end | |||
luci.http.prepare_content("application/json") | |||
luci.http.write_json(rv) | |||
end | |||
function mwan3_tshoot_data() | |||
local rv = { } | |||
-- software versions | |||
local wrtrelease = ut.trim(luci.version.distversion) | |||
if wrtrelease ~= "" then | |||
wrtrelease = "OpenWrt - " .. wrtrelease | |||
else | |||
wrtrelease = "OpenWrt - unknown" | |||
end | |||
local lucirelease = ut.trim(luci.version.luciversion) | |||
if lucirelease ~= "" then | |||
lucirelease = "\nLuCI - " .. lucirelease | |||
else | |||
lucirelease = "\nLuCI - unknown" | |||
end | |||
local mwan3version = ut.trim(sys.exec("opkg info mwan3 | grep Version | awk -F' ' '{ print $2 }'")) | |||
if mwan3version ~= "" then | |||
mwan3version = "\n\nmwan3 - " .. mwan3version | |||
else | |||
mwan3version = "\nmwan3 - unknown" | |||
end | |||
local mwan3lversion = ut.trim(sys.exec("opkg info luci-app-mwan3 | grep Version | awk -F' ' '{ print $2 }'")) | |||
if mwan3lversion ~= "" then | |||
mwan3lversion = "\nluci-app-mwan3 - " .. mwan3lversion | |||
else | |||
mwan3lversion = "\nluci-app-mwan3 - unknown" | |||
end | |||
local softrev = wrtrelease .. lucirelease .. mwan3version .. mwan3lversion | |||
rv.mw3ver = { } | |||
mwv = {} | |||
mwv[softrev] = #rv.mw3ver + 1 | |||
rv.mw3ver[mwv[softrev]] = { mwan3v = softrev } | |||
-- mwan3 config | |||
local mwcg = ut.trim(sys.exec("cat /etc/config/mwan3")) | |||
if mwcg == "" then | |||
mwcg = "No data found" | |||
end | |||
rv.mwan3config = { } | |||
mwan3cfg = {} | |||
mwan3cfg[mwcg] = #rv.mwan3config + 1 | |||
rv.mwan3config[mwan3cfg[mwcg]] = { mwn3cfg = mwcg } | |||
-- network config | |||
local netcg = ut.trim(sys.exec("cat /etc/config/network | sed -e 's/.*username.*/ USERNAME HIDDEN/' -e 's/.*password.*/ PASSWORD HIDDEN/'")) | |||
if netcg == "" then | |||
netcg = "No data found" | |||
end | |||
rv.netconfig = { } | |||
ncfg = {} | |||
ncfg[netcg] = #rv.netconfig + 1 | |||
rv.netconfig[ncfg[netcg]] = { netcfg = netcg } | |||
-- ifconfig | |||
local ifcg = ut.trim(sys.exec("ifconfig")) | |||
if ifcg == "" then | |||
ifcg = "No data found" | |||
end | |||
rv.ifconfig = { } | |||
icfg = {} | |||
icfg[ifcg] = #rv.ifconfig + 1 | |||
rv.ifconfig[icfg[ifcg]] = { ifcfg = ifcg } | |||
-- route -n | |||
local routeshow = ut.trim(sys.exec("route -n")) | |||
if routeshow == "" then | |||
routeshow = "No data found" | |||
end | |||
rv.rtshow = { } | |||
rshw = {} | |||
rshw[routeshow] = #rv.rtshow + 1 | |||
rv.rtshow[rshw[routeshow]] = { iprtshow = routeshow } | |||
-- ip rule show | |||
local ipr = ut.trim(sys.exec("ip rule show")) | |||
if ipr == "" then | |||
ipr = "No data found" | |||
end | |||
rv.iprule = { } | |||
ipruleid = {} | |||
ipruleid[ipr] = #rv.iprule + 1 | |||
rv.iprule[ipruleid[ipr]] = { rule = ipr } | |||
-- ip route list table 1-250 | |||
local routelisting, rlstr = ut.trim(sys.exec("ip rule | sed 's/://g' | awk -F' ' '$1>=2001 && $1<=2250' | awk -F' ' '{ print $NF }'")), "" | |||
if routelisting ~= "" then | |||
for line in routelisting:gmatch("[^\r\n]+") do | |||
rlstr = rlstr .. line .. "\n" .. sys.exec("ip route list table " .. line) | |||
end | |||
rlstr = ut.trim(rlstr) | |||
else | |||
rlstr = "No data found" | |||
end | |||
rv.routelist = { } | |||
rtlist = {} | |||
rtlist[rlstr] = #rv.routelist + 1 | |||
rv.routelist[rtlist[rlstr]] = { iprtlist = rlstr } | |||
-- default firewall output policy | |||
local defout = ut.trim(sys.exec("uci get -p /var/state firewall.@defaults[0].output")) | |||
if defout == "" then | |||
defout = "No data found" | |||
end | |||
rv.fidef = { } | |||
fwdf = {} | |||
fwdf[defout] = #rv.fidef + 1 | |||
rv.fidef[fwdf[defout]] = { firedef = defout } | |||
-- iptables | |||
local iptbl = ut.trim(sys.exec("iptables -L -t mangle -v -n")) | |||
if iptbl == "" then | |||
iptbl = "No data found" | |||
end | |||
rv.iptables = { } | |||
tables = {} | |||
tables[iptbl] = #rv.iptables + 1 | |||
rv.iptables[tables[iptbl]] = { iptbls = iptbl } | |||
luci.http.prepare_content("application/json") | |||
luci.http.write_json(rv) | |||
end |
@ -0,0 +1,55 @@ | |||
-- ------ hotplug script configuration ------ -- | |||
fs = require "nixio.fs" | |||
sys = require "luci.sys" | |||
ut = require "luci.util" | |||
script = "/etc/hotplug.d/iface/16-mwan3custom" | |||
scriptbak = "/etc/hotplug.d/iface/16-mwan3custombak" | |||
if luci.http.formvalue("cbid.luci.1._restorebak") then -- restore button has been clicked | |||
luci.http.redirect(luci.dispatcher.build_url("admin/network/mwan3/advanced/hotplug") .. "?restore=yes") | |||
elseif luci.http.formvalue("restore") == "yes" then -- restore script from backup | |||
os.execute("cp -f " .. scriptbak .. " " .. script) | |||
end | |||
m5 = SimpleForm("luci", nil) | |||
m5:append(Template("mwan3/mwan3_adv_hotplug")) -- highlight current tab | |||
f = m5:section(SimpleSection, nil, | |||
translate("This section allows you to modify the contents of /etc/hotplug.d/iface/16-mwan3custom<br />" .. | |||
"This is useful for running system commands and/or scripts based on interface ifup or ifdown hotplug events<br /><br />" .. | |||
"Notes:<br />" .. | |||
"The first line of the script must be "#!/bin/sh" without quotes<br />" .. | |||
"Lines beginning with # are comments and are not executed<br /><br />" .. | |||
"Available variables:<br />" .. | |||
"$ACTION is the hotplug event (ifup, ifdown)<br />" .. | |||
"$INTERFACE is the interface name (wan1, wan2, etc.)<br />" .. | |||
"$DEVICE is the device name attached to the interface (eth0.1, eth1, etc.)")) | |||
restore = f:option(Button, "_restorebak", translate("Restore default hotplug script")) | |||
restore.inputtitle = translate("Restore...") | |||
restore.inputstyle = "apply" | |||
t = f:option(TextValue, "lines") | |||
t.rmempty = true | |||
t.rows = 20 | |||
function t.cfgvalue() | |||
local hps = fs.readfile(script) | |||
if not hps or hps == "" then -- if script does not exist or is blank restore from backup | |||
sys.call("cp -f " .. scriptbak .. " " .. script) | |||
return fs.readfile(script) | |||
else | |||
return hps | |||
end | |||
end | |||
function t.write(self, section, data) -- format and write new data to script | |||
return fs.writefile(script, ut.trim(data:gsub("\r\n", "\n")) .. "\n") | |||
end | |||
return m5 |
@ -0,0 +1,32 @@ | |||
-- ------ mwan3 configuration ------ -- | |||
ut = require "luci.util" | |||
mwan3file = "/etc/config/mwan3" | |||
m5 = SimpleForm("luci", nil) | |||
m5:append(Template("mwan3/mwan3_adv_mwan3")) -- highlight current tab | |||
f = m5:section(SimpleSection, nil, | |||
translate("This section allows you to modify the contents of /etc/config/mwan3")) | |||
t = f:option(TextValue, "lines") | |||
t.rmempty = true | |||
t.rows = 20 | |||
function t.cfgvalue() | |||
return nixio.fs.readfile(mwan3file) or "" | |||
end | |||
function t.write(self, section, data) -- format and write new data to script | |||
return nixio.fs.writefile(mwan3file, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n") | |||
end | |||
function f.handle(self, state, data) | |||
return true | |||
end | |||
return m5 |
@ -0,0 +1,32 @@ | |||
-- ------ network configuration ------ -- | |||
ut = require "luci.util" | |||
netfile = "/etc/config/network" | |||
m5 = SimpleForm("networkconf", nil) | |||
m5:append(Template("mwan3/mwan3_adv_network")) -- highlight current tab | |||
f = m5:section(SimpleSection, nil, | |||
translate("This section allows you to modify the contents of /etc/config/network")) | |||
t = f:option(TextValue, "lines") | |||
t.rmempty = true | |||
t.rows = 20 | |||
function t.cfgvalue() | |||
return nixio.fs.readfile(netfile) or "" | |||
end | |||
function t.write(self, section, data) -- format and write new data to script | |||
return nixio.fs.writefile(netfile, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n") | |||
end | |||
function f.handle(self, state, data) | |||
return true | |||
end | |||
return m5 |
@ -0,0 +1,266 @@ | |||
-- ------ extra functions ------ -- | |||
function iface_check() -- find issues with too many interfaces, reliability and metric | |||
uci.cursor():foreach("mwan3", "interface", | |||
function (section) | |||
local ifname = section[".name"] | |||
ifnum = ifnum+1 -- count number of mwan3 interfaces configured | |||
-- create list of metrics for none and duplicate checking | |||
local metlkp = ut.trim(sys.exec("uci get -p /var/state network." .. ifname .. ".metric")) | |||
if metlkp == "" then | |||
err_found = 1 | |||
err_nomet_list = err_nomet_list .. ifname .. " " | |||
else | |||
metric_list = metric_list .. ifname .. " " .. metlkp .. "\n" | |||
end | |||
-- check if any interfaces have a higher reliability requirement than tracking IPs configured | |||
local tipnum = tonumber(ut.trim(sys.exec("echo $(uci get -p /var/state mwan3." .. ifname .. ".track_ip) | wc -w"))) | |||
if tipnum > 0 then | |||
local relnum = tonumber(ut.trim(sys.exec("uci get -p /var/state mwan3." .. ifname .. ".reliability"))) | |||
if relnum and relnum > tipnum then | |||
err_found = 1 | |||
err_rel_list = err_rel_list .. ifname .. " " | |||
end | |||
end | |||
-- check if any interfaces are not properly configured in /etc/config/network or have no default route in main routing table | |||
if ut.trim(sys.exec("uci get -p /var/state network." .. ifname)) == "interface" then | |||
local ifdev = ut.trim(sys.exec("uci get -p /var/state network." .. ifname .. ".ifname")) | |||
if ifdev == "uci: Entry not found" or ifdev == "" then | |||
err_found = 1 | |||
err_netcfg_list = err_netcfg_list .. ifname .. " " | |||
err_route_list = err_route_list .. ifname .. " " | |||
else | |||
local rtcheck = ut.trim(sys.exec("route -n | awk -F' ' '{ if ($8 == \"" .. ifdev .. "\" && $1 == \"0.0.0.0\") print $1 }'")) | |||
if rtcheck == "" then | |||
err_found = 1 | |||
err_route_list = err_route_list .. ifname .. " " | |||
end | |||
end | |||
else | |||
err_found = 1 | |||
err_netcfg_list = err_netcfg_list .. ifname .. " " | |||
err_route_list = err_route_list .. ifname .. " " | |||
end | |||
end | |||
) | |||
-- check if any interfaces have duplicate metrics | |||
local metric_dupnums = sys.exec("echo '" .. metric_list .. "' | awk -F' ' '{ print $2 }' | uniq -d") | |||
if metric_dupnums ~= "" then | |||
err_found = 1 | |||
local metric_dupes = "" | |||
for line in metric_dupnums:gmatch("[^\r\n]+") do | |||
metric_dupes = sys.exec("echo '" .. metric_list .. "' | grep '" .. line .. "' | awk -F' ' '{ print $1 }'") | |||
err_dupmet_list = err_dupmet_list .. metric_dupes | |||
end | |||
err_dupmet_list = sys.exec("echo '" .. err_dupmet_list .. "' | tr '\n' ' '") | |||
end | |||
end | |||
function iface_warn() -- display status and warning messages at the top of the page | |||
local warns = "" | |||
if ifnum <= 250 then | |||
warns = "<strong>There are currently " .. ifnum .. " of 250 supported interfaces configured</strong>" | |||
else | |||
warns = "<font color=\"ff0000\"><strong>WARNING: " .. ifnum .. " interfaces are configured exceeding the maximum of 250!</strong></font>" | |||
end | |||
if err_rel_list ~= " " then | |||
warns = warns .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have a higher reliability requirement than there are tracking IP addresses!</strong></font>" | |||
end | |||
if err_route_list ~= " " then | |||
warns = warns .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have no default route in the main routing table!</strong></font>" | |||
end | |||
if err_netcfg_list ~= " " then | |||
warns = warns .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces are configured incorrectly or not at all in /etc/config/network!</strong></font>" | |||
end | |||
if err_nomet_list ~= " " then | |||
warns = warns .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have no metric configured in /etc/config/network!</strong></font>" | |||
end | |||
if err_dupmet_list ~= " " then | |||
warns = warns .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have duplicate metrics configured in /etc/config/network!</strong></font>" | |||
end | |||
return warns | |||
end | |||
-- ------ interface configuration ------ -- | |||
dsp = require "luci.dispatcher" | |||
sys = require "luci.sys" | |||
ut = require "luci.util" | |||
ifnum = 0 | |||
metric_list = "" | |||
err_found = 0 | |||
err_dupmet_list = " " | |||
err_netcfg_list = " " | |||
err_nomet_list = " " | |||
err_rel_list = " " | |||
err_route_list = " " | |||
iface_check() | |||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Interface Configuration"), | |||
translate(iface_warn())) | |||
m5:append(Template("mwan3/mwan3_config_css")) | |||
mwan_interface = m5:section(TypedSection, "interface", translate("Interfaces"), | |||
translate("MWAN3 supports up to 250 physical and/or logical interfaces<br />" .. | |||
"MWAN3 requires that all interfaces have a unique metric configured in /etc/config/network<br />" .. | |||
"Names must match the interface name found in /etc/config/network (see advanced tab)<br />" .. | |||
"Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" .. | |||
"Interfaces may not share the same name as configured members, policies or rules")) | |||
mwan_interface.addremove = true | |||
mwan_interface.dynamic = false | |||
mwan_interface.sectionhead = "Interface" | |||
mwan_interface.sortable = true | |||
mwan_interface.template = "cbi/tblsection" | |||
mwan_interface.extedit = dsp.build_url("admin", "network", "mwan3", "configuration", "interface", "%s") | |||
function mwan_interface.create(self, section) | |||
TypedSection.create(self, section) | |||
m5.uci:save("mwan3") | |||
luci.http.redirect(dsp.build_url("admin", "network", "mwan3", "configuration", "interface", section)) | |||
end | |||
enabled = mwan_interface:option(DummyValue, "enabled", translate("Enabled")) | |||
enabled.rawhtml = true | |||
function enabled.cfgvalue(self, s) | |||
if self.map:get(s, "enabled") == "1" then | |||
return "Yes" | |||
else | |||
return "No" | |||
end | |||
end | |||
track_ip = mwan_interface:option(DummyValue, "track_ip", translate("Tracking IP")) | |||
track_ip.rawhtml = true | |||
function track_ip.cfgvalue(self, s) | |||
local str = "" | |||
tracked = self.map:get(s, "track_ip") | |||
if tracked then | |||
for k,v in pairs(tracked) do | |||
str = str .. v .. "<br />" | |||
end | |||
return str | |||
else | |||
return "—" | |||
end | |||
end | |||
reliability = mwan_interface:option(DummyValue, "reliability", translate("Tracking reliability")) | |||
reliability.rawhtml = true | |||
function reliability.cfgvalue(self, s) | |||
if tracked then | |||
return self.map:get(s, "reliability") or "—" | |||
else | |||
return "—" | |||
end | |||
end | |||
count = mwan_interface:option(DummyValue, "count", translate("Ping count")) | |||
count.rawhtml = true | |||
function count.cfgvalue(self, s) | |||
if tracked then | |||
return self.map:get(s, "count") or "—" | |||
else | |||
return "—" | |||
end | |||
end | |||
timeout = mwan_interface:option(DummyValue, "timeout", translate("Ping timeout")) | |||
timeout.rawhtml = true | |||
function timeout.cfgvalue(self, s) | |||
if tracked then | |||
local tcheck = self.map:get(s, "timeout") | |||
if tcheck then | |||
return tcheck .. "s" | |||
else | |||
return "—" | |||
end | |||
else | |||
return "—" | |||
end | |||
end | |||
interval = mwan_interface:option(DummyValue, "interval", translate("Ping interval")) | |||
interval.rawhtml = true | |||
function interval.cfgvalue(self, s) | |||
if tracked then | |||
local icheck = self.map:get(s, "interval") | |||
if icheck then | |||
return icheck .. "s" | |||
else | |||
return "—" | |||
end | |||
else | |||
return "—" | |||
end | |||
end | |||
down = mwan_interface:option(DummyValue, "down", translate("Interface down")) | |||
down.rawhtml = true | |||
function down.cfgvalue(self, s) | |||
if tracked then | |||
return self.map:get(s, "down") or "—" | |||
else | |||
return "—" | |||
end | |||
end | |||
up = mwan_interface:option(DummyValue, "up", translate("Interface up")) | |||
up.rawhtml = true | |||
function up.cfgvalue(self, s) | |||
if tracked then | |||
return self.map:get(s, "up") or "—" | |||
else | |||
return "—" | |||
end | |||
end | |||
metric = mwan_interface:option(DummyValue, "metric", translate("Metric")) | |||
metric.rawhtml = true | |||
function metric.cfgvalue(self, s) | |||
local metcheck = sys.exec("uci get -p /var/state network." .. s .. ".metric") | |||
if metcheck ~= "" then | |||
return metcheck | |||
else | |||
return "—" | |||
end | |||
end | |||
errors = mwan_interface:option(DummyValue, "errors", translate("Errors")) | |||
errors.rawhtml = true | |||
function errors.cfgvalue(self, s) | |||
if err_found == 1 then | |||
local mouseover, linebrk = "", "" | |||
if string.find(err_rel_list, " " .. s .. " ") then | |||
mouseover = "Higher reliability requirement than there are tracking IP addresses" | |||
linebrk = " " | |||
end | |||
if string.find(err_route_list, " " .. s .. " ") then | |||
mouseover = mouseover .. linebrk .. "No default route in the main routing table" | |||
linebrk = " " | |||
end | |||
if string.find(err_netcfg_list, " " .. s .. " ") then | |||
mouseover = mouseover .. linebrk .. "Configured incorrectly or not at all in /etc/config/network" | |||
linebrk = " " | |||
end | |||
if string.find(err_nomet_list, " " .. s .. " ") then | |||
mouseover = mouseover .. linebrk .. "No metric configured in /etc/config/network" | |||
linebrk = " " | |||
end | |||
if string.find(err_dupmet_list, " " .. s .. " ") then | |||
mouseover = mouseover .. linebrk .. "Duplicate metric configured in /etc/config/network" | |||
end | |||
if mouseover == "" then | |||
return "" | |||
else | |||
return "<span title=\"" .. mouseover .. "\"><img src=\"/luci-static/resources/cbi/reset.gif\" alt=\"error\"></img></span>" | |||
end | |||
else | |||
return "" | |||
end | |||
end | |||
return m5 |
@ -0,0 +1,191 @@ | |||
-- ------ extra functions ------ -- | |||
function iface_check() | |||
metcheck = ut.trim(sys.exec("uci get -p /var/state network." .. arg[1] .. ".metric")) | |||
if metcheck == "" then -- no metric | |||
err_nomet = 1 | |||
else -- if metric exists create list of interface metrics to compare against for duplicates | |||
uci.cursor():foreach("mwan3", "interface", | |||
function (section) | |||
local metlkp = ut.trim(sys.exec("uci get -p /var/state network." .. section[".name"] .. ".metric")) | |||
metric_list = metric_list .. section[".name"] .. " " .. metlkp .. "\n" | |||
end | |||
) | |||
-- compare metric against list | |||
local metric_dupnums, metric_dupes = sys.exec("echo '" .. metric_list .. "' | awk -F' ' '{ print $2 }' | uniq -d"), "" | |||
for line in metric_dupnums:gmatch("[^\r\n]+") do | |||
metric_dupes = sys.exec("echo '" .. metric_list .. "' | grep '" .. line .. "' | awk -F' ' '{ print $1 }'") | |||
err_dupmet_list = err_dupmet_list .. metric_dupes | |||
end | |||
if sys.exec("echo '" .. err_dupmet_list .. "' | grep -w " .. arg[1]) ~= "" then | |||
err_dupmet = 1 | |||
end | |||
end | |||
-- check if this interface has a higher reliability requirement than track IPs configured | |||
local tipnum = tonumber(ut.trim(sys.exec("echo $(uci get -p /var/state mwan3." .. arg[1] .. ".track_ip) | wc -w"))) | |||
if tipnum > 0 then | |||
local relnum = tonumber(ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".reliability"))) | |||
if relnum and relnum > tipnum then | |||
err_reliability = 1 | |||
end | |||
end | |||
-- check if any interfaces are not properly configured in /etc/config/network or have no default route in main routing table | |||
if ut.trim(sys.exec("uci get -p /var/state network." .. arg[1])) == "interface" then | |||
local ifdev = ut.trim(sys.exec("uci get -p /var/state network." .. arg[1] .. ".ifname")) | |||
if ifdev == "uci: Entry not found" or ifdev == "" then | |||
err_netcfg = 1 | |||
err_route = 1 | |||
else | |||
local rtcheck = ut.trim(sys.exec("route -n | awk -F' ' '{ if ($8 == \"" .. ifdev .. "\" && $1 == \"0.0.0.0\") print $1 }'")) | |||
if rtcheck == "" then | |||
err_route = 1 | |||
end | |||
end | |||
else | |||
err_netcfg = 1 | |||
err_route = 1 | |||
end | |||
end | |||
function iface_warn() -- display warning messages at the top of the page | |||
local warns, linebrk = "", "" | |||
if err_reliability == 1 then | |||
warns = "<font color=\"ff0000\"><strong>WARNING: this interface has a higher reliability requirement than there are tracking IP addresses!</strong></font>" | |||
linebrk = "<br /><br />" | |||
end | |||
if err_route == 1 then | |||
warns = warns .. linebrk .. "<font color=\"ff0000\"><strong>WARNING: this interface has no default route in the main routing table!</strong></font>" | |||
linebrk = "<br /><br />" | |||
end | |||
if err_netcfg == 1 then | |||
warns = warns .. linebrk .. "<font color=\"ff0000\"><strong>WARNING: this interface is configured incorrectly or not at all in /etc/config/network!</strong></font>" | |||
linebrk = "<br /><br />" | |||
end | |||
if err_nomet == 1 then | |||
warns = warns .. linebrk .. "<font color=\"ff0000\"><strong>WARNING: this interface has no metric configured in /etc/config/network!</strong></font>" | |||
elseif err_dupmet == 1 then | |||
warns = warns .. linebrk .. "<font color=\"ff0000\"><strong>WARNING: this and other interfaces have duplicate metrics configured in /etc/config/network!</strong></font>" | |||
end | |||
return warns | |||
end | |||
-- ------ interface configuration ------ -- | |||
dsp = require "luci.dispatcher" | |||
sys = require "luci.sys" | |||
ut = require "luci.util" | |||
arg[1] = arg[1] or "" | |||
metcheck = "" | |||
metric_list = "" | |||
err_dupmet_list = "" | |||
err_rel_list = "" | |||
err_nomet = 0 | |||
err_dupmet = 0 | |||
err_route = 0 | |||
err_netcfg = 0 | |||
err_reliability = 0 | |||
iface_check() | |||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Interface Configuration - " .. arg[1]), | |||
translate(iface_warn())) | |||
m5.redirect = dsp.build_url("admin", "network", "mwan3", "configuration", "interface") | |||
mwan_interface = m5:section(NamedSection, arg[1], "interface", "") | |||
mwan_interface.addremove = false | |||
mwan_interface.dynamic = false | |||
enabled = mwan_interface:option(ListValue, "enabled", translate("Enabled")) | |||
enabled.default = "1" | |||
enabled:value("1", translate("Yes")) | |||
enabled:value("0", translate("No")) | |||
track_ip = mwan_interface:option(DynamicList, "track_ip", translate("Tracking IP"), | |||
translate("This IP address will be pinged to dermine if the link is up or down. Leave blank to assume interface is always online")) | |||
track_ip.datatype = "ipaddr" | |||
reliability = mwan_interface:option(Value, "reliability", translate("Tracking reliability"), | |||
translate("Acceptable values: 1-100. This many Tracking IP addresses must respond for the link to be deemed up")) | |||
reliability.datatype = "range(1, 100)" | |||
reliability.default = "1" | |||
count = mwan_interface:option(ListValue, "count", translate("Ping count")) | |||
count.default = "1" | |||
count:value("1") | |||
count:value("2") | |||
count:value("3") | |||
count:value("4") | |||
count:value("5") | |||
timeout = mwan_interface:option(ListValue, "timeout", translate("Ping timeout")) | |||
timeout.default = "2" | |||
timeout:value("1", translate("1 second")) | |||
timeout:value("2", translate("2 seconds")) | |||
timeout:value("3", translate("3 seconds")) | |||
timeout:value("4", translate("4 seconds")) | |||
timeout:value("5", translate("5 seconds")) | |||
timeout:value("6", translate("6 seconds")) | |||
timeout:value("7", translate("7 seconds")) | |||
timeout:value("8", translate("8 seconds")) | |||
timeout:value("9", translate("9 seconds")) | |||
timeout:value("10", translate("10 seconds")) | |||
interval = mwan_interface:option(ListValue, "interval", translate("Ping interval")) | |||
interval.default = "5" | |||
interval:value("1", translate("1 second")) | |||
interval:value("3", translate("3 seconds")) | |||
interval:value("5", translate("5 seconds")) | |||
interval:value("10", translate("10 seconds")) | |||
interval:value("20", translate("20 seconds")) | |||
interval:value("30", translate("30 seconds")) | |||
interval:value("60", translate("1 minute")) | |||
interval:value("300", translate("5 minutes")) | |||
interval:value("600", translate("10 minutes")) | |||
interval:value("900", translate("15 minutes")) | |||
interval:value("1800", translate("30 minutes")) | |||
interval:value("3600", translate("1 hour")) | |||
down = mwan_interface:option(ListValue, "down", translate("Interface down"), | |||
translate("Interface will be deemed down after this many failed ping tests")) | |||
down.default = "3" | |||
down:value("1") | |||
down:value("2") | |||
down:value("3") | |||
down:value("4") | |||
down:value("5") | |||
down:value("6") | |||
down:value("7") | |||
down:value("8") | |||
down:value("9") | |||
down:value("10") | |||
up = mwan_interface:option(ListValue, "up", translate("Interface up"), | |||
translate("Downed interface will be deemed up after this many successful ping tests")) | |||
up.default = "3" | |||
up:value("1") | |||
up:value("2") | |||
up:value("3") | |||
up:value("4") | |||
up:value("5") | |||
up:value("6") | |||
up:value("7") | |||
up:value("8") | |||
up:value("9") | |||
up:value("10") | |||
metric = mwan_interface:option(DummyValue, "metric", translate("Metric"), | |||
translate("This displays the metric assigned to this interface in /etc/config/network")) | |||
metric.rawhtml = true | |||
function metric.cfgvalue(self, s) | |||
if err_nomet == 0 then | |||
return metcheck | |||
else | |||
return "—" | |||
end | |||
end | |||
return m5 |
@ -0,0 +1,46 @@ | |||
-- ------ member configuration ------ -- | |||
ds = require "luci.dispatcher" | |||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Member Configuration")) | |||
m5:append(Template("mwan3/mwan3_config_css")) | |||
mwan_member = m5:section(TypedSection, "member", translate("Members"), | |||
translate("Members are profiles attaching a metric and weight to an MWAN3 interface<br />" .. | |||
"Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" .. | |||
"Members may not share the same name as configured interfaces, policies or rules")) | |||
mwan_member.addremove = true | |||
mwan_member.dynamic = false | |||
mwan_member.sectionhead = "Member" | |||
mwan_member.sortable = true | |||
mwan_member.template = "cbi/tblsection" | |||
mwan_member.extedit = ds.build_url("admin", "network", "mwan3", "configuration", "member", "%s") | |||
function mwan_member.create(self, section) | |||
TypedSection.create(self, section) | |||
m5.uci:save("mwan3") | |||
luci.http.redirect(ds.build_url("admin", "network", "mwan3", "configuration", "member", section)) | |||
end | |||
interface = mwan_member:option(DummyValue, "interface", translate("Interface")) | |||
interface.rawhtml = true | |||
function interface.cfgvalue(self, s) | |||
return self.map:get(s, "interface") or "—" | |||
end | |||
metric = mwan_member:option(DummyValue, "metric", translate("Metric")) | |||
metric.rawhtml = true | |||
function metric.cfgvalue(self, s) | |||
return self.map:get(s, "metric") or "1" | |||
end | |||
weight = mwan_member:option(DummyValue, "weight", translate("Weight")) | |||
weight.rawhtml = true | |||
function weight.cfgvalue(self, s) | |||
return self.map:get(s, "weight") or "1" | |||
end | |||
return m5 |
@ -0,0 +1,47 @@ | |||
-- ------ extra functions ------ -- | |||
function cbi_add_interface(field) | |||
uci.cursor():foreach("mwan3", "interface", | |||
function (section) | |||
field:value(section[".name"]) | |||
end | |||
) | |||
end | |||
-- ------ member configuration ------ -- | |||
dsp = require "luci.dispatcher" | |||
arg[1] = arg[1] or "" | |||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Member Configuration - ") .. arg[1]) | |||
m5.redirect = dsp.build_url("admin", "network", "mwan3", "configuration", "member") | |||
mwan_member = m5:section(NamedSection, arg[1], "member", "") | |||
mwan_member.addremove = false | |||
mwan_member.dynamic = false | |||
interface = mwan_member:option(Value, "interface", translate("Interface")) | |||
cbi_add_interface(interface) | |||
metric = mwan_member:option(Value, "metric", translate("Metric"), | |||
translate("Acceptable values: 1-1000. Defaults to 1 if not set")) | |||
metric.datatype = "range(1, 1000)" | |||
weight = mwan_member:option(Value, "weight", translate("Weight"), | |||
translate("Acceptable values: 1-1000. Defaults to 1 if not set")) | |||
weight.datatype = "range(1, 1000)" | |||
-- ------ currently configured interfaces ------ -- | |||
mwan_interface = m5:section(TypedSection, "interface", translate("Currently Configured Interfaces")) | |||
mwan_interface.addremove = false | |||
mwan_interface.dynamic = false | |||
mwan_interface.sortable = false | |||
mwan_interface.template = "cbi/tblsection" | |||
return m5 |
@ -0,0 +1,82 @@ | |||
-- ------ extra functions ------ -- | |||
function policy_check() -- check to see if any policy names exceed the maximum of 15 characters | |||
uci.cursor():foreach("mwan3", "policy", | |||
function (section) | |||
if string.len(section[".name"]) > 15 then | |||
toolong = 1 | |||
err_name_list = err_name_list .. section[".name"] .. " " | |||
end | |||
end | |||
) | |||
end | |||
function policy_warn() -- display status and warning messages at the top of the page | |||
if toolong == 1 then | |||
return "<font color=\"ff0000\"><strong>WARNING: Some policies have names exceeding the maximum of 15 characters!</strong></font>" | |||
else | |||
return "" | |||
end | |||
end | |||
-- ------ policy configuration ------ -- | |||
ds = require "luci.dispatcher" | |||
sys = require "luci.sys" | |||
toolong = 0 | |||
err_name_list = " " | |||
policy_check() | |||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Policy Configuration"), | |||
translate(policy_warn())) | |||
m5:append(Template("mwan3/mwan3_config_css")) | |||
mwan_policy = m5:section(TypedSection, "policy", translate("Policies"), | |||
translate("Policies are profiles grouping one or more members controlling how MWAN3 distributes traffic<br />" .. | |||
"Member interfaces with lower metrics are used first. Interfaces with the same metric load-balance<br />" .. | |||
"Load-balanced member interfaces distribute more traffic out those with higher weights<br />" .. | |||
"Names may contain characters A-Z, a-z, 0-9, _ and no spaces. Names must be 15 characters or less<br />" .. | |||
"Policies may not share the same name as configured interfaces, members or rules")) | |||
mwan_policy.addremove = true | |||
mwan_policy.dynamic = false | |||
mwan_policy.sectionhead = "Policy" | |||
mwan_policy.sortable = true | |||
mwan_policy.template = "cbi/tblsection" | |||
mwan_policy.extedit = ds.build_url("admin", "network", "mwan3", "configuration", "policy", "%s") | |||
function mwan_policy.create(self, section) | |||
TypedSection.create(self, section) | |||
m5.uci:save("mwan3") | |||
luci.http.redirect(ds.build_url("admin", "network", "mwan3", "configuration", "policy", section)) | |||
end | |||
use_member = mwan_policy:option(DummyValue, "use_member", translate("Members assigned")) | |||
use_member.rawhtml = true | |||
function use_member.cfgvalue(self, s) | |||
local tab, str = self.map:get(s, "use_member"), "" | |||
if tab then | |||
for k,v in pairs(tab) do | |||
str = str .. v .. "<br />" | |||
end | |||
return str | |||
else | |||
return "—" | |||
end | |||
end | |||
errors = mwan_policy:option(DummyValue, "errors", translate("Errors")) | |||
errors.rawhtml = true | |||
function errors.cfgvalue(self, s) | |||
if not string.find(err_name_list, " " .. s .. " ") then | |||
return "" | |||
else | |||
return "<span title=\"Name exceeds 15 characters\"><img src=\"/luci-static/resources/cbi/reset.gif\" alt=\"error\"></img></span>" | |||
end | |||
end | |||
return m5 |
@ -0,0 +1,58 @@ | |||
-- ------ extra functions ------ -- | |||
function policy_check() -- check to see if this policy's name exceed the maximum of 15 characters | |||
polchar = string.len(arg[1]) | |||
if polchar > 15 then | |||
toolong = 1 | |||
end | |||
end | |||
function policy_warn() -- display status and warning messages at the top of the page | |||
if toolong == 1 then | |||
return "<font color=\"ff0000\"><strong>WARNING: this policy's name is " .. polchar .. " characters exceeding the maximum of 15!</strong></font>" | |||
else | |||
return "" | |||
end | |||
end | |||
function cbi_add_member(field) | |||
uci.cursor():foreach("mwan3", "member", | |||
function (section) | |||
field:value(section[".name"]) | |||
end | |||
) | |||
end | |||
-- ------ policy configuration ------ -- | |||
dsp = require "luci.dispatcher" | |||
arg[1] = arg[1] or "" | |||
toolong = 0 | |||
policy_check() | |||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Policy Configuration - " .. arg[1]), | |||
translate(policy_warn())) | |||
m5.redirect = dsp.build_url("admin", "network", "mwan3", "configuration", "policy") | |||
mwan_policy = m5:section(NamedSection, arg[1], "policy", "") | |||
mwan_policy.addremove = false | |||
mwan_policy.dynamic = false | |||
use_member = mwan_policy:option(DynamicList, "use_member", translate("Member used")) | |||
cbi_add_member(use_member) | |||
-- ------ currently configured members ------ -- | |||
mwan_member = m5:section(TypedSection, "member", translate("Currently Configured Members")) | |||
mwan_member.addremove = false | |||
mwan_member.dynamic = false | |||
mwan_member.sortable = false | |||
mwan_member.template = "cbi/tblsection" | |||
return m5 |
@ -0,0 +1,109 @@ | |||
-- ------ extra functions ------ -- | |||
function rule_check() -- determine if rules needs a proper protocol configured | |||
uci.cursor():foreach("mwan3", "rule", | |||
function (section) | |||
local sport = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".src_port")) | |||
local dport = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".dest_port")) | |||
if sport ~= "" or dport ~= "" then -- ports configured | |||
local proto = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".proto")) | |||
if proto == "" or proto == "all" then -- no or improper protocol | |||
err_proto_list = err_proto_list .. section[".name"] .. " " | |||
end | |||
end | |||
end | |||
) | |||
end | |||
function rule_warn() -- display warning messages at the top of the page | |||
if err_proto_list ~= " " then | |||
return "<font color=\"ff0000\"><strong>WARNING: some rules have a port configured with no or improper protocol specified! Please configure a specific protocol!</strong></font>" | |||
else | |||
return "" | |||
end | |||
end | |||
-- ------ rule configuration ------ -- | |||
dsp = require "luci.dispatcher" | |||
sys = require "luci.sys" | |||
ut = require "luci.util" | |||
err_proto = 0 | |||
err_proto_list = " " | |||
rule_check() | |||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Traffic Rule Configuration"), | |||
translate(rule_warn())) | |||
m5:append(Template("mwan3/mwan3_config_css")) | |||
mwan_rule = m5:section(TypedSection, "rule", translate("Traffic Rules"), | |||
translate("Rules specify which traffic will use a particular MWAN3 policy based on IP address, port or protocol<br />" .. | |||
"Rules are matched from top to bottom. Rules below a matching rule are ignored. Traffic not matching any rule is routed using the main routing table<br />" .. | |||
"Traffic destined for known (other than default) networks is handled by the main routing table. Traffic matching a rule, but all WAN interfaces for that policy are down will be blackholed<br />" .. | |||
"Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" .. | |||
"Rules may not share the same name as configured interfaces, members or policies")) | |||
mwan_rule.addremove = true | |||
mwan_rule.anonymous = false | |||
mwan_rule.dynamic = false | |||
mwan_rule.sectionhead = "Rule" | |||
mwan_rule.sortable = true | |||
mwan_rule.template = "cbi/tblsection" | |||
mwan_rule.extedit = dsp.build_url("admin", "network", "mwan3", "configuration", "rule", "%s") | |||
function mwan_rule.create(self, section) | |||
TypedSection.create(self, section) | |||
m5.uci:save("mwan3") | |||
luci.http.redirect(dsp.build_url("admin", "network", "mwan3", "configuration", "rule", section)) | |||
end | |||
src_ip = mwan_rule:option(DummyValue, "src_ip", translate("Source address")) | |||
src_ip.rawhtml = true | |||
function src_ip.cfgvalue(self, s) | |||
return self.map:get(s, "src_ip") or "—" | |||
end | |||
src_port = mwan_rule:option(DummyValue, "src_port", translate("Source port")) | |||
src_port.rawhtml = true | |||
function src_port.cfgvalue(self, s) | |||
return self.map:get(s, "src_port") or "—" | |||
end | |||
dest_ip = mwan_rule:option(DummyValue, "dest_ip", translate("Destination address")) | |||
dest_ip.rawhtml = true | |||
function dest_ip.cfgvalue(self, s) | |||
return self.map:get(s, "dest_ip") or "—" | |||
end | |||
dest_port = mwan_rule:option(DummyValue, "dest_port", translate("Destination port")) | |||
dest_port.rawhtml = true | |||
function dest_port.cfgvalue(self, s) | |||
return self.map:get(s, "dest_port") or "—" | |||
end | |||
proto = mwan_rule:option(DummyValue, "proto", translate("Protocol")) | |||
proto.rawhtml = true | |||
function proto.cfgvalue(self, s) | |||
return self.map:get(s, "proto") or "all" | |||
end | |||
use_policy = mwan_rule:option(DummyValue, "use_policy", translate("Policy assigned")) | |||
use_policy.rawhtml = true | |||
function use_policy.cfgvalue(self, s) | |||
return self.map:get(s, "use_policy") or "—" | |||
end | |||
errors = mwan_rule:option(DummyValue, "errors", translate("Errors")) | |||
errors.rawhtml = true | |||
function errors.cfgvalue(self, s) | |||
if not string.find(err_proto_list, " " .. s .. " ") then | |||
return "" | |||
else | |||
return "<span title=\"No protocol specified\"><img src=\"/luci-static/resources/cbi/reset.gif\" alt=\"error\"></img></span>" | |||
end | |||
end | |||
return m5 |
@ -0,0 +1,99 @@ | |||
-- ------ extra functions ------ -- | |||
function rule_check() -- determine if rule needs a protocol specified | |||
local sport = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".src_port")) | |||
local dport = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".dest_port")) | |||
if sport ~= "" or dport ~= "" then -- ports configured | |||
local proto = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".proto")) | |||
if proto == "" or proto == "all" then -- no or improper protocol | |||
err_proto = 1 | |||
end | |||
end | |||
end | |||
function rule_warn() -- display warning message at the top of the page | |||
if err_proto == 1 then | |||
return "<font color=\"ff0000\"><strong>WARNING: this rule is incorrectly configured with no or improper protocol specified! Please configure a specific protocol!</strong></font>" | |||
else | |||
return "" | |||
end | |||
end | |||
function cbi_add_policy(field) | |||
uci.cursor():foreach("mwan3", "policy", | |||
function (section) | |||
field:value(section[".name"]) | |||
end | |||
) | |||
end | |||
function cbi_add_protocol(field) | |||
local protos = ut.trim(sys.exec("cat /etc/protocols | grep ' # ' | awk -F' ' '{print $1}' | grep -vw -e 'ip' -e 'tcp' -e 'udp' -e 'icmp' -e 'esp' | grep -v 'ipv6' | sort | tr '\n' ' '")) | |||
for p in string.gmatch(protos, "%S+") do | |||
field:value(p) | |||
end | |||
end | |||
-- ------ rule configuration ------ -- | |||
dsp = require "luci.dispatcher" | |||
sys = require "luci.sys" | |||
ut = require "luci.util" | |||
arg[1] = arg[1] or "" | |||
err_proto = 0 | |||
rule_check() | |||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Rule Configuration - ") .. arg[1], | |||
translate(rule_warn())) | |||
m5.redirect = dsp.build_url("admin", "network", "mwan3", "configuration", "rule") | |||
mwan_rule = m5:section(NamedSection, arg[1], "rule", "") | |||
mwan_rule.addremove = false | |||
mwan_rule.dynamic = false | |||
src_ip = mwan_rule:option(Value, "src_ip", translate("Source address"), | |||
translate("Supports CIDR notation (eg \"192.168.100.0/24\") without quotes")) | |||
src_ip.datatype = ipaddr | |||
src_port = mwan_rule:option(Value, "src_port", translate("Source port"), | |||
translate("May be entered as a single or multiple port(s) (eg \"22\" or \"80,443\") or as a portrange (eg \"1024:2048\") without quotes")) | |||
dest_ip = mwan_rule:option(Value, "dest_ip", translate("Destination address"), | |||
translate("Supports CIDR notation (eg \"192.168.100.0/24\") without quotes")) | |||
dest_ip.datatype = ipaddr | |||
dest_port = mwan_rule:option(Value, "dest_port", translate("Destination port"), | |||
translate("May be entered as a single or multiple port(s) (eg \"22\" or \"80,443\") or as a portrange (eg \"1024:2048\") without quotes")) | |||
proto = mwan_rule:option(Value, "proto", translate("Protocol"), | |||
translate("View the contents of /etc/protocols for protocol descriptions")) | |||
proto.default = "all" | |||
proto.rmempty = false | |||
proto:value("all") | |||
proto:value("ip") | |||
proto:value("tcp") | |||
proto:value("udp") | |||
proto:value("icmp") | |||
proto:value("esp") | |||
cbi_add_protocol(proto) | |||
use_policy = mwan_rule:option(Value, "use_policy", translate("Policy assigned")) | |||
cbi_add_policy(use_policy) | |||
use_policy:value("unreachable") | |||
use_policy:value("default") | |||
-- ------ currently configured policies ------ -- | |||
mwan_policy = m5:section(TypedSection, "policy", translate("Currently Configured Policies")) | |||
mwan_policy.addremove = false | |||
mwan_policy.dynamic = false | |||
mwan_policy.sortable = false | |||
mwan_policy.template = "cbi/tblsection" | |||
return m5 |
@ -0,0 +1 @@ | |||
<%+mwan3/mwan3_status%> |
@ -0,0 +1,134 @@ | |||
<%+header%> | |||
<ul class="cbi-tabmenu"> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/hotplug")%>"><%:Hotplug Script%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/mwan3")%>"><%:MWAN3 Config%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/network")%>"><%:Network Config%></a></li> | |||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/diag")%>"><%:Diagnostics%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/tshoot")%>"><%:Troubleshooting%></a></li> | |||
</ul> | |||
<% | |||
local uci = require "luci.model.uci" | |||
str = "" | |||
uci.cursor():foreach("mwan3", "interface", | |||
function (section) | |||
str = str .. section[".name"] .. " " | |||
end | |||
) | |||
%> | |||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script> | |||
<script type="text/javascript">//<![CDATA[ | |||
var stxhr = new XHR(); | |||
function update_status(tool, alt) | |||
{ | |||
var iface = document.getElementById('mwan3iface').value; | |||
var output = document.getElementById('diag_output'); | |||
if (tool == "service") | |||
{ | |||
output.innerHTML = | |||
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="padding: 20px; vertical-align: middle;" /> ' + | |||
"Waiting for MWAN3 to " + alt + "..." | |||
; | |||
} | |||
else | |||
{ | |||
output.innerHTML = | |||
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="padding: 20px; vertical-align: middle;" /> ' + | |||
"Waiting for diagnostic results..." | |||
; | |||
} | |||
output.parentNode.style.display = 'block'; | |||
output.style.display = 'inline'; | |||
stxhr.get('<%=luci.dispatcher.build_url("admin", "network", "mwan3", "advanced")%>/diag_display' + '/' + iface + '/' + tool + '/' + alt, null, | |||
function(x, st) | |||
{ | |||
if (st.diagres) | |||
{ | |||
output.innerHTML = String.format('<pre id="diag_output_css">%h</pre>', st.diagres[0].diagresult); | |||
} | |||
else | |||
{ | |||
var temp = ''; | |||
var ncint = 'No diagnostic results returned'; | |||
temp = String.format( | |||
'<pre id="diag_output_css"><strong>%s</strong></pre>', | |||
ncint | |||
); | |||
output.innerHTML = temp; | |||
} | |||
} | |||
); | |||
} | |||
//]]></script> | |||
<div id="mwan3_diagnostics" class="cbi-map"> | |||
<fieldset id="diag_select" class="cbi-section"> | |||
<legend><%:MWAN3 Interface Diagnostics%></legend> | |||
<select id="mwan3iface"> | |||
<% for z in str:gmatch("[^ ]+") do -%><option value="<%=z%>"><%=z%></option><%- end %> | |||
</select> | |||
<div id="buttoncss"> | |||
<input type="button" value="<%:Ping default gateway%>" class="cbi-button cbi-button-apply" onclick="update_status('ping', 'gateway')" /> | |||
<input type="button" value="<%:Ping tracking IP%>" class="cbi-button cbi-button-apply" onclick="update_status('ping', 'track_ip')" /> | |||
<input type="button" value="<%:Check IP rules%>" class="cbi-button cbi-button-apply" onclick="update_status('rulechk', null)" /> | |||
<input type="button" value="<%:Check routing table%>" class="cbi-button cbi-button-apply" onclick="update_status('routechk', null)" /> | |||
<input type="button" value="<%:Hotplug ifup%>" class="cbi-button cbi-button-apply" onclick="update_status('hotplug', 'ifup')" /> | |||
<input type="button" value="<%:Hotplug ifdown%>" class="cbi-button cbi-button-apply" onclick="update_status('hotplug', 'ifdown')" /> | |||
</div> | |||
</fieldset> | |||
<fieldset id="diag_select" class="cbi-section"> | |||
<legend><%:MWAN3 Service Control%></legend> | |||
<div id="buttoncss"> | |||
<input type="button" value="<%:Restart MWAN3%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'restart')" /> | |||
<input type="button" value="<%:Stop MWAN3%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'stop')" /> | |||
<input type="button" value="<%:Start MWAN3%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'start')" /> | |||
</div> | |||
</fieldset> | |||
<fieldset class="cbi-section" style="display:none"> | |||
<legend><%:Diagnostic Results%></legend> | |||
<div id="diag_output"></div> | |||
</fieldset> | |||
</div> | |||
<style type="text/css"> | |||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/ | |||
max-width: none; | |||
margin-left: 30px; | |||
padding-right: 30px; | |||
width: auto; | |||
} | |||
#mwan3_diagnostics { | |||
background-color: #FFFFFF; | |||
border: 1px dotted #555555; | |||
padding: 20px; | |||
} | |||
#diag_select { | |||
padding: 12px 20px 20px 20px; | |||
} | |||
#mwan3iface { | |||
float: left; | |||
margin: 8px 20px 0px 0px; | |||
} | |||
#buttoncss { | |||
display: table; | |||
float: left; | |||
text-align: left; | |||
} | |||
.cbi-button { | |||
margin: 8px 20px 0px 0px; | |||
min-width: 153px; | |||
} | |||
#diag_output_css { | |||
padding: 20px; | |||
text-align: left; | |||
} | |||
</style> | |||
<%+footer%> |
@ -0,0 +1,23 @@ | |||
<ul class="cbi-tabmenu"> | |||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/hotplug")%>"><%:Hotplug Script%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/mwan3")%>"><%:MWAN3 Config%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/network")%>"><%:Network Config%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/diag")%>"><%:Diagnostics%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/tshoot")%>"><%:Troubleshooting%></a></li> | |||
</ul> | |||
<style type="text/css"> | |||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/ | |||
max-width: none; | |||
margin: 0px 0px 0px 30px; | |||
padding-right: 30px; | |||
width: auto; | |||
} | |||
.cbi-section-node { | |||
margin-top: 20px; | |||
} | |||
.cbi-section { | |||
border: 1px dotted #555555; | |||
padding: 20px; | |||
} | |||
</style> |
@ -0,0 +1,23 @@ | |||
<ul class="cbi-tabmenu"> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/hotplug")%>"><%:Hotplug Script%></a></li> | |||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/mwan3")%>"><%:MWAN3 Config%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/network")%>"><%:Network Config%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/diag")%>"><%:Diagnostics%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/tshoot")%>"><%:Troubleshooting%></a></li> | |||
</ul> | |||
<style type="text/css"> | |||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/ | |||
max-width: none; | |||
margin: 0px 0px 0px 30px; | |||
padding-right: 30px; | |||
width: auto; | |||
} | |||
.cbi-section-node { | |||
margin-top: 20px; | |||
} | |||
.cbi-section { | |||
border: 1px dotted #555555; | |||
padding: 20px; | |||
} | |||
</style> |
@ -0,0 +1,23 @@ | |||
<ul class="cbi-tabmenu"> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/hotplug")%>"><%:Hotplug Script%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/mwan3")%>"><%:MWAN3 Config%></a></li> | |||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/network")%>"><%:Network Config%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/diag")%>"><%:Diagnostics%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/tshoot")%>"><%:Troubleshooting%></a></li> | |||
</ul> | |||
<style type="text/css"> | |||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/ | |||
max-width: none; | |||
margin: 0px 0px 0px 30px; | |||
padding-right: 30px; | |||
width: auto; | |||
} | |||
.cbi-section-node { | |||
margin-top: 20px; | |||
} | |||
.cbi-section { | |||
border: 1px dotted #555555; | |||
padding: 20px; | |||
} | |||
</style> |
@ -0,0 +1,77 @@ | |||
<%+header%> | |||
<ul class="cbi-tabmenu"> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/hotplug")%>"><%:Hotplug Script%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/mwan3")%>"><%:MWAN3 Config%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/network")%>"><%:Network Config%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/diag")%>"><%:Diagnostics%></a></li> | |||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/tshoot")%>"><%:Troubleshooting%></a></li> | |||
</ul> | |||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script> | |||
<script type="text/javascript">//<![CDATA[ | |||
XHR.poll(15, '<%=luci.dispatcher.build_url("admin", "network", "mwan3", "advanced", "tshoot_display")%>', null, | |||
function(x, st) | |||
{ | |||
var tx = document.getElementById('mwan3_tshoot_text'); | |||
if (st.mw3ver) | |||
{ | |||
var temp = ''; | |||
var mwanvers = 'Software versions : <br /><br />'; | |||
var mwan3cnfg = '<br /><br />Output of "cat /etc/config/mwan3" : <br /><br />'; | |||
var netcnfg = '<br /><br />Output of "cat /etc/config/network" : <br /><br />'; | |||
var ifcnfg = '<br /><br />Output of "ifconfig" : <br /><br />'; | |||
var iproute = '<br /><br />Output of "route -n" : <br /><br />'; | |||
var iprulesh = '<br /><br />Output of "ip rule show" : <br /><br />'; | |||
var routelisttbl = '<br /><br />Output of "ip route list table 1-250" : <br /><br />'; | |||
var firewalldef = '<br /><br />Firewall default output policy (must be ACCEPT) : <br /><br />'; | |||
var iptable = '<br /><br />Output of "iptables -L -t mangle -v -n" : <br /><br />'; | |||
temp = String.format( | |||
'<pre><span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s</pre>', | |||
mwanvers, st.mw3ver[0].mwan3v, mwan3cnfg, st.mwan3config[0].mwn3cfg, netcnfg, st.netconfig[0].netcfg, ifcnfg, st.ifconfig[0].ifcfg, iproute, st.rtshow[0].iprtshow, iprulesh, st.iprule[0].rule, routelisttbl, st.routelist[0].iprtlist, firewalldef, st.fidef[0].firedef, iptable, st.iptables[0].iptbls | |||
); | |||
tx.innerHTML = temp; | |||
} | |||
else | |||
{ | |||
var temp = ''; | |||
var terror = 'Error collecting troubleshooting information'; | |||
temp = String.format( | |||
'<strong>%s</strong>', | |||
terror | |||
); | |||
tx.innerHTML = temp; | |||
} | |||
} | |||
); | |||
//]]></script> | |||
<div id="tshoot_div"> | |||
<fieldset class="cbi-section"> | |||
<legend><%:Troubleshooting Data%></legend> | |||
<div id="mwan3_tshoot_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div> | |||
</fieldset> | |||
</div> | |||
<style type="text/css"> | |||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/ | |||
max-width: none; | |||
margin-left: 30px; | |||
padding-right: 30px; | |||
width: auto; | |||
} | |||
#tshoot_div { | |||
background-color: #FFFFFF; | |||
border: 1px dotted #555555; | |||
padding: 20px; | |||
} | |||
#mwan3_tshoot_text { | |||
padding: 20px; | |||
text-align: left; | |||
} | |||
.tsht { | |||
background-color: rgb(78, 186, 241); | |||
} | |||
</style> | |||
<%+footer%> |
@ -0,0 +1,34 @@ | |||
<style type="text/css"> | |||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/ | |||
max-width: none; | |||
margin-left: 30px; | |||
padding-right: 30px; | |||
width: auto; | |||
} | |||
table td { /*cells showing the configuration values*/ | |||
padding: 0px; | |||
text-align: center; | |||
vertical-align: middle; | |||
} | |||
table th { /*column for configuration section name*/ | |||
padding: 0px; | |||
text-align: center; | |||
vertical-align: middle; | |||
} | |||
table tbody th { /*column for configuration section name*/ | |||
padding: 0px; | |||
vertical-align: middle; | |||
} | |||
.cbi-section-node table div { /*rows*/ | |||
padding-top: 5px; | |||
} | |||
table.cbi-section-table td.cbi-section-table-cell { /*sort buttons column*/ | |||
text-align: center; | |||
} | |||
.cbi-section h3 { | |||
color: rgb(85, 85, 85); | |||
font-family: Trebuchet MS,Verdana,sans-serif; | |||
font-style: italic; | |||
font-weight: normal; | |||
} | |||
</style> |
@ -0,0 +1,62 @@ | |||
<%+header%> | |||
<ul class="cbi-tabmenu"> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/overview")%>"><%:Interface Status%></a></li> | |||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/overview/over_detail")%>"><%:Detailed Status%></a></li> | |||
</ul> | |||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script> | |||
<script type="text/javascript">//<![CDATA[ | |||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "mwan3", "overview", "detail_status")%>', null, | |||
function(x, st) | |||
{ | |||
var tx = document.getElementById('mwan3_detail_text'); | |||
if (st.mwan3dst) | |||
{ | |||
var temp = ''; | |||
temp = String.format( | |||
'<pre>%s</pre>', | |||
st.mwan3dst[0].detailstat | |||
); | |||
tx.innerHTML = temp; | |||
} | |||
else | |||
{ | |||
var temp = ''; | |||
var nslg = 'No detailed status information available'; | |||
temp = String.format( | |||
'<strong>%s</strong>', | |||
nslg | |||
); | |||
tx.innerHTML = temp; | |||
} | |||
} | |||
); | |||
//]]></script> | |||
<div id="mwan3_detail_status"> | |||
<fieldset class="cbi-section"> | |||
<legend><%:MWAN3 Multi-WAN Detailed Status%></legend> | |||
<div id="mwan3_detail_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div> | |||
</fieldset> | |||
</div> | |||
<style type="text/css"> | |||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/ | |||
max-width: none; | |||
margin-left: 30px; | |||
padding-right: 30px; | |||
width: auto; | |||
} | |||
#mwan3_detail_status { | |||
border: 1px dotted #555555; | |||
background-color: #FFFFFF; | |||
padding: 20px; | |||
} | |||
#mwan3_detail_text { | |||
padding: 20px; | |||
text-align: left; | |||
} | |||
</style> | |||
<%+footer%> |
@ -0,0 +1,146 @@ | |||
<%+header%> | |||
<ul class="cbi-tabmenu"> | |||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/overview")%>"><%:Interface Status%></a></li> | |||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/overview/over_detail")%>"><%:Detailed Status%></a></li> | |||
</ul> | |||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script> | |||
<script type="text/javascript">//<![CDATA[ | |||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "mwan3", "overview", "iface_status")%>', null, | |||
function(x, st) | |||
{ | |||
var tx = document.getElementById('mwan3_status_text'); | |||
if (st.wans) | |||
{ | |||
var temp = ''; | |||
for( var i = 0; i < st.wans.length; i++ ) | |||
{ | |||
var stat = ''; | |||
var cssc = ''; | |||
switch (st.wans[i].status) | |||
{ | |||
case 'on': | |||
stat = 'Online (tracking active)'; | |||
cssc = 'wanon'; | |||
break; | |||
case 'nm': | |||
stat = 'Online (tracking off)'; | |||
cssc = 'wanon'; | |||
break; | |||
case 'off': | |||
stat = 'Offline'; | |||
cssc = 'wanoff'; | |||
break; | |||
case 'ne': | |||
stat = 'Disabled'; | |||
cssc = 'wanoff'; | |||
break; | |||
} | |||
temp += String.format( | |||
'<span class="%s"><strong>%s (<a href="%q">%s</a>)</strong><br />%s</span>', | |||
cssc, st.wans[i].name, st.wans[i].link, st.wans[i].ifname, stat | |||
); | |||
} | |||
tx.innerHTML = temp; | |||
} | |||
else | |||
{ | |||
var temp = ''; | |||
var ncint = 'No MWAN3 interfaces found'; | |||
temp = String.format( | |||
'<strong>%s</strong>', | |||
ncint | |||
); | |||
tx.innerHTML = temp; | |||
} | |||
var tx = document.getElementById('mwan3_statuslog_text'); | |||
if (st.mwan3log) | |||
{ | |||
var temp = ''; | |||
var mwan3lg = 'Last 50 MWAN3 systemlog entries. Newest entries sorted at the top :'; | |||
temp = String.format( | |||
'<pre>%s<br /><br />%s</pre>', | |||
mwan3lg, st.mwan3log[0].mwanlog | |||
); | |||
tx.innerHTML = temp; | |||
} | |||
else | |||
{ | |||
var temp = ''; | |||
var nslg = 'No MWAN3 systemlog history found'; | |||
temp = String.format( | |||
'<strong>%s</strong>', | |||
nslg | |||
); | |||
tx.innerHTML = temp; | |||
} | |||
} | |||
); | |||
//]]></script> | |||
<div id="mwan3_interface_status"> | |||
<fieldset id="interface_field" class="cbi-section"> | |||
<legend><%:MWAN3 Multi-WAN Interface Live Status%></legend> | |||
<div id="mwan3_status_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div> | |||
</fieldset> | |||
<fieldset class="cbi-section"> | |||
<legend><%:MWAN3 Multi-WAN Interface Systemlog%></legend> | |||
<div id="mwan3_statuslog_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div> | |||
</fieldset> | |||
</div> | |||
<style type="text/css"> | |||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/ | |||
max-width: none; | |||
margin-left: 30px; | |||
padding-right: 30px; | |||
width: auto; | |||
} | |||
#mwan3_interface_status { | |||
background-color: #FFFFFF; | |||
border: 1px dotted #555555; | |||
padding: 20px; | |||
} | |||
#interface_field { | |||
padding: 12px 20px 20px 20px; | |||
} | |||
#mwan3_status_text { | |||
display: table; | |||
font-size: 14px; | |||
margin: auto; | |||
max-width: 1044px; | |||
min-width: 246px; | |||
width: 100%; | |||
} | |||
.wanon { | |||
background-color: rgb(144, 240, 144); | |||
} | |||
.wanoff { | |||
background-color: rgb(240, 144, 144); | |||
} | |||
.wanon, .wanoff { | |||
border-radius: 60px; | |||
box-shadow: 0px 2px 5px -3px; | |||
float: left; | |||
margin: 8px 3px 0px 3px; | |||
min-height: 30px; | |||
min-width: 235px; | |||
padding: 5px 10px 8px 10px; | |||
text-align: center; | |||
} | |||
#mwan3_statuslog_text { | |||
padding: 20px; | |||
text-align: left; | |||
} | |||
</style> | |||
<%+footer%> |
@ -0,0 +1,95 @@ | |||
<script type="text/javascript">//<![CDATA[ | |||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "mwan3", "overview", "iface_status")%>', null, | |||
function(x, st) | |||
{ | |||
var tx = document.getElementById('mwan3_status_text'); | |||
if (st.wans) | |||
{ | |||
var temp = ''; | |||
for( var i = 0; i < st.wans.length; i++ ) | |||
{ | |||
var stat = ''; | |||
var cssc = ''; | |||
switch (st.wans[i].status) | |||
{ | |||
case 'on': | |||
stat = 'Online (tracking active)'; | |||
cssc = 'wanon'; | |||
break; | |||
case 'nm': | |||
stat = 'Online (tracking off)'; | |||
cssc = 'wanon'; | |||
break; | |||
case 'off': | |||
stat = 'Offline'; | |||
cssc = 'wanoff'; | |||
break; | |||
case 'ne': | |||
stat = 'Disabled'; | |||
cssc = 'wanoff'; | |||
break; | |||
} | |||
temp += String.format( | |||
'<span class="%s"><strong>%s (<a href="%q">%s</a>)</strong><br />%s</span>', | |||
cssc, st.wans[i].name, st.wans[i].link, st.wans[i].ifname, stat | |||
); | |||
} | |||
tx.innerHTML = temp; | |||
} | |||
else | |||
{ | |||
var temp = ''; | |||
var ncint = 'No MWAN3 interfaces found'; | |||
temp += String.format( | |||
'<strong>%s</strong>', | |||
ncint | |||
); | |||
tx.innerHTML = temp; | |||
} | |||
} | |||
); | |||
//]]></script> | |||
<fieldset id="interface_field" class="cbi-section"> | |||
<legend><%:MWAN3 Multi-WAN Interface Live Status%></legend> | |||
<div id="mwan3_status_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div> | |||
</fieldset> | |||
<style type="text/css"> | |||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/ | |||
max-width: 1044px; | |||
} | |||
#interface_field { | |||
padding: 12px 20px 20px 20px; | |||
} | |||
#mwan3_status_text { | |||
display: table; | |||
font-size: 14px; | |||
margin: auto; | |||
max-width: 1044px; | |||
min-width: 246px; | |||
width: 100%; | |||
} | |||
.wanon { | |||
background-color: rgb(144, 240, 144); | |||
} | |||
.wanoff { | |||
background-color: rgb(240, 144, 144); | |||
} | |||
.wanon, .wanoff { | |||
border-radius: 60px; | |||
box-shadow: 0px 2px 5px -3px; | |||
float: left; | |||
margin: 8px 3px 0px 3px; | |||
min-height: 30px; | |||
min-width: 235px; | |||
padding: 5px 10px 8px 10px; | |||
text-align: center; | |||
} | |||
</style> |
@ -0,0 +1,48 @@ | |||
# | |||
# Copyright (C) 2006-2014 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=mwan3 | |||
PKG_VERSION:=1.4 | |||
PKG_RELEASE:=22 | |||
PKG_MAINTAINER:=Jeroen Louwes <jeroen.louwes@gmail.com> | |||
PKG_LICENSE:=GPLv2 | |||
include $(INCLUDE_DIR)/package.mk | |||
define Package/mwan3 | |||
SECTION:=net | |||
CATEGORY:=Network | |||
SUBMENU:=Routing and Redirection | |||
DEPENDS:=+ip +iptables +iptables-mod-conntrack-extra +iptables-mod-ipopt | |||
TITLE:=Multiwan hotplug script with connection tracking support | |||
MAINTAINER:=Jeroen Louwes <jeroen.louwes@gmail.com> | |||
PKGARCH:=all | |||
endef | |||
define Package/mwan3/description | |||
Hotplug script which makes configuration of multiple WAN interfaces simple and manageable. With loadbalancing/failover support for up to 250 wan interfaces, connection tracking and an easy to manage traffic ruleset. | |||
endef | |||
define Package/mwan3/conffiles | |||
/etc/config/mwan3 | |||
endef | |||
define Build/Compile | |||
endef | |||
define Package/mwan3/install | |||
$(CP) ./files/* $(1) | |||
endef | |||
define Package/mwan3/postinst | |||
[ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/mwan3 enable | |||
exit 0 | |||
endef | |||
$(eval $(call BuildPackage,mwan3)) |
@ -0,0 +1,79 @@ | |||
config interface 'wan' | |||
option enabled '1' | |||
list track_ip '8.8.4.4' | |||
list track_ip '8.8.8.8' | |||
list track_ip '208.67.222.222' | |||
list track_ip '208.67.220.220' | |||
option reliability '2' | |||
option count '1' | |||
option timeout '2' | |||
option interval '5' | |||
option down '3' | |||
option up '8' | |||
config interface 'wan2' | |||
option enabled '0' | |||
list track_ip '8.8.8.8' | |||
list track_ip '208.67.220.220' | |||
option reliability '1' | |||
option count '1' | |||
option timeout '2' | |||
option interval '5' | |||
option down '3' | |||
option up '8' | |||
config member 'wan_m1_w3' | |||
option interface 'wan' | |||
option metric '1' | |||
option weight '3' | |||
config member 'wan_m2_w3' | |||
option interface 'wan' | |||
option metric '2' | |||
option weight '3' | |||
config member 'wan2_m1_w2' | |||
option interface 'wan2' | |||
option metric '1' | |||
option weight '2' | |||
config member 'wan2_m2_w2' | |||
option interface 'wan2' | |||
option metric '2' | |||
option weight '2' | |||
config policy 'wan_only' | |||
list use_member 'wan_m1_w3' | |||
config policy 'wan2_only' | |||
list use_member 'wan2_m1_w2' | |||
config policy 'balanced' | |||
list use_member 'wan_m1_w3' | |||
list use_member 'wan2_m1_w2' | |||
config policy 'wan_wan2' | |||
list use_member 'wan_m1_w3' | |||
list use_member 'wan2_m2_w2' | |||
config policy 'wan2_wan' | |||
list use_member 'wan_m2_w3' | |||
list use_member 'wan2_m1_w2' | |||
config rule 'sticky_even' | |||
option src_ip '0.0.0.0/0.0.0.1' | |||
option dest_port '443' | |||
option proto 'tcp' | |||
option use_policy 'wan_wan2' | |||
config rule 'sticky_odd' | |||
option src_ip '0.0.0.1/0.0.0.1' | |||
option dest_port '443' | |||
option proto 'tcp' | |||
option use_policy 'wan2_wan' | |||
config rule 'default_rule' | |||
option dest_ip '0.0.0.0/0' | |||
option use_policy 'balanced' | |||
@ -0,0 +1,328 @@ | |||
#!/bin/sh | |||
mwan3_get_iface_id() | |||
{ | |||
let iface_count++ | |||
[ "$1" == "$INTERFACE" ] && iface_id=$iface_count | |||
} | |||
mwan3_get_route_args() | |||
{ | |||
route_args=$(ip -4 route list dev $DEVICE default | head -1 | sed '/.*via \([^ ]*\) .*$/!d;s//\1/;q' | egrep '[0-9]{1,3}(\.[0-9]{1,3}){3}') | |||
[ -n "$route_args" ] && route_args="via $route_args" | |||
route_args="nexthop $route_args dev $DEVICE" | |||
} | |||
mwan3_set_general_iptables() | |||
{ | |||
if ! iptables -S mwan3_ifaces -t mangle &> /dev/null; then | |||
iptables -N mwan3_ifaces -t mangle | |||
fi | |||
if ! iptables -S mwan3_rules -t mangle &> /dev/null; then | |||
iptables -N mwan3_rules -t mangle | |||
fi | |||
if ! iptables -S mwan3_connected -t mangle &> /dev/null; then | |||
iptables -N mwan3_connected -t mangle | |||
fi | |||
if ! iptables -S mwan3_hook -t mangle &> /dev/null; then | |||
iptables -N mwan3_hook -t mangle | |||
iptables -A mwan3_hook -t mangle -j CONNMARK --restore-mark --nfmask 0xff00 --ctmask 0xff00 | |||
iptables -A mwan3_hook -t mangle -m mark --mark 0x0/0xff00 -j mwan3_ifaces | |||
iptables -A mwan3_hook -t mangle -m mark --mark 0x0/0xff00 -j mwan3_connected | |||
iptables -A mwan3_hook -t mangle -m mark --mark 0x0/0xff00 -j mwan3_rules | |||
iptables -A mwan3_hook -t mangle -j CONNMARK --save-mark --nfmask 0xff00 --ctmask 0xff00 | |||
fi | |||
if ! iptables -S mwan3_track_hook -t mangle &> /dev/null; then | |||
iptables -N mwan3_track_hook -t mangle | |||
fi | |||
if ! iptables -S PREROUTING -t mangle | grep mwan3_hook &> /dev/null; then | |||
iptables -A PREROUTING -t mangle -j mwan3_hook | |||
fi | |||
if ! iptables -S OUTPUT -t mangle | grep mwan3_hook &> /dev/null; then | |||
iptables -A OUTPUT -t mangle -j mwan3_hook | |||
fi | |||
if ! iptables -S OUTPUT -t mangle | grep mwan3_track_hook &> /dev/null; then | |||
iptables -A OUTPUT -t mangle -j mwan3_track_hook | |||
fi | |||
iptables -F mwan3_rules -t mangle | |||
} | |||
mwan3_set_connected_iptables() | |||
{ | |||
local connected_networks | |||
if iptables -S mwan3_connected -t mangle &> /dev/null; then | |||
iptables -F mwan3_connected -t mangle | |||
for connected_networks in $(ip -4 route | awk '{print $1}' | egrep '[0-9]{1,3}(\.[0-9]{1,3}){3}'); do | |||
iptables -A mwan3_connected -t mangle -d $connected_networks -m mark --mark 0x0/0xff00 -j MARK --set-xmark 0xff00/0xff00 | |||
done | |||
iptables -I mwan3_connected -t mangle -d 224.0.0.0/3 -m mark --mark 0x0/0xff00 -j MARK --set-xmark 0xff00/0xff00 | |||
iptables -I mwan3_connected -t mangle -d 127.0.0.0/8 -m mark --mark 0x0/0xff00 -j MARK --set-xmark 0xff00/0xff00 | |||
fi | |||
} | |||
mwan3_set_iface_iptables() | |||
{ | |||
local local_net local_nets | |||
local_net=$(ip -4 route list dev $DEVICE scope link | awk '{print $1}' | egrep '[0-9]{1,3}(\.[0-9]{1,3}){3}') | |||
if ! iptables -S mwan3_iface_$INTERFACE -t mangle &> /dev/null; then | |||
iptables -N mwan3_iface_$INTERFACE -t mangle | |||
fi | |||
iptables -F mwan3_iface_$INTERFACE -t mangle | |||
iptables -D mwan3_ifaces -t mangle -i $DEVICE -m mark --mark 0x0/0xff00 -j mwan3_iface_$INTERFACE &> /dev/null | |||
if [ $ACTION == "ifup" ]; then | |||
if [ -n "$local_net" ]; then | |||
for local_nets in $local_net ; do | |||
if [ $ACTION == "ifup" ]; then | |||
iptables -I mwan3_iface_$INTERFACE -t mangle -s $local_net -m mark --mark 0x0/0xff00 -m comment --comment "$INTERFACE" -j MARK --set-xmark 0xff00/0xff00 | |||
fi | |||
done | |||
fi | |||
iptables -A mwan3_iface_$INTERFACE -t mangle -m mark --mark 0x0/0xff00 -m comment --comment "$INTERFACE" -j MARK --set-xmark $(($iface_id*256))/0xff00 | |||
iptables -A mwan3_ifaces -t mangle -i $DEVICE -m mark --mark 0x0/0xff00 -j mwan3_iface_$INTERFACE | |||
fi | |||
if [ $ACTION == "ifdown" ]; then | |||
iptables -X mwan3_iface_$INTERFACE -t mangle | |||
fi | |||
} | |||
mwan3_set_iface_route() | |||
{ | |||
ip -4 route flush table $iface_id | |||
[ $ACTION == "ifup" ] && ip -4 route add table $iface_id default $route_args | |||
} | |||
mwan3_set_iface_rules() | |||
{ | |||
while [ -n "$(ip -4 rule list | awk '$1 == "'$(($iface_id+1000)):'"')" ]; do | |||
ip -4 rule del pref $(($iface_id+1000)) | |||
done | |||
while [ -n "$(ip -4 rule list | awk '$1 == "'$(($iface_id+2000)):'"')" ]; do | |||
ip -4 rule del pref $(($iface_id+2000)) | |||
done | |||
while [ -n "$(ip -4 rule list | awk '$1 == "2254:"')" ]; do | |||
ip -4 rule del pref 2254 | |||
done | |||
[ $ACTION == "ifup" ] && ip -4 rule add pref $(($iface_id+1000)) iif $DEVICE lookup main | |||
[ $ACTION == "ifup" ] && ip -4 rule add pref $(($iface_id+2000)) fwmark $(($iface_id*256))/0xff00 lookup $iface_id | |||
ip rule add pref 2254 fwmark 0xfe00/0xff00 unreachable | |||
} | |||
mwan3_track() | |||
{ | |||
local track_ip track_ips reliability count timeout interval down up | |||
mwan3_list_track_ips() | |||
{ | |||
track_ips="$1 $track_ips" | |||
} | |||
config_list_foreach $INTERFACE track_ip mwan3_list_track_ips | |||
if [ -n "$track_ips" ]; then | |||
config_get reliability $INTERFACE reliability 1 | |||
config_get count $INTERFACE count 1 | |||
config_get timeout $INTERFACE timeout 4 | |||
config_get interval $INTERFACE interval 10 | |||
config_get down $INTERFACE down 5 | |||
config_get up $INTERFACE up 5 | |||
if ! iptables -S mwan3_track_$INTERFACE -t mangle &> /dev/null; then | |||
iptables -N mwan3_track_$INTERFACE -t mangle | |||
iptables -A mwan3_track_hook -t mangle -p icmp -m icmp --icmp-type 8 -m length --length 32 -j mwan3_track_$INTERFACE | |||
fi | |||
iptables -F mwan3_track_$INTERFACE -t mangle | |||
for track_ip in $track_ips; do | |||
iptables -A mwan3_track_$INTERFACE -t mangle -d $track_ip -j MARK --set-xmark 0xff00/0xff00 | |||
done | |||
[ -x /usr/sbin/mwan3track ] && /usr/sbin/mwan3track $INTERFACE $DEVICE $reliability $count $timeout $interval $down $up $track_ips & | |||
else | |||
iptables -D mwan3_track_hook -t mangle -p icmp -m icmp --icmp-type 8 -m length --length 32 -j mwan3_track_$INTERFACE &> /dev/null | |||
iptables -F mwan3_track_$INTERFACE -t mangle &> /dev/null | |||
iptables -X mwan3_track_$INTERFACE -t mangle &> /dev/null | |||
fi | |||
} | |||
mwan3_set_policy() | |||
{ | |||
local iface_count iface_id metric probability weight | |||
config_get INTERFACE $1 interface | |||
config_get metric $1 metric 1 | |||
config_get weight $1 weight 1 | |||
[ -n "$INTERFACE" ] || return 0 | |||
config_foreach mwan3_get_iface_id interface | |||
[ -n "$iface_id" ] || return 0 | |||
if iptables -S mwan3_iface_$INTERFACE -t mangle &> /dev/null; then | |||
if [ "$metric" -lt "$lowest_metric" ]; then | |||
total_weight=$weight | |||
iptables -F mwan3_policy_$policy -t mangle | |||
iptables -A mwan3_policy_$policy -t mangle -m mark --mark 0x0/0xff00 -m comment --comment "$INTERFACE $weight $weight" -j MARK --set-xmark $(($iface_id*256))/0xff00 | |||
lowest_metric=$metric | |||
elif [ "$metric" -eq "$lowest_metric" ]; then | |||
total_weight=$(($total_weight+$weight)) | |||
probability=$(($weight*1000/$total_weight)) | |||
if [ "$probability" -lt 10 ]; then | |||
probability="0.00$probability" | |||
elif [ $probability -lt 100 ]; then | |||
probability="0.0$probability" | |||
elif [ $probability -lt 1000 ]; then | |||
probability="0.$probability" | |||
else | |||
probability="1" | |||
fi | |||
probability="-m statistic --mode random --probability $probability" | |||
iptables -I mwan3_policy_$policy -t mangle -m mark --mark 0x0/0xff00 $probability -m comment --comment "$INTERFACE $weight $total_weight" -j MARK --set-xmark $(($iface_id*256))/0xff00 | |||
fi | |||
fi | |||
} | |||
mwan3_set_policies_iptables() | |||
{ | |||
local lowest_metric policy total_weight | |||
policy=$1 | |||
if [ "$policy" != $(echo "$policy" | cut -c1-15) ]; then | |||
logger -t mwan3 -p warn "Policy $policy exceeds max of 15 chars. Not setting policy" && return 0 | |||
fi | |||
if ! iptables -S mwan3_policy_$policy -t mangle &> /dev/null; then | |||
iptables -N mwan3_policy_$policy -t mangle | |||
fi | |||
iptables -F mwan3_policy_$policy -t mangle | |||
iptables -A mwan3_policy_$policy -t mangle -m mark --mark 0x0/0xff00 -m comment --comment "unreachable" -j MARK --set-xmark 0xfe00/0xff00 | |||
lowest_metric=256 | |||
total_weight=0 | |||
config_list_foreach $policy use_member mwan3_set_policy | |||
iptables -X $policy -t mangle &> /dev/null | |||
} | |||
mwan3_set_user_rules_iptables() | |||
{ | |||
local proto src_ip src_port dest_ip dest_port use_policy | |||
config_get proto $1 proto all | |||
config_get src_ip $1 src_ip 0.0.0.0/0 | |||
config_get src_port $1 src_port 0:65535 | |||
config_get dest_ip $1 dest_ip 0.0.0.0/0 | |||
config_get dest_port $1 dest_port 0:65535 | |||
config_get use_policy $1 use_policy | |||
if [ -n "$use_policy" ]; then | |||
if [ "$use_policy" == "default" ]; then | |||
use_policy="MARK --set-xmark 0xff00/0xff00" | |||
elif [ "$use_policy" == "unreachable" ]; then | |||
use_policy="MARK --set-xmark 0xfe00/0xff00" | |||
else | |||
use_policy="mwan3_policy_$use_policy" | |||
fi | |||
case $proto in | |||
tcp|udp) | |||
iptables -A mwan3_rules -t mangle -p $proto -s $src_ip -d $dest_ip -m multiport --sports $src_port -m multiport --dports $dest_port -m mark --mark 0/0xff00 -m comment --comment "$1" -j $use_policy &> /dev/null | |||
;; | |||
*) | |||
iptables -A mwan3_rules -t mangle -p $proto -s $src_ip -d $dest_ip -m mark --mark 0/0xff00 -m comment --comment "$1" -j $use_policy &> /dev/null | |||
;; | |||
esac | |||
fi | |||
} | |||
mwan3_ifupdown() | |||
{ | |||
local counter enabled iface_count iface_id route_args wan_metric | |||
[ -n "$DEVICE" ] || exit 0 | |||
[ -n "$INTERFACE" ] || exit 0 | |||
[ "$(uci get -P /var/state mwan3.$INTERFACE 2> /dev/null)" == "interface" ] || return 0 | |||
config_load mwan3 | |||
config_get enabled $INTERFACE enabled 0 | |||
counter=0 | |||
if [ $ACTION == "ifup" ]; then | |||
[ "$enabled" -eq 1 ] || exit 0 | |||
while [ -z "$(ip -4 route list dev $DEVICE default | head -1)" -a "$counter" -lt 10 ]; do | |||
sleep 1 | |||
let counter++ | |||
if [ "$counter" -ge 10 ]; then | |||
logger -t mwan3 -p warn "Could not find gateway for interface $INTERFACE ($DEVICE)" && exit 0 | |||
fi | |||
done | |||
mwan3_get_route_args | |||
fi | |||
while [ "$(pgrep -f -o hotplug-call)" -ne $$ -a "$counter" -lt 60 ]; do | |||
sleep 1 | |||
let counter++ | |||
if [ "$counter" -ge 60 ]; then | |||
logger -t mwan3 -p warn "Timeout waiting for older hotplug processes to finish. $ACTION interface $INTERFACE ($DEVICE) aborted" && exit 0 | |||
fi | |||
done | |||
config_foreach mwan3_get_iface_id interface | |||
[ -n "$iface_id" ] || exit 0 | |||
[ "$iface_count" -le 250 ] || exit 0 | |||
unset iface_count | |||
unset counter | |||
logger -t mwan3 -p notice "$ACTION interface $INTERFACE ($DEVICE)" | |||
mwan3_set_general_iptables | |||
mwan3_set_iface_iptables | |||
mwan3_set_iface_route | |||
mwan3_set_iface_rules | |||
[ $ACTION == "ifup" ] && mwan3_track | |||
config_foreach mwan3_set_policies_iptables policy | |||
config_foreach mwan3_set_user_rules_iptables rule | |||
} | |||
case "$ACTION" in | |||
ifup|ifdown) | |||
mwan3_ifupdown | |||
mwan3_set_connected_iptables | |||
;; | |||
esac |
@ -0,0 +1,20 @@ | |||
#!/bin/sh /etc/rc.common | |||
START=99 | |||
start() { | |||
/usr/sbin/mwan3 start | |||
} | |||
stop() { | |||
/usr/sbin/mwan3 stop | |||
} | |||
restart() { | |||
stop | |||
start | |||
} | |||
boot() { | |||
# Don't start on boot, mwan3 is started by hotplug event. | |||
return 0 | |||
} |
@ -0,0 +1,208 @@ | |||
#!/bin/sh /etc/rc.common | |||
. /lib/network/config.sh | |||
extra_help() { | |||
cat <<EOF | |||
ifup <iface> Start service on interface | |||
ifdown <iface> Stop service on interface | |||
interfaces Show interfaces status | |||
policies Show policies status | |||
rules Show rules status | |||
status Show all status | |||
EOF | |||
} | |||
EXTRA_COMMANDS="ifdown ifup interfaces policies rules status" | |||
EXTRA_HELP="$(extra_help)" | |||
ifdown() | |||
{ | |||
if [ -z "$1" ]; then | |||
echo "Error: Expecting interface. Usage: mwan3 ifdown <interface>" && exit 0 | |||
fi | |||
if [ -n "$2" ]; then | |||
echo "Error: Too many arguments. Usage: mwan3 ifdown <interface>" && exit 0 | |||
fi | |||
local device | |||
device=$(uci get -p /var/state network.$1.ifname) &> /dev/null | |||
if [ -e /var/run/mwan3track-$1.pid ] ; then | |||
kill $(cat /var/run/mwan3track-$1.pid) | |||
rm /var/run/mwan3track-$1.pid | |||
fi | |||
if [ -n "$device" ] ; then | |||
ACTION=ifdown INTERFACE=$1 DEVICE=$device /sbin/hotplug-call iface | |||
fi | |||
} | |||
ifup() | |||
{ | |||
config_load mwan3 | |||
if [ -z "$1" ]; then | |||
echo "Expecting interface. Usage: mwan3 ifup <interface>" && exit 0 | |||
fi | |||
if [ -n "$2" ]; then | |||
echo "Too many arguments. Usage: mwan3 ifup <interface>" && exit 0 | |||
fi | |||
local device enabled | |||
config_get enabled "$1" enabled 0 | |||
device=$(uci get -p /var/state network.$1.ifname) &> /dev/null | |||
if [ -n "$device" ] ; then | |||
[ "$enabled" -eq 1 ] && ACTION=ifup INTERFACE=$1 DEVICE=$device /sbin/hotplug-call iface | |||
fi | |||
} | |||
interfaces() | |||
{ | |||
config_load mwan3 | |||
local device enabled iface_id tracking | |||
echo "Interface status:" | |||
check_iface_status() | |||
{ | |||
device=$(uci get -p /var/state network.$1.ifname) &> /dev/null | |||
if [ -z "$device" ]; then | |||
echo "Interface $1 is unknown" | |||
return 0 | |||
fi | |||
config_get enabled "$1" enabled 0 | |||
let iface_id++ | |||
if [ -n "$(ps -w | grep mwan3track | grep -v grep | sed '/.*\/usr\/sbin\/mwan3track \([^ ]*\) .*$/!d;s//\1/' | awk '$1 == ("'$1'")')" ]; then | |||
tracking="active" | |||
else | |||
tracking="down" | |||
fi | |||
if [ -n "$(ip rule | awk '$5 == ("'$device'")')" -a -n "$(iptables -S mwan3_iface_$1 -t mangle 2> /dev/null)" -a -n "$(ip -4 route list table $iface_id default dev $device 2> /dev/null)" ]; then | |||
if [ -n "$(uci get -p /var/state mwan3.$1.track_ip 2> /dev/null)" ]; then | |||
echo "Interface $1 is online (tracking $tracking)" | |||
else | |||
echo "Interface $1 is online" | |||
fi | |||
elif [ -n "$(ip rule | awk '$5 == ("'$device'")')" -o -n "$(iptables -S mwan3_iface_$1 -t mangle 2> /dev/null)" -o -n "$(ip -4 route list table $iface_id default dev $device 2> /dev/null)" ]; then | |||
echo "Interface $1 error" | |||
else | |||
if [ "$enabled" -eq 1 ]; then | |||
if [ -n "$(uci get -p /var/state mwan3.$1.track_ip 2> /dev/null)" ]; then | |||
echo "Interface $1 is offline (tracking $tracking)" | |||
else | |||
echo "Interface $1 is offline" | |||
fi | |||
else | |||
echo "Interface $1 is disabled" | |||
fi | |||
fi | |||
} | |||
config_foreach check_iface_status interface | |||
echo -e | |||
} | |||
policies() | |||
{ | |||
local percent policy share total_weight weight iface | |||
for policy in $(iptables -S -t mangle | awk '{print $2}' | grep mwan3_policy_ | sort -u); do | |||
echo "Policy $policy:" | sed 's/mwan3_policy_//g' | |||
for iface in $(iptables -S $policy -t mangle | cut -s -d'"' -f2 | awk '{print $1}'); do | |||
[ -n "$total_weight" ] || total_weight=$(iptables -S $policy -t mangle | grep "$iface " | cut -s -d'"' -f2 | awk '{print $3}') | |||
done | |||
if [ ! -z "${total_weight##*[!0-9]*}" ]; then | |||
for iface in $(iptables -S $policy -t mangle | cut -s -d'"' -f2 | awk '{print $1}'); do | |||
weight=$(iptables -S $policy -t mangle | grep "$iface " | cut -s -d'"' -f2 | awk '{print $2}') | |||
percent=$(($weight*100/$total_weight)) | |||
echo " $iface ($percent%)" | |||
done | |||
else | |||
echo " $(iptables -S $policy -t mangle | sed '/.*--comment \([^ ]*\) .*$/!d;s//\1/;q')" | |||
fi | |||
echo -e | |||
unset iface | |||
unset total_weight | |||
done | |||
} | |||
rules() | |||
{ | |||
if [ -n "$(iptables -S mwan3_connected -t mangle 2> /dev/null)" ]; then | |||
echo "Known networks:" | |||
echo "destination policy hits" | awk '{ printf "%-19s%-19s%-9s%s\n",$1,$2,$3}' | |||
echo "------------------------------------------------" | |||
iptables -L mwan3_connected -t mangle -n -v 2> /dev/null | tail -n+3 | sed 's/mark.*//' | sed 's/mwan3_policy_//g' | awk '{printf "%-19s%-19s%-9s%s\n",$9,"default",$1}' | |||
echo -e | |||
fi | |||
if [ -n "$(iptables -S mwan3_rules -t mangle 2> /dev/null)" ]; then | |||
echo "Active rules:" | |||
echo "source destination proto src-port dest-port policy hits" | awk '{ printf "%-19s%-19s%-7s%-14s%-14s%-16s%-9s%s\n",$1,$2,$3,$4,$5,$6,$7}' | |||
echo "---------------------------------------------------------------------------------------------------" | |||
iptables -L mwan3_rules -t mangle -n -v 2> /dev/null | tail -n+3 | sed 's/mark.*//' | sed 's/mwan3_policy_//g' | awk '{ printf "%-19s%-19s%-7s%-14s%-14s%-16s%-9s%s\n",$8,$9,$4,$12,$15,$3,$1}' | |||
echo -e | |||
fi | |||
} | |||
status() | |||
{ | |||
interfaces | |||
policies | |||
rules | |||
} | |||
start() | |||
{ | |||
config_load mwan3 | |||
config_foreach ifup interface | |||
} | |||
stop() | |||
{ | |||
local route rule table | |||
killall mwan3track &> /dev/null | |||
rm /var/run/mwan3track-* &> /dev/null | |||
for route in $(ip route list table all | sed 's/.*table \([^ ]*\) .*/\1/' | awk '{print $1}' | awk '{for(i=1;i<=NF;i++) if($i+0>0) if($i+0<255) {print;break}}'); do | |||
ip -4 route flush table $route &> /dev/null | |||
done | |||
for rule in $(ip -4 rule list | egrep '^[1-2][0-9]{3}\:' | cut -d ':' -f 1); do | |||
ip -4 rule del pref $rule &> /dev/null | |||
done | |||
iptables -D PREROUTING -t mangle -j mwan3_hook &> /dev/null | |||
iptables -D OUTPUT -t mangle -j mwan3_hook &> /dev/null | |||
iptables -D OUTPUT -t mangle -j mwan3_track_hook &> /dev/null | |||
for table in $(iptables -S -t mangle | awk '{print $2}' | grep mwan3 | sort -u); do | |||
iptables -F $table -t mangle &> /dev/null | |||
done | |||
for table in $(iptables -S -t mangle | awk '{print $2}' | grep mwan3 | sort -u); do | |||
iptables -X $table -t mangle &> /dev/null | |||
done | |||
} | |||
restart() { | |||
stop | |||
start | |||
} |
@ -0,0 +1,65 @@ | |||
#!/bin/sh | |||
[ -z "$9" ] && echo "Error: should not be started manually" && exit 0 | |||
if [ -e /var/run/mwan3track-$1.pid ] ; then | |||
kill $(cat /var/run/mwan3track-$1.pid) &> /dev/null | |||
rm /var/run/mwan3track-$1.pid &> /dev/null | |||
fi | |||
echo "$$" > /var/run/mwan3track-$1.pid | |||
score=$(($7+$8)) | |||
track_ips=$(echo $* | cut -d ' ' -f 9-99) | |||
host_up_count=0 | |||
lost=0 | |||
while true; do | |||
for track_ip in $track_ips; do | |||
ping -I $2 -c $4 -W $5 -s 4 -q $track_ip &> /dev/null | |||
if [ $? -eq 0 ]; then | |||
let host_up_count++ | |||
else | |||
let lost++ | |||
fi | |||
done | |||
if [ $host_up_count -lt $3 ]; then | |||
let score-- | |||
if [ $score -lt $8 ]; then score=0 ; fi | |||
if [ $score -eq $8 ]; then | |||
logger -t mwan3track -p notice "Interface $1 ($2) is offline" | |||
env -i ACTION=ifdown INTERFACE=$1 DEVICE=$2 /sbin/hotplug-call iface | |||
score=0 | |||
fi | |||
else | |||
if [ $score -lt $(($7+$8)) ] && [ $lost -gt 0 ]; then | |||
logger -t mwan3track -p info "Lost $(($lost*$4)) ping(s) on interface $1 ($2)" | |||
fi | |||
let score++ | |||
lost=0 | |||
if [ $score -gt $8 ]; then score=$(($7+$8)); fi | |||
if [ $score -eq $8 ]; then | |||
logger -t mwan3track -p notice "Interface $1 ($2) is online" | |||
env -i ACTION=ifup INTERFACE=$1 DEVICE=$2 /sbin/hotplug-call iface | |||
rm /var/run/mwan3track-$1.pid | |||
exit 0 | |||
fi | |||
fi | |||
host_up_count=0 | |||
sleep $6 | |||
done | |||
exit 1 |
@ -0,0 +1,86 @@ | |||
# | |||
# Copyright (C) 2009-2013 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=netatalk | |||
PKG_VERSION:=2.2.4 | |||
PKG_RELEASE:=1 | |||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 | |||
PKG_SOURCE_URL:=@SF/netatalk | |||
PKG_MD5SUM:=40753a32340c24e4ec395aeb55ef056e | |||
PKG_BUILD_PARALLEL:=1 | |||
PKG_INSTALL:=1 | |||
PKG_FIXUP:=autoreconf | |||
include $(INCLUDE_DIR)/package.mk | |||
define Package/netatalk | |||
SECTION:=net | |||
CATEGORY:=Network | |||
SUBMENU:=Filesystem | |||
DEPENDS:=+attr +libdb47 +libgcrypt +libopenssl $(LIBRPC_DEPENDS) | |||
TITLE:=netatalk | |||
URL:=http://netatalk.sourceforge.net | |||
MAINTAINER:=W. Michael Petullo <mike@flyn.org> | |||
endef | |||
define Package/netatalk/decription | |||
Netatalk is a freely-available Open Source AFP fileserver. | |||
It also provides a kernel level implementation of the AppleTalk | |||
Protocol Suite. | |||
endef | |||
define Package/netatalk/conffiles | |||
/etc/netatalk/afpd.conf | |||
endef | |||
TARGET_CFLAGS += -std=gnu99 | |||
TARGET_LDFLAGS += $(LIBRPC) | |||
CONFIGURE_ARGS += \ | |||
--disable-afs \ | |||
--enable-hfs \ | |||
--disable-debugging \ | |||
--disable-shell-check \ | |||
--disable-timelord \ | |||
--disable-a2boot \ | |||
--disable-cups \ | |||
--disable-tcp-wrappers \ | |||
--with-cnid-default-backend=dbd \ | |||
--with-bdb="$(STAGING_DIR)/usr/" \ | |||
--with-libgcrypt-dir="$(STAGING_DIR)/usr" \ | |||
--with-ssl-dir="$(STAGING_DIR)/usr" \ | |||
--with-uams-path="/usr/lib/uams" \ | |||
--without-acls \ | |||
--without-pam \ | |||
--disable-admin-group \ | |||
--disable-srvloc \ | |||
--disable-zeroconf \ | |||
$(if $(CONFIG_SHADOW_PASSWORDS),--with-shadow,--without-shadow) \ | |||
--without-ldap | |||
define Package/netatalk/install | |||
$(INSTALL_DIR) $(1)/usr/bin | |||
$(INSTALL_DIR) $(1)/usr/sbin | |||
$(INSTALL_DIR) $(1)/usr/lib/uams | |||
$(INSTALL_DIR) $(1)/etc/netatalk | |||
$(INSTALL_DIR) $(1)/etc/init.d | |||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/afppasswd $(1)/usr/bin/ | |||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/afpd $(1)/usr/sbin/ | |||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/cnid_dbd $(1)/usr/sbin/ | |||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/cnid_metad $(1)/usr/sbin/ | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/uams/*.so $(1)/usr/lib/uams/ | |||
$(CP) ./files/AppleVolumes.default $(1)/etc/netatalk/ | |||
$(CP) $(PKG_INSTALL_DIR)/etc/netatalk/AppleVolumes.system $(1)/etc/netatalk/ | |||
$(INSTALL_CONF) ./files/afpd.conf $(1)/etc/netatalk/ | |||
$(INSTALL_BIN) ./files/afpd.init $(1)/etc/init.d/afpd | |||
endef | |||
$(eval $(call BuildPackage,netatalk)) |
@ -0,0 +1,2 @@ | |||
- | |||
/tmp Temp allow:root,nobody cnidscheme:dbd |
@ -0,0 +1 @@ | |||
- -noddp -uampath /usr/lib/uams -uamlist uams_guest.so,uams_passwd.so,uams_dhx_passwd.so,uams_randnum.so,uams_dhx2.so -passwdfile /etc/netatalk/afppasswd -savepassword -passwdminlen 0 -nosetpassword -defaultvol /etc/netatalk/AppleVolumes.default -systemvol /etc/netatalk/AppleVolumes.system -nouservol -guestname "nobody" -sleep 1 -icon |